Re: [PATCH v4] iommu/amd: Add support for hw_info for iommu capability query
From: Jason Gunthorpe
Date: Tue Sep 23 2025 - 13:55:58 EST
On Thu, Sep 04, 2025 at 07:31:12PM +0000, Suravee Suthikulpanit wrote:
> AMD IOMMU Extended Feature (EFR) and Extended Feature 2 (EFR2) registers
> specify features supported by each IOMMU hardware instance.
> The IOMMU driver checks each feature-specific bits before enabling
> each feature at run time.
>
> For IOMMUFD, the hypervisor passes the raw value of amd_iommu_efr and
> amd_iommu_efr2 to VMM via iommufd IOMMU_DEVICE_GET_HW_INFO ioctl.
>
> Reviewed-by: Nicolin Chen <nicolinc@xxxxxxxxxx>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@xxxxxxx>
> ---
> Change in v4:
> * Add CONFIG_AMD_IOMMU_IOMMUFD
> * Update comment regarding EFR/EFR2 from struct iommu_hw_info_amd.
>
> Change in v3:
> * Remove extern
> * Fix link to IOMMU spec
> * Update kdoc
>
> Change in v2:
> * Do not mask the EFR/EFR2 and simply return the value reported by hardware
> * Move amd_iommufd_hw_info() to drivers/iommu/amd/iommufd.c
> * Also support IOMMU_HW_INFO_TYPE_DEFAULT
>
> drivers/iommu/amd/Kconfig | 10 ++++++++++
> drivers/iommu/amd/Makefile | 1 +
> drivers/iommu/amd/iommu.c | 2 ++
> drivers/iommu/amd/iommufd.c | 31 +++++++++++++++++++++++++++++++
> drivers/iommu/amd/iommufd.h | 15 +++++++++++++++
> include/uapi/linux/iommufd.h | 28 ++++++++++++++++++++++++++++
> 6 files changed, 87 insertions(+)
> create mode 100644 drivers/iommu/amd/iommufd.c
> create mode 100644 drivers/iommu/amd/iommufd.h
There was a kbuild issue so this needs to be resent, but
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason