Generic Linux architectural discussions
 help / color / mirror / Atom feed
From: Kameron Carr <kameroncarr@linux.microsoft.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com,
	mhklinux@outlook.com, will@kernel.org, mark.rutland@arm.com,
	lpieralisi@kernel.org, sudeep.holla@kernel.org, arnd@arndb.de,
	thuth@redhat.com, linux-hyperv@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
	Suzuki K Poulose <Suzuki.Poulose@arm.com>
Subject: Re: [PATCH v5 2/6] firmware: smccc: Detect hypervisor via RSI host call in CCA Realms
Date: Fri, 30 Oct 2026 17:35:58 -0700	[thread overview]
Message-ID: <8d175247-24a9-42ee-8ce8-4bdfce6db548@linux.microsoft.com> (raw)
In-Reply-To: <auPOnb_9Jfzh-oQE@arm.com>

On 10/29/2026 3:54 PM, Catalin Marinas wrote:
> On Fri, Oct 02, 2026 at 02:57:21PM -0700, Kameron Carr wrote:
>> +#ifdef CONFIG_ARM64
>> +static struct rsi_host_call uuid_hc;
>> +static DEFINE_SPINLOCK(uuid_hc_lock);
>> +
>> +/*
>> + * Helper function to get the hypervisor UUID via an RsiHostCall.
>> + */
>> +static void arm_smccc_realm_get_hypervisor_uuid(struct arm_smccc_res *res)
>> +{
>> +	guard(spinlock_irqsave)(&uuid_hc_lock);
>> +
>> +	memset(&uuid_hc, 0, sizeof(uuid_hc));
>> +	uuid_hc.gprs[0] = ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID;
>> +
>> +	if (rsi_host_call(__pa_symbol(&uuid_hc)) != RSI_SUCCESS) {
>> +		res->a0 = SMCCC_RET_NOT_SUPPORTED;
>> +		return;
>> +	}
>> +
>> +	res->a0 = uuid_hc.gprs[0];
>> +	res->a1 = uuid_hc.gprs[1];
>> +	res->a2 = uuid_hc.gprs[2];
>> +	res->a3 = uuid_hc.gprs[3];
>> +}
>> +#endif
>> +
>>  bool arm_smccc_hypervisor_has_uuid(const uuid_t *hyp_uuid)
>>  {
>>  	struct arm_smccc_res res = {};
>>  	uuid_t uuid;
>>  
>> -	arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID, &res);
>> +#ifdef CONFIG_ARM64
>> +	if (is_realm_world())
>> +		arm_smccc_realm_get_hypervisor_uuid(&res);
>> +	else
>> +#endif
>> +		arm_smccc_1_1_invoke(ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID,
>> +				     &res);
> 
> Is this meant to be generic? I'm not sure the trick to pass
> ARM_SMCCC_VENDOR_HYP_CALL_UID_FUNC_ID in gprs[0] and forward it to the
> host is a documented ABI. I think it even confuses other realm guests
> that don't expect this (e.g. kvm_init_hyp_services()).
> 
> I thought realms should stick to the RSI interface and not try to guess
> the host hypervisor. But if you do need this, a better fit would be in
> hyperv_detect_via_smccc() (if realms don't boot with ACPI).
> 
> I'll leave it to Sudeep or Suzuki to comment further.

I moved this code to a Hyper-V specific location as you suggested.

Let me know if you have any other concerns.

[v6] https://lore.kernel.org/all/20261031001412.4150488-1-kameroncarr@linux.microsoft.com/

-- 
Regards,
Kameron

  reply	other threads:[~2026-10-31  0:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 21:57 [PATCH v5 0/6] arm64: hyperv: Add Realm support for Hyper-V Kameron Carr
2026-10-02 21:57 ` [PATCH v5 1/6] arm64: rsi: Add RSI host call structure and helper function Kameron Carr
2026-10-22  7:41   ` Wei Liu
2026-10-29 22:55   ` Catalin Marinas
2026-10-02 21:57 ` [PATCH v5 2/6] firmware: smccc: Detect hypervisor via RSI host call in CCA Realms Kameron Carr
2026-10-29 22:54   ` Catalin Marinas
2026-10-31  0:35     ` Kameron Carr [this message]
2026-10-31  4:47     ` [EXTERNAL] " Dexuan Cui
2026-10-31  8:42       ` Suzuki K Poulose
2026-10-02 21:57 ` [PATCH v5 3/6] arm64: hyperv: Add per-CPU RSI host call infrastructure for " Kameron Carr
2026-10-02 21:57 ` [PATCH v5 4/6] Drivers: hv: Mark shared memory as decrypted " Kameron Carr
2026-10-02 21:57 ` [PATCH v5 5/6] arm64: hyperv: Route hypercalls through RSI host call in " Kameron Carr
2026-10-02 21:57 ` [PATCH v5 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=8d175247-24a9-42ee-8ce8-4bdfce6db548@linux.microsoft.com \
    --to=kameroncarr@linux.microsoft.com \
    --cc=Suzuki.Poulose@arm.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