From: Eric Auger <eric.auger@redhat.com>
To: Shameer Kolothum <skolothumtho@nvidia.com>,
"qemu-arm@nongnu.org" <qemu-arm@nongnu.org>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Nicolin Chen <nicolinc@nvidia.com>,
"ddutile@redhat.com" <ddutile@redhat.com>,
"berrange@redhat.com" <berrange@redhat.com>,
Nathan Chen <nathanc@nvidia.com>, Matt Ochs <mochs@nvidia.com>,
"smostafa@google.com" <smostafa@google.com>,
"wangzhou1@hisilicon.com" <wangzhou1@hisilicon.com>,
"jiangkunkun@huawei.com" <jiangkunkun@huawei.com>,
"jonathan.cameron@huawei.com" <jonathan.cameron@huawei.com>,
"zhangfei.gao@linaro.org" <zhangfei.gao@linaro.org>,
"zhenzhong.duan@intel.com" <zhenzhong.duan@intel.com>,
"yi.l.liu@intel.com" <yi.l.liu@intel.com>,
Krishnakant Jaju <kjaju@nvidia.com>
Subject: Re: [PATCH v5 31/32] vfio: Synthesize vPASID capability to VM
Date: Thu, 6 Nov 2025 16:44:24 +0100 [thread overview]
Message-ID: <b4ec85e7-2142-44b1-9cc1-315b75e6d2bb@redhat.com> (raw)
In-Reply-To: <CH3PR12MB7548610D1BE66DA63CFE788EABC2A@CH3PR12MB7548.namprd12.prod.outlook.com>
On 11/6/25 3:27 PM, Shameer Kolothum wrote:
>
>> -----Original Message-----
>> From: Eric Auger <eric.auger@redhat.com>
>> Sent: 06 November 2025 13:56
>> To: Shameer Kolothum <skolothumtho@nvidia.com>; qemu-
>> arm@nongnu.org; qemu-devel@nongnu.org
>> Cc: peter.maydell@linaro.org; Jason Gunthorpe <jgg@nvidia.com>; Nicolin
>> Chen <nicolinc@nvidia.com>; ddutile@redhat.com; berrange@redhat.com;
>> Nathan Chen <nathanc@nvidia.com>; Matt Ochs <mochs@nvidia.com>;
>> smostafa@google.com; wangzhou1@hisilicon.com;
>> jiangkunkun@huawei.com; jonathan.cameron@huawei.com;
>> zhangfei.gao@linaro.org; zhenzhong.duan@intel.com; yi.l.liu@intel.com;
>> Krishnakant Jaju <kjaju@nvidia.com>
>> Subject: Re: [PATCH v5 31/32] vfio: Synthesize vPASID capability to VM
>>
>> External email: Use caution opening links or attachments
>>
>>
>> Hi Shameer,
>> On 10/31/25 11:50 AM, Shameer Kolothum wrote:
>>> From: Yi Liu <yi.l.liu@intel.com>
>>>
>>> If user wants to expose PASID capability in vIOMMU, then VFIO would also
>> need to report?
>>> report the PASID cap for this device if the underlying hardware supports
>>> it as well.
>>>
>>> As a start, this chooses to put the vPASID cap in the last 8 bytes of the
>>> vconfig space. This is a choice in the good hope of no conflict with any
>>> existing cap or hidden registers. For the devices that has hidden registers,
>>> user should figure out a proper offset for the vPASID cap. This may require
>>> an option for user to config it. Here we leave it as a future extension.
>>> There are more discussions on the mechanism of finding the proper offset.
>>>
>>>
>> https://lore.kernel.org/kvm/BN9PR11MB5276318969A212AD0649C7BE8C
>> BE2@BN9PR11MB5276.namprd11.prod.outlook.com/
>>> Since we add a check to ensure the vIOMMU supports PASID, only devices
>>> under those vIOMMUs can synthesize the vPASID capability. This gives
>>> users control over which devices expose vPASID.
>>>
>>> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
>>> Tested-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>>> Signed-off-by: Shameer Kolothum <skolothumtho@nvidia.com>
>>> ---
>>> hw/vfio/pci.c | 37 +++++++++++++++++++++++++++++++++++++
>>> include/hw/iommu.h | 1 +
>>> 2 files changed, 38 insertions(+)
>>>
>>> diff --git a/hw/vfio/pci.c b/hw/vfio/pci.c
>>> index 06b06afc2b..2054eac897 100644
>>> --- a/hw/vfio/pci.c
>>> +++ b/hw/vfio/pci.c
>>> @@ -24,6 +24,7 @@
>>> #include <sys/ioctl.h>
>>>
>>> #include "hw/hw.h"
>>> +#include "hw/iommu.h"
>>> #include "hw/pci/msi.h"
>>> #include "hw/pci/msix.h"
>>> #include "hw/pci/pci_bridge.h"
>>> @@ -2500,7 +2501,12 @@ static int vfio_setup_rebar_ecap(VFIOPCIDevice
>> *vdev, uint16_t pos)
>>> static void vfio_add_ext_cap(VFIOPCIDevice *vdev)
>>> {
>>> + HostIOMMUDevice *hiod = vdev->vbasedev.hiod;
>>> + HostIOMMUDeviceClass *hiodc =
>> HOST_IOMMU_DEVICE_GET_CLASS(hiod);
>>> PCIDevice *pdev = PCI_DEVICE(vdev);
>>> + uint64_t max_pasid_log2 = 0;
>>> + bool pasid_cap_added = false;
>>> + uint64_t hw_caps;
>>> uint32_t header;
>>> uint16_t cap_id, next, size;
>>> uint8_t cap_ver;
>>> @@ -2578,12 +2584,43 @@ static void vfio_add_ext_cap(VFIOPCIDevice
>> *vdev)
>>> pcie_add_capability(pdev, cap_id, cap_ver, next, size);
>>> }
>>> break;
>>> + case PCI_EXT_CAP_ID_PASID:
>>> + pasid_cap_added = true;
>>> + /* fallthrough */
>>> default:
>>> pcie_add_capability(pdev, cap_id, cap_ver, next, size);
>>> }
>>>
>>> }
>>>
>>> +#ifdef CONFIG_IOMMUFD
>>> + /*
>>> + * Although we check for PCI_EXT_CAP_ID_PASID above, the Linux VFIO
>>> + * framework currently hides this capability. Try to retrieve it
>>> + * through alternative kernel interfaces (e.g. IOMMUFD APIs).
>> I don't catch this sentence . When are you supposed to read above
>> PCI_EXT_CAP_ID_PASID cap id then?
> That’s to make it future proof in case VFIO relaxes that. If that happens
> the code above by default, will add the CAP and we may end with a
> duplicate at below offset.
OK thanks for the clarification. Then I would move the comment about
VFIO kernel code currently hiding the extended cap along with
+ pasid_cap_added = true;
and explain it is added to make it future proof in case VFIO relaxes that
Eric
>
>>> + */
>>> + if (!pasid_cap_added && hiodc->get_cap) {
>>> + hiodc->get_cap(hiod, HOST_IOMMU_DEVICE_CAP_GENERIC_HW,
>> &hw_caps, NULL);
>>> + hiodc->get_cap(hiod, HOST_IOMMU_DEVICE_CAP_MAX_PASID_LOG2,
>>> + &max_pasid_log2, NULL);
>>> + }
>>> +
>>> + /*
>>> + * If supported, adds the PASID capability in the end of the PCIe config
>>> + * space. TODO: Add option for enabling pasid at a safe offset.
>>> + */
>>> + if (max_pasid_log2 && (pci_device_get_viommu_flags(pdev) &
>>> + VIOMMU_FLAG_PASID_SUPPORTED)) {
>>> + bool exec_perm = (hw_caps & IOMMU_HW_CAP_PCI_PASID_EXEC) ?
>> true : false;
>> can't you direct set exec_perm = (hw_caps &
>> IOMMU_HW_CAP_PCI_PASID_EXEC);
> True 😊
>
> Thanks,
> Shameer
next prev parent reply other threads:[~2025-11-06 15:44 UTC|newest]
Thread overview: 148+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 10:49 [PATCH v5 00/32] hw/arm/virt: Add support for user-creatable accelerated SMMUv3 Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 01/32] backends/iommufd: Introduce iommufd_backend_alloc_viommu Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 02/32] backends/iommufd: Introduce iommufd_backend_alloc_vdev Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 03/32] hw/arm/smmu-common: Factor out common helper functions and export Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 04/32] hw/arm/smmu-common: Make iommu ops part of SMMUState Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 05/32] hw/arm/smmuv3-accel: Introduce smmuv3 accel device Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 06/32] hw/arm/smmuv3-accel: Initialize shared system address space Shameer Kolothum
2025-10-31 21:10 ` Nicolin Chen
2025-11-03 14:17 ` Shameer Kolothum
2025-11-03 13:12 ` Jonathan Cameron via
2025-11-03 15:53 ` Shameer Kolothum
2025-11-03 13:39 ` Philippe Mathieu-Daudé
2025-11-03 16:30 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 07/32] hw/pci/pci: Move pci_init_bus_master() after adding device to bus Shameer Kolothum
2025-11-03 13:24 ` Jonathan Cameron via
2025-11-03 16:40 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 08/32] hw/pci/pci: Add optional supports_address_space() callback Shameer Kolothum
2025-11-03 13:30 ` Jonathan Cameron via
2025-11-03 16:47 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 09/32] hw/pci-bridge/pci_expander_bridge: Move TYPE_PXB_PCIE_DEV to header Shameer Kolothum
2025-11-03 13:30 ` Jonathan Cameron via
2025-11-03 14:25 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 10/32] hw/arm/smmuv3-accel: Restrict accelerated SMMUv3 to vfio-pci endpoints with iommufd Shameer Kolothum
2025-11-03 16:51 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 11/32] hw/arm/smmuv3: Implement get_viommu_cap() callback Shameer Kolothum
2025-11-03 16:55 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 12/32] hw/arm/smmuv3-accel: Add set/unset_iommu_device callback Shameer Kolothum
2025-10-31 22:02 ` Nicolin Chen
2025-10-31 22:08 ` Nicolin Chen
2025-11-03 14:19 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 13/32] hw/arm/smmuv3-accel: Add nested vSTE install/uninstall support Shameer Kolothum
2025-10-31 23:52 ` Nicolin Chen
2025-11-01 0:20 ` Nicolin Chen
2025-11-03 15:11 ` Shameer Kolothum
2025-11-03 17:32 ` Nicolin Chen
2025-11-04 11:05 ` Eric Auger
2025-11-04 12:26 ` Shameer Kolothum
2025-11-04 13:30 ` Eric Auger
2025-11-04 16:48 ` Nicolin Chen
2025-10-31 10:49 ` [PATCH v5 14/32] hw/arm/smmuv3-accel: Install SMMUv3 GBPA based hwpt Shameer Kolothum
2025-11-04 13:28 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 15/32] hw/pci/pci: Introduce optional get_msi_address_space() callback Shameer Kolothum
2025-11-04 14:11 ` Eric Auger
2025-11-04 14:20 ` Jason Gunthorpe
2025-11-04 14:42 ` Shameer Kolothum
2025-11-04 14:51 ` Jason Gunthorpe
2025-11-04 14:58 ` Shameer Kolothum
2025-11-04 15:12 ` Jason Gunthorpe
2025-11-04 15:20 ` Shameer Kolothum
2025-11-04 15:35 ` Jason Gunthorpe
2025-11-04 17:11 ` Nicolin Chen
2025-11-04 17:41 ` Jason Gunthorpe
2025-11-04 17:57 ` Nicolin Chen
2025-11-04 18:09 ` Jason Gunthorpe
2025-11-04 18:44 ` Nicolin Chen
2025-11-04 18:56 ` Jason Gunthorpe
2025-11-04 19:31 ` Nicolin Chen
2025-11-04 19:35 ` Jason Gunthorpe
2025-11-04 19:43 ` Nicolin Chen
2025-11-04 19:45 ` Jason Gunthorpe
2025-11-04 19:59 ` Nicolin Chen
2025-11-04 19:46 ` Shameer Kolothum
2025-11-05 12:52 ` Jason Gunthorpe
2025-11-05 17:32 ` Eric Auger
2025-11-04 14:37 ` Shameer Kolothum
2025-11-04 14:44 ` Eric Auger
2025-11-04 15:14 ` Shameer Kolothum
2025-11-04 16:01 ` Eric Auger
2025-11-04 17:47 ` Nicolin Chen
2025-11-05 7:47 ` Eric Auger
2025-11-05 19:30 ` Nicolin Chen
2025-11-04 19:08 ` Shameer Kolothum
2025-11-05 8:56 ` Eric Auger
2025-11-05 11:41 ` Shameer Kolothum
2025-11-05 17:25 ` Eric Auger
2025-11-05 18:10 ` Jason Gunthorpe
2025-11-05 18:33 ` Nicolin Chen
2025-11-05 18:58 ` Jason Gunthorpe
2025-11-05 19:33 ` Nicolin Chen
2025-11-06 7:42 ` Eric Auger
2025-11-06 11:48 ` Shameer Kolothum
2025-11-06 17:04 ` Eric Auger
2025-11-07 10:27 ` Shameer Kolothum
2025-11-06 14:32 ` Jason Gunthorpe
2025-11-06 15:47 ` Eric Auger
2025-11-05 18:33 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 16/32] hw/arm/smmuv3-accel: Make use of " Shameer Kolothum
2025-10-31 23:57 ` Nicolin Chen
2025-11-03 15:19 ` Shameer Kolothum
2025-11-03 17:34 ` Nicolin Chen
2025-10-31 10:49 ` [PATCH v5 17/32] hw/arm/smmuv3-accel: Add support to issue invalidation cmd to host Shameer Kolothum
2025-11-01 0:35 ` Nicolin Chen via
2025-11-03 15:28 ` Shameer Kolothum
2025-11-03 17:43 ` Nicolin Chen
2025-11-03 18:17 ` Shameer Kolothum
2025-11-03 18:51 ` Nicolin Chen
2025-11-04 8:55 ` Eric Auger
2025-11-04 16:41 ` Nicolin Chen
2025-11-03 17:11 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 18/32] hw/arm/smmuv3: Initialize ID registers early during realize() Shameer Kolothum
2025-11-01 0:24 ` Nicolin Chen
2025-11-03 13:57 ` Jonathan Cameron via
2025-11-03 15:11 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 19/32] hw/arm/smmuv3-accel: Get host SMMUv3 hw info and validate Shameer Kolothum
2025-11-01 0:49 ` Nicolin Chen
2025-11-01 14:20 ` Zhangfei Gao
2025-11-03 15:42 ` Shameer Kolothum
2025-11-03 17:16 ` Eric Auger
2025-11-03 14:47 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 20/32] hw/pci-host/gpex: Allow to generate preserve boot config DSM #5 Shameer Kolothum
2025-11-03 13:58 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 21/32] hw/arm/virt: Set PCI preserve_config for accel SMMUv3 Shameer Kolothum
2025-11-03 14:58 ` Eric Auger
2025-11-03 15:03 ` Eric Auger via
2025-11-03 16:01 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 22/32] tests/qtest/bios-tables-test: Prepare for IORT revison upgrade Shameer Kolothum
2025-11-03 14:48 ` Jonathan Cameron via
2025-11-03 14:59 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 23/32] hw/arm/virt-acpi-build: Add IORT RMR regions to handle MSI nested binding Shameer Kolothum
2025-11-03 14:53 ` Jonathan Cameron via
2025-11-03 15:43 ` Shameer Kolothum
2025-10-31 10:49 ` [PATCH v5 24/32] tests/qtest/bios-tables-test: Update IORT blobs after revision upgrade Shameer Kolothum
2025-11-03 14:54 ` Jonathan Cameron via
2025-11-03 15:01 ` Eric Auger
2025-10-31 10:49 ` [PATCH v5 25/32] hw/arm/smmuv3: Add accel property for SMMUv3 device Shameer Kolothum
2025-11-03 14:56 ` Jonathan Cameron via
2025-10-31 10:49 ` [PATCH v5 26/32] hw/arm/smmuv3-accel: Add a property to specify RIL support Shameer Kolothum
2025-11-03 15:07 ` Eric Auger
2025-11-03 16:08 ` Shameer Kolothum
2025-11-03 16:25 ` Eric Auger
2025-11-04 9:38 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 27/32] hw/arm/smmuv3-accel: Add support for ATS Shameer Kolothum
2025-11-04 14:22 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 28/32] hw/arm/smmuv3-accel: Add property to specify OAS bits Shameer Kolothum
2025-11-04 14:35 ` Eric Auger
2025-11-04 14:50 ` Jason Gunthorpe
2025-11-06 7:54 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 29/32] backends/iommufd: Retrieve PASID width from iommufd_backend_get_device_info() Shameer Kolothum
2025-10-31 10:50 ` [PATCH v5 30/32] Extend get_cap() callback to support PASID Shameer Kolothum
2025-11-03 14:58 ` Jonathan Cameron via
2025-11-06 8:45 ` Eric Auger
2025-10-31 10:50 ` [PATCH v5 31/32] vfio: Synthesize vPASID capability to VM Shameer Kolothum
2025-11-03 15:00 ` Jonathan Cameron via
2025-11-06 13:55 ` Eric Auger
2025-11-06 14:27 ` Shameer Kolothum
2025-11-06 15:44 ` Eric Auger [this message]
2025-10-31 10:50 ` [PATCH v5 32/32] hw/arm/smmuv3-accel: Add support for PASID enable Shameer Kolothum
2025-11-06 16:46 ` Eric Auger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4ec85e7-2142-44b1-9cc1-315b75e6d2bb@redhat.com \
--to=eric.auger@redhat.com \
--cc=berrange@redhat.com \
--cc=ddutile@redhat.com \
--cc=jgg@nvidia.com \
--cc=jiangkunkun@huawei.com \
--cc=jonathan.cameron@huawei.com \
--cc=kjaju@nvidia.com \
--cc=mochs@nvidia.com \
--cc=nathanc@nvidia.com \
--cc=nicolinc@nvidia.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=skolothumtho@nvidia.com \
--cc=smostafa@google.com \
--cc=wangzhou1@hisilicon.com \
--cc=yi.l.liu@intel.com \
--cc=zhangfei.gao@linaro.org \
--cc=zhenzhong.duan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).