From: Mukesh R <mrathor@linux.microsoft.com>
To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
iommu@lists.linux.dev, linux-arch@vger.kernel.org
Cc: jgg@nvidia.com, jacob.pan@linux.microsoft.com,
haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
tglx@kernel.org, mingo@redhat.com, bp@alien8.de,
dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com,
joro@8bytes.org, will@kernel.org, robin.murphy@arm.com,
arnd@arndb.de, mrathor@linux.microsoft.com
Subject: [PATCH V3 4/5] iommu/hyperv: Only call pviommu init on non-root VMs
Date: Mon, 2 Nov 2026 18:51:49 -0800 [thread overview]
Message-ID: <20261103025150.3192119-5-mrathor@linux.microsoft.com> (raw)
In-Reply-To: <20261103025150.3192119-1-mrathor@linux.microsoft.com>
Next patch introduces root iommu init. Since both can co-exist, set
x86 iommu_init to pviommu init only on non-root VMs. Also, rename
hv_iommu_init() to hv_pviommu_init(). Lastly, check for null iommu_init
before assignement as suggested by one of the pviommu authors.
Signed-off-by: Mukesh R <mrathor@linux.microsoft.com>
---
arch/x86/hyperv/hv_init.c | 3 ++-
arch/x86/include/asm/mshyperv.h | 2 +-
drivers/iommu/hyperv/hv-iommu-guest.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index b90e6f487533..18651c38dba3 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -580,7 +580,8 @@ void __init hyperv_init(void)
x86_init.timers.setup_percpu_clockev = hv_stimer_setup_percpu_clockev;
#ifdef CONFIG_HYPERV_PVIOMMU
- x86_init.iommu.iommu_init = hv_iommu_init;
+ if (!hv_root_partition() && x86_init.iommu.iommu_init == NULL)
+ x86_init.iommu.iommu_init = hv_pviommu_init;
#endif
hv_apic_init();
diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 24b19cd28a05..c95d75ae645e 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -320,7 +320,7 @@ static inline void __mshv_vtl_return_call(struct mshv_vtl_cpu_context *vtl0) {}
#endif
#ifdef CONFIG_HYPERV_PVIOMMU
-int __init hv_iommu_init(void);
+int __init hv_pviommu_init(void);
#endif
#include <asm-generic/mshyperv.h>
diff --git a/drivers/iommu/hyperv/hv-iommu-guest.c b/drivers/iommu/hyperv/hv-iommu-guest.c
index 876a22f21f1e..a40a8ceb3261 100644
--- a/drivers/iommu/hyperv/hv-iommu-guest.c
+++ b/drivers/iommu/hyperv/hv-iommu-guest.c
@@ -601,7 +601,7 @@ hv_init_iommu_device(struct hv_iommu_dev *hv_iommu,
hv_iommu_device = hv_iommu;
}
-int __init hv_iommu_init(void)
+int __init hv_pviommu_init(void)
{
u64 status;
int ret = 0;
--
2.51.2.vfs.0.1
next prev parent reply other threads:[~2026-11-03 2:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 2:51 [PATCH V3 0/5] Hyper-V: root VM iommu kernel only driver Mukesh R
2026-11-03 2:51 ` [PATCH V3 1/5] mshv: Add gfp flags to deposit memory logic Mukesh R
2026-11-03 2:51 ` [PATCH V3 2/5] PCI: hv: Export hv_build_devid_type_pci() and change return type Mukesh R
2026-11-03 2:51 ` [PATCH V3 3/5] mshv: Import data structs around device domains from hyperv headers Mukesh R
2026-11-03 3:17 ` Easwar Hariharan
2026-11-03 2:51 ` Mukesh R [this message]
2026-11-03 2:57 ` [PATCH V3 4/5] iommu/hyperv: Only call pviommu init on non-root VMs sashiko-bot
2026-11-03 2:51 ` [PATCH V3 5/5] x86/hyperv: Implement root partition IOMMU kernel only driver Mukesh R
2026-11-03 3:25 ` sashiko-bot
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=20261103025150.3192119-5-mrathor@linux.microsoft.com \
--to=mrathor@linux.microsoft.com \
--cc=arnd@arndb.de \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=hpa@zytor.com \
--cc=iommu@lists.linux.dev \
--cc=jacob.pan@linux.microsoft.com \
--cc=jgg@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=robin.murphy@arm.com \
--cc=tglx@kernel.org \
--cc=wei.liu@kernel.org \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.