From: Kameron Carr <kameroncarr@linux.microsoft.com>
To: decui@microsoft.com, haiyangz@microsoft.com,
mhklinux@outlook.com, wei.liu@kernel.org
Cc: arnd@arndb.de, catalin.marinas@arm.com,
linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
lpieralisi@kernel.org, mark.rutland@arm.com,
sudeep.holla@kernel.org, thuth@redhat.com, will@kernel.org
Subject: [PATCH v6 2/6] arm64: hyperv: Detect Hyper-V via RSI host call in CCA Realms
Date: Fri, 30 Oct 2026 17:14:08 -0700 [thread overview]
Message-ID: <20261031001412.4150488-3-kameroncarr@linux.microsoft.com> (raw)
In-Reply-To: <20261031001412.4150488-1-kameroncarr@linux.microsoft.com>
When booting without ACPI, hyperv_detect_via_smccc() detects Hyper-V by
querying the SMCCC vendor hypervisor UID. In an Arm CCA Realm the SMCCC
call is handled by the RMM rather than by the hypervisor, so the
query never reaches Hyper-V and detection fails.
When running in a Realm, forward ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID
to the host with RSI_HOST_CALL instead, which is how Hyper-V hypercalls
are issued from a Realm.
This is done in the Hyper-V code rather than in the generic
arm_smccc_hypervisor_has_uuid() because the other users expect different
behavior.
hyperv_init() is an early_initcall and runs before the secondary CPUs
are brought up, so a single __initdata host call structure is used
without locking.
ACPI-based detection and non-Realm guests are unaffected.
Signed-off-by: Kameron Carr <kameroncarr@linux.microsoft.com>
---
arch/arm64/hyperv/mshyperv.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c
index 4fdc26a..82572c5 100644
--- a/arch/arm64/hyperv/mshyperv.c
+++ b/arch/arm64/hyperv/mshyperv.c
@@ -11,6 +11,7 @@
#include <linux/types.h>
#include <linux/acpi.h>
+#include <linux/arm-rsi-cmds.h>
#include <linux/export.h>
#include <linux/errno.h>
#include <linux/version.h>
@@ -60,6 +61,27 @@ static bool __init hyperv_detect_via_acpi(void)
#endif
+/*
+ * In a Realm, the SMCCC call is handled by the RMM rather than by
+ * Hyper-V, so the vendor hypervisor UID query must be forwarded to the
+ * host with RSI_HOST_CALL, in the same way as hypercalls.
+ */
+static bool __init hyperv_realm_has_uuid(const uuid_t *hyperv_uuid)
+{
+ static struct rsi_host_call hc __initdata;
+ uuid_t uuid;
+
+ hc.gprs[0] = ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID;
+
+ if (rsi_host_call(__pa_symbol(&hc)) != RSI_SUCCESS ||
+ hc.gprs[0] == SMCCC_RET_NOT_SUPPORTED)
+ return false;
+
+ uuid = smccc_res_to_uuid(hc.gprs[0], hc.gprs[1], hc.gprs[2],
+ hc.gprs[3]);
+ return uuid_equal(&uuid, hyperv_uuid);
+}
+
static bool __init hyperv_detect_via_smccc(void)
{
uuid_t hyperv_uuid = UUID_INIT(
@@ -67,6 +89,9 @@ static bool __init hyperv_detect_via_smccc(void)
0x75, 0x6c, 0xef, 0x8e,
0x24, 0x70, 0x59, 0x16);
+ if (is_realm_world())
+ return hyperv_realm_has_uuid(&hyperv_uuid);
+
return arm_smccc_hypervisor_has_uuid(&hyperv_uuid);
}
--
2.45.4
next prev parent reply other threads:[~2026-10-31 0:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 0:14 [PATCH v6 0/6] arm64: hyperv: Add Realm support for Hyper-V Kameron Carr
2026-10-31 0:14 ` [PATCH v6 1/6] arm64: rsi: Add RSI host call structure and helper function Kameron Carr
2026-10-31 4:51 ` Dexuan Cui
2026-10-31 0:14 ` Kameron Carr [this message]
2026-10-31 0:14 ` [PATCH v6 3/6] arm64: hyperv: Add per-CPU RSI host call infrastructure for CCA Realms Kameron Carr
2026-10-31 0:14 ` [PATCH v6 4/6] Drivers: hv: Mark shared memory as decrypted " Kameron Carr
2026-10-31 0:14 ` [PATCH v6 5/6] arm64: hyperv: Route hypercalls through RSI host call in " Kameron Carr
2026-10-31 0:14 ` [PATCH v6 6/6] arm64: hyperv: Implement hv_is_isolation_supported() for " Kameron Carr
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=20261031001412.4150488-3-kameroncarr@linux.microsoft.com \
--to=kameroncarr@linux.microsoft.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mark.rutland@arm.com \
--cc=mhklinux@outlook.com \
--cc=sudeep.holla@kernel.org \
--cc=thuth@redhat.com \
--cc=wei.liu@kernel.org \
--cc=will@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox