[PATCH v2 0/8] hm/mips/fuloong2e fixes

Jiaxun Yang posted 8 patches 4 years, 11 months ago
Failed in applying to current master (apply log)
hw/mips/fuloong2e.c                    | 84 +++++++++++++++++---------
hw/pci-host/bonito.c                   | 45 ++++----------
tests/acceptance/boot_linux_console.py | 21 +++++++
3 files changed, 87 insertions(+), 63 deletions(-)
[PATCH v2 0/8] hm/mips/fuloong2e fixes
Posted by Jiaxun Yang 4 years, 11 months ago
It can now boot Debian installer[1] as well as a custom PMON bootloader
distribution[2].

Note that it can't boot PMON shipped with actual machine as our ATI vgabios
is using some x86 hack that can't be handled by x86emu in original PMON. 


Tree avilable at: https://gitlab.com/FlyGoat/qemu/-/tree/fuloong_fixes_v2

v2:
 - Collect review tags.
 - Get CPU clock via elegant method. (philmd)
 - Add boot_linux_console scceptance test

[1]: http://archive.debian.org/debian/dists/jessie/main/installer-mipsel/current/images/loongson-2e/netboot/
[2]: https://github.com/loongson-community/pmon/releases/download/20201219/pmon-2edev.bin

Thanks.

- Jiaxun

Jiaxun Yang (8):
  hw/mips/fuloong2e: Remove define DEBUG_FULOONG2E_INIT
  hw/mips/fuloong2e: Relpace fault links
  hw/pci-host/bonito: Fixup IRQ mapping
  hw/pci-host/bonito: Fixup pci.lomem mapping
  hw/mips/fuloong2e: Remove unused env entry
  hw/mips/fuloong2e: Correct cpuclock env
  hw/mips/fuloong2e: Add highmem support
  tests/acceptance: Test boot_linux_console for fuloong2e

 hw/mips/fuloong2e.c                    | 84 +++++++++++++++++---------
 hw/pci-host/bonito.c                   | 45 ++++----------
 tests/acceptance/boot_linux_console.py | 21 +++++++
 3 files changed, 87 insertions(+), 63 deletions(-)

-- 
2.29.2

Re: [PATCH v2 0/8] hm/mips/fuloong2e fixes
Posted by BALATON Zoltan via 4 years, 11 months ago
On Sat, 19 Dec 2020, Jiaxun Yang wrote:
> It can now boot Debian installer[1] as well as a custom PMON bootloader
> distribution[2].
>
> Note that it can't boot PMON shipped with actual machine as our ATI vgabios
> is using some x86 hack that can't be handled by x86emu in original PMON.

This may be similar problem that I've seen with similar PPC firmwares:

https://osdn.net/projects/qmiga/wiki/SubprojectAti
https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2#h3-Known.20issues

TLDR; vgabios-ati.bin is compiled for i386 real mode (bacause that's what 
gcc can do, real x86 real mode would need something like bcc I think) that 
some x86emu can't handle. You can either use Bochs vga bios via romfile 
property of the vga emulation or try the option for x86emu when compiling 
vgabios-ati.bin (which did not help the firmwares I've tried).

Regards,
BALATON Zoltan

>
> Tree avilable at: https://gitlab.com/FlyGoat/qemu/-/tree/fuloong_fixes_v2
>
> v2:
> - Collect review tags.
> - Get CPU clock via elegant method. (philmd)
> - Add boot_linux_console scceptance test
>
> [1]: http://archive.debian.org/debian/dists/jessie/main/installer-mipsel/current/images/loongson-2e/netboot/
> [2]: https://github.com/loongson-community/pmon/releases/download/20201219/pmon-2edev.bin
>
> Thanks.
>
> - Jiaxun
>
> Jiaxun Yang (8):
>  hw/mips/fuloong2e: Remove define DEBUG_FULOONG2E_INIT
>  hw/mips/fuloong2e: Relpace fault links
>  hw/pci-host/bonito: Fixup IRQ mapping
>  hw/pci-host/bonito: Fixup pci.lomem mapping
>  hw/mips/fuloong2e: Remove unused env entry
>  hw/mips/fuloong2e: Correct cpuclock env
>  hw/mips/fuloong2e: Add highmem support
>  tests/acceptance: Test boot_linux_console for fuloong2e
>
> hw/mips/fuloong2e.c                    | 84 +++++++++++++++++---------
> hw/pci-host/bonito.c                   | 45 ++++----------
> tests/acceptance/boot_linux_console.py | 21 +++++++
> 3 files changed, 87 insertions(+), 63 deletions(-)
>
>

Re: [PATCH v2 0/8] hm/mips/fuloong2e fixes
Posted by Jiaxun Yang 4 years, 11 months ago

在2020年12月19日十二月 下午8:13,BALATON Zoltan写道:
> On Sat, 19 Dec 2020, Jiaxun Yang wrote:
> > It can now boot Debian installer[1] as well as a custom PMON bootloader
> > distribution[2].
> >
> > Note that it can't boot PMON shipped with actual machine as our ATI vgabios
> > is using some x86 hack that can't be handled by x86emu in original PMON.
> 
> This may be similar problem that I've seen with similar PPC firmwares:
> 
> https://osdn.net/projects/qmiga/wiki/SubprojectAti
> https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2#h3-Known.20issues
> 
> TLDR; vgabios-ati.bin is compiled for i386 real mode (bacause that's what 
> gcc can do, real x86 real mode would need something like bcc I think) that 
> some x86emu can't handle. You can either use Bochs vga bios via romfile 
> property of the vga emulation or try the option for x86emu when compiling 
> vgabios-ati.bin (which did not help the firmwares I've tried).

Hi,

Thinks for your reminder!

To be more specified, our x86emu in PMON can handle i386 real mode,
however vgabios-ati uses INT15h when INT10h ax=0x4f01 (Get VESA Mode)
is called. And x86emu won't process INT15h properly.

My workround[1] is to allow 0x4f01 to be failed in PMON, as ax=0x4f02
(Set VESA Mode) do work, it won't be a actual problem.


- Jiaxun

Re: [PATCH v2 0/8] hm/mips/fuloong2e fixes
Posted by BALATON Zoltan via 4 years, 11 months ago
On Sat, 19 Dec 2020, Jiaxun Yang wrote:
> 在2020年12月19日十二月 下午8:13,BALATON Zoltan写道:
>> On Sat, 19 Dec 2020, Jiaxun Yang wrote:
>>> It can now boot Debian installer[1] as well as a custom PMON bootloader
>>> distribution[2].
>>>
>>> Note that it can't boot PMON shipped with actual machine as our ATI vgabios
>>> is using some x86 hack that can't be handled by x86emu in original PMON.
>>
>> This may be similar problem that I've seen with similar PPC firmwares:
>>
>> https://osdn.net/projects/qmiga/wiki/SubprojectAti
>> https://osdn.net/projects/qmiga/wiki/SubprojectPegasos2#h3-Known.20issues
>>
>> TLDR; vgabios-ati.bin is compiled for i386 real mode (bacause that's what
>> gcc can do, real x86 real mode would need something like bcc I think) that
>> some x86emu can't handle. You can either use Bochs vga bios via romfile
>> property of the vga emulation or try the option for x86emu when compiling
>> vgabios-ati.bin (which did not help the firmwares I've tried).
>
> Hi,
>
> Thinks for your reminder!
>
> To be more specified, our x86emu in PMON can handle i386 real mode,
> however vgabios-ati uses INT15h when INT10h ax=0x4f01 (Get VESA Mode)
> is called. And x86emu won't process INT15h properly.
>
> My workround[1] is to allow 0x4f01 to be failed in PMON, as ax=0x4f02
> (Set VESA Mode) do work, it won't be a actual problem.

Adding Gerd who is the vgabios maintainer and added the VESA mode support 
so he knows about this even if no fix is needed but maybe he knows a 
simple way to work around it anyway. Maybe this could be related to my 
problems too but with the sam460ex firmware I did not get any output, it 
just stops (did not check u-boot-sam460ex source yet), but with the 
pegasos2 firmware I got this diagnostics:

INTERNAL ERROR: 0000000E=UNIMPLEMENTED EXTENDED OPCODE

EAX=0000 EBX=0000 ECX=2222 EDX=3333 ESP=0000 EBP=0000 ESI=6666 EDI=0000
  AX=0055  BX=FFDA  CX=2222  DX=3333  SP=FF86  BP=FF9A  SI=6666  DI=FFA6
  DS=1000  ES=BAD0  SS=1000  CS=C000  IP=2E05   NV UP -- PL NZ NA PE NC
CS:IP = 0F
STACK: 0000 0000 0000 0000 FFDA 0000 6666 6666
   00: FE00 F000 FE01 F000 FE02 F000 FE03 F000
   10: FE04 F000 FE05 F000 FE06 F000 FE07 F000
   20: FE08 F000 FE09 F000 FE0A F000 FE0B F000
   30: FE0C F000 FE0D F000 FE0E F000 FE0F F000
   40: FE10 F000 FE11 F000 FE12 F000 FE13 F000
   50: FE14 F000 FE15 F000 FE16 F000 FE17 F000
   60: FE18 F000 FE19 F000 FE1A F000 FE1B F000
   70: FE1C F000 FE1D F000 FE1E F000 FE1F F000
   80: FE20 F000 FE21 F000 FE22 F000 FE23 F000
   90: FE24 F000 FE25 F000 FE26 F000 FE27 F000
   A0: FE28 F000 FE29 F000 FE2A F000 FE2B F000
   B0: FE2C F000 FE2D F000 FE2E F000 FE2F F000
   C0: FE30 F000 FE31 F000 FE32 F000 FE33 F000
   D0: FE34 F000 FE35 F000 FE36 F000 FE37 F000
   E0: FE38 F000 FE39 F000 FE3A F000 FE3B F000
   F0: FE3C F000 FE3D F000 FE3E F000 FE3F F000
   00: FE40 F000 FE41 F000 FE42 F000 FE43 F000
   10: FE44 F000 FE45 F000 FE46 F000 FE47 F000
   20: FE48 F000 FE49 F000 FE4A F000 FE4B F000
   30: FE4C F000 FE4D F000 FE4E F000 FE4F F000
MISC: UNHANDLED 32 BIT DATA PREFIX AT CS:IP = 0000C000:00002E04 0F
INTERNAL ERROR: 0000000A=UNHANDLED 32BIT PREFIX

EAX=0000 EBX=0000 ECX=2222 EDX=3333 ESP=0000 EBP=0000 ESI=6666 EDI=0000
  AX=0055  BX=FFDA  CX=2222  DX=3333  SP=FF86  BP=FF9A  SI=6666  DI=FFA6
  DS=1000  ES=BAD0  SS=1000  CS=C000  IP=2E05   NV UP -- PL NZ NA PE NC
CS:IP = 0F
STACK: 0000 0000 0000 0000 FFDA 0000 6666 6666
   00: FE00 F000 FE01 F000 FE02 F000 FE03 F000
   10: FE04 F000 FE05 F000 FE06 F000 FE07 F000
   20: FE08 F000 FE09 F000 FE0A F000 FE0B F000
   30: FE0C F000 FE0D F000 FE0E F000 FE0F F000
   40: FE10 F000 FE11 F000 FE12 F000 FE13 F000
   50: FE14 F000 FE15 F000 FE16 F000 FE17 F000
   60: FE18 F000 FE19 F000 FE1A F000 FE1B F000
   70: FE1C F000 FE1D F000 FE1E F000 FE1F F000
   80: FE20 F000 FE21 F000 FE22 F000 FE23 F000
   90: FE24 F000 FE25 F000 FE26 F000 FE27 F000
   A0: FE28 F000 FE29 F000 FE2A F000 FE2B F000
   B0: FE2C F000 FE2D F000 FE2E F000 FE2F F000
   C0: FE30 F000 FE31 F000 FE32 F000 FE33 F000
   D0: FE34 F000 FE35 F000 FE36 F000 FE37 F000
   E0: FE38 F000 FE39 F000 FE3A F000 FE3B F000
   F0: FE3C F000 FE3D F000 FE3E F000 FE3F F000
   00: FE40 F000 FE41 F000 FE42 F000 FE43 F000
   10: FE44 F000 FE45 F000 FE46 F000 FE47 F000
   20: FE48 F000 FE49 F000 FE4A F000 FE4B F000
   30: FE4C F000 FE4D F000 FE4E F000 FE4F F000
Failed to emulate CS:IP [C000:2E04]=66,0F,BE,C0,E9,FB
UNHANDLED INT 10 FUNCTION 0100 WITHIN EMULATION
EA: BYTE READ FROM UNINITIALIZED LOW MEM 0040:0085
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION

which I assumed could be the same problem with sam460ex too but maybe it's 
different then.

Regards,
BALATON Zoltan

>
> - Jiaxun
>
>
Re: [PATCH v2 0/8] hm/mips/fuloong2e fixes
Posted by Gerd Hoffmann 4 years, 11 months ago
> > To be more specified, our x86emu in PMON can handle i386 real mode,
> > however vgabios-ati uses INT15h when INT10h ax=0x4f01 (Get VESA Mode)
> > is called. And x86emu won't process INT15h properly.
> > 
> > My workround[1] is to allow 0x4f01 to be failed in PMON, as ax=0x4f02
> > (Set VESA Mode) do work, it won't be a actual problem.
> 
> Adding Gerd who is the vgabios maintainer and added the VESA mode support so
> he knows about this even if no fix is needed but maybe he knows a simple way
> to work around it anyway.

Hmm, memcpy_high() uses int15.  memcpy_high() is used to access the
framebuffer, and there isn't a way around it.  From a quick scan of the
source code I can't see why "get mode" uses that though.  "set mode" will
call it to clear the screen (unless the noclearmem flag is set).

take care,
  Gerd