From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MGENy-0003d7-IT for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:46:15 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MGENt-0003Un-3m for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:46:13 -0400 Received: from [199.232.76.173] (port=37365 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MGENs-0003Ua-Us for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:46:09 -0400 Received: from mail-qy0-f191.google.com ([209.85.221.191]:60800) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MGENs-0004qH-Be for qemu-devel@nongnu.org; Mon, 15 Jun 2009 11:46:08 -0400 Received: by qyk29 with SMTP id 29so4691674qyk.4 for ; Mon, 15 Jun 2009 08:46:05 -0700 (PDT) MIME-Version: 1.0 Sender: slightlyunconventional@gmail.com In-Reply-To: <3cdfa5bc0906142140nf2a78rf2a07c3185a9614d@mail.gmail.com> References: <3cdfa5bc0906142140nf2a78rf2a07c3185a9614d@mail.gmail.com> Date: Mon, 15 Jun 2009 10:46:05 -0500 Message-ID: Subject: Re: [Qemu-devel] PowerPC 440 support From: Hollis Blanchard Content-Type: multipart/alternative; boundary=0022152d6d9dbe3a6c046c64f401 List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Baojun Wang Cc: Blue Swirl , "Richard W.M. Jones" , qemu-devel@nongnu.org --0022152d6d9dbe3a6c046c64f401 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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 On Sun, Jun 14, 2009 at 11:40 PM, Baojun Wang wrote: > 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 > > On Mon, Jun 15, 2009 at 3:46 AM, Hollis Blanchard > wrote: > > 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 > > > > On Sun, Jun 14, 2009 at 1:33 PM, Blue Swirl wrote: > >> 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 > >> > >> On 6/14/09, Hollis Blanchard wrote: > >>> 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 > wrote: > >>> > > >>> > 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 seems hw/ppc405_uc.c is emulation for DCRs, > >>> > PLB, DMA, GPIO, I2C.., but there is no hw/ppc44x_uc.c. > >>> > > >>> > the qemu source I used is 0.10.5. > >>> > > >>> > Also in ppc/translate_init.c, there lots of CONFIG_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< > hollis@penguinppc.org> wrote: > >>> > > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl < > blauwirbel@gmail.com> wrote: > >>> > >> > >>> > >> On 6/11/09, Baojun Wang 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 > >>> > > > >>> > >> > > > --0022152d6d9dbe3a6c046c64f401 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable KVM PPC execution doesn't use firmware today. Instead we create the dev= ice tree in qemu itself, stuff it into guest memory, and point a guest regi= ster at it on entry. This was just a shortcut/hack, because we didn't h= ave enough time to enable both Linux and uboot.

I agree that the best way to do things long-term is to run u-boot insid= e 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 approa= ch there would be to have u-boot interpret a device tree from qemu, then mo= dify it and pass it on to the kernel. Obviously that will require u-boot wo= rk.

-Hollis

On Sun, Jun 14, 2009 at 11:40= PM, Baojun Wang <= wangbj@gmail.com> wrote:
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..

=A0Best Regards,
Wang

On Mon, Jun 15, 2009 at 3:46 AM, Hollis Blanchard<hollis@penguinppc.org> wrote:
> My 440 board is inaccessible for a couple weeks, so I can't test y= our
> 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 h= elp
> the original poster, and I'm not sure how useful it is, but I don&= #39;t
> object...
>
> Either way I guess it will become a non-issue once PowerPC boards are<= br> > converted to the device tree infrastructure.
>
> -Hollis
>
> On Sun, Jun 14, 2009 at 1:33 PM, Blue Swirl<blauwirbel@gmail.com> wrote:
>> Sorry, I was very confused (I didn't look at ppc440.c).
>>
>> For some reason, CPU model can't be specified on the command l= ine. 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 =A0 LR 0000000000000000 CTR 0000000000000000 = XER 00000000
>> MSR 0000000000000000 HID0 0000000000000300 =A0HF 0000000000000000 = idx 1
>> Segmentation fault
>>
>> On 6/14/09, Hollis Blanchard <hollis@penguinppc.org> wrote:
>>> Yes, I wrote the code you quoted.
>>>
>>> =A0In case there is any confusion, let me restate: You can boo= t a Bamboo
>>> =A0(PowerPC 440) guest under KVM on a PowerPC 440 host. KVM by= passes
>>> =A0qemu's CPU emulation (TCG), but uses qemu's device = emulation.
>>> =A0Therefore, if someone were to implement 440 core emulation = in qemu,
>>> =A0you could boot a 440 kernel with qemu without KVM.
>>>
>>> =A0Most devices found on 440 SoCs are the same as or very simi= lar to the
>>> =A0devices found on 405 SoCs. Qemu's 440 device emulation = isn't perfect,
>>> =A0but because Linux is highly modular, with a modified device= tree you
>>> =A0can boot it. See pc-bios/bamboo.dts.
>>>
>>> =A0-Hollis
>>>
>>> =A0On Sat, Jun 13, 2009 at 10:47 PM, Baojun Wang <wangbj@gmail.com> wrote:
>>> =A0>
>>> =A0> in hw/ppc440.c:
>>> =A0>
>>> =A0> =A0 =A0env =3D cpu_ppc_init("440EP");
>>> =A0> =A0 =A0if (!env && kvm_enabled()) {
>>> =A0> =A0 =A0 =A0 =A0/* XXX Since qemu doesn't yet emula= te 440, we just say it's a 405.
>>> =A0> =A0 =A0 =A0 =A0 * Since KVM doesn't use qemu's= CPU emulation it seems to be working
>>> =A0> =A0 =A0 =A0 =A0 * OK. */
>>> =A0> =A0 =A0 =A0 =A0env =3D cpu_ppc_init("405");<= br> >>> =A0> =A0 =A0}
>>> =A0> =A0 =A0if (!env) {
>>> =A0> =A0 =A0 =A0 =A0fprintf(stderr, "Unable to initial= ize CPU!\n");
>>> =A0> =A0 =A0 =A0 =A0exit(1);
>>> =A0> =A0 =A0}
>>> =A0>
>>> =A0> also in hw/ppc.c:
>>> =A0>
>>> =A0> I can find ppc40x_irq_init/e500_irq_init(used mpc8544d= s), but there is
>>> =A0> no ppcbooke_irq_init? It seems hw/ppc405_uc.c is emula= tion for DCRs,
>>> =A0> PLB, DMA, GPIO, I2C.., but there is no hw/ppc44x_uc.c.=
>>> =A0>
>>> =A0> the qemu source I used is 0.10.5.
>>> =A0>
>>> =A0> Also in ppc/translate_init.c, there lots of CONFIG_USE= R_ONLY, but I
>>> =A0> many of them are DEBUG or CACHE related SPR emulation,= and since qemu
>>> =A0> doesn't emulate cache, I think it's OK.
>>> =A0>
>>> =A0> =A0Thanks,
>>> =A0> Wang
>>> =A0>
>>> =A0> On Sun, Jun 14, 2009 at 1:47 AM, Hollis Blanchard<<= a href=3D"mailto:hollis@penguinppc.org">hollis@penguinppc.org> wrote= :
>>> =A0> > On Fri, Jun 12, 2009 at 10:48 AM, Blue Swirl <= blauwirbel@gmail.com> wrote:=
>>> =A0> >>
>>> =A0> >> On 6/11/09, Baojun Wang <wangbj@gmail.com> wrote:
>>> =A0> >> > could qemu emulate some board like bambo= o (without kvm) or MPC8544ds
>>> =A0> >> > now? Thanks
>>> =A0> >>
>>> =A0> >> Yes, if someone adds emulation for these devi= ces: UIC, PLB, DMA, POB,
>>> =A0> >> EBC, IIC, ZMII. Maybe some are not needed in = all cases.
>>> =A0> >
>>> =A0> > No, qemu still doesn't emulate Book E cores, = such as the PowerPC 440 in a
>>> =A0> > Bamboo board.
>>> =A0> >
>>> =A0> > UIC is of course emulated, otherwise KVM guests o= n 440 wouldn't get very
>>> =A0> > far. :) Enough 440 SoC devices are emulated to su= pport Linux boot with a
>>> =A0> > properly stripped device tree.
>>> =A0> >
>>> =A0> > -Hollis
>>> =A0> >
>>>
>>
>

--0022152d6d9dbe3a6c046c64f401--