PowerPC 440 support
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See pc-bios/bamboo.dts.
-Hollis
Quoted 49 lines · Baojun Wang
in
hw/ppc440.c:env =
cpu_ppc_init("440EP");
if (!env &&kvm_enabled()) {
/* XXX Since qemu doesn't yet emulate 440, we just say it's a 405.
* Since KVM doesn't use qemu's CPU emulation it seems to be working
* OK. */
env =cpu_ppc_init("405");
}
if (!env) {
fprintf(stderr, "Unable to initialize CPU!\n");
exit(1);
}also in
hw/ppc.c:I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is no
ppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.the qemu source I used is 0.10.5.
Also in
ppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I many of them are DEBUG or CACHE related SPR emulation, and since qemu doesn't emulate cache, I think it's OK.Thanks,
WangQuoted 18 lines · Hollis Blanchard
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Baojun Wang
could qemu emulate some board like bamboo (without kvm) or MPC8544ds now? Thanks
Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, EBC, IIC, ZMII. Maybe some are not needed in all cases.
No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a Bamboo board.
UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very far. :) Enough 440 SoC devices are emulated to support Linux boot with a properly stripped device tree.
-Hollis
Sorry, I was very confused (I didn't look at ppc440.c).
For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at 0x00000000fffffffc
NIP 00000000fffffffc LR 0000000000000000 CTR 0000000000000000 XER 00000000
MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation fault
Quoted 8 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Quoted 58 lines
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
Quoted 49 lines · Baojun Wang
in
hw/ppc440.c:env = cpu_ppc_init("440EP"); if (!env && kvm_enabled()) { /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. * Since KVM doesn't use qemu's CPU emulation it seems to be working * OK. */ env = cpu_ppc_init("405"); } if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); }also in
hw/ppc.c:I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is no
ppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.the qemu source I used is 0.10.5.
Also in
ppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I many of them are DEBUG or CACHE related SPR emulation, and since qemu doesn't emulate cache, I think it's OK.Thanks,
WangQuoted 18 lines · Hollis Blanchard
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Baojun Wang
could qemu emulate some board like bamboo (without kvm) or MPC8544ds now? Thanks
Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, EBC, IIC, ZMII. Maybe some are not needed in all cases.
No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a Bamboo board.
UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very far. :) Enough 440 SoC devices are emulated to support Linux boot with a properly stripped device tree.
-Hollis
From 46f1cdbafbb67f0057654faddf3d51e9d9460672 Mon Sep 17 00:00:00 2001
From: Blue Swirl <[email protected]>
Date: Sun, 14 Jun 2009 18:23:46 +0000
Subject: [PATCH] Allow user to specify CPU model
--- hw/ppc440.c | 13 +++++-------- hw/ppc440.h | 3 ++- hw/ppc440_bamboo.c | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-)
hw/ppc440.c +5 -8
@@ -34,7 +34,8 @@ static const unsigned int ppc440ep_sdram_bank_sizes[] = { };CPUState *ppc440ep_init (ram_addr_t *ram_size,PCIBus **pcip, -const unsigned int pci_irq_nrs[4 ],int do_init) +const unsigned int pci_irq_nrs[4 ],int do_init, +const char *cpu_model) {target_phys_addr_t ram_bases[PPC440EP_SDRAM_NR_BANKS ];target_phys_addr_t ram_sizes[PPC440EP_SDRAM_NR_BANKS ];
@@ -44,13 +45,9 @@ CPUState *ppc440ep_init(ram_addr_t *ram_size, PCIBus **pcip,qemu_irq *irqs;qemu_irq *pci_irqs; - env =cpu_ppc_init ("440EP" ); -if (!env &&kvm_enabled ()) { -/* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. -* Since KVM doesn't use qemu's CPU emulation it seems to be working -* OK. */ - env =cpu_ppc_init ("405" ); - } +if (cpu_model ==NULL ) + cpu_model ="405" ;// XXX: should be 440EP + env =cpu_init (cpu_model);if (!env) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
hw/ppc440.h +2 -1
@@ -15,6 +15,7 @@#include "hw.h" CPUState *ppc440ep_init (ram_addr_t *ram_size,PCIBus **pcip, -const unsigned int pci_irq_nrs[4 ],int do_init); +const unsigned int pci_irq_nrs[4 ],int do_init, +const char *cpu_model);#endif
hw/ppc440_bamboo.c +1 -1
@@ -103,7 +103,7 @@ static void bamboo_init(ram_addr_t ram_size,int i;/* Setup CPU. */ - env =ppc440ep_init (&ram_size, &pcibus, pci_irq_nrs,1 ); + env =ppc440ep_init (&ram_size, &pcibus, pci_irq_nrs,1 , cpu_model);if (pcibus) {int unit_id =0 ;
Signature · 1 line
1.5.6.5
My 440 board is inaccessible for a couple weeks, so I can't test your patch. That said, the code looks fine.
However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
-Hollis
Quoted 86 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000 MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 66 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]> wrote:
>
> inhw/ppc440.c:
>
> env =cpu_ppc_init("440EP");
> if (!env &&kvm_enabled()) {
> /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. > * Since KVM doesn't use qemu's CPU emulation it seems to be working > * OK. */
> env =cpu_ppc_init("405");
> }
> if (!env) {
> fprintf(stderr, "Unable to initialize CPU!\n");
> exit(1);
> }
>
> also inhw/ppc.c:
>
> I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is > noppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, > PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.
>
> the qemu source I used is 0.10.5.
>
> Also inppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I > many of them are DEBUG or CACHE related SPR emulation, and since qemu > doesn't emulate cache, I think it's OK.
>
> Thanks,
> Wang
>
> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<[email protected]> wrote:
> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <[email protected]> wrote:
> >>
> >> On 6/11/09, Baojun Wang <[email protected]> wrote:
> >> > could qemu emulate some board like bamboo (without kvm) or MPC8544ds > >> > now? Thanks
> >>
> >> Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, > >> EBC, IIC, ZMII. Maybe some are not needed in all cases.
> >
> > No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a > > Bamboo board.
> >
> > UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very > > far. :) Enough 440 SoC devices are emulated to support Linux boot with a > > properly stripped device tree.
> >
> > -Hollis
> >
Quoted 7 lines · Hollis Blanchard
My 440 board is inaccessible for a couple weeks, so I can't test your
patch. That said, the code looks fine.However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
That could be useful, but I'm trying to fix the CPU model selection logic. It does not yield a working CPU without KVM.
Quoted 2 lines
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
Probably.
Quoted 93 lines
-Hollis
Quoted 86 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000
MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 66 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
Quoted 49 lines · Baojun Wang
in
hw/ppc440.c:env = cpu_ppc_init("440EP"); if (!env && kvm_enabled()) { /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. * Since KVM doesn't use qemu's CPU emulation it seems to be working * OK. */ env = cpu_ppc_init("405"); } if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1); }also in
hw/ppc.c:I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is no
ppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.the qemu source I used is 0.10.5.
Also in
ppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I many of them are DEBUG or CACHE related SPR emulation, and since qemu doesn't emulate cache, I think it's OK.Thanks,
WangQuoted 18 lines · Hollis Blanchard
Quoted 7 lines · Blue Swirl
Quoted 2 lines · Baojun Wang
could qemu emulate some board like bamboo (without kvm) or MPC8544ds now? Thanks
Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, EBC, IIC, ZMII. Maybe some are not needed in all cases.
No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a Bamboo board.
UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very far. :) Enough 440 SoC devices are emulated to support Linux boot with a properly stripped device tree.
-Hollis
It seems most boards will converted to the device tree infrastructure?
but I think we will need a firmware first before loading the linux kernel, I don't know if qemu-system-ppcemb could run kernel directly without a firmware..
Best Regards,
Wang
Quoted 101 lines · Hollis Blanchard
My 440 board is inaccessible for a couple weeks, so I can't test your patch. That said, the code looks fine.
However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
-Hollis
Quoted 86 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000 MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 66 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]> wrote:
>
> inhw/ppc440.c:
>
> env =cpu_ppc_init("440EP");
> if (!env &&kvm_enabled()) {
> /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. > * Since KVM doesn't use qemu's CPU emulation it seems to be working > * OK. */
> env =cpu_ppc_init("405");
> }
> if (!env) {
> fprintf(stderr, "Unable to initialize CPU!\n");
> exit(1);
> }
>
> also inhw/ppc.c:
>
> I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is > noppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, > PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.
>
> the qemu source I used is 0.10.5.
>
> Also inppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I > many of them are DEBUG or CACHE related SPR emulation, and since qemu > doesn't emulate cache, I think it's OK.
>
> Thanks,
> Wang
>
> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<[email protected]> wrote:
> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <[email protected]> wrote:
> >>
> >> On 6/11/09, Baojun Wang <[email protected]> wrote:
> >> > could qemu emulate some board like bamboo (without kvm) or MPC8544ds > >> > now? Thanks
> >>
> >> Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, > >> EBC, IIC, ZMII. Maybe some are not needed in all cases.
> >
> > No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a > > Bamboo board.
> >
> > UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very > > far. :) Enough 440 SoC devices are emulated to support Linux boot with a > > properly stripped device tree.
> >
> > -Hollis
> >
KVM PPC execution doesn't use firmware today. Instead we create the device tree in qemu itself, stuff it into guest memory, and point a guest register at it on entry. This was just a shortcut/hack, because we didn't have enough time to enable both Linux and uboot.
I agree that the best way to do things long-term is to run u-boot inside the guest environment. That will likely require improvements to qemu's device emulation, and also we'll probably need to work out a way for qemu to pass parameters (e.g. memory size) to u-boot. IMHO, the best approach there would be to have u-boot interpret a device tree from qemu, then modify it and pass it on to the kernel. Obviously that will require u-boot work.
-Hollis
Quoted 126 lines · Baojun Wang
It seems most boards will converted to the device tree infrastructure?
but I think we will need a firmware first before loading the linux kernel, I don't know if qemu-system-ppcemb could run kernel directly without a firmware..
Best Regards,
WangQuoted 8 lines · Hollis Blanchard
My 440 board is inaccessible for a couple weeks, so I can't test your patch. That said, the code looks fine.
However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
Quoted 21 lines
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
-Hollis
Quoted 15 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER00000000
Quoted 20 lines
Quoted 20 lines
MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation fault
Quoted 16 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]>
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
in
hw/ppc440.c:env = cpu_ppc_init("440EP"); if (!env && kvm_enabled()) { /* XXX Since qemu doesn't yet emulate 440, we just say it's a405.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
* Since KVM doesn't use qemu's CPU emulation it seems to be
working
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
* OK. */
env =cpu_ppc_init("405");
}if (!env) { fprintf(stderr, "Unable to initialize CPU!\n"); exit(1);}
also in
hw/ppc.c:I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there
is
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
no
ppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.the qemu source I used is 0.10.5.
Also in
ppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I many of them are DEBUG or CACHE related SPR emulation, and sinceqemu
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
doesn't emulate cache, I think it's OK.
Thanks,
WangOn Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<
Quoted 1 line · [email protected]> wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <
Quoted 3 lines · [email protected]> wrote:
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines · Baojun Wang
Quoted 1 line
could qemu emulate some board like bamboo (without kvm) or
MPC8544ds
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
now? Thanks
Yes, if someone adds emulation for these devices: UIC, PLB, DMA,
POB,
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
EBC, IIC, ZMII. Maybe some are not needed in all cases.
No, qemu still doesn't emulate Book E cores, such as the PowerPC
440 in a
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Bamboo board.
UIC is of course emulated, otherwise KVM guests on 440 wouldn't
get very
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
far. :) Enough 440 SoC devices are emulated to support Linux boot
with a
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 4 lines
Quoted 4 lines
properly stripped device tree.
-Hollis
Quoted 11 lines · Hollis Blanchard
KVM PPC execution doesn't use firmware today. Instead we create the device tree in qemu itself, stuff it into guest memory, and point a guest register at it on entry. This was just a shortcut/hack, because we didn't have enough time to enable both Linux and uboot.
I agree that the best way to do things long-term is to run u-boot inside the guest environment. That will likely require improvements to qemu's device emulation, and also we'll probably need to work out a way for qemu to pass parameters (e.g. memory size) to u-boot. IMHO, the best approach there would be to have u-boot interpret a device tree from qemu, then modify it and pass it on to the kernel. Obviously that will require u-boot work.
I'm not familiar with u-boot, could we use OpenBIOS instead? Is u-boot used on real hardware?
Quoted 14 lines · Blue Swirl
Quoted 1 line · Hollis Blanchard
KVM PPC execution doesn't use firmware today. Instead we create the
device
Quoted 1 line
tree in qemu itself, stuff it into guest memory, and point a guest
register
Quoted 1 line
at it on entry. This was just a shortcut/hack, because we didn't have
enough
Quoted 3 lines
time to enable both Linux and uboot.
I agree that the best way to do things long-term is to run u-boot inside
the
Quoted 2 lines
guest environment. That will likely require improvements to qemu's device emulation, and also we'll probably need to work out a way for qemu to
pass
Quoted 9 lines
Quoted 1 line
parameters (e.g. memory size) to u-boot. IMHO, the best approach there
would
Quoted 1 line
be to have u-boot interpret a device tree from qemu, then modify it and
pass
Quoted 1 line
it on to the kernel. Obviously that will require u-boot work.
I'm not familiar with u-boot, could we use OpenBIOS instead? Is u-boot used on real hardware?
Yes, u-boot is used on a wide variety of real hardware. Open Firmware is almost unheard-of in embedded systems.
-Hollis
I think the idea is very good, otherwise it will take too much time to finish, and it gives us a way to lauch kernel directly without a firmware.
I have some question about the new qemu device tree, in ppc440_bamboo.c:
function bamboo_load_device_tree() is only usable when HAVE_FDT defined as 1, but currently (even with git version) version (0.10.5) we can not enable this feature? I have forced HAVE_FDT to be defined by:
echo '#define HAVE_FDT 1' >> config-host.h
&
echo 'FDT_LIBS=-lfdt' >> config-host.mak
but that lead to compile error, seems device tree in qemu is not fully populated?
Regard & Thanks,
Wang
Quoted 144 lines · Hollis Blanchard
KVM PPC execution doesn't use firmware today. Instead we create the device tree in qemu itself, stuff it into guest memory, and point a guest register at it on entry. This was just a shortcut/hack, because we didn't have enough time to enable both Linux and uboot.
I agree that the best way to do things long-term is to run u-boot inside the guest environment. That will likely require improvements to qemu's device emulation, and also we'll probably need to work out a way for qemu to pass parameters (e.g. memory size) to u-boot. IMHO, the best approach there would be to have u-boot interpret a device tree from qemu, then modify it and pass it on to the kernel. Obviously that will require u-boot work.
-Hollis
Quoted 127 lines · Baojun Wang
It seems most boards will converted to the device tree infrastructure?
but I think we will need a firmware first before loading the linux kernel, I don't know if qemu-system-ppcemb could run kernel directly without a firmware..
Best Regards,
WangQuoted 115 lines · Hollis Blanchard
My 440 board is inaccessible for a couple weeks, so I can't test your patch. That said, the code looks fine.
However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
-Hollis
Quoted 100 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000
MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 79 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]> wrote:
>
> inhw/ppc440.c:
>
> env =cpu_ppc_init("440EP");
> if (!env &&kvm_enabled()) {
> /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405.
> * Since KVM doesn't use qemu's CPU emulation it seems to be working
> * OK. */
> env =cpu_ppc_init("405");
> }
> if (!env) {
> fprintf(stderr, "Unable to initialize CPU!\n");
> exit(1);
> }
>
> also inhw/ppc.c:
>
> I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is
> noppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs,
> PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.
>
> the qemu source I used is 0.10.5.
>
> Also inppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I > many of them are DEBUG or CACHE related SPR emulation, and since qemu
> doesn't emulate cache, I think it's OK.
>
> Thanks,
> Wang
>
> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<[email protected]> wrote:
> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <[email protected]> wrote:
> >>
> >> On 6/11/09, Baojun Wang <[email protected]> wrote:
> >> > could qemu emulate some board like bamboo (without kvm) or MPC8544ds
> >> > now? Thanks
> >>
> >> Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB,
> >> EBC, IIC, ZMII. Maybe some are not needed in all cases. > >
> > No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a
> > Bamboo board.
> >
> > UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very
> > far. :) Enough 440 SoC devices are emulated to support Linux boot with a
> > properly stripped device tree.
> >
> > -Hollis
> >
Quoted 3 lines · Baojun Wang
I think the idea is very good, otherwise it will take too much time to finish, and it gives us a way to lauch kernel directly without a firmware.
Note however that this approach means qemu must initialize the target as if u-boot had. Practically speaking, that means device tree, initial register values, and also TLB entries. At least on some platforms, u-boot leaves a UART mapping for early kernel use.
Quoted 7 lines
I have some question about the new qemu device tree, in
ppc440_bamboo.c:function
bamboo_load_device_tree()is only usable whenHAVE_FDTdefined as 1, but currently (even with git version) version (0.10.5) we can not enable this feature? I have forcedHAVE_FDTto be defined by:
Quoted 8 lines
echo '#define
HAVE_FDT1' >>config-host.h&
echo 'FDT_LIBS=-lfdt' >> config-host.mak
but that lead to compile error, seems device tree in qemu is not fully populated?
Do you have libfdt installed? If so, configure should have found it, and you wouldn't need to mess with config-host.* manually.
Currently there are no distribution packages for libfdt. You must download dtc source (http://git.jdl.com/gitweb/?p=dtc.git;a=summary)
and install libfdt by hand from there.
-Hollis
Quoted 149 lines
Regard & Thanks,
WangQuoted 144 lines · Hollis Blanchard
KVM PPC execution doesn't use firmware today. Instead we create the device tree in qemu itself, stuff it into guest memory, and point a guest register at it on entry. This was just a shortcut/hack, because we didn't have enough time to enable both Linux and uboot.
I agree that the best way to do things long-term is to run u-boot inside the guest environment. That will likely require improvements to qemu's device emulation, and also we'll probably need to work out a way for qemu to pass parameters (e.g. memory size) to u-boot. IMHO, the best approach there would be to have u-boot interpret a device tree from qemu, then modify it and pass it on to the kernel. Obviously that will require u-boot work.
-Hollis
Quoted 127 lines · Baojun Wang
It seems most boards will converted to the device tree infrastructure?
but I think we will need a firmware first before loading the linux kernel, I don't know if qemu-system-ppcemb could run kernel directly without a firmware..
Best Regards,
WangQuoted 115 lines · Hollis Blanchard
My 440 board is inaccessible for a couple weeks, so I can't test your patch. That said, the code looks fine.
However, I wonder what your goal is? You want to be able to create a Bamboo board with e.g. a 750 processor? I don't think that would help the original poster, and I'm not sure how useful it is, but I don't object...
Either way I guess it will become a non-issue once PowerPC boards are converted to the device tree infrastructure.
-Hollis
Quoted 100 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000
MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 79 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]> wrote:
>
> inhw/ppc440.c:
>
> env =cpu_ppc_init("440EP");
> if (!env &&kvm_enabled()) {
> /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405.
> * Since KVM doesn't use qemu's CPU emulation it seems to be working
> * OK. */
> env =cpu_ppc_init("405");
> }
> if (!env) {
> fprintf(stderr, "Unable to initialize CPU!\n");
> exit(1);
> }
>
> also inhw/ppc.c:
>
> I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is
> noppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs,
> PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.
>
> the qemu source I used is 0.10.5.
>
> Also inppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I > many of them are DEBUG or CACHE related SPR emulation, and since qemu
> doesn't emulate cache, I think it's OK.
>
> Thanks,
> Wang
>
> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<[email protected]> wrote:
> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <[email protected]> wrote:
> >>
> >> On 6/11/09, Baojun Wang <[email protected]> wrote:
> >> > could qemu emulate some board like bamboo (without kvm) or MPC8544ds
> >> > now? Thanks
> >>
> >> Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB,
> >> EBC, IIC, ZMII. Maybe some are not needed in all cases. > >
> > No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a
> > Bamboo board.
> >
> > UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very
> > far. :) Enough 440 SoC devices are emulated to support Linux boot with a
> > properly stripped device tree.
> >
> > -Hollis
> >
I think we can use u-boot as the firmware for testing, but to compile u-boot, we have to choose a board first..
for bamboo (440ep) or mpc8544ds, we could compile a u-boot like:
make ARCH=ppc bamboo_config
or
make ARCH=ppc MPC8544DS_config
then
make ARCH=ppc CROSS_COMPILE=powerpc-unknown-linux-gnu-
this will produce u-boot.bin, and we could use
qemu-system-ppcemb -m bamboo -kernel u-boot.bin -net nic -net tap
to verify if qemu-works.
during reset, the ppc processor start (ip) at address 0xFFFF_FFFC, so I think we need a firmware be loaded at that address.
I have check ppc_oldworld.c, it tries to load the firmware first openbios-ppc (should be of compatible) :
snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset |IO_MEM_ROM);
/* Load OpenBIOS (ELF) */
bios_size = load_elf(buf, 0, NULL, NULL, NULL);PROM_ADDR is at 0xFFF0_0000 and BIOS_SIZE is 1MB (last 1MB, mpc85xx default ROM location is last 8MB from 0xFF80_0000, but boot loader like u-boot only use the last 512KB), and the openbios-ppc should be a crafted ELF file just like u-boot which have put some _magic_ at 0xFFFF_FFFC so that the CPU could go on during reset.
I have ever used qemu-system-arm to start the integratorcp board's u-boot, and then use the u-boot to start a linux kernel (integratorcp) successfully.
Few days ago I haved tried to uncomment the CONFIG_USER_ONLY macro in ppc/translate_init.c, but qemu-system-ppcemb still failed, so I guess the ppc booke softmmu still have some minor problem.
Best Regards,
Wang
Quoted 86 lines · Blue Swirl
Sorry, I was very confused (I didn't look at
ppc440.c).For some reason, CPU model can't be specified on the command line. The patch allows this, does it look OK?
Is there a kernel and initrd somewhere, so I could test this?
Currently I get (no kernel or ROM, so nothing to execute):
Truncating memory to 128 MiB to fit SDRAM controller limits.ppc405_serial_init: offset 0000000000000300
QEMU 0.10.50 monitor - type 'help' for more information (qemu) qemu: fatal: Trying to execute code outside RAM or ROM at0x00000000fffffffcNIP
00000000fffffffcLR 0000000000000000 CTR 0000000000000000 XER 00000000 MSR 0000000000000000 HID0 0000000000000300 HF 0000000000000000 idx 1 Segmentation faultQuoted 66 lines · Hollis Blanchard
Yes, I wrote the code you quoted.
In case there is any confusion, let me restate: You can boot a Bamboo (PowerPC 440) guest under KVM on a PowerPC 440 host. KVM bypasses qemu's CPU emulation (TCG), but uses qemu's device emulation. Therefore, if someone were to implement 440 core emulation in qemu, you could boot a 440 kernel with qemu without KVM.
Most devices found on 440 SoCs are the same as or very similar to the devices found on 405 SoCs. Qemu's 440 device emulation isn't perfect, but because Linux is highly modular, with a modified device tree you can boot it. See
pc-bios/bamboo.dts.-Hollis
On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <[email protected]> wrote:
>
> inhw/ppc440.c:
>
> env =cpu_ppc_init("440EP");
> if (!env &&kvm_enabled()) {
> /* XXX Since qemu doesn't yet emulate 440, we just say it's a 405. > * Since KVM doesn't use qemu's CPU emulation it seems to be working > * OK. */
> env =cpu_ppc_init("405");
> }
> if (!env) {
> fprintf(stderr, "Unable to initialize CPU!\n");
> exit(1);
> }
>
> also inhw/ppc.c:
>
> I can find ppc40x_irq_init/e500_irq_init(used mpc8544ds), but there is > noppcbooke_irq_init? It seemshw/ppc405_uc.cis emulation for DCRs, > PLB, DMA, GPIO, I2C.., but there is nohw/ppc44x_uc.c.
>
> the qemu source I used is 0.10.5.
>
> Also inppc/translate_init.c, there lots ofCONFIG_USER_ONLY, but I > many of them are DEBUG or CACHE related SPR emulation, and since qemu > doesn't emulate cache, I think it's OK.
>
> Thanks,
> Wang
>
> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<[email protected]> wrote:
> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <[email protected]> wrote:
> >>
> >> On 6/11/09, Baojun Wang <[email protected]> wrote:
> >> > could qemu emulate some board like bamboo (without kvm) or MPC8544ds > >> > now? Thanks
> >>
> >> Yes, if someone adds emulation for these devices: UIC, PLB, DMA, POB, > >> EBC, IIC, ZMII. Maybe some are not needed in all cases.
> >
> > No, qemu still doesn't emulate Book E cores, such as the PowerPC 440 in a > > Bamboo board.
> >
> > UIC is of course emulated, otherwise KVM guests on 440 wouldn't get very > > far. :) Enough 440 SoC devices are emulated to support Linux boot with a > > properly stripped device tree.
> >
> > -Hollis
> >