Skip to contentSkip to conversation

firmware: arm_scmi: fix psci dependency

PATCH In review Arnd Bergmann 4 participants 7 messages May 5, 2020 – May 6, 2020 Secure monitor call(SMC) calling convention (SMCCC)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firmware: arm_scmi: fix psci dependency

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Fixes 1dc6558062da ("firmware: arm_scmi: Add smc/hvc transport")
---
 include/linux/arm-smccc.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/linux/arm-smccc.h +7 -0
index 59494df0f55b..4f7c962856c0 100644
@@ -95,7 +95,14 @@ enum arm_smccc_conduit {
  *
  * When SMCCCv1.1 is not present, returns SMCCC_CONDUIT_NONE.
  */
+#ifdef CONFIG_ARM_PSCI_FW
 enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void);
+#else
+static inline enum arm_smccc_conduit arm_smccc_1_1_get_conduit(void)
+{
+	return SMCCC_CONDUIT_NONE;
+}
+#endif
 
 /**
  * struct arm_smccc_res - Result from SMC/HVC call
Signature · 1 line
2.26.0
#1 lore raw

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+
2. The new SMCCC driver(strictly speaking library/few APIs) can probe independent of PSCI if DT node is present
3. Else we fallback on PSCI and detect the SMCCC version for v1.1 and v1.2
4. Assume v1.0 if
a. PSCI FEATURE returns NOT_SUPPORTED for ARM_SMCCC_VERSION_FUNC_ID b. CONFIG_ARM_PSCI{,_FW} is not defined

Mark/Will/Marc,

Any other use-case config missed above ?

--
Regards,
Sudeep

maintainer
#2 lore raw
Quoted 30 lines · Sudeep Holla

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+
2. The new SMCCC driver(strictly speaking library/few APIs) can probe independent of PSCI if DT node is present
3. Else we fallback on PSCI and detect the SMCCC version for v1.1 and v1.2
4. Assume v1.0 if
a. PSCI FEATURE returns NOT_SUPPORTED for ARM_SMCCC_VERSION_FUNC_ID b. CONFIG_ARM_PSCI{,_FW} is not defined

Quoted 3 lines

Mark/Will/Marc,

Any other use-case config missed above ?

Do we need to support SMCCC without PSCI? Is anyone goingto build a sysyem with SMCCC but no PSCI functionality?

If not, then given we can always probe SMCCC from PSCI (for both ACPI and DT), I'd prefer to support only support doing things that way around. i.e. have SMCCC depend on PSCI.

Otherwise I suspect we're inviting more problems than a dependency on PSCI.

Thanks,
Mark.

#3 lore raw
Quoted 31 lines · Mark Rutland
Quoted 30 lines · Sudeep Holla

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+
2. The new SMCCC driver(strictly speaking library/few APIs) can probe independent of PSCI if DT node is present
3. Else we fallback on PSCI and detect the SMCCC version for v1.1 and v1.2
4. Assume v1.0 if
a. PSCI FEATURE returns NOT_SUPPORTED for ARM_SMCCC_VERSION_FUNC_ID b. CONFIG_ARM_PSCI{,_FW} is not defined

Quoted 7 lines
Quoted 3 lines

Mark/Will/Marc,

Any other use-case config missed above ?

Do we need to support SMCCC without PSCI? Is anyone goingto build a sysyem with SMCCC but no PSCI functionality?

May be arm32 using all new fancy specification we may come up to solve certain areas but continue to use legacy boot/power methods. I may be wrong. E.g: Today we enable HAVE_ARM_SMCCC for armv7 and above but not all have PSCI enabled.

Quoted 4 lines

If not, then given we can always probe SMCCC from PSCI (for both ACPI and DT), I'd prefer to support only support doing things that way around. i.e. have SMCCC depend on PSCI.

OK, but we still have above config.

Quoted 3 lines

Otherwise I suspect we're inviting more problems than a dependency on PSCI.

Agreed and I am happy to keep it as is.

--
Regards,
Sudeep

#4 lore raw
In reply to Sudeep Holla
Quoted 28 lines · Sudeep Holla
Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+
2. The new SMCCC driver(strictly speaking library/few APIs) can probe independent of PSCI if DT node is present
3. Else we fallback on PSCI and detect the SMCCC version for v1.1 and v1.2
4. Assume v1.0 if
a. PSCI FEATURE returns NOT_SUPPORTED for ARM_SMCCC_VERSION_FUNC_ID b. CONFIG_ARM_PSCI{,_FW} is not defined

Quoted 3 lines

Mark/Will/Marc,

Any other use-case config missed above ?

Do we really gain much by separating PSCI from SMCCC? In other words, why do we care about allowing them to be selected independently?

Will

#5 lore raw
Quoted 29 lines · Will Deacon
Quoted 28 lines · Sudeep Holla
Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+
2. The new SMCCC driver(strictly speaking library/few APIs) can probe independent of PSCI if DT node is present
3. Else we fallback on PSCI and detect the SMCCC version for v1.1 and v1.2
4. Assume v1.0 if
a. PSCI FEATURE returns NOT_SUPPORTED for ARM_SMCCC_VERSION_FUNC_ID b. CONFIG_ARM_PSCI{,_FW} is not defined

Quoted 7 lines
Quoted 3 lines

Mark/Will/Marc,

Any other use-case config missed above ?

Do we really gain much by separating PSCI from SMCCC? In other words, why do we care about allowing them to be selected independently?

As I mentioned to Mark's response, it is mostly the current arm32 configuration. We enable SMCCC for armv7 and of course we don't mandate PSCI for them. I assumed depending on PSCI for all uses of SMCCC even if it is not remotely connected to PSCI was wrong. But if that is fine, then we don't have any issue 😄

Signature · 2 lines
Regards,
Sudeep
#6 lore raw
In reply to Sudeep Holla
Quoted 15 lines · Sudeep Holla

Hi Arnd,

Quoted 8 lines · Arnd Bergmann

When CONFIG_ARM_PSCI_FW is disabled but CONFIG_HAVE_ARM_SMCCC is enabled, arm-scmi runs into a link failure:

arm-linux-gnueabi-ld: drivers/firmware/arm_scmi/smc.o: in function `smc_send_message':
smc.c:(.text+0x200): undefined reference to `arm_smccc_1_1_get_conduit'

Use an inline helper to default to version v1.0 in the absence of psci.

Thanks for fixing this. I was thinking if we can separate PSCI and SMCCC quickly as a fix for this but I think he needs to be discussed in detail.

Quoted 7 lines

I am fine with this fix as is and happy to apply to my tree if no one objects.

Sorry but taking this patch as opportunity to discuss how to carry the dependency in future. Just a proposal,

1. Introduce a DT node for SMCCC v1.2+

Sorry for the confusion and the above note might have scared people. Also I misunderstood some internal discussions we had as part of my SMCCC SOC_ID series[1]. I realised(rather Mark made me realise) this SCMI SMC is kind of dependent on PSCI as we reuse the conduit from there. So for now I will make it depend on PSCI to fix the build temporarily.

Also I will try to work out if we can move HAVE_ARCH_SMCCC to something like HAVE_ARCH_RAW_SMCCC and use HAVE_ARCH_SMCCC for newer changes that depend on PSCI for probing and conduit. The legacy SMCCC can then go under HAVE_ARCH_RAW_SMCCC. This was Mark's suggestion, I will try to work it out and may be post it as part of my SMCCC SOC_ID series also moving code under drivers/firmware/smccc

--
Regards,
Sudeep

[1] https://lore.kernel.org/r/[email protected]