Re: [PATCH v4 08/18] iommufd: Add capabilities to IOMMU_GET_HW_INFO

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 18, 2023 at 09:27:05PM +0100, Joao Martins wrote:
> Extend IOMMUFD_CMD_GET_HW_INFO op to query generic iommu capabilities for a
> given device.
> 
> Capabilities are IOMMU agnostic and use device_iommu_capable() API passing
> one of the IOMMU_CAP_*. Enumerate IOMMU_CAP_DIRTY for now in the
> out_capabilities field returned back to userspace.
> 
> Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx>
> ---
>  drivers/iommu/iommufd/device.c |  4 ++++
>  include/uapi/linux/iommufd.h   | 11 +++++++++++
>  2 files changed, 15 insertions(+)
> 
> diff --git a/drivers/iommu/iommufd/device.c b/drivers/iommu/iommufd/device.c
> index e88fa73a45e6..71ee22dc1a85 100644
> --- a/drivers/iommu/iommufd/device.c
> +++ b/drivers/iommu/iommufd/device.c
> @@ -1185,6 +1185,10 @@ int iommufd_get_hw_info(struct iommufd_ucmd *ucmd)
>  	 */
>  	cmd->data_len = data_len;
>  
> +	cmd->out_capabilities = 0;
> +	if (device_iommu_capable(idev->dev, IOMMU_CAP_DIRTY))
> +		cmd->out_capabilities |= IOMMU_HW_CAP_DIRTY_TRACKING;
> +
>  	rc = iommufd_ucmd_respond(ucmd, sizeof(*cmd));
>  out_free:
>  	kfree(data);
> diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
> index efeb12c1aaeb..91de0043e73f 100644
> --- a/include/uapi/linux/iommufd.h
> +++ b/include/uapi/linux/iommufd.h
> @@ -419,6 +419,14 @@ enum iommu_hw_info_type {
>  	IOMMU_HW_INFO_TYPE_INTEL_VTD,
>  };
>  
> +/**
> + * enum iommufd_hw_info_capabilities
> + * @IOMMU_CAP_DIRTY_TRACKING: IOMMU hardware support for dirty tracking
> + */

Lets write more details here, which iommufd APIs does this flag mean
work.

But otherwise

Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux