linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented
@ 2021-11-19 23:39 Michael Kelley
  2021-11-22  8:35 ` Sudeep Holla
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Kelley @ 2021-11-19 23:39 UTC (permalink / raw)
  To: mark.rutland, lorenzo.pieralisi, sudeep.holla, steven.price,
	linux-arm-kernel, linux-kernel
  Cc: mikelley

The ARCH_FEATURES function ID is a 32-bit SMC call, which returns
a 32-bit result per the SMCCC spec.  Current code is doing a 64-bit
comparison against -1 (SMCCC_RET_NOT_SUPPORTED) to detect that the
feature is unimplemented.  That check doesn't work in a Hyper-V VM,
where the upper 32-bits are zero as allowed by the spec.

Cast the result as an 'int' so the comparison works. The change also
makes the code consistent with other similar checks in this file.

Fixes: 821b67fa4639 ("firmware: smccc: Add ARCH_SOC_ID support")
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
 drivers/firmware/smccc/soc_id.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/firmware/smccc/soc_id.c b/drivers/firmware/smccc/soc_id.c
index 581aa5e..dd7c3d5 100644
--- a/drivers/firmware/smccc/soc_id.c
+++ b/drivers/firmware/smccc/soc_id.c
@@ -50,7 +50,7 @@ static int __init smccc_soc_init(void)
 	arm_smccc_1_1_invoke(ARM_SMCCC_ARCH_FEATURES_FUNC_ID,
 			     ARM_SMCCC_ARCH_SOC_ID, &res);
 
-	if (res.a0 == SMCCC_RET_NOT_SUPPORTED) {
+	if ((int)res.a0 == SMCCC_RET_NOT_SUPPORTED) {
 		pr_info("ARCH_SOC_ID not implemented, skipping ....\n");
 		return 0;
 	}
-- 
1.8.3.1


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

* Re: [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented
  2021-11-19 23:39 [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented Michael Kelley
@ 2021-11-22  8:35 ` Sudeep Holla
  2021-11-22 10:56   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Sudeep Holla @ 2021-11-22  8:35 UTC (permalink / raw)
  To: Michael Kelley
  Cc: mark.rutland, lorenzo.pieralisi, steven.price, linux-arm-kernel,
	linux-kernel, Sudeep Holla

On Fri, Nov 19, 2021 at 03:39:01PM -0800, Michael Kelley wrote:
> The ARCH_FEATURES function ID is a 32-bit SMC call, which returns
> a 32-bit result per the SMCCC spec.  Current code is doing a 64-bit
> comparison against -1 (SMCCC_RET_NOT_SUPPORTED) to detect that the
> feature is unimplemented.  That check doesn't work in a Hyper-V VM,
> where the upper 32-bits are zero as allowed by the spec.
> 
> Cast the result as an 'int' so the comparison works. The change also
> makes the code consistent with other similar checks in this file.
> 
> Fixes: 821b67fa4639 ("firmware: smccc: Add ARCH_SOC_ID support")

Good catch.

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

Can you please re-post with my review tag keeping arm@kernel.org and
soc@kernel.org ? I don't have any other fixes at the moment, we can
ask SoC maintainers to fix this up directly.

-- 
Regards,
Sudeep

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

* Re: [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented
  2021-11-22  8:35 ` Sudeep Holla
@ 2021-11-22 10:56   ` Arnd Bergmann
  2021-11-22 11:52     ` Sudeep Holla
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2021-11-22 10:56 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: Michael Kelley, Mark Rutland, Lorenzo Pieralisi, Steven Price,
	Linux ARM, Linux Kernel Mailing List

On Mon, Nov 22, 2021 at 9:35 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
> On Fri, Nov 19, 2021 at 03:39:01PM -0800, Michael Kelley wrote:
> > The ARCH_FEATURES function ID is a 32-bit SMC call, which returns
> > a 32-bit result per the SMCCC spec.  Current code is doing a 64-bit
> > comparison against -1 (SMCCC_RET_NOT_SUPPORTED) to detect that the
> > feature is unimplemented.  That check doesn't work in a Hyper-V VM,
> > where the upper 32-bits are zero as allowed by the spec.
> >
> > Cast the result as an 'int' so the comparison works. The change also
> > makes the code consistent with other similar checks in this file.
> >
> > Fixes: 821b67fa4639 ("firmware: smccc: Add ARCH_SOC_ID support")
>
> Good catch.
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
>
> Can you please re-post with my review tag keeping arm@kernel.org and
> soc@kernel.org ? I don't have any other fixes at the moment, we can
> ask SoC maintainers to fix this up directly.

In general, I think the easiest way would be for you to forward the
patch with your Signed-off-by, when you don't have other material
for a pull request.

I've applied this patch from the list now.

       Arnd

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

* Re: [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented
  2021-11-22 10:56   ` Arnd Bergmann
@ 2021-11-22 11:52     ` Sudeep Holla
  0 siblings, 0 replies; 4+ messages in thread
From: Sudeep Holla @ 2021-11-22 11:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Michael Kelley, Mark Rutland, Lorenzo Pieralisi, Steven Price,
	Linux ARM, Linux Kernel Mailing List

On Mon, Nov 22, 2021 at 11:56:16AM +0100, Arnd Bergmann wrote:
> On Mon, Nov 22, 2021 at 9:35 AM Sudeep Holla <sudeep.holla@arm.com> wrote:
> > On Fri, Nov 19, 2021 at 03:39:01PM -0800, Michael Kelley wrote:
> > > The ARCH_FEATURES function ID is a 32-bit SMC call, which returns
> > > a 32-bit result per the SMCCC spec.  Current code is doing a 64-bit
> > > comparison against -1 (SMCCC_RET_NOT_SUPPORTED) to detect that the
> > > feature is unimplemented.  That check doesn't work in a Hyper-V VM,
> > > where the upper 32-bits are zero as allowed by the spec.
> > >
> > > Cast the result as an 'int' so the comparison works. The change also
> > > makes the code consistent with other similar checks in this file.
> > >
> > > Fixes: 821b67fa4639 ("firmware: smccc: Add ARCH_SOC_ID support")
> >
> > Good catch.
> >
> > Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
> >
> > Can you please re-post with my review tag keeping arm@kernel.org and
> > soc@kernel.org ? I don't have any other fixes at the moment, we can
> > ask SoC maintainers to fix this up directly.
>
> In general, I think the easiest way would be for you to forward the
> patch with your Signed-off-by, when you don't have other material
> for a pull request.
>

Thanks for the tip, I will follow that in future.

> I've applied this patch from the list now.
>

Thanks for that.

--
Regards,
Sudeep

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

end of thread, other threads:[~2021-11-22 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-19 23:39 [PATCH 1/1] firmware: smccc: Fix check for ARCH_SOC_ID not implemented Michael Kelley
2021-11-22  8:35 ` Sudeep Holla
2021-11-22 10:56   ` Arnd Bergmann
2021-11-22 11:52     ` Sudeep Holla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).