[PATCH hyperv-next v8 02/11] arm64: hyperv: Use SMCCC to detect hypervisor presence

Roman Kisel romank at linux.microsoft.com
Mon Apr 28 12:23:04 PDT 2025



On 4/17/2025 8:27 AM, Michael Kelley wrote:
> From: Roman Kisel <romank at linux.microsoft.com> Sent: Monday, April 14, 2025 3:47 PM
[...]
> I had previously given my Reviewed-by: on v5 of this patch. But
> looking at it again, it would be nice if this UUID were defined in
> include/linux/arm-smccc.h alongside the definition of
> ARM_SMCCC_VENDOR_HYP_UID_KVM. The UUID values are
> are independent of each other, but it's a bit asymmetric to have
> the KVM UUID defined centrally while the Hyper-V UUID is
> buried in Hyper-V specific code. But I'm OK with the current code
> if there's nothing else to respin for.
> 

As I saw that, KVM is special in the kernel as the kernel provides
both the host side code and the kernel side code so the UUID has
to be shared in the header file.

In the Hyper-V case, we have only the guest side code so it seemed
more economical to have that tucked into the function rather than
adding to the arch-wide header and including the header.


>> +
>> +	return arm_smccc_hypervisor_has_uuid(&hyperv_uuid);
>> +}
>> +
>>   static int __init hyperv_init(void)
>>   {
>>   	struct hv_get_vp_registers_output	result;
>> @@ -36,13 +78,11 @@ static int __init hyperv_init(void)
>>
>>   	/*
>>   	 * Allow for a kernel built with CONFIG_HYPERV to be running in
>> -	 * a non-Hyper-V environment, including on DT instead of ACPI.
>> +	 * a non-Hyper-V environment.
>> +	 *
>>   	 * In such cases, do nothing and return success.
>>   	 */
>> -	if (acpi_disabled)
>> -		return 0;
>> -
>> -	if (strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8))
>> +	if (!hyperv_detect_via_acpi() && !hyperv_detect_via_smccc())
>>   		return 0;
>>
>>   	/* Setup the guest ID */
>> --
>> 2.43.0
>>
> 
> My UUID comment notwithstanding,
> 
> Reviewed-by: Michael Kelley <mhklinux at outlook.com>
> 
> 

-- 
Thank you,
Roman




More information about the linux-arm-kernel mailing list