I turned on serial output and looks like its starting when hitting the VGA code in the bios. Its throwing an error at that point, but gets past it until the freeze happens at the end of loading kickstart modules.
You can see that the GFX card has been added to the PCI bus, and not PCIE which may have an impact.
U-Boot 2010.06.05 (Jul 08 2018 - 22:45:33)
CPU: AMCC PowerPC 460EX Rev. B at 1150 MHz (PLB=230 OPB=115 EBC=115)
No Security/Kasumi support
Bootstrap Option A - Boot ROM Location EBC (8 bits)
Internal PCI arbiter disabled
32 kB I-Cache 32 kB D-Cache
Board: Sam460ex, PCIe 4x + SATA-2
I2C: ready
DRAM: 2 GiB (ECC not enabled, 460 MHz, CL0)
*** Warning - bad CRC, using default environment
PCI: Bus Dev VenId DevId Class Int
00 01 1095 3112 0104 00
00 02 1002 6811 0300 05
00 06 126f 0501 0380 00
PCIE1: successfully set as root-complex
Net: ppc_4xx_eth0
FPGA: Revision 00 (20 0-00-00)
SM502: found
VGA: qemu: VFIO_MAP_DMA failed: Invalid argument
qemu: vfio_dma_map(0x56161a2cf550, 0xf0000000, 0x10000000, 0x7f91cfe00000) = -22 (Invalid argument)
1
VESA: OK
qemu: VFIO_MAP_DMA failed: Invalid argument
qemu: vfio_dma_map(0x56161a2cf550, 0xf0000000, 0x10000000, 0x7f91cfe00000) = -22 (Invalid argument)
@joerg >QEmu does not appear to include any Radeon emulation.
In QEMU it does and is in the official repository. A simple 2D emulation of an ATI card. Morphos and Linux work fine under Qemu/Pegasos2. AOS does not. It's all explained there.
I'm not sure if I understood correctly, but if we had a radeon rom that would initialize the atiradeon.chip could you use it with Qemu as an emulated graphics card?
No. I'm responding to the attempts to use the PCI pass-through with actual graphics cards. Basically, the driver needs access to the graphics card's actual ROM.
The sentence you quoted is me guessing that the same is true with the atiradeon.chip driver. I don't know that for sure, though.
As for using the emulated Radeon. My understanding is that qemu has an emulated Rage 128 Pro, and partial Mobility Radeon 7000 (a.k.a., M6). We don't have an ATI Rage driver, so that one is out.** The atiradeon.chip driver can handle the Radeon 7000 (IIRC, the Micro-A1 had it on-board), but I don't know if the mobility version needs any special handling. No guarantees that having an actual ROM would get it working.
Hans
** AFAIK, MorphOS has an ATI Rage driver, so they may be using the emulated Rage 128 Pro.
From the list of gfx cards mentioned there IMHO the Voodoo3/5 would be the only usable option. Not because it's a good gfx card, but because the Voodoo3/5 gfx driver is AFAIK the only AmigaOS PCI gfx card driver which works without an x86 emulator executing the gfx card BIOS ROM first. Several other AmigaOS gfx drivers do work that way as well, but only the ones for Zorro II/III bus gfx cards and the CSPPC local bus Permedia2 one (CyberVisionPPC), not any other PCI gfx card driver. IIRC the classic Amiga kernel includes an x86 emulator as well, required for example for using ATI PCI gfx cards with a Mediator or Prometheus ZorroIII<->PCI bridge, but the other kernels don't because executing the x86 gfx card BIOS is done by the machine firmware instead already before AmigaOS is started.
I don't think using pass-through instead of gfx card emulation is an option, at least not for the Pegasos2 emulation: The Pegasos2 only supported PCI and AGP, but not PCIe, i.e. you'd have to use a very old PC with PCI or AGP slots for it, and such old PCs have a way too slow CPU for usable speed in the QEmu PPC CPU emulation.
The atiradeon.chip driver can handle the Radeon 7000 (IIRC, the Micro-A1 had it on-board),
Yes, but the µA1 onboard gfx is using AGP. Even if there is a PCIe version of a Radeon 7000/M6, or using a PCIe<->PCI adaptor, it very likely can't work with the atiradeon.chip driver only supporting PCI/AGP.
Quote:
No guarantees that having an actual ROM would get it working.
But it's guaranteed that it wont work without the ROM: The µA1 U-Boot includes the Radeon 7000 BIOS ROM.
While the ATOMBIOS ASICInit function should theoretically initialize the card from zero, we found that cards typically wouldn't work properly unless the motherboard's firmware did the lowlevel initialization first
I've ported ATOMBIOS into Sam460 U-boot version, and ASICInit indeed seems to initialize correctly the card but ATM I cannot get any videomode working. Do I need to call the classic x86 BIOS emulation before calling ASICInit, or something else need to be done to have a basic 640x480 screen mode ?
Hello, Finally registered here but I don't have time now so will reply to the topics in detail later. (You can omit the welcome replies just to keep this already long thread a bit shorter.)
Has anyone managed to get AmiCygnix working with qemu with export DISPLAY ?
I've already sent you this via email before but I think you don't need tap for X you can just use the hostfwd option to forward right port and set DISPLAY accordingly. Port forwarding with user netdev is mentioned on the first page of the QEMU docs at https://www.qemu.org/docs/master/system/introduction.html where it uses -netdev user,id=unet,hostfwd=tcp::2222-:22 to let you connect to guest port 22 from host port 2222. You can do the same for X, assuming AmiCygnix listens on port 6000 for X then you can add e.g. -netdev user,id=unet,hostfwd=tcp::6010-:6000 then set DISPLAY to :10 on the host to display the X app on the guest.
This seems amazingly complex for just creating a command line but maybe it's usefui for some. You seem to have log_kernel_responses() function defined twice and maybe missing some quotes here and there so it could have problems with paths and file names containing spaces.
You said GPU pass through worked for you but maybe it would be helpful if you could share what GPU whan host and what guest you've tried.
From the list of gfx cards mentioned there IMHO the Voodoo3/5 would be the only usable option. Not because it's a good gfx card, but because the Voodoo3/5 gfx driver is AFAIK the only AmigaOS PCI gfx card driver which works without an x86 emulator executing the gfx card BIOS ROM first. Several other AmigaOS gfx drivers do work that way as well, but only the ones for Zorro II/III bus gfx cards and the CSPPC local bus Permedia2 one (CyberVisionPPC), not any other PCI gfx card driver. IIRC the classic Amiga kernel includes an x86 emulator as well, required for example for using ATI PCI gfx cards with a Mediator or Prometheus ZorroIIIPCI bridge, but the other kernels don't because executing the x86 gfx card BIOS is done by the machine firmware instead already before AmigaOS is started.
I don't think using pass-through instead of gfx card emulation is an option, at least not for the Pegasos2 emulation: The Pegasos2 only supported PCI and AGP, but not PCIe, i.e. you'd have to use a very old PC with PCI or AGP slots for it, and such old PCs have a way too slow CPU for usable speed in the QEmu PPC CPU emulation.
There exist PCIe to PCI bridges to connect PCI cards to modern systems. I've heard fhat those using a Pericom chip might be the best but this is not confirmed, just rumors. Also I'm not sure if the guest really has to support PCIe to pass through a card but it seems likely that having a PCIe card appear as a PCI card in the guest might cause problems and the driver could get confused so that's less likely to work.
The issue with the BIOS might not be fatal though as long as it works enough for the driver to find and init the card so I would not give up on that yet.
As for using the emulated Radeon. My understanding is that qemu has an emulated Rage 128 Pro, and partial Mobility Radeon 7000 (a.k.a., M6). We don't have an ATI Rage driver, so that one is out.** The atiradeon.chip driver can handle the Radeon 7000 (IIRC, the Micro-A1 had it on-board), but I don't know if the mobility version needs any special handling. No guarantees that having an actual ROM would get it working.
As detailed on the qmiga development page on ati-vga the emulated Radeon 7000 is missing emulation of the micro-engine (aka CCE or PM4) so while the driver detects it and starts to talk to it it stops working when the driver enables the command processor. This could be emulated to make it work but somebody would need to port code for that from Xenia emulator as I haven't got to that yet because it's quire some work and so far I had enough to do on pegasos2 emulation and improving what's there. This is explained in https://osdn.net/projects/qmiga/ticket/40018
Emulating an ATI Radeon card would be good because it would work with all legacy systems that have a driver for it (almost all of them have) but these cards are quite complex so emulating them is not easy and due to emulating it the performance may be less than it could be (although likely still much faster than a real card).
If we are only concerned about one guest OS like AmigaOS then wrting a guest driver for QEMU's virtio devices may be easier and get better results.
Quote:
** AFAIK, MorphOS has an ATI Rage driver, so they may be using the emulated Rage 128 Pro.
Correct, the ati-vga by default emulates Rage 128 Pro which works with the simpler drivers that don't use CCE.
For pass-through let's discuss the pegasos2 and sam460ex cases separately. For the pegasos2 the bios emulator may crash on some ROMs but regardless of this the machine may be booted and if the guest OS driver can init the card itself then it may work. I haven't tried pass through as I don't have a suitable card but I can reproduce the issue with ati-vga. As I wrote in the email Maijestro forwarded:
will result in similar errors but the machine works just the display output is not visible as the card is not init'ed. But you can type in the QEMU window and see more errors but you can also boot MorphOS and then it inits the card and see picture. You can get back the firmware ok prompt on serial when this happens by blindly typing exactly the following (note there must be a space between the first quote and /failsafe, that's Forth not a typo):
" /failsafe" io
You have to type this in the QEMU window where the keyboard input would normally be and it won't be echoed but if successful then the ok prompt should appear where the errors are displayed and you can continue to type there to interact with the firmware. I'm not sure if you get a QEMU window with pass-thorugh but I think you should get some guest window, so type in that window not where the errors are. You only have one chance to type it without mistakes otherwise the io command breaks the input as well so if it did not work then restart the VM and try again.
You might also want to read https://osdn.net/projects/qmiga/wiki/DeveloperTips on the info qtree and info mtree QEMU monitor commands which may help debugging this and see where are the BARs of the card mapped.
Edited by balaton on 2023/6/24 13:23:29 Edited by balaton on 2023/6/24 13:24:02 Edited by balaton on 2023/6/24 21:14:42
I've ported ATOMBIOS into Sam460 U-boot version, and ASICInit indeed seems to initialize correctly the card but ATM I cannot get any videomode working. Do I need to call the classic x86 BIOS emulation before calling ASICInit, or something else need to be done to have a basic 640x480 screen mode ?
IIRC, you need to do the lowlevel initialization (POSTing) of the card for it to work. That should be part of the old x86 ROM code.
The errors you got with sam460ex are explained here: https://bugs.launchpad.net/qemu/+bug/1869006 from that it seems it tries to map something at guest address 0xf0000000 and it may be due to a problem in some Linux kernel versions if I gat that correctly but I'm not sure what is happening here and if that's not a side effect of a diiferent problem.
Looking at the code that runs in sam460ex U-Boot at https://gitlab.com/qemu-project/u-boot ... m460ex/init_radeon.c#L216 (that @m3x may know more about) it looks like it decides which BAR to map not based on card type but if it's a PCIe card. So maybe you should connect the card to a PCIe bus which may be possble by adding ,bus=pcie.1 to the -device vfio-pci options but since I had no docs on the PCIe on the 460EX this may not be correctly emulated but maybe worth a try. You can verify with info qtree in the QEMU monitor where the card is connected. Experimenting with ati-vga I've found only the PCI bus (pci.0) and pcie.1 are checked by the firmware).
Does anybody know if ATI X550 card is supported by AmigaOS? I may have a card around somewhere which I could test but I think it's not supported by either AmigaOS nor MorphOS although X300 and X1000 which is probably similar are supported.
There exist PCIe to PCI bridges to connect PCI cards to modern systems. I've heard fhat those using a Pericom chip might be the best but this is not confirmed, just rumors. Also I'm not sure if the guest really has to support PCIe to pass through a card but it seems likely that having a PCIe card appear as a PCI card in the guest might cause problems and the driver could get confused so that's less likely to work.
The issue with the BIOS might not be fatal though as long as it works enough for the driver to find and init the card so I would not give up on that yet.
The Pegasos II UBoot issue is a show-stopper. It won't look behind a PCI-to-PCI(e) bridge, which means it won't configure cards behind a bridge, and the card also doesn't appear in the hardware list passed to the OS. It's like the card isn't there.
Quote:
As detailed on the qmiga development page on ati-vga the emulated Radeon 7000 is missing emulation of the micro-engine (aka CCE or PM4) so while the driver detects it and starts to talk to it it stops working when the driver enables the command processor. This could be emulated to make it work but somebody would need to port code for that from Xenia emulator as I haven't got to that yet because it's quire some work and so far I had enough to do on pegasos2 emulation and improving what's there. This is explained in https://osdn.net/projects/qmiga/ticket/40018
That probably would be quite a bit of work.
Quote:
If we are only concerned about one guest OS like AmigaOS then wrting a guest driver for QEMU's virtio devices may be easier and get better results.
Virtio drivers would be the best way forward for AmigaOS.
The Pegasos II UBoot issue is a show-stopper. It won't look behind a PCI-to-PCI(e) bridge, which means it won't configure cards behind a bridge, and the card also doesn't appear in the hardware list passed to the OS. It's like the card isn't there.
I'm not sure the guest would see the bridge but I'm no expert on vfio. I think the bridge is handled by the host and it can pass the PCI card to the guest where it just appears as another PCI card so the guest does not need to know about the bridge but I haven't tried that. I've heard though that some people managed to do that and boot MacOS with a Rage 128 so I think it's possible.
Depends how much we want to emulate it. Emulating the micro engine is really hard because it's not documented so I don't know how to do that. Emulating what the microcode does and parsing the command packets is only boring but not difficult but it was already mostly done in Xenia emulator so maybe it could just be ported to QEMU. It's still a lot of work but not much experties is needed just somebody who wants to spend time with it.
Quote:
Quote:
If we are only concerned about one guest OS like AmigaOS then wrting a guest driver for QEMU's virtio devices may be easier and get better results.
Virtio drivers would be the best way forward for AmigaOS.
That's what I said. I could try that if there was some sample template driver available somewhere. The P96 page has a cirrus driver as a sample but that's quite complex and written in 68k assembly so may not be the best reference. Some FPGA projects have simpler uaegfx drivers that may be used as an example but if there's some better reference to get started it might help. Driving the QEMU card is really simple because no initialisation or any such things are needed so I think a simple frame buffer "driver" would be like 5 lines the rest only being boilerplate code for AmigaOS needs. This is where I would start before looking at virtio.
@joerg >QEmu does not appear to include any Radeon emulation.
In QEMU it does and is in the official repository. A simple 2D emulation of an ATI card. Morphos and Linux work fine under Qemu/Pegasos2. AOS does not.
Rage != Radeon QEmu only supports emulation of an old ATI Rage card, but not any ATI Radeon cards supported by AmigaOS. For MorphOS (and Linux) there is a driver for Rage cards, but there is none for AmigaOS.