mbox series

[v2,0/3] Sam460ex emulation

Message ID cover.1518730026.git.balaton@eik.bme.hu
Headers show
Series Sam460ex emulation | expand

Message

BALATON Zoltan Feb. 15, 2018, 9:27 p.m. UTC
Remaining patches for Sam460ex emulation. The original cover letter
with more details is here:

http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html

We'll need to also add binaries for firmware (customised u-boot
version) and dtb but I'm not sure how to submit those.

Current status for OSes I've tried:

- AROS boots (after I've fixed some bugs in it which are now upstream
  so the nightly iso should work) but keyboard doesn't work (could be
  a bug in AROS's HID driver) and time is going slow (this can be seen
  in time prefs). This may be a QEMU bug and possibly causes the hang
  seen in other OSes but I don't know what causes it or how to fix it.
  Maybe related to some internal timing registers of the SoC because
  setting multipliers to real values causes U-Boot to become slow.
  Anyone with more knowledge of this hardware has any idea?

- Linux: kernel boots but hangs during user space (again could be the
  above timing problem or maybe missing emac network interface
  emulation but I don't really know).

- AmigaOS 4 seems to boot but display is not working so not usable
  (either related to timing problem or could be SM502 emulation).

- MorphOS does not boot (it seems to either deliberately do stuff to
  prevent it from running on QEMU or it has bugs but developers are
  not communicative about it)

Regards,
BALATON Zoltan

BALATON Zoltan (3):
  ppc4xx: Add device models found in PPC440 core SoCs
  ppc440: Add emulation of plb-pcix controller found in some 440 SoCs
  ppc: Add aCube Sam460ex board

 default-configs/ppc-softmmu.mak    |    2 +
 default-configs/ppcemb-softmmu.mak |    1 +
 hw/ppc/Makefile.objs               |    3 +-
 hw/ppc/ppc440.h                    |   26 +
 hw/ppc/ppc440_pcix.c               |  528 ++++++++++++++++
 hw/ppc/ppc440_uc.c                 | 1159 ++++++++++++++++++++++++++++++++++++
 hw/ppc/sam460ex.c                  |  603 +++++++++++++++++++
 hw/ppc/trace-events                |    8 +
 include/hw/pci/pcie_host.h         |    2 +-
 9 files changed, 2330 insertions(+), 2 deletions(-)
 create mode 100644 hw/ppc/ppc440.h
 create mode 100644 hw/ppc/ppc440_pcix.c
 create mode 100644 hw/ppc/ppc440_uc.c
 create mode 100644 hw/ppc/sam460ex.c

Comments

Thomas Huth Feb. 16, 2018, 6:50 a.m. UTC | #1
On 15.02.2018 22:27, BALATON Zoltan wrote:
> Remaining patches for Sam460ex emulation. The original cover letter
> with more details is here:
> 
> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
> 
> We'll need to also add binaries for firmware (customised u-boot
> version) and dtb but I'm not sure how to submit those.

For the dtb, I think you could simply provide a patch that adds the dts
file to the pc-bios directory and another one that adds the dtb. Just
like it is already done with pc-bios/bamboo.dts / pc-bios/bamboo.dtb.

For u-boot, can you use the same upstream level as e500 ? I.e. check
whether "git submodule status roms/u-boot" is fine for you? If that's
ok, just do a "git submodule update roms/u-boot" and build uboot from
that directory - you then can submit a binary patch with that file for
pc-bios, too.

In case you need another u-boot version, I think you've got to update
the submodule to the newer upstream version first, and then also rebuild
the e500 binary... Cumbersome, but that's necessary since we've got to
ship the u-boot sources in the QEMU release tarballs, too, to be
compliant with the GPL.

 Thomas
BALATON Zoltan Feb. 16, 2018, 10:55 a.m. UTC | #2
On Fri, 16 Feb 2018, Thomas Huth wrote:
> On 15.02.2018 22:27, BALATON Zoltan wrote:
>> Remaining patches for Sam460ex emulation. The original cover letter
>> with more details is here:
>>
>> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
>>
>> We'll need to also add binaries for firmware (customised u-boot
>> version) and dtb but I'm not sure how to submit those.
>
> For the dtb, I think you could simply provide a patch that adds the dts
> file to the pc-bios directory and another one that adds the dtb. Just
> like it is already done with pc-bios/bamboo.dts / pc-bios/bamboo.dtb.

OK thanks, I'll do that. Does it have to be two separate patches?

> For u-boot, can you use the same upstream level as e500 ? I.e. check
> whether "git submodule status roms/u-boot" is fine for you? If that's
> ok, just do a "git submodule update roms/u-boot" and build uboot from
> that directory - you then can submit a binary patch with that file for
> pc-bios, too.
>
> In case you need another u-boot version, I think you've got to update
> the submodule to the newer upstream version first, and then also rebuild
> the e500 binary... Cumbersome, but that's necessary since we've got to
> ship the u-boot sources in the QEMU release tarballs, too, to be
> compliant with the GPL.

Unfortunately we can't use the same u-boot as e500 because this board uses 
a forked and patched version which is not in upstream u-boot and upstream 
u-boot has even dropped support for this CPU in latest version so we 
actually need an older version (with patches) and not a newer one.

Therefore, it needs to be a binary built from a separate source so I think 
a new submodule will need to be added for this. How to do that? Where to 
host this git repo? Should I put it on github and refer to that as an 
external repo or should it be hosted in qemu repo somehow?

Regards,
BALATON Zoltan
Thomas Huth Feb. 16, 2018, 11:07 p.m. UTC | #3
On 16.02.2018 11:55, BALATON Zoltan wrote:
> On Fri, 16 Feb 2018, Thomas Huth wrote:
>> On 15.02.2018 22:27, BALATON Zoltan wrote:
>>> Remaining patches for Sam460ex emulation. The original cover letter
>>> with more details is here:
>>>
>>> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
>>>
>>> We'll need to also add binaries for firmware (customised u-boot
>>> version) and dtb but I'm not sure how to submit those.
>>
>> For the dtb, I think you could simply provide a patch that adds the dts
>> file to the pc-bios directory and another one that adds the dtb. Just
>> like it is already done with pc-bios/bamboo.dts / pc-bios/bamboo.dtb.
> 
> OK thanks, I'll do that. Does it have to be two separate patches?

I don't think so, I just thought that would be cleaner ... but one patch
should be fine, too, I guess. David?

>> For u-boot, can you use the same upstream level as e500 ? I.e. check
>> whether "git submodule status roms/u-boot" is fine for you? If that's
>> ok, just do a "git submodule update roms/u-boot" and build uboot from
>> that directory - you then can submit a binary patch with that file for
>> pc-bios, too.
>>
>> In case you need another u-boot version, I think you've got to update
>> the submodule to the newer upstream version first, and then also rebuild
>> the e500 binary... Cumbersome, but that's necessary since we've got to
>> ship the u-boot sources in the QEMU release tarballs, too, to be
>> compliant with the GPL.
> 
> Unfortunately we can't use the same u-boot as e500 because this board
> uses a forked and patched version which is not in upstream u-boot and
> upstream u-boot has even dropped support for this CPU in latest version
> so we actually need an older version (with patches) and not a newer one.

That's very unfortunate ... any chance that you could try to get that
CPU activated in upstream u-boot again and get the patches included there?

> Therefore, it needs to be a binary built from a separate source so I
> think a new submodule will need to be added for this. How to do that?
> Where to host this git repo? Should I put it on github and refer to that
> as an external repo or should it be hosted in qemu repo somehow?

No clue ... adding Stefan and Jeff to CC:, maybe they can recommend
something here.

 Thomas
BALATON Zoltan Feb. 17, 2018, 9:24 a.m. UTC | #4
On Sat, 17 Feb 2018, Thomas Huth wrote:
> On 16.02.2018 11:55, BALATON Zoltan wrote:
>> On Fri, 16 Feb 2018, Thomas Huth wrote:
>>> On 15.02.2018 22:27, BALATON Zoltan wrote:
>>>> Remaining patches for Sam460ex emulation. The original cover letter
>>>> with more details is here:
>>>>
>>>> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
>>>>
>>>> We'll need to also add binaries for firmware (customised u-boot
>>>> version) and dtb but I'm not sure how to submit those.
>>>
>>> For the dtb, I think you could simply provide a patch that adds the dts
>>> file to the pc-bios directory and another one that adds the dtb. Just
>>> like it is already done with pc-bios/bamboo.dts / pc-bios/bamboo.dtb.
>>
>> OK thanks, I'll do that. Does it have to be two separate patches?
>
> I don't think so, I just thought that would be cleaner ... but one patch
> should be fine, too, I guess. David?
>
>>> For u-boot, can you use the same upstream level as e500 ? I.e. check
>>> whether "git submodule status roms/u-boot" is fine for you? If that's
>>> ok, just do a "git submodule update roms/u-boot" and build uboot from
>>> that directory - you then can submit a binary patch with that file for
>>> pc-bios, too.
>>>
>>> In case you need another u-boot version, I think you've got to update
>>> the submodule to the newer upstream version first, and then also rebuild
>>> the e500 binary... Cumbersome, but that's necessary since we've got to
>>> ship the u-boot sources in the QEMU release tarballs, too, to be
>>> compliant with the GPL.
>>
>> Unfortunately we can't use the same u-boot as e500 because this board
>> uses a forked and patched version which is not in upstream u-boot and
>> upstream u-boot has even dropped support for this CPU in latest version
>> so we actually need an older version (with patches) and not a newer one.
>
> That's very unfortunate ... any chance that you could try to get that
> CPU activated in upstream u-boot again and get the patches included there?

Not likely because it was removed to simplify code and get rid of 
unmaintained CPUs. Also the hardware vendor never upstreamed the board 
code which only exists in their sources, but these u-boot modifications 
are needed for boot loaders running on the hardware so we cannot use stock 
u-boot if we want to boot usual OSes which we want as that's the 
interesting part of this hardware.

Regards,
BALATON Zoltan

>> Therefore, it needs to be a binary built from a separate source so I
>> think a new submodule will need to be added for this. How to do that?
>> Where to host this git repo? Should I put it on github and refer to that
>> as an external repo or should it be hosted in qemu repo somehow?
>
> No clue ... adding Stefan and Jeff to CC:, maybe they can recommend
> something here.
>
> Thomas
>
>
David Gibson Feb. 19, 2018, 2:19 a.m. UTC | #5
On Sat, Feb 17, 2018 at 12:07:34AM +0100, Thomas Huth wrote:
> On 16.02.2018 11:55, BALATON Zoltan wrote:
> > On Fri, 16 Feb 2018, Thomas Huth wrote:
> >> On 15.02.2018 22:27, BALATON Zoltan wrote:
> >>> Remaining patches for Sam460ex emulation. The original cover letter
> >>> with more details is here:
> >>>
> >>> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
> >>>
> >>> We'll need to also add binaries for firmware (customised u-boot
> >>> version) and dtb but I'm not sure how to submit those.
> >>
> >> For the dtb, I think you could simply provide a patch that adds the dts
> >> file to the pc-bios directory and another one that adds the dtb. Just
> >> like it is already done with pc-bios/bamboo.dts / pc-bios/bamboo.dtb.
> > 
> > OK thanks, I'll do that. Does it have to be two separate patches?
> 
> I don't think so, I just thought that would be cleaner ... but one patch
> should be fine, too, I guess. David?

I'd actually prefer them both in one patch.

> 
> >> For u-boot, can you use the same upstream level as e500 ? I.e. check
> >> whether "git submodule status roms/u-boot" is fine for you? If that's
> >> ok, just do a "git submodule update roms/u-boot" and build uboot from
> >> that directory - you then can submit a binary patch with that file for
> >> pc-bios, too.
> >>
> >> In case you need another u-boot version, I think you've got to update
> >> the submodule to the newer upstream version first, and then also rebuild
> >> the e500 binary... Cumbersome, but that's necessary since we've got to
> >> ship the u-boot sources in the QEMU release tarballs, too, to be
> >> compliant with the GPL.
> > 
> > Unfortunately we can't use the same u-boot as e500 because this board
> > uses a forked and patched version which is not in upstream u-boot and
> > upstream u-boot has even dropped support for this CPU in latest version
> > so we actually need an older version (with patches) and not a newer one.
> 
> That's very unfortunate ... any chance that you could try to get that
> CPU activated in upstream u-boot again and get the patches included there?
> 
> > Therefore, it needs to be a binary built from a separate source so I
> > think a new submodule will need to be added for this. How to do that?
> > Where to host this git repo? Should I put it on github and refer to that
> > as an external repo or should it be hosted in qemu repo somehow?
> 
> No clue ... adding Stefan and Jeff to CC:, maybe they can recommend
> something here.
> 
>  Thomas
>
Guenter Roeck June 21, 2018, 9:15 p.m. UTC | #6
Hi,

On Thu, Feb 15, 2018 at 10:27:06PM +0100, BALATON Zoltan wrote:
> Remaining patches for Sam460ex emulation. The original cover letter
> with more details is here:
> 
> http://lists.nongnu.org/archive/html/qemu-ppc/2017-08/msg00112.html
> 
> We'll need to also add binaries for firmware (customised u-boot
> version) and dtb but I'm not sure how to submit those.
> 
> Current status for OSes I've tried:
> 
> - AROS boots (after I've fixed some bugs in it which are now upstream
>   so the nightly iso should work) but keyboard doesn't work (could be
>   a bug in AROS's HID driver) and time is going slow (this can be seen
>   in time prefs). This may be a QEMU bug and possibly causes the hang
>   seen in other OSes but I don't know what causes it or how to fix it.
>   Maybe related to some internal timing registers of the SoC because
>   setting multipliers to real values causes U-Boot to become slow.
>   Anyone with more knowledge of this hardware has any idea?
> 
> - Linux: kernel boots but hangs during user space (again could be the
>   above timing problem or maybe missing emac network interface
>   emulation but I don't really know).
> 
I played with the sam460ex emulation under Linux. There are two problems:

- qemu does not emulate "ibm,cpm". If specified in the devicetree file,
  Linux tries to access the respective dcr register (0x160) and crashes.
- If the kernel is loaded with "-kernel" and there is no uboot, the serial
  port frequency is set to 0, and the serial ports fail to initialize.
  As result, there is no serial port output from userspace. Userspace runs,
  but is silent.

Both problems are easy to fix with a separate devicetree file.

Guenter