Discussion:
Emulating powerpc 440EP with qemu-system-ppcemb
Dushyant Bansal
2011-01-23 12:59:27 UTC
Permalink
Hi all,

I have configured and built qemu with device tree support.
qemu-version: 0.13.50
I have built kernel image (uImage) for bamboo using powerpc-440 toolchain.
kernel-version: 2.6.37-rc6+

When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage -append ""

I get the following output and qemu just hangs there:
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778

Has anyone tried to emulate bamboo with qemu before ?

Thanks,
Dushyant
Rob Landley
2011-01-23 18:42:44 UTC
Permalink
Post by Dushyant Bansal
Hi all,
I have configured and built qemu with device tree support.
qemu-version: 0.13.50
I have built kernel image (uImage) for bamboo using powerpc-440 toolchain.
kernel-version: 2.6.37-rc6+
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage -append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Has anyone tried to emulate bamboo with qemu before ?
Thanks,
Dushyant
In my Aboriginal Linux project (http://landley.net/aboriginal) I have a
config that builds a ppc440 cross compiler and builds a root filesystem
and kernel with it, but the kernel .config is bog standard 32 bit PPC
(mac99 board I think). It boots and runs, gives you a shell prompt, but
occasionally misbehaves you try to do anything fancy with it.

Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...

What kernel .config are you using for the bamboo kernel?

Rob
Dushyant Bansal
2011-01-23 19:01:02 UTC
Permalink
Post by Rob Landley
Post by Dushyant Bansal
Hi all,
I have configured and built qemu with device tree support.
qemu-version: 0.13.50
I have built kernel image (uImage) for bamboo using powerpc-440 toolchain.
kernel-version: 2.6.37-rc6+
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage -append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Has anyone tried to emulate bamboo with qemu before ?
Thanks,
Dushyant
In my Aboriginal Linux project (http://landley.net/aboriginal) I have a
config that builds a ppc440 cross compiler and builds a root filesystem
and kernel with it, but the kernel .config is bog standard 32 bit PPC
(mac99 board I think). It boots and runs, gives you a shell prompt, but
occasionally misbehaves you try to do anything fancy with it.
I am also using
<http://www.landley.net/aboriginal/downloads/binaries/cross-compiler-powerpc-440fp.tar.bz2>"cross-compiler-powerpc-440fp"
from the aboriginal project
(http://www.landley.net/aboriginal/downloads/binaries/) to build the
kernel image :).
Post by Rob Landley
Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...
Yes, qemu supports ppc440(bamboo).

$ qemu-system-ppcemb -M ?
Supported machines are:
mpc8544ds mpc8544ds
bamboo bamboo
ref405ep ref405ep
taihu taihu
mac99 Mac99 based PowerMAC
g3beige Heathrow based PowerMAC (default)
prep PowerPC PREP platform
Post by Rob Landley
What kernel .config are you using for the bamboo kernel?
Rob
I am using arch/powerpc/configs/44x/bamboo_defconfig.

Thanks,
Dushyant
Rob Landley
2011-01-23 19:21:54 UTC
Permalink
Post by Dushyant Bansal
I am also using
<http://www.landley.net/aboriginal/downloads/binaries/cross-compiler-powerpc-440fp.tar.bz2>"cross-compiler-powerpc-440fp"
from the aboriginal project
(http://www.landley.net/aboriginal/downloads/binaries/) to build the
kernel image :).
Heh. :)

Note that I don't have any actual ppc440 hardware. Somebody else once
tested this on real hardware for me and said it worked (their interest
was why i added the platform in the first place), and I haven't changed
the compiler config since then, but I can't prove anything if QEMU won't
cooperate.
Post by Dushyant Bansal
Yes, qemu supports ppc440(bamboo).
$ qemu-system-ppcemb -M ?
mpc8544ds mpc8544ds
bamboo bamboo
ref405ep ref405ep
taihu taihu
mac99 Mac99 based PowerMAC
g3beige Heathrow based PowerMAC (default)
prep PowerPC PREP platform
Those are board emulations. Does it have a 440 _cpu_ emulation?

./qemu-system-ppc -cpu ? | grep 440

(Don't ask me why qemu-system-ppc lists every single powerpc stepping
ever as a separate interesting CPU emulation. Seems kind of crazy to
me, but eh...)
Post by Dushyant Bansal
Post by Rob Landley
What kernel .config are you using for the bamboo kernel?
I am using arch/powerpc/configs/44x/bamboo_defconfig.
Reasonable.

Note that beating a usable console out of the thing so you can see
output is the second hard step. (The first hard step is getting
everything set up so that the kernel will actually build and boot on the
hardware. Without a console, you can't prove it did.)

I prefer serial console to pop-up window because it's scriptable with
"expect" or similar, I can log the output via "tee", and cut and paste
works without further effort. But if you're just trying to see boot
messages, a SDL frame buffer window (or vnc) is fine.

Rob
Dushyant Bansal
2011-01-23 19:52:19 UTC
Permalink
Post by Rob Landley
Those are board emulations. Does it have a 440 _cpu_ emulation?
./qemu-system-ppc -cpu ? | grep 440
This is the output.
PowerPC 440-Xilinx PVR 7ff21910

Is this right for my requirement?
This is qemu version 0.13.50. And, it seems this support has been added
recently. It is missing in qemu version 0.12.5.
I have one more query. You said 440 was supported in kvm. But kvm also
uses qemu as its userspace component. So, 440 was supported through kvm
kernel module?

--
Dushyant
Rob Landley
2011-01-23 22:21:47 UTC
Permalink
Post by Dushyant Bansal
Post by Rob Landley
Those are board emulations. Does it have a 440 _cpu_ emulation?
./qemu-system-ppc -cpu ? | grep 440
This is the output.
PowerPC 440-Xilinx PVR 7ff21910
Is this right for my requirement?
I have no idea? Sounds worth a try...
Post by Dushyant Bansal
This is qemu version 0.13.50. And, it seems this support has been added
recently. It is missing in qemu version 0.12.5.
I have one more query. You said 440 was supported in kvm.
KVM runs on powerpc systems, including PPC 440.

KVM doesn't do CPU emulation, it does CPU virtualization. IT can't do
PowerPC on an x86 host, it does PowerPC on a PowerPC host. (It only
uses QEMU to attach I/O devices to the virtual CPUs the hardware
provides. It needs a CPU that can do nested page tables, things like
the Intel VT extensions.)

So KVM can run PowerPC 440 code when running on a PowerPC 440 host.
That's where the Bamboo board emulation came from: somebody was running
KVM on a PowerPC 440 host, and wanted a board emulation for the virtual
systems to do I/O through.
Post by Dushyant Bansal
But kvm also
uses qemu as its userspace component. So, 440 was supported through kvm
kernel module?
KVM just uses the QEMU code to attach virtual I/O devices to a CPU
context that's provided by the hardware.

So in order to get KVM to emulate a PowerPC 440, you have to run it on a
PowerPC 440 host. (If you do so, QEMU will happily emulate a bamboo
board for it.)

I suspect the problem is that the kernel's actual bamboo drivers have
inline assembly instructions snippets, and QEMU isn't emulating those
instructions.

Note that the powerpc 440 is mostly a subset of normal 32 bit powerpc
(um, 405?). Specifically, powerpc 440 userspace code should run on a
full-fledged PPC just fine, at least with software floating point. It's
the protected mode instructions (mmu management and such) that differ,
stuff that only really happens in the kernel.

My fuzzy understanding is that the 440 happened when IBM tried to strip
down the PowerPC for the embedded market, mostly by removing several
instructions. (So 405 code won't run on it, but 440 code will mostly
run on a 405, except for the priviledged instructions which of course
are all wildly different, but that should only get used inside the
kernel. Don't ask me about floating point.)

Motorola did the same thing by the way, except they removed a DIFFERENT
set of instructions so the two were incompatible. You can find traces
of that in kernel under "arch/powerpc/platforms/8xx" if you're curious,
but I think that died even before they spun off Freescale. (Maybe it
just doesn't get used on Linux? They tried to revive it as the
"PowerQUIC" SOC line a few years ago but I dunno if it went anywhere.)

Of course wikipedia will have an opinion. (A subset of it might even be
correct, who knows? It's the best source of anecdotal evidence on the net.)

http://en.wikipedia.org/wiki/List_of_PowerPC_processors

Rob

Andreas Färber
2011-01-23 19:52:05 UTC
Permalink
Post by Rob Landley
Post by Dushyant Bansal
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage -
append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...
Matches my info. No ppc440 series since then.

Andreas
Dushyant Bansal
2011-01-23 20:08:35 UTC
Permalink
Post by Andreas Färber
Post by Rob Landley
Post by Dushyant Bansal
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage
-append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...
Matches my info. No ppc440 series since then.
Andreas
$ ./qemu-system-ppc -cpu ? | grep 440
This is the output.
PowerPC 440-Xilinx PVR 7ff21910

qemu version: 0.13.50.
Will it work for ppc440 processor emulation?

Dushyant
Edgar E. Iglesias
2011-01-23 21:00:50 UTC
Permalink
Post by Dushyant Bansal
Post by Andreas Färber
Post by Rob Landley
Post by Dushyant Bansal
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage
-append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...
Matches my info. No ppc440 series since then.
Andreas
$ ./qemu-system-ppc -cpu ? | grep 440
This is the output.
PowerPC 440-Xilinx PVR 7ff21910
qemu version: 0.13.50.
Will it work for ppc440 processor emulation?
Yes, for a long time the MMU emulation was half done. A few months ago
I pushed a set of patches to add enough MMU emulation to handle linux
guests. But there are still parts missing.

The virtex-ml507 board works good enough to run linux on. I can dig
for kernel configs and publish devicetrees and kernel images if
there is interest.

Cheers
Alexander Graf
2011-01-23 22:11:09 UTC
Permalink
Post by Andreas Färber
Post by Rob Landley
Post by Dushyant Bansal
When I try to run this command,
# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage -append ""
Trying to read privileged spr 947 3b3 at 00001028
Trying to read invalid spr 62 03e at 00000778
Last I checked, the bamboo board was implemented for KVM not QEMU, and
QEMU didn't have a ppc440 processor emulation. But that was over a year
ago, things could easily have changed...
Matches my info. No ppc440 series since then.
Edgar did some work on 440 emulation, but not with bamboo IIRC.


Alex
Loading...