lkml.org 
[lkml]   [2023]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCHES 15/17] iommufd: Allow new hwpt_alloc flags
Date
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@linux.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
\
 
 \ /
  Last update: 2023-05-30 07:41    [W:0.284 / U:0.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site