VM with ivshmem and host pci device does not boot Description of problem: The boot aborts early if ivshmem and host-pci devices are used at the same time. Steps to reproduce: 1. use a recent host kernel => 6.1.8 2. use qemu from bullseye-backports (7.2) 3. use a recent edk2 bios with 4M secure boot + SMM 4. add ivshmem with e.g.: -chardev socket,path=/tmp/shared_mem,id=shared_mem -device ivshmem-doorbell,chardev=shared_mem,vectors=1 5. add a host-pci device to the VM 6. try to boot he VM Additional information: Observations: always add ivshmem with: -chardev socket,path=/tmp/shared_mem,id=shared_mem -device ivshmem-doorbell,chardev=shared_mem,vectors=1 - a) no host-pci device + edk2 with secure boot => works - b) with host-pci device + non edk2 => works - c) with host-pci device + edk2 with secure boot => does not work - d) with host-pci device + edk2 with secure boot + but without ivshmem => works I have compiled a debug version of qemu und added some prints to the linux kernel. Qemu log shows: ``` 2023-01-25T23:30:47.128716Z qemu-system-x86_64: VFIO_MAP_DMA failed: Invalid argument 2023-01-25T23:30:47.128741Z qemu-system-x86_64: vfio_dma_map(0x55cee4bf7b20, 0x385000000000, 0x2000000, 0x7fd7253ff000) = -2 (No such file or directory) qemu: hardware error: vfio: DMA mapping failed, unable to continue ``` Kernel log prints in vfio_iommu_iova_dma_valid@drivers/vfio/vfio_iommu_type1.c - if (start >= node->start && end <= node->end): ``` [ 1156.241294] DEBUG valid 1048576 >= 0 && 2147483647 <= 4276092927 [ 1156.269472] DEBUG valid 1048576 >= 0 && 2130706431 <= 4276092927 [ 1156.477577] DEBUG valid 3221225472 >= 0 && 3229614079 <= 4276092927 [ 1156.478889] DEBUG valid 3254779904 >= 0 && 3254845439 <= 4276092927 [ 1156.481226] DEBUG valid 3254779904 >= 0 && 3255042047 <= 4276092927 [ 1156.482864] DEBUG valid 3221225472 >= 0 && 3229614079 <= 4276092927 [ 1156.502867] DEBUG valid 61916248539136 >= 0 && 61916282093567 <= 4276092927 [ 1156.502870] DEBUG valid 61916248539136 >= 4277141504 && 61916282093567 <= 549755813887 ``` The vfio_dma_map ioctl request from qemu to the kernel seems to fail because 0x385000000000 from qemu is not in any iova range known by the kernel.