Skip to content

Commit 720d813

Browse files
committed
Merge tag 'scmi-updates-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux into soc/drivers
Arm SCMI updates for v7.1 This batch mainly improves SCMI robustness on systems where the SCP does not generate completion interrupts, and includes two small follow-up cleanups in the SCMI core. The main functional change adds support for the new DT property 'arm,no-completion-irq'. When present for mailbox/shared-memory based SCMI implementations, the driver forces SCMI operations into polling mode so affected platforms can continue to operate even with broken firmware interrupt behavior. In addition, it - replaces open-coded size rounding in the base protocol path with round_up() for clarity, with no functional change - updates the SCMI quirk snippet macro implementation so quirk handlers can use break and continue directly when invoked inside loop contexts * tag 'scmi-updates-7.1' of git://git.kernel.org/pub/scm/linux/kernel/git/sudeep.holla/linux: firmware: arm_scmi: Support loop control in quirk code snippets firmware: arm_scmi: Use round_up() for base protocol list size calculation firmware: arm_scmi: Implement arm,no-completion-irq property dt-bindings: firmware: arm,scmi: Document arm,no-completion-irq property Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents a0ac82c + 0a7ec80 commit 720d813

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

Documentation/devicetree/bindings/firmware/arm,scmi.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,13 @@ properties:
146146
this platform. If set, the value should be non-zero.
147147
minimum: 1
148148

149+
arm,no-completion-irq:
150+
type: boolean
151+
description:
152+
This optional property is intended for hardware that does not generate
153+
completion interrupts and can be used to unconditionally enable forced
154+
polling mode of operation.
155+
149156
arm,smc-id:
150157
$ref: /schemas/types.yaml#/definitions/uint32
151158
description:
@@ -379,6 +386,9 @@ then:
379386
- shmem
380387

381388
else:
389+
properties:
390+
arm,no-completion-irq: false
391+
382392
if:
383393
properties:
384394
compatible:

drivers/firmware/arm_scmi/base.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#define pr_fmt(fmt) "SCMI Notifications BASE - " fmt
99

10+
#include <linux/math.h>
1011
#include <linux/module.h>
1112
#include <linux/scmi_protocol.h>
1213

@@ -219,8 +220,7 @@ scmi_base_implementation_list_get(const struct scmi_protocol_handle *ph,
219220
}
220221

221222
real_list_sz = t->rx.len - sizeof(u32);
222-
calc_list_sz = (1 + (loop_num_ret - 1) / sizeof(u32)) *
223-
sizeof(u32);
223+
calc_list_sz = round_up(loop_num_ret, sizeof(u32));
224224
if (calc_list_sz != real_list_sz) {
225225
dev_warn(dev,
226226
"Malformed reply - real_sz:%zd calc_sz:%u (loop_num_ret:%d)\n",

drivers/firmware/arm_scmi/common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@ struct scmi_transport_ops {
235235
* to have an execution latency lesser-equal to the threshold
236236
* should be considered for atomic mode operation: such
237237
* decision is finally left up to the SCMI drivers.
238+
* @no_completion_irq: Flag to indicate that this transport has no completion
239+
* interrupt and has to be polled. This is similar to the
240+
* force_polling below, except this is set via DT property.
238241
* @force_polling: Flag to force this whole transport to use SCMI core polling
239242
* mechanism instead of completion interrupts even if available.
240243
* @sync_cmds_completed_on_ret: Flag to indicate that the transport assures
@@ -254,6 +257,7 @@ struct scmi_desc {
254257
int max_msg;
255258
int max_msg_size;
256259
unsigned int atomic_threshold;
260+
bool no_completion_irq;
257261
const bool force_polling;
258262
const bool sync_cmds_completed_on_ret;
259263
const bool atomic_enabled;

drivers/firmware/arm_scmi/driver.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,6 +2735,7 @@ static int scmi_chan_setup(struct scmi_info *info, struct device_node *of_node,
27352735
cinfo->is_p2a = !tx;
27362736
cinfo->rx_timeout_ms = info->desc->max_rx_timeout_ms;
27372737
cinfo->max_msg_size = info->desc->max_msg_size;
2738+
cinfo->no_completion_irq = info->desc->no_completion_irq;
27382739

27392740
/* Create a unique name for this transport device */
27402741
snprintf(name, 32, "__scmi_transport_device_%s_%02X",
@@ -3150,6 +3151,9 @@ static const struct scmi_desc *scmi_transport_setup(struct device *dev)
31503151
if (ret && ret != -EINVAL)
31513152
dev_err(dev, "Malformed arm,max-msg DT property.\n");
31523153

3154+
trans->desc.no_completion_irq = of_property_read_bool(dev->of_node,
3155+
"arm,no-completion-irq");
3156+
31533157
dev_info(dev,
31543158
"SCMI max-rx-timeout: %dms / max-msg-size: %dbytes / max-msg: %d\n",
31553159
trans->desc.max_rx_timeout_ms, trans->desc.max_msg_size,

drivers/firmware/arm_scmi/quirks.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
* named as _qn.
2121
*/
2222
#define SCMI_QUIRK(_qn, _blk) \
23-
do { \
23+
({ \
2424
if (static_branch_unlikely(&(scmi_quirk_ ## _qn))) \
2525
(_blk); \
26-
} while (0)
26+
})
2727

2828
void scmi_quirks_initialize(void);
2929
void scmi_quirks_enable(struct device *dev, const char *vend,
@@ -34,10 +34,10 @@ void scmi_quirks_enable(struct device *dev, const char *vend,
3434
#define DECLARE_SCMI_QUIRK(_qn)
3535
/* Force quirks compilation even when SCMI Quirks are disabled */
3636
#define SCMI_QUIRK(_qn, _blk) \
37-
do { \
37+
({ \
3838
if (0) \
3939
(_blk); \
40-
} while (0)
40+
})
4141

4242
static inline void scmi_quirks_initialize(void) { }
4343
static inline void scmi_quirks_enable(struct device *dev, const char *vend,

0 commit comments

Comments
 (0)