Re: [PATCH v2 00/17] Add Nested Translation Support for SMMUv3

From: Nicolin Chen
Date: Mon May 15 2023 - 11:59:06 EST


Hi Zhangfei,

On Mon, May 15, 2023 at 06:00:26PM +0800, Zhangfei Gao wrote:

> I rebased on these two branches and did some basic tests.
>
> The basic functions work after backport
> iommufd: Add IOMMU_PAGE_RESPONSE
> iommufd: Add device fault handler support
>
> https://github.com/Linaro/linux-kernel-warpdrive/tree/uacce-devel-6.4
> https://github.com/Linaro/qemu/tree/iommufd-6.4-nesting-smmuv3-v2

Thanks for testing!

> However when debugging hotplug PCI device, it still does not work,
> Segmentation fault same as 6.2.
>
> guest kernel
> CONFIG_HOTPLUG_PCI_PCIE=y
>
> boot guest (this info does not appear in 6.2)
> qemu-system-aarch64: -device
> vfio-pci,host=0000:76:00.1,bus=pci.1,addr=0x0,id=acc1,iommufd=iommufd0:
> Failed to set data -1
> qemu-system-aarch64: -device
> vfio-pci,host=0000:76:00.1,bus=pci.1,addr=0x0,id=acc1,iommufd=iommufd0:
> failed to set device data

Hmm.. I wonder what fails the set_dev_data ioctl...

> $ sudo nc -U /tmp/qmpm_1.socket
> (qemu) info pci
> (qemu) device_del acc1
>
> guest:
> qemu-system-aarch64: IOMMU_IOAS_UNMAP failed: No such file or directory
> qemu-system-aarch64: vfio_container_dma_unmap(0xaaaae1fc0380,
> 0x8000000000, 0x10000) = -2 (No such file or directory)

This is resulted from the following commit that we should
drop later:

commit c4fd2efd7c02dd30491adf676c1b0aed67656f36
Author: Yi Liu <yi.l.liu@xxxxxxxxx>
Date: Thu Apr 27 05:47:03 2023 -0700

vfio/container: Skip readonly pages

This is a temparary solution for Intel platform due to an errata in
which readonly pages in second stage page table is exclusive with
nested support.

Signed-off-by: Yi Liu <yi.l.liu@xxxxxxxxx>


> qemu-system-aarch64: Failed to unset data -1
> Segmentation fault (core dumped). // also happened in 6.2

Hmm, would it be possible for you to run the test again by
adding the following tracers to your QEMU command?
--trace "iommufd*" \
--trace "smmu*" \
--trace "vfio_*" \
--trace "pci_*"

Thanks
Nic