Skip to contentSkip to conversation

Emulating powerpc 440EP with qemu-system-ppcemb

Qemu-devel Dushyant Bansal 5 participants 10 messages Jan 23, 2011

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 10 lines · 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 ""
Quoted 8 lines

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

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

#2 lore raw
Quoted 18 lines · Rob Landley
Quoted 16 lines · 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 ""

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 ?

Quoted 10 lines
Quoted 3 lines

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 :).

Quoted 4 lines

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
Quoted 5 lines

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

Rob

I am using arch/powerpc/configs/44x/bamboo_defconfig.

Thanks,
Dushyant

#3 lore raw
Quoted 5 lines · 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.

Quoted 11 lines

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

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...)

Quoted 2 lines
Quoted 1 line

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

#6 lore raw
In reply to Rob Landley

Am 23.01.2011 um 19:42 schrieb Rob Landley:

Quoted 11 lines · Dushyant Bansal
Quoted 6 lines

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

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

#4 lore raw
In reply to Rob Landley
Quoted 5 lines

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

#7 lore raw
In reply to Andreas Färber
Quoted 11 lines · Andreas Färber

Am 23.01.2011 um 19:42 schrieb Rob Landley:

Quoted 9 lines · Dushyant Bansal
Quoted 7 lines

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

Quoted 7 lines
Quoted 3 lines

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

#8 lore raw
Quoted 18 lines · Dushyant Bansal
Quoted 17 lines · Andreas Färber

Am 23.01.2011 um 19:42 schrieb Rob Landley:

Quoted 5 lines · Dushyant Bansal
Quoted 4 lines

When I try to run this command,

# qemu-system-ppcemb -nographic -m 128 -M bamboo -kernel uImage  
-append ""
Quoted 7 lines
Quoted 3 lines

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

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.

Quoted 8 lines
Quoted 1 line

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

#9 lore raw
In reply to Andreas Färber
Quoted 10 lines · Andreas Färber

Am 23.01.2011 um 19:42 schrieb Rob Landley:

Quoted 8 lines · Dushyant Bansal
Quoted 6 lines

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

Quoted 5 lines
Quoted 3 lines

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

#5 lore raw
In reply to Dushyant Bansal
Quoted 9 lines · Dushyant Bansal
Quoted 5 lines

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...

Quoted 3 lines

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.

Quoted 3 lines

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