From: Jacob Pan <jacob.pan@linux.microsoft.com>
To: iommu@lists.linux.dev
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
Nicolin Chen <nicolinc@nvidia.com>,
Kevin Tian <kevin.tian@intel.com>, Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>, Wei Liu <wei.liu@kernel.org>,
"K . Y . Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Dexuan Cui <decui@microsoft.com>, Long Li <longli@microsoft.com>,
linux-hyperv@vger.kernel.org, Joerg Roedel <joro@8bytes.org>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Vasant Hegde <vasant.hegde@amd.com>,
Arnd Bergmann <arnd@arndb.de>,
linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org,
"Aneesh Kumar K . V" <aneesh.kumar@kernel.org>,
Mukesh Rathor <mukeshrathor@microsoft.com>,
John Starks <John.Starks@microsoft.com>,
Souradeep Chakrabarti <schakrabarti@microsoft.com>,
Yu Zhang <zhangyu1@linux.microsoft.com>,
Easwar Hariharan <eahariha@linux.microsoft.com>,
Alex Williamson <alex@shazbot.org>
Subject: [PATCH RFC 7/9] iommu/hyperv: Split root IOMMU declarations
Date: Fri, 25 Sep 2026 12:07:40 -0700 [thread overview]
Message-ID: <20260925190742.1575380-8-jacob.pan@linux.microsoft.com> (raw)
In-Reply-To: <20260925190742.1575380-1-jacob.pan@linux.microsoft.com>
Move the root IOMMU shared domain type, page-size mask, and
geometry into a private Hyper-V IOMMU header so IOMMUFD support
can live outside the main root driver file.
Assisted-by: GPT-5.6 Sol
Signed-off-by: Jacob Pan <jacob.pan@linux.microsoft.com>
---
drivers/iommu/hyperv/hv-iommu-root.c | 11 +----------
drivers/iommu/hyperv/hv-iommu.h | 26 ++++++++++++++++++++++++++
2 files changed, 27 insertions(+), 10 deletions(-)
create mode 100644 drivers/iommu/hyperv/hv-iommu.h
diff --git a/drivers/iommu/hyperv/hv-iommu-root.c b/drivers/iommu/hyperv/hv-iommu-root.c
index a5268e0e52cc..3b82891c9cab 100644
--- a/drivers/iommu/hyperv/hv-iommu-root.c
+++ b/drivers/iommu/hyperv/hv-iommu-root.c
@@ -7,6 +7,7 @@
#include <linux/dma-map-ops.h>
#include <linux/interval_tree.h>
#include <linux/hyperv.h>
+#include "hv-iommu.h"
#include <asm/iommu.h>
#include <asm/mshyperv.h>
#include "../dma-iommu.h"
@@ -31,15 +32,6 @@ static struct iommu_domain_ops hv_paging_domain_ops;
/* IOMMU device that we export to the world. HyperV supports max of one */
static struct iommu_device hv_virt_iommu;
-struct hv_domain {
- struct iommu_domain iommu_dom;
- u32 domid_num; /* as opposed to domain_id.type */
- spinlock_t mappings_lock; /* protects mappings_tree */
- struct rb_root_cached mappings_tree; /* iova to pa lookup tree */
-};
-
-#define to_hv_domain(d) container_of(d, struct hv_domain, iommu_dom)
-
struct hv_iommu_mapping {
phys_addr_t paddr;
struct interval_tree_node iova;
@@ -67,7 +59,6 @@ static bool hv_special_domain(struct hv_domain *hvdom)
return hvdom == &hv_def_identity_dom || hvdom == &hv_def_blocked_dom;
}
-#define HV_IOMMU_PGSIZES SZ_4K /* for now, to be enhanced */
static atomic_t hv_unique_id; /* unique numeric id for a new domain */
static bool hv_iommu_capable(struct device *dev, enum iommu_cap cap)
diff --git a/drivers/iommu/hyperv/hv-iommu.h b/drivers/iommu/hyperv/hv-iommu.h
new file mode 100644
index 000000000000..6895b4e7eb6d
--- /dev/null
+++ b/drivers/iommu/hyperv/hv-iommu.h
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Hyper-V root vIOMMU driver.
+ * Copyright (C) 2026, Microsoft, Inc.
+ */
+
+#ifndef __HYPERV_IOMMU_H
+#define __HYPERV_IOMMU_H
+
+#include <linux/interval_tree.h>
+#include <linux/iommu.h>
+#include <linux/sizes.h>
+#include <linux/spinlock.h>
+
+#define HV_IOMMU_PGSIZES SZ_4K /* for now, to be enhanced */
+
+struct hv_domain {
+ struct iommu_domain iommu_dom;
+ u32 domid_num; /* as opposed to domain_id.type */
+ spinlock_t mappings_lock; /* protects mappings_tree */
+ struct rb_root_cached mappings_tree; /* iova to pa lookup tree */
+};
+
+#define to_hv_domain(d) container_of(d, struct hv_domain, iommu_dom)
+
+#endif /* __HYPERV_IOMMU_H */
--
2.43.0
next prev parent reply other threads:[~2026-09-25 19:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-25 19:07 [RFC PATCH 0/9] iommu/iommufd: Add hypervisor external attach Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 1/9] iommu: Introduce external attach domain type Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 2/9] iommufd: Introduce hypervisor vIOMMU type Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 3/9] iommufd: Add external HWPT support Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 4/9] iommufd/selftest: Add hypervisor external attach backend Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 5/9] mshv: Add partition file identity helper Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 6/9] mshv: Add prepare callback for external device attach Jacob Pan
2026-09-25 19:07 ` Jacob Pan [this message]
2026-09-25 19:07 ` [PATCH RFC 8/9] iommu/hyperv: Add fd-backed vIOMMU support Jacob Pan
2026-09-25 19:07 ` [PATCH RFC 9/9] iommu/hyperv: Add IOMMUFD external domains Jacob Pan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260925190742.1575380-8-jacob.pan@linux.microsoft.com \
--to=jacob.pan@linux.microsoft.com \
--cc=John.Starks@microsoft.com \
--cc=alex@shazbot.org \
--cc=aneesh.kumar@kernel.org \
--cc=arnd@arndb.de \
--cc=decui@microsoft.com \
--cc=eahariha@linux.microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@ziepe.ca \
--cc=joro@8bytes.org \
--cc=kevin.tian@intel.com \
--cc=kys@microsoft.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=mukeshrathor@microsoft.com \
--cc=nicolinc@nvidia.com \
--cc=robin.murphy@arm.com \
--cc=schakrabarti@microsoft.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=vasant.hegde@amd.com \
--cc=wei.liu@kernel.org \
--cc=will@kernel.org \
--cc=zhangyu1@linux.microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®