The dummy IOMMU driver for No-IOMMU mode needs a page table to store IOVA
to physical address mappings. Instead of inventing a new format, reuse the
generic IOMMU page table (iommupt) provided mock format where its
implementation modeled after AMD IOMMU v1 format, but generalized for
software-only use.
Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
---
drivers/iommu/generic_pt/fmt/Makefile | 1 +
drivers/iommu/generic_pt/fmt/iommu_noiommu.c | 10 ++++++++++
include/linux/generic_pt/iommu.h | 5 +++++
3 files changed, 16 insertions(+)
create mode 100644 drivers/iommu/generic_pt/fmt/iommu_noiommu.c
diff --git a/drivers/iommu/generic_pt/fmt/Makefile b/drivers/iommu/generic_pt/fmt/Makefile
index 5a3379107999..59ea791c6383 100644
--- a/drivers/iommu/generic_pt/fmt/Makefile
+++ b/drivers/iommu/generic_pt/fmt/Makefile
@@ -2,6 +2,7 @@
iommu_pt_fmt-$(CONFIG_IOMMU_PT_AMDV1) += amdv1
iommu_pt_fmt-$(CONFIG_IOMMUFD_TEST) += mock
+iommu_pt_fmt-$(CONFIG_NOIOMMU_MODE_IOMMU) += noiommu
iommu_pt_fmt-$(CONFIG_IOMMU_PT_X86_64) += x86_64
diff --git a/drivers/iommu/generic_pt/fmt/iommu_noiommu.c b/drivers/iommu/generic_pt/fmt/iommu_noiommu.c
new file mode 100644
index 000000000000..4991dff60b59
--- /dev/null
+++ b/drivers/iommu/generic_pt/fmt/iommu_noiommu.c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES
+ * Copyright (c) 2025, Microsoft Corporation.
+ */
+#define PT_FMT amdv1
+#define PT_FMT_VARIANT noiommu
+#define PT_SUPPORTED_FEATURES 0
+
+#include "iommu_template.h"
diff --git a/include/linux/generic_pt/iommu.h b/include/linux/generic_pt/iommu.h
index fde7ccf007c5..d7f70eaeb37f 100644
--- a/include/linux/generic_pt/iommu.h
+++ b/include/linux/generic_pt/iommu.h
@@ -255,6 +255,11 @@ IOMMU_FORMAT(amdv1, amdpt);
struct pt_iommu_amdv1_mock_hw_info;
IOMMU_PROTOTYPES(amdv1_mock);
+#define pt_iommu_amdv1_noiommu pt_iommu_amdv1
+#define pt_iommu_amdv1_noiommu_cfg pt_iommu_amdv1_cfg
+struct pt_iommu_amdv1_noiommu_hw_info;
+IOMMU_PROTOTYPES(amdv1_noiommu);
+
struct pt_iommu_x86_64_cfg {
struct pt_iommu_cfg common;
};
--
2.34.1