1 | 1 | ||
---|---|---|---|
2 | > -----Original Message----- | 2 | > -----Original Message----- |
3 | > From: Nathan Chen <nathanc@nvidia.com> | 3 | > From: Jason Gunthorpe <jgg@nvidia.com> |
4 | > Sent: Friday, November 22, 2024 1:42 AM | 4 | > Sent: Thursday, February 6, 2025 6:13 PM |
5 | > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> | 5 | > To: Shameerali Kolothum Thodi <shameerali.kolothum.thodi@huawei.com> |
6 | > Cc: qemu-arm@nongnu.org; qemu-devel@nongnu.org; | 6 | > Cc: Daniel P. Berrangé <berrange@redhat.com>; qemu-arm@nongnu.org; |
7 | > eric.auger@redhat.com; peter.maydell@linaro.org; jgg@nvidia.com; | 7 | > qemu-devel@nongnu.org; eric.auger@redhat.com; |
8 | > ddutile@redhat.com; Linuxarm <linuxarm@huawei.com>; Wangzhou (B) | 8 | > peter.maydell@linaro.org; nicolinc@nvidia.com; ddutile@redhat.com; |
9 | > Linuxarm <linuxarm@huawei.com>; Wangzhou (B) | ||
9 | > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; | 10 | > <wangzhou1@hisilicon.com>; jiangkunkun <jiangkunkun@huawei.com>; |
10 | > Jonathan Cameron <jonathan.cameron@huawei.com>; | 11 | > Jonathan Cameron <jonathan.cameron@huawei.com>; |
11 | > zhangfei.gao@linaro.org; Nicolin Chen <nicolinc@nvidia.com> | 12 | > zhangfei.gao@linaro.org; nathanc@nvidia.com |
12 | > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable | 13 | > Subject: Re: [RFC PATCH 0/5] hw/arm/virt: Add support for user-creatable |
13 | > nested SMMUv3 | 14 | > nested SMMUv3 |
14 | > | 15 | > |
15 | > >> Also as a heads up, I've added support for auto-inserting PCIe switch | 16 | > On Thu, Feb 06, 2025 at 06:04:57PM +0000, Shameerali Kolothum Thodi |
16 | > >> between the PXB and GPUs in libvirt to attach multiple devices to a | 17 | > wrote: |
17 | > SMMU | 18 | > > > Some kind of hot plug smmu would have to create a vSMMU without |
18 | > >> node per libvirt's documentation - "If you intend to plug multiple | 19 | > any |
19 | > >> devices into a pcie-expander-bus, you must connect a | 20 | > > > kernel backing and then later bind it to a kernel implementation. |
20 | > >> pcie-switch-upstream-port to the pcie-root-port that is plugged into the | 21 | > > |
21 | > >> pcie-expander-bus, and multiple pcie-switch-downstream-ports to the | 22 | > > Not sure I get the problem with associating vSMMU with a pSMMU. |
22 | > >> pcie-switch-upstream-port". Future unit-tests should follow this | 23 | > Something |
23 | > >> topology configuration. | 24 | > > like an iommu instance id mentioned before, |
24 | > > | 25 | > > |
25 | > > Ok. Could you please give me an example Qemu equivalent command | 26 | > > -device arm-smmuv3-accel,id=smmuv2,bus=pcie.2,host-smmu=iommu.1 |
26 | > option, | 27 | > > |
27 | > > if possible, for the above case. I am not that familiar with libvirt | 28 | > > This can realize the vSMMU without actually creating a vIOMMU in kernel. |
28 | > and I would | 29 | > > And when the dev gets attached/realized, check (GET_HW_INFO)the |
29 | > > also like to test the above scenario. | 30 | > specified |
31 | > > iommu instance id matches or not. | ||
32 | > > | ||
33 | > > Or the concern here is exporting an iommu instance id to user space? | ||
30 | > | 34 | > |
31 | > You can use "-device x3130-upstream" for the upstream switch port, and | 35 | > Philisophically we do not permit any HW access through iommufd without |
32 | > "-device xio3130-downstream" for the downstream port: | 36 | > a VFIO fd to "prove" the process has rights to touch hardware. |
33 | > | 37 | > |
34 | > -device pxb-pcie,bus_nr=250,id=pci.1,bus=pcie.0,addr=0x1 \ | 38 | > We don't have any way to prove the process has rights to touch the |
35 | > -device pcie-root-port,id=pci.2,bus=pci.1,addr=0x0 \ | 39 | > iommu hardware seperately from VFIO. |
36 | > -device x3130-upstream,id=pci.3,bus=pci.2,addr=0x0 \ | ||
37 | > -device xio3130- | ||
38 | > downstream,id=pci.4,bus=pci.3,addr=0x0,chassis=17,port=1 \ | ||
39 | > -device vfio-pci,host=0009:01:00.0,id=hostdev0,bus=pci.4,addr=0x0 \ | ||
40 | > -device arm-smmuv3-nested,pci-bus=pci.1 | ||
41 | 40 | ||
42 | Thanks. Just wondering why libvirt mandates usage of pcie-switch for multiple | 41 | It is not. Qemu just instantiates a vSMMU and assigns the IOMMU |
43 | device plugging rather than just using pcie-root-ports? | 42 | instance id to it. |
44 | 43 | ||
45 | Please let me if there is any advantage in doing so that you are aware of. | 44 | > |
45 | > So even if you invent an iommu ID we cannot accept it as a handle to | ||
46 | > create viommu in iommufd. | ||
47 | |||
48 | Creating the vIOMMU only happens when the user does a cold/hot plug of | ||
49 | a VFIO device. At that time Qemu checks whether the assigned id matches | ||
50 | with whatever the kernel tell it. | ||
46 | 51 | ||
47 | Thanks, | 52 | Thanks, |
48 | Shameer | 53 | Shameer | diff view generated by jsdifflib |