Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: kvm, smccc: Fix vendor uuid
@ 2025-07-21 13:05 Jack Thomson
  2025-07-21 15:59 ` Marc Zyngier
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jack Thomson @ 2025-07-21 13:05 UTC (permalink / raw)
  To: mark.rutland, lpieralisi, sudeep.holla, arnd, wei.liu, romank,
	mhklinux, linux-arm-kernel, linux-kernel, maz, oliver.upton,
	kvmarm
  Cc: roypat, Jack Thomson

From: Jack Thomson <jackabt@amazon.com>

Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
getting hypervisor UUID") replaced the explicit register constants
with the UUID_INIT macro. However, there is an endian issue, meaning
the UUID generated and used in the handshake didn't match UUID prior to
the commit.

The change in UUID causes the SMCCC vendor handshake to fail with older
guest kernels, meaning devices such as PTP were not available in the
guest.

This patch updates the parameters to the macro to generate a UUID which
matches the previous value, and re-establish backwards compatibility
with older guest kernels.

Fixes: 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for getting hypervisor UUID")
getting hypervisor UUID")
Signed-off-by: Jack Thomson <jackabt@amazon.com>
---
 include/linux/arm-smccc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
index 784ebe4607a4..50b47eba7d01 100644
--- a/include/linux/arm-smccc.h
+++ b/include/linux/arm-smccc.h
@@ -113,7 +113,7 @@
 
 /* KVM UID value: 28b46fb6-2ec5-11e9-a9ca-4b564d003a74 */
 #define ARM_SMCCC_VENDOR_HYP_UID_KVM UUID_INIT(\
-	0xb66fb428, 0xc52e, 0xe911, \
+	0x28b46fb6, 0x2ec5, 0x11e9, \
 	0xa9, 0xca, 0x4b, 0x56, \
 	0x4d, 0x00, 0x3a, 0x74)
 

base-commit: 89be9a83ccf1f88522317ce02f854f30d6115c41
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 13:05 [PATCH] arm64: kvm, smccc: Fix vendor uuid Jack Thomson
@ 2025-07-21 15:59 ` Marc Zyngier
  2025-07-21 17:14   ` Will Deacon
  2025-07-21 16:15 ` Sudeep Holla
  2025-07-21 17:45 ` Will Deacon
  2 siblings, 1 reply; 7+ messages in thread
From: Marc Zyngier @ 2025-07-21 15:59 UTC (permalink / raw)
  To: Jack Thomson, Will Deacon
  Cc: mark.rutland, lpieralisi, sudeep.holla, arnd, wei.liu, romank,
	mhklinux, linux-arm-kernel, linux-kernel, oliver.upton, kvmarm,
	roypat, Jack Thomson

[+Will]

On Mon, 21 Jul 2025 14:05:58 +0100,
Jack Thomson <jackabt.amazon@gmail.com> wrote:
> 
> From: Jack Thomson <jackabt@amazon.com>
> 
> Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
> getting hypervisor UUID") replaced the explicit register constants
> with the UUID_INIT macro. However, there is an endian issue, meaning
> the UUID generated and used in the handshake didn't match UUID prior to
> the commit.
> 
> The change in UUID causes the SMCCC vendor handshake to fail with older
> guest kernels, meaning devices such as PTP were not available in the
> guest.
> 
> This patch updates the parameters to the macro to generate a UUID which
> matches the previous value, and re-establish backwards compatibility
> with older guest kernels.
> 
> Fixes: 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for getting hypervisor UUID")
> getting hypervisor UUID")
> Signed-off-by: Jack Thomson <jackabt@amazon.com>
> ---
>  include/linux/arm-smccc.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> index 784ebe4607a4..50b47eba7d01 100644
> --- a/include/linux/arm-smccc.h
> +++ b/include/linux/arm-smccc.h
> @@ -113,7 +113,7 @@
>  
>  /* KVM UID value: 28b46fb6-2ec5-11e9-a9ca-4b564d003a74 */
>  #define ARM_SMCCC_VENDOR_HYP_UID_KVM UUID_INIT(\
> -	0xb66fb428, 0xc52e, 0xe911, \
> +	0x28b46fb6, 0x2ec5, 0x11e9, \
>  	0xa9, 0xca, 0x4b, 0x56, \
>  	0x4d, 0x00, 0x3a, 0x74)
>  
> 

Irk. This is remarkably embarrassing, and needs to be addressed ASAP,
before 6.16 ships. FWIW, I've just posted a quickly whipped selftest
that shows the problem[1].

Will, is there a chance you can pick this up and ferry it to Linus?
If you do, please add:

Reviewed-by: Marc Zyngier <maz@kernel.org>
Tested-by: Marc Zyngier <maz@kernel.org>

Thanks,

	M.

[1] https://lore.kernel.org/r/20250721155136.892255-1-maz@kernel.org

-- 
Without deviation from the norm, progress is not possible.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 13:05 [PATCH] arm64: kvm, smccc: Fix vendor uuid Jack Thomson
  2025-07-21 15:59 ` Marc Zyngier
@ 2025-07-21 16:15 ` Sudeep Holla
  2025-07-21 17:20   ` Roman Kisel
  2025-07-21 17:45 ` Will Deacon
  2 siblings, 1 reply; 7+ messages in thread
From: Sudeep Holla @ 2025-07-21 16:15 UTC (permalink / raw)
  To: Jack Thomson
  Cc: mark.rutland, lpieralisi, arnd, wei.liu, romank, mhklinux,
	linux-arm-kernel, linux-kernel, maz, Sudeep Holla, oliver.upton,
	kvmarm, roypat, Jack Thomson

(I can't see this original patch in my mailbox, got only Marc's response)

On Mon, Jul 21, 2025 at 02:05:58PM +0100, Jack Thomson wrote:
> From: Jack Thomson <jackabt@amazon.com>
> 
> Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
> getting hypervisor UUID") replaced the explicit register constants
> with the UUID_INIT macro. However, there is an endian issue, meaning
> the UUID generated and used in the handshake didn't match UUID prior to
> the commit.
> 
> The change in UUID causes the SMCCC vendor handshake to fail with older
> guest kernels, meaning devices such as PTP were not available in the
> guest.
> 
> This patch updates the parameters to the macro to generate a UUID which
> matches the previous value, and re-establish backwards compatibility
> with older guest kernels.
> 

Nice catch. This is result of classic confusion with UUID and GUID especially
coming from Microsoft who tend to use GUID more.

Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>

This also makes me wonder if the initialisation in arch/arm64/hyperv/mshyperv.c
is also wrong or may be that's correct only MS guys can confirm as I couldn't
find the UUID string for that.

-- 
Regards,
Sudeep


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 15:59 ` Marc Zyngier
@ 2025-07-21 17:14   ` Will Deacon
  2025-07-21 17:27     ` Roman Kisel
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2025-07-21 17:14 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: Jack Thomson, mark.rutland, lpieralisi, sudeep.holla, arnd,
	wei.liu, romank, mhklinux, linux-arm-kernel, linux-kernel,
	oliver.upton, kvmarm, roypat, Jack Thomson

On Mon, Jul 21, 2025 at 04:59:36PM +0100, Marc Zyngier wrote:
> [+Will]
> 
> On Mon, 21 Jul 2025 14:05:58 +0100,
> Jack Thomson <jackabt.amazon@gmail.com> wrote:
> > 
> > From: Jack Thomson <jackabt@amazon.com>
> > 
> > Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
> > getting hypervisor UUID") replaced the explicit register constants
> > with the UUID_INIT macro. However, there is an endian issue, meaning
> > the UUID generated and used in the handshake didn't match UUID prior to
> > the commit.
> > 
> > The change in UUID causes the SMCCC vendor handshake to fail with older
> > guest kernels, meaning devices such as PTP were not available in the
> > guest.
> > 
> > This patch updates the parameters to the macro to generate a UUID which
> > matches the previous value, and re-establish backwards compatibility
> > with older guest kernels.
> > 
> > Fixes: 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for getting hypervisor UUID")
> > getting hypervisor UUID")
> > Signed-off-by: Jack Thomson <jackabt@amazon.com>
> > ---
> >  include/linux/arm-smccc.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linux/arm-smccc.h b/include/linux/arm-smccc.h
> > index 784ebe4607a4..50b47eba7d01 100644
> > --- a/include/linux/arm-smccc.h
> > +++ b/include/linux/arm-smccc.h
> > @@ -113,7 +113,7 @@
> >  
> >  /* KVM UID value: 28b46fb6-2ec5-11e9-a9ca-4b564d003a74 */
> >  #define ARM_SMCCC_VENDOR_HYP_UID_KVM UUID_INIT(\
> > -	0xb66fb428, 0xc52e, 0xe911, \
> > +	0x28b46fb6, 0x2ec5, 0x11e9, \
> >  	0xa9, 0xca, 0x4b, 0x56, \
> >  	0x4d, 0x00, 0x3a, 0x74)
> >  
> > 
> 
> Irk. This is remarkably embarrassing, and needs to be addressed ASAP,
> before 6.16 ships. FWIW, I've just posted a quickly whipped selftest
> that shows the problem[1].
> 
> Will, is there a chance you can pick this up and ferry it to Linus?
> If you do, please add:
> 
> Reviewed-by: Marc Zyngier <maz@kernel.org>
> Tested-by: Marc Zyngier <maz@kernel.org>

Sure, I'll grab it. Thanks!

Will


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 16:15 ` Sudeep Holla
@ 2025-07-21 17:20   ` Roman Kisel
  0 siblings, 0 replies; 7+ messages in thread
From: Roman Kisel @ 2025-07-21 17:20 UTC (permalink / raw)
  To: Sudeep Holla, Jack Thomson
  Cc: mark.rutland, lpieralisi, arnd, wei.liu, mhklinux,
	linux-arm-kernel, linux-kernel, maz, oliver.upton, kvmarm, roypat,
	Jack Thomson



On 7/21/2025 9:15 AM, Sudeep Holla wrote:
> (I can't see this original patch in my mailbox, got only Marc's response)
> 
> On Mon, Jul 21, 2025 at 02:05:58PM +0100, Jack Thomson wrote:
>> From: Jack Thomson <jackabt@amazon.com>
>>
>> Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
>> getting hypervisor UUID") replaced the explicit register constants
>> with the UUID_INIT macro. However, there is an endian issue, meaning
>> the UUID generated and used in the handshake didn't match UUID prior to
>> the commit.
>>
>> The change in UUID causes the SMCCC vendor handshake to fail with older
>> guest kernels, meaning devices such as PTP were not available in the
>> guest.
>>
>> This patch updates the parameters to the macro to generate a UUID which
>> matches the previous value, and re-establish backwards compatibility
>> with older guest kernels.
>>
> 
> Nice catch. This is result of classic confusion with UUID and GUID especially
> coming from Microsoft who tend to use GUID more.
> 
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> 
> This also makes me wonder if the initialisation in arch/arm64/hyperv/mshyperv.c
> is also wrong or may be that's correct only MS guys can confirm as I couldn't
> find the UUID string for that.

MUCH appreciated!! Apologies for that miss in testing of the older
kernels. I'll check on our side and will fix what needs fixing.

> 

-- 
Thank you,
Roman



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 17:14   ` Will Deacon
@ 2025-07-21 17:27     ` Roman Kisel
  0 siblings, 0 replies; 7+ messages in thread
From: Roman Kisel @ 2025-07-21 17:27 UTC (permalink / raw)
  To: Will Deacon, Marc Zyngier
  Cc: Jack Thomson, mark.rutland, lpieralisi, sudeep.holla, arnd,
	wei.liu, mhklinux, linux-arm-kernel, linux-kernel, oliver.upton,
	kvmarm, roypat, Jack Thomson



On 7/21/2025 10:14 AM, Will Deacon wrote:
> On Mon, Jul 21, 2025 at 04:59:36PM +0100, Marc Zyngier wrote:

[...]

>>
>> Irk. This is remarkably embarrassing, and needs to be addressed ASAP,
>> before 6.16 ships. FWIW, I've just posted a quickly whipped selftest
>> that shows the problem[1].
>>
>> Will, is there a chance you can pick this up and ferry it to Linus?
>> If you do, please add:
>>
>> Reviewed-by: Marc Zyngier <maz@kernel.org>
>> Tested-by: Marc Zyngier <maz@kernel.org>
> 
> Sure, I'll grab it. Thanks!
> 

I'm sorry for that, apologies for screwing things up :(
Very much appreciate the fix and the test. I clearly missed testing
backward compat. with the old kernels.

> Will

-- 
Thank you,
Roman



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] arm64: kvm, smccc: Fix vendor uuid
  2025-07-21 13:05 [PATCH] arm64: kvm, smccc: Fix vendor uuid Jack Thomson
  2025-07-21 15:59 ` Marc Zyngier
  2025-07-21 16:15 ` Sudeep Holla
@ 2025-07-21 17:45 ` Will Deacon
  2 siblings, 0 replies; 7+ messages in thread
From: Will Deacon @ 2025-07-21 17:45 UTC (permalink / raw)
  To: mark.rutland, lpieralisi, sudeep.holla, arnd, wei.liu, romank,
	mhklinux, linux-arm-kernel, linux-kernel, maz, oliver.upton,
	kvmarm, Jack Thomson
  Cc: catalin.marinas, kernel-team, Will Deacon, roypat, Jack Thomson

On Mon, 21 Jul 2025 14:05:58 +0100, Jack Thomson wrote:
> Commit 13423063c7cb ("arm64: kvm, smccc: Introduce and use API for
> getting hypervisor UUID") replaced the explicit register constants
> with the UUID_INIT macro. However, there is an endian issue, meaning
> the UUID generated and used in the handshake didn't match UUID prior to
> the commit.
> 
> The change in UUID causes the SMCCC vendor handshake to fail with older
> guest kernels, meaning devices such as PTP were not available in the
> guest.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: kvm, smccc: Fix vendor uuid
      https://git.kernel.org/arm64/c/ab1612211532

There was a stray "getting hypervisor UUID")" line in the original
commit message after the Fixes: tag, so I dropped that bit.

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-07-21 18:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-21 13:05 [PATCH] arm64: kvm, smccc: Fix vendor uuid Jack Thomson
2025-07-21 15:59 ` Marc Zyngier
2025-07-21 17:14   ` Will Deacon
2025-07-21 17:27     ` Roman Kisel
2025-07-21 16:15 ` Sudeep Holla
2025-07-21 17:20   ` Roman Kisel
2025-07-21 17:45 ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox