First run and this is the output - qemu didnt run and it went back to the menu.
$ ./run_qemu.sh
Creating log and config files...
Log file created: pci_passthrough.log
Not running as root. Elevating the script...
Creating log and config files...
Current working directory: /home/derfs/QEMU
config.txt
Main Menu:
1. Configuration Menu
2. Run QEMU
3. Exit
Select an option (default: 2): 2
./run_qemu.sh: line 582: unbind_pci_device: command not found
Kernel/Driver Responses for Unbinding:
cat: '/sys/bus/pci/devices/0000:0b:00.0/driver/Unbinding': No such file or directory
PCI Device: 0000:0b:00.0
Driver: driver
Response:
Starting QEMU with the following command:
./run_qemu.sh: line 112: echo: write error: Invalid argument
cat: /sys/bus/pci/drivers/vfio-pci/new_id: Permission denied
Kernel/Driver Responses for Binding:
cat: '/sys/bus/pci/devices/0000:0b:00.0/driver/Binding': No such file or directory
PCI Device: 0000:0b:00.0
Driver: driver
Response:
Main Menu:
1. Configuration Menu
2. Run QEMU
3. Exit
Select an option (default: 2): 3
Exiting...
As you can see, the GFX card and it's audio are attached to VFIO-PCI
02:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] RV770 [Radeon HD 4850] [1002:9442]
Subsystem: Micro-Star International Co., Ltd. [MSI] RV770 [Radeon HD 4850] [1462:1510]
Kernel driver in use: vfio-pci
Kernel modules: radeon, amdgpu
02:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] RV770 HDMI Audio [Radeon HD 4850/4870] [1002:aa30]
Subsystem: Micro-Star International Co., Ltd. [MSI] RV770 HDMI Audio [Radeon HD 4850/4870] [1462:aa30]
Kernel driver in use: vfio-pci
Kernel modules: snd_hda_intel
When you passthrough a GFX for windows in QEMU, you must also pass the gfx card bios rom for initialisation. Not sure if this is also necesary for OS4 emulation.
Unfortunately I do not know who throws this error and what it means.
CS:IP = 0000C000:00000F5A means code_section:instruction_pointer
Googling for "READ ACCESS FROM UNEMULATED IOPORT" doesn't result in any hits. But I can think of different meanings: - QEMU-system-ppc is not VFIO aware? - Pegasos target missing VFIO functionality? - QEMU tries to connect VFIO device to a non-existant/emulated PCI root complex inside the emulated pegasos target? - Pegasos target can only handle VFIO passthrough from PCI ports?
Maybe we can cross-check the issue with the QEMU SAM460 target? This system is PCI-e aware. Unfortunately I do not own OS4 for a SAM460.
Tried the HD4850 again with passing through both devices in the IOMMU group and now the error is similar to the RX560.
No unimplemented extended opcode this time but only the interrupt issue.
PegasosII Boot Strap (c) 2002-2003 bplan GmbH
Running on CPU PVR:80020102
Enable L1 ICache... Done.
Clean/Flush Block enabled
Reading W83194 : FAILED.
Setting Front Side Bus to 133MHz... FAILED.
Configuring DDR... Done.
Configuring PCI0... Done.
Configuring PCI1... Done.
Configuring ETH... Done.
Releasing IDE reset ... Done.
Configuring Legacy Devices
Initializing KBD... Done.
Testing 10000000 Bytes, Pass: 00000000 Failed: 00000000
RAM TEST (fill linear)... Done.
FFFFFFFF
SmartFirmware:
cpu0: PowerPC,74x7 CPUClock 1533 Mhz BUSClock 133 Mhz (Version 0x8002,0x0102)
no/bad nvramrc - performing default startup script
channel 0 unit 0 : ata | QEMU HARDDISK | 2.5+
ATA device not present or not responding
channel 1 unit 0 : atapi | QEMU DVD-ROM | 2.5+
ATA device not present or not responding
Failed to emulate CS:IP [C000:0C36]=F5,72,F0,03,F6,4D
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
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
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
entering main read/eval loop...
UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION
UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
Tried the HD4850 again with passing through both devices in the IOMMU group and now the error is similar to the RX560.
In both cases there is an error in the x86 emulator while executing the gfx card ROM.
Quote:
When you passthrough a GFX for windows in QEMU, you must also pass the gfx card bios rom for initialisation. Not sure if this is also necesary for OS4 emulation.
AFAIK the OS4 gfx card drivers themselves don't need nor use the gfx card BIOS, but they can only work after the x86 emulator in the firmware (U-Boot, CFE or SmartFirmware) has executed the gfx card BIOS initialising the card.
In both cases there is an error in the x86 emulator while executing the gfx card ROM.
Ah, forgot about that one. So the missing extended opcode is probably an issue with the x86 emulator in the pegasos2.of. The interrupt issue can also be related to the pegasos machine emulation. Either way, this looks like a dead end for now.
Those old Radeon 9250 should be supported by both the pegasos2 and Amigaos4. I'll have to get me a PCIe to pci adapter first before I can test this. But I'll probably run into the issue that the pci bridge will be in the same iommu group.
Quote:
AFAIK the OS4 gfx card drivers themselves don't need nor use the gfx card BIOS, but they can only work after the x86 emulator in the firmware (U-Boot, CFE or SmartFirmware) has executed the gfx card BIOS initialising the card.
Turns out that this vbios is necessary for nVidia cards who will only present their bios once. Without the vbios, a reset within the emulator will not work properly.
I have written to BALATON Zoltan if he can give any tips. Apparently the cards that are tested with Qemu Peg2 are a bit too new, the firmware has problems with it as well as a real Peg2. Tested should be with an ATI Radeon 9250 or 9800pro these work also on real hardware.
Quote:
I've been following that thread but I don't know much about this topic. The user terminills said it worked but did not give enough details on what actually was tested: which graphics card and which guest OS so I'd ask for more info from there.
As for the errors in the last posts these come from the pegasos2 firmware BIOS emulator trying to ran the card ROM. This BIOS support of the pegasos2 firmware also crashes on the QEMU vgabios so it seems to be picky about what it can run and probably only supports older cards from the era this firmware and pegasos2 is from. It might also be a problem with using PCIe cards on pegasos2 which only had PCI and AGP so I don't know if passing through a PCIe card would work. The best chance would be trying a PCI ATI card but maybe those are rare. The sam460ex should have PCIe but I'm not sure it's emulated enough to get a card working with it so this would need to be tried by somebody who can debug it more.
I don't know if the AmigaOS driver need the BIOS to init the card but if not it might work with just disabling the BIOS so the board firmware is not crashing on it. Not sure how to do that but maybe adding rombar=0 to the -device vfio part might help.
Or maybe just ignoring the errors and trying to boot anyway might work. When you use -device ati-vga without romfile="" then it will print similar errors and the window stays black but it actually works, e.g.:
$ qemu-system-ppc -M pegasos2 -bios pegasos2.rom -device ati-vga -cdrom morphos-3.18.iso -serial stdio [...] channel 1 unit 0 : atapi | QEMU DVD-ROM | 2.5+ ATA device not present or not responding INTERNAL ERROR: 0000000E=UNIMPLEMENTED EXTENDED OPCODE
EAX=0000 EBX=0000 ECX=2222 EDX=3333 ESP=0000 EBP=0000 ESI=6666 EDI=0000 AX=FF55 BX=FFAA CX=2222 DX=3333 SP=FF82 BP=FF9E SI=6666 DI=0000 DS=1000 ES=BAD0 SS=1000 CS=C000 IP=2E23 NV UP -- PL NZ NA PE NC CS:IP = 0F STACK: 0000 0000 0000 0000 0000 0000 0000 0000 [..] Failed to emulate CS:IP [C000:2E22]=66,0F,BE,C0,E9,AD 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 entering main read/eval loop... UNHANDLED INT 10 FUNCTION 0300 WITHIN EMULATION UNHANDLED INT 10 FUNCTION 1301 WITHIN EMULATION
When you type "boot cd boot.img" in the QEMU window or the terminal window (which will not display it just some more errors will be shown) then it boots and the MorophOS driver eventually detects and inits the card. What happens is that the firmware detects there is a graphics card so it redirects output to screen and input to keyboard instead of using serial like when no graphics card is detected but then it fails to run the card ROM so you can't see the output. But if the OS driver can init the card itself then this may not be a problem.
Maybe it's helpful, but I don't think so.
MacStudio ARM M1 Max Qemu//Pegasos2 AmigaOs4.1 FE / AmigaOne x5000/40 AmigaOs4.1 FE
If it's indeed all related to smartfirmware then we are out of luck. The OS4 drivers rely on the firmware to init the card.
I've just read on an old amigans thread that a PCI Radeon HD card will also not work on a real pegasos2. Because it's behind a PCI to pcie bridge. But now we know that it wouldn't have worked if this problem was solved.
The RadeonHD & RadeonRX drivers do need a copy of the graphics card's ROM. It won't touch the VGABIOS x86 code (or UEFI equivalent), but will use the ATOMBIOS. This includes both data tables and code in a virtual machine language that ATI/AMD created for the purpose.
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.
There's a good chance that the older atiradeon.chip driver also needs to read from the ROM. Obtaining a copy of the ROM after the firmware has read it can be tricky. Radeon cards tend to need a bunch of registers to be set to a particular state for it to be readable.
Hans wrote:@all There's a good chance that the older atiradeon.chip driver also needs to read from the ROM. Obtaining a copy of the ROM after the firmware has read it can be tricky. Radeon cards tend to need a bunch of registers to be set to a particular state for it to be readable.
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?
MacStudio ARM M1 Max Qemu//Pegasos2 AmigaOs4.1 FE / AmigaOne x5000/40 AmigaOs4.1 FE
As for the rtl8139 cards it would appear that you are not actually getting an external IP with:
correct so it is easier to understand for those who want to help me:
sudo ip tuntap add mode tap dev tap0 sudo ip addr add 172.18.1.1/24 dev tap0 sudo ip link set dev tap0 up sudo iptables -t nat -A POSTROUTING -s 172.18.0.1/24 -d 172.18.1.1 -j MASQUERADE
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?
QEmu doesn't seem to include any Radeon emulation. The only gfx card supported by both QEmu and AmigaOS 4.x seems to be the Cirrus Logic GD5446 (Picasso IV), but I don't know if the AmigaOS 4.x Picasso IV gfx driver supports PCI as well, or if it's limited to Zorro III. But even if it works it's way slower and especially supports much less RAM than than SM501/2, the only advantage would be the 24/32 bit support. AmigaOS 4.x software which doesn't support 15/16 bit modes any more and therefore can't work with SM501/2 emulation would work with it.
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?
QEmu doesn't seem to include any Radeon emulation. The only gfx card supported by both QEmu and AmigaOS 4.x seems to be the Cirrus Logic GD5446 (Picasso IV), but I don't know if the AmigaOS 4.x Picasso IV gfx driver supports PCI as well, or if it's limited to Zorro III.
This was already tested by Zoltan BALATON and unfortunately failed. For this he used the Classic version.
Since his system is not up to date with update 2, something might have been missing in his test. Maybe tomorrow I will find some time to test it on my current system with update 2.
Otherwise there is only the hope that someday someone will write a simple frame buffer driver for AmigaOs4.1 Qemu Peg 2 which can be extended piece by piece up to 3d acceleration.
MacStudio ARM M1 Max Qemu//Pegasos2 AmigaOs4.1 FE / AmigaOne x5000/40 AmigaOs4.1 FE
OK, we known that a real Sam460 u-boot can handle the Radeon HD. The fact that you made it to loading kernel modules is promising for sam460 emulation as well. The DMA errors are a result of OS4 driver doing something with DMA that isn't emulated properly.