[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230530053724.232765-16-baolu.lu@linux.intel.com>
Date: Tue, 30 May 2023 13:37:22 +0800
From: Lu Baolu <baolu.lu@...ux.intel.com>
To: Jason Gunthorpe <jgg@...pe.ca>, Kevin Tian <kevin.tian@...el.com>,
Joerg Roedel <joro@...tes.org>, Will Deacon <will@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Jean-Philippe Brucker <jean-philippe@...aro.org>,
Nicolin Chen <nicolinc@...dia.com>,
Yi Liu <yi.l.liu@...el.com>,
Jacob Pan <jacob.jun.pan@...ux.intel.com>
Cc: iommu@...ts.linux.dev, linux-kselftest@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
linux-kernel@...r.kernel.org, Lu Baolu <baolu.lu@...ux.intel.com>
Subject: [RFC PATCHES 15/17] iommufd: Allow new hwpt_alloc flags
We have completed all puzzles for IO page fault delivery so far. We can
allow user space to opt-in the flags of IOMMU_HWPT_ALLOC_FLAGS_IOPF and
IOMMU_HWPT_ALLOC_FLAGS_USER_PASID_TABLE now.
Signed-off-by: Lu Baolu <baolu.lu@...ux.intel.com>
---
include/uapi/linux/iommufd.h | 3 +++
drivers/iommu/iommufd/hw_pagetable.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/include/uapi/linux/iommufd.h b/include/uapi/linux/iommufd.h
index 65bb856dd8fb..908d12219727 100644
--- a/include/uapi/linux/iommufd.h
+++ b/include/uapi/linux/iommufd.h
@@ -491,6 +491,9 @@ struct iommu_hwpt_alloc {
__u32 flags;
#define IOMMU_HWPT_ALLOC_FLAGS_IOPF_CAPABLE (1 << 0)
#define IOMMU_HWPT_ALLOC_FLAGS_USER_PASID_TABLE (1 << 1)
+#define IOMMU_HWPT_ALLOC_FLAGS_ALL \
+ (IOMMU_HWPT_ALLOC_FLAGS_IOPF_CAPABLE | \
+ IOMMU_HWPT_ALLOC_FLAGS_USER_PASID_TABLE)
__u32 dev_id;
__u32 pt_id;
__u32 out_hwpt_id;
diff --git a/drivers/iommu/iommufd/hw_pagetable.c b/drivers/iommu/iommufd/hw_pagetable.c
index 7f18e6bd76ec..7be6bf26290f 100644
--- a/drivers/iommu/iommufd/hw_pagetable.c
+++ b/drivers/iommu/iommufd/hw_pagetable.c
@@ -208,7 +208,7 @@ int iommufd_hwpt_alloc(struct iommufd_ucmd *ucmd)
int klen = 0;
int rc = 0;
- if (cmd->flags || cmd->__reserved)
+ if ((cmd->flags & ~IOMMU_HWPT_ALLOC_FLAGS_ALL) || cmd->__reserved)
return -EOPNOTSUPP;
idev = iommufd_get_device(ucmd, cmd->dev_id);
--
2.34.1
Powered by blists - more mailing lists