Unable to pass-through PCIe devices from a ppc64le host to an x86_64 guest
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Attempting to pass through a PCIe device from a ppc64le host to an x86_64 guest with QEMU v5.2.0-
include/
To reproduce this issue, simply run the following command on a POWER9 system:
qemu-
Where $DBSF is a domain:
This also fails with QEMU 3.1.0 (from Debian Buster), so I assume this has never worked. Helpfully, the error message it prints seems to indicate where the problem is:
hw/
My kernel (Linux v5.8.0 plus some small unrelated patches) is built with the page size set to 4k, so this issue shouldn't be due to a page size mismatch. And as I stated earlier, my host arch is ppc64le, so it shouldn't be an endianness issue, either.
I assume this should be possible (in theory) since I've seen reports of others getting PCIe passthrough working with aarch64 guests on x86_64 hosts, but of course that (passthrough to weird guest arch on x86) is somewhat the opposite of what I'm trying to do (passthrough to x86 on weird host arch) so I don't know for sure. If it is possible, I'm willing to develop a fix myself, but I'm almost completely unfamiliar with QEMU's internals so if anyone has any advice on where to start I'd greatly appreciate it.
I've done some more investigating, and have produced a backtrace of the error:
#0 0x00003ffff6b63228 in __libc_ signal_ restore_ set (set=0x3fffffff cec8) at ../sysdeps/ unix/sysv/ linux/internal- signals. h:84 unix/sysv/ linux/raise. c:48 dynamic_ cast_assert
(obj=0x1016db8 60, typename= 0x100bf9980 "qemu:iommu- memory- region" , file=0x100bf9940 "/usr/src/ qemu/include/ exec/memory. h", line=<optimized out>, func=0x100c08a70 <__func__.21845> "IOMMU_ MEMORY_ REGION" ) at ../qom/object.c:883 qemu/include/ exec/memory. h:42 create_ window (container= 0x102357380, section= 0x3fffffffd410, pgsize= 0x3fffffffd368) spapr.c: 149 region_ add (listener= 0x102357390, section= 0x3fffffffd410) at ../hw/vfio/ common. c:709 add_address_ space (as=<optimized out>, listener= 0x102357390) at ../softmmu/ memory. c:2729 listener_ register (listener= 0x102357390, as=<optimized out>) at ../softmmu/ memory. c:2796 container (errp=0x3ffffff fe818, as=<optimized out>, group=0x102357300) common. c:1886 e818) common. c:2003 e818) at ../hw/vfio/ pci.c:2834 e940) at ../hw/pci/ pci.c:2113 ea50) at ../hw/core/ qdev.c: 761
(obj=0x102350f 80, v=<optimized out>, name=<optimized out>, opaque=0x1014f1930, errp=0x3fffffff ea50) at ../qom/ object. c:2257
0x102351d30, errp=0x101450b30 <error_fatal>) at ../qom/ object. c:1402 property_ set_qobject
(obj=0x102350f 80, name=0x100c023a0 "realized", value=<optimized out>, errp=0x101450b30 <error_fatal>) at ../qom/ qom-qobject. c:28 property_ set_bool
(obj=0x102350f 80, name=0x100c023a0 "realized", value=<optimized out>, errp=0x101450b30 <error_fatal>) at ../qom/ object. c:1472 qdev.c: 389 qemu/include/ hw/qdev- core.h: 17 vl.c:1202
#1 0x00003ffff6b63228 in __GI_raise (sig=<optimized out>) at ../sysdeps/
#2 0x00003ffff6b4358c in __GI_abort () at abort.c:79
#3 0x000000010080d524 in object_
#4 0x00000001006b6f84 in IOMMU_MEMORY_REGION (obj=<optimized out>) at /usr/src/
#5 0x00000001006b6f84 in vfio_spapr_
at ../hw/vfio/
#6 0x00000001007a09a0 in vfio_listener_
#7 0x00000001006ea6f4 in listener_
#8 0x00000001006ea6f4 in memory_
#9 0x00000001007a36f4 in vfio_connect_
at ../hw/vfio/
#10 0x00000001007a36f4 in vfio_get_group (groupid=<optimized out>, as=<optimized out>, errp=0x3fffffff
at ../hw/vfio/
#11 0x000000010071a2a8 in vfio_realize (pdev=0x102350f80, errp=0x3fffffff
#12 0x0000000100488e20 in pci_qdev_realize (qdev=0x102350f80, errp=0x3fffffff
#13 0x00000001008063e0 in device_set_realized (obj=0x102350f80, value=<optimized out>, errp=0x3fffffff
#14 0x000000010080afbc in property_set_bool
#15 0x000000010080ee2c in object_property_set (obj=0x102350f80, name=0x100c023a0 "realized", v=
#16 0x000000010080a55c in object_
#17 0x000000010080f1b0 in object_
#18 0x00000001008042bc in qdev_realize (dev=0x102350f80, bus=<optimized out>, errp=0x101450b30 <error_fatal>)
at ../hw/core/
#19 0x000000010036cfac in qdev_device_add (opts=0x1014e9960, errp=0x101450b30 <error_fatal>)
at /usr/src/
#20 0x00000001006d5e68 in device_init_func (opaque=<optimized out>, opts=<optimized out>, errp=<optimized out>)
at ../softmmu/
#21 0x0000000100abe070 in qemu_opts_fore...