]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
firmware: arm_scmi: quirk: Force perf level get fastchannel
authorJohan Hovold <johan+linaro@kernel.org>
Wed, 30 Apr 2025 13:51:46 +0000 (15:51 +0200)
committerSudeep Holla <sudeep.holla@arm.com>
Tue, 6 May 2025 10:12:30 +0000 (11:12 +0100)
The Qualcomm SCP firmware in X1E machines like the Lenovo ThinkPad T14s
does not set the FastChannel supported attribute bit for PERF_LEVEL_GET
but crashes when falling back to regular messaging.

Use the new SCMI quirk framework to force FastChannel initialisation for
this implementation.

Note that we can add an upper bound on the version matching when we
learn which version has a fix (or limit matching using a SoC compatible
string in the unlikely event that always enabling FC causes trouble
somewhere).

Link: https://lore.kernel.org/lkml/Z4Dt8E7C6upVtEGV@hovoldconsulting.com/
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Message-Id: <20250430135146.5154-1-johan+linaro@kernel.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/driver.c
drivers/firmware/arm_scmi/quirks.c
drivers/firmware/arm_scmi/quirks.h

index e81cbc896f5dcd99ecb198094db78afcb7c1c5e3..2699c8efef0a0ffe822242974ce195d6b6ea45b3 100644 (file)
@@ -1895,6 +1895,13 @@ struct scmi_msg_resp_desc_fc {
        __le32 db_preserve_hmask;
 };
 
+#define QUIRK_PERF_FC_FORCE                                            \
+       ({                                                              \
+               if (pi->proto->id == SCMI_PROTOCOL_PERF &&              \
+                   message_id == 0x8 /* PERF_LEVEL_GET */)             \
+                       attributes |= BIT(0);                           \
+       })
+
 static void
 scmi_common_fastchannel_init(const struct scmi_protocol_handle *ph,
                             u8 describe_id, u32 message_id, u32 valid_size,
@@ -1915,6 +1922,7 @@ scmi_common_fastchannel_init(const struct scmi_protocol_handle *ph,
 
        /* Check if the MSG_ID supports fastchannel */
        ret = scmi_protocol_msg_check(ph, message_id, &attributes);
+       SCMI_QUIRK(perf_level_get_fc_force, QUIRK_PERF_FC_FORCE);
        if (ret || !MSG_SUPPORTS_FASTCHANNEL(attributes)) {
                dev_dbg(ph->dev,
                        "Skip FC init for 0x%02X/%d  domain:%d - ret:%d\n",
index a425cd8ea9844bfbd3f346a4993b949a542dc95f..03960aca3610012d11b56471afe1ce4915029d4d 100644 (file)
@@ -170,6 +170,7 @@ struct scmi_quirk {
 
 /* Global Quirks Definitions */
 DEFINE_SCMI_QUIRK(clock_rates_triplet_out_of_spec, NULL, NULL, NULL);
+DEFINE_SCMI_QUIRK(perf_level_get_fc_force, "Qualcomm", NULL, "0x20000-");
 
 /*
  * Quirks Pointers Array
@@ -179,6 +180,7 @@ DEFINE_SCMI_QUIRK(clock_rates_triplet_out_of_spec, NULL, NULL, NULL);
  */
 static struct scmi_quirk *scmi_quirks_table[] = {
        __DECLARE_SCMI_QUIRK_ENTRY(clock_rates_triplet_out_of_spec),
+       __DECLARE_SCMI_QUIRK_ENTRY(perf_level_get_fc_force),
        NULL
 };
 
index 7fdc496c94c7c370d155643918ff93f5e2bcb649..a71fde85a5272aff471db1976934dc9c0fde9bf6 100644 (file)
@@ -47,5 +47,6 @@ static inline void scmi_quirks_enable(struct device *dev, const char *vend,
 
 /* Quirk delarations */
 DECLARE_SCMI_QUIRK(clock_rates_triplet_out_of_spec);
+DECLARE_SCMI_QUIRK(perf_level_get_fc_force);
 
 #endif /* _SCMI_QUIRKS_H */