Skip to content

Commit 9b9b6e7

Browse files
committed
Merge tag 'soc-fixes-6.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
Pull SoC fixes from Arnd Bergmann: "The main change this time is an update to the MAINTAINERS file, listing Krzysztof Kozlowski, Alexandre Belloni, and Linus Walleij as additional maintainers for the SoC tree, in order to go back to a group maintainership. Drew Fustini joins as an additional reviewer for the SoC tree. Thanks to all of you for volunteering to help out. On the actual bugfixes, we have a few correctness changes for firmware drivers (qtee, arm-ffa, scmi) and two devicetree fixes for Raspberry Pi" * tag 'soc-fixes-6.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: soc: officially expand maintainership team firmware: arm_scmi: Fix premature SCMI_XFER_FLAG_IS_RAW clearing in raw mode firmware: arm_scmi: Skip RAW initialization on failure include: trace: Fix inflight count helper on failed initialization firmware: arm_scmi: Account for failed debug initialization ARM: dts: broadcom: rpi: Switch to V3D firmware clock arm64: dts: broadcom: bcm2712: Define VGIC interrupt firmware: arm_ffa: Add support for IMPDEF value in the memory access descriptor tee: QCOMTEE should depend on ARCH_QCOM tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails tee: qcom: prevent potential off by one read
2 parents 7bd29bf + b2a578f commit 9b9b6e7

File tree

11 files changed

+119
-58
lines changed

11 files changed

+119
-58
lines changed

MAINTAINERS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1997,6 +1997,10 @@ F: include/uapi/linux/if_arcnet.h
19971997

19981998
ARM AND ARM64 SoC SUB-ARCHITECTURES (COMMON PARTS)
19991999
M: Arnd Bergmann <[email protected]>
2000+
M: Krzysztof Kozlowski <[email protected]>
2001+
M: Alexandre Belloni <[email protected]>
2002+
M: Linus Walleij <[email protected]>
2003+
R: Drew Fustini <[email protected]>
20002004
L: [email protected] (moderated for non-subscribers)
20012005
20022006
S: Maintained

arch/arm/boot/dts/broadcom/bcm2711-rpi.dtsi

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,14 @@
7777
/delete-property/ pinctrl-0;
7878
};
7979

80+
&pm {
81+
clocks = <&firmware_clocks 5>,
82+
<&clocks BCM2835_CLOCK_PERI_IMAGE>,
83+
<&clocks BCM2835_CLOCK_H264>,
84+
<&clocks BCM2835_CLOCK_ISP>;
85+
clock-names = "v3d", "peri_image", "h264", "isp";
86+
};
87+
8088
&rmem {
8189
/*
8290
* RPi4's co-processor will copy the board's bootloader configuration

arch/arm/boot/dts/broadcom/bcm2835-rpi-common.dtsi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,16 @@
1313
clock-names = "pixel", "hdmi";
1414
};
1515

16+
&pm {
17+
clocks = <&firmware_clocks 5>,
18+
<&clocks BCM2835_CLOCK_PERI_IMAGE>,
19+
<&clocks BCM2835_CLOCK_H264>,
20+
<&clocks BCM2835_CLOCK_ISP>;
21+
clock-names = "v3d", "peri_image", "h264", "isp";
22+
};
23+
1624
&v3d {
25+
clocks = <&firmware_clocks 5>;
1726
power-domains = <&power RPI_POWER_DOMAIN_V3D>;
1827
};
1928

arch/arm64/boot/dts/broadcom/bcm2712.dtsi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@
326326
<0x7fffe000 0x2000>;
327327
interrupt-controller;
328328
#address-cells = <0>;
329+
interrupts = <GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(4) |
330+
IRQ_TYPE_LEVEL_HIGH)>;
329331
#interrupt-cells = <3>;
330332
};
331333

drivers/firmware/arm_ffa/driver.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,26 @@ static u16 ffa_memory_attributes_get(u32 func_id)
649649
return FFA_MEM_NORMAL | FFA_MEM_WRITE_BACK | FFA_MEM_INNER_SHAREABLE;
650650
}
651651

652+
static void ffa_emad_impdef_value_init(u32 version, void *dst, void *src)
653+
{
654+
struct ffa_mem_region_attributes *ep_mem_access;
655+
656+
if (FFA_EMAD_HAS_IMPDEF_FIELD(version))
657+
memcpy(dst, src, sizeof(ep_mem_access->impdef_val));
658+
}
659+
660+
static void
661+
ffa_mem_region_additional_setup(u32 version, struct ffa_mem_region *mem_region)
662+
{
663+
if (!FFA_MEM_REGION_HAS_EP_MEM_OFFSET(version)) {
664+
mem_region->ep_mem_size = 0;
665+
} else {
666+
mem_region->ep_mem_size = ffa_emad_size_get(version);
667+
mem_region->ep_mem_offset = sizeof(*mem_region);
668+
memset(mem_region->reserved, 0, 12);
669+
}
670+
}
671+
652672
static int
653673
ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
654674
struct ffa_mem_ops_args *args)
@@ -667,27 +687,24 @@ ffa_setup_and_transmit(u32 func_id, void *buffer, u32 max_fragsize,
667687
mem_region->flags = args->flags;
668688
mem_region->sender_id = drv_info->vm_id;
669689
mem_region->attributes = ffa_memory_attributes_get(func_id);
670-
ep_mem_access = buffer +
671-
ffa_mem_desc_offset(buffer, 0, drv_info->version);
672690
composite_offset = ffa_mem_desc_offset(buffer, args->nattrs,
673691
drv_info->version);
674692

675-
for (idx = 0; idx < args->nattrs; idx++, ep_mem_access++) {
693+
for (idx = 0; idx < args->nattrs; idx++) {
694+
ep_mem_access = buffer +
695+
ffa_mem_desc_offset(buffer, idx, drv_info->version);
676696
ep_mem_access->receiver = args->attrs[idx].receiver;
677697
ep_mem_access->attrs = args->attrs[idx].attrs;
678698
ep_mem_access->composite_off = composite_offset;
679699
ep_mem_access->flag = 0;
680700
ep_mem_access->reserved = 0;
701+
ffa_emad_impdef_value_init(drv_info->version,
702+
ep_mem_access->impdef_val,
703+
args->attrs[idx].impdef_val);
681704
}
682705
mem_region->handle = 0;
683706
mem_region->ep_count = args->nattrs;
684-
if (drv_info->version <= FFA_VERSION_1_0) {
685-
mem_region->ep_mem_size = 0;
686-
} else {
687-
mem_region->ep_mem_size = sizeof(*ep_mem_access);
688-
mem_region->ep_mem_offset = sizeof(*mem_region);
689-
memset(mem_region->reserved, 0, 12);
690-
}
707+
ffa_mem_region_additional_setup(drv_info->version, mem_region);
691708

692709
composite = buffer + composite_offset;
693710
composite->total_pg_cnt = ffa_get_num_pages_sg(args->sg);

drivers/firmware/arm_scmi/common.h

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,16 +309,36 @@ enum debug_counters {
309309
SCMI_DEBUG_COUNTERS_LAST
310310
};
311311

312-
static inline void scmi_inc_count(atomic_t *arr, int stat)
312+
/**
313+
* struct scmi_debug_info - Debug common info
314+
* @top_dentry: A reference to the top debugfs dentry
315+
* @name: Name of this SCMI instance
316+
* @type: Type of this SCMI instance
317+
* @is_atomic: Flag to state if the transport of this instance is atomic
318+
* @counters: An array of atomic_c's used for tracking statistics (if enabled)
319+
*/
320+
struct scmi_debug_info {
321+
struct dentry *top_dentry;
322+
const char *name;
323+
const char *type;
324+
bool is_atomic;
325+
atomic_t counters[SCMI_DEBUG_COUNTERS_LAST];
326+
};
327+
328+
static inline void scmi_inc_count(struct scmi_debug_info *dbg, int stat)
313329
{
314-
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS))
315-
atomic_inc(&arr[stat]);
330+
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) {
331+
if (dbg)
332+
atomic_inc(&dbg->counters[stat]);
333+
}
316334
}
317335

318-
static inline void scmi_dec_count(atomic_t *arr, int stat)
336+
static inline void scmi_dec_count(struct scmi_debug_info *dbg, int stat)
319337
{
320-
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS))
321-
atomic_dec(&arr[stat]);
338+
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) {
339+
if (dbg)
340+
atomic_dec(&dbg->counters[stat]);
341+
}
322342
}
323343

324344
enum scmi_bad_msg {

drivers/firmware/arm_scmi/driver.c

Lines changed: 21 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,6 @@ struct scmi_protocol_instance {
115115

116116
#define ph_to_pi(h) container_of(h, struct scmi_protocol_instance, ph)
117117

118-
/**
119-
* struct scmi_debug_info - Debug common info
120-
* @top_dentry: A reference to the top debugfs dentry
121-
* @name: Name of this SCMI instance
122-
* @type: Type of this SCMI instance
123-
* @is_atomic: Flag to state if the transport of this instance is atomic
124-
* @counters: An array of atomic_c's used for tracking statistics (if enabled)
125-
*/
126-
struct scmi_debug_info {
127-
struct dentry *top_dentry;
128-
const char *name;
129-
const char *type;
130-
bool is_atomic;
131-
atomic_t counters[SCMI_DEBUG_COUNTERS_LAST];
132-
};
133-
134118
/**
135119
* struct scmi_info - Structure representing a SCMI instance
136120
*
@@ -610,7 +594,7 @@ scmi_xfer_inflight_register_unlocked(struct scmi_xfer *xfer,
610594
/* Set in-flight */
611595
set_bit(xfer->hdr.seq, minfo->xfer_alloc_table);
612596
hash_add(minfo->pending_xfers, &xfer->node, xfer->hdr.seq);
613-
scmi_inc_count(info->dbg->counters, XFERS_INFLIGHT);
597+
scmi_inc_count(info->dbg, XFERS_INFLIGHT);
614598

615599
xfer->pending = true;
616600
}
@@ -819,8 +803,9 @@ __scmi_xfer_put(struct scmi_xfers_info *minfo, struct scmi_xfer *xfer)
819803
hash_del(&xfer->node);
820804
xfer->pending = false;
821805

822-
scmi_dec_count(info->dbg->counters, XFERS_INFLIGHT);
806+
scmi_dec_count(info->dbg, XFERS_INFLIGHT);
823807
}
808+
xfer->flags = 0;
824809
hlist_add_head(&xfer->node, &minfo->free_xfers);
825810
}
826811
spin_unlock_irqrestore(&minfo->xfer_lock, flags);
@@ -839,8 +824,6 @@ void scmi_xfer_raw_put(const struct scmi_handle *handle, struct scmi_xfer *xfer)
839824
{
840825
struct scmi_info *info = handle_to_scmi_info(handle);
841826

842-
xfer->flags &= ~SCMI_XFER_FLAG_IS_RAW;
843-
xfer->flags &= ~SCMI_XFER_FLAG_CHAN_SET;
844827
return __scmi_xfer_put(&info->tx_minfo, xfer);
845828
}
846829

@@ -1034,7 +1017,7 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
10341017
spin_unlock_irqrestore(&minfo->xfer_lock, flags);
10351018

10361019
scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED);
1037-
scmi_inc_count(info->dbg->counters, ERR_MSG_UNEXPECTED);
1020+
scmi_inc_count(info->dbg, ERR_MSG_UNEXPECTED);
10381021

10391022
return xfer;
10401023
}
@@ -1062,7 +1045,7 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo, u32 msg_hdr)
10621045
msg_type, xfer_id, msg_hdr, xfer->state);
10631046

10641047
scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID);
1065-
scmi_inc_count(info->dbg->counters, ERR_MSG_INVALID);
1048+
scmi_inc_count(info->dbg, ERR_MSG_INVALID);
10661049

10671050
/* On error the refcount incremented above has to be dropped */
10681051
__scmi_xfer_put(minfo, xfer);
@@ -1107,7 +1090,7 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
11071090
PTR_ERR(xfer));
11081091

11091092
scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM);
1110-
scmi_inc_count(info->dbg->counters, ERR_MSG_NOMEM);
1093+
scmi_inc_count(info->dbg, ERR_MSG_NOMEM);
11111094

11121095
scmi_clear_channel(info, cinfo);
11131096
return;
@@ -1123,7 +1106,7 @@ static void scmi_handle_notification(struct scmi_chan_info *cinfo,
11231106
trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
11241107
xfer->hdr.id, "NOTI", xfer->hdr.seq,
11251108
xfer->hdr.status, xfer->rx.buf, xfer->rx.len);
1126-
scmi_inc_count(info->dbg->counters, NOTIFICATION_OK);
1109+
scmi_inc_count(info->dbg, NOTIFICATION_OK);
11271110

11281111
scmi_notify(cinfo->handle, xfer->hdr.protocol_id,
11291112
xfer->hdr.id, xfer->rx.buf, xfer->rx.len, ts);
@@ -1183,10 +1166,10 @@ static void scmi_handle_response(struct scmi_chan_info *cinfo,
11831166
if (xfer->hdr.type == MSG_TYPE_DELAYED_RESP) {
11841167
scmi_clear_channel(info, cinfo);
11851168
complete(xfer->async_done);
1186-
scmi_inc_count(info->dbg->counters, DELAYED_RESPONSE_OK);
1169+
scmi_inc_count(info->dbg, DELAYED_RESPONSE_OK);
11871170
} else {
11881171
complete(&xfer->done);
1189-
scmi_inc_count(info->dbg->counters, RESPONSE_OK);
1172+
scmi_inc_count(info->dbg, RESPONSE_OK);
11901173
}
11911174

11921175
if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
@@ -1296,7 +1279,7 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
12961279
"timed out in resp(caller: %pS) - polling\n",
12971280
(void *)_RET_IP_);
12981281
ret = -ETIMEDOUT;
1299-
scmi_inc_count(info->dbg->counters, XFERS_RESPONSE_POLLED_TIMEOUT);
1282+
scmi_inc_count(info->dbg, XFERS_RESPONSE_POLLED_TIMEOUT);
13001283
}
13011284
}
13021285

@@ -1321,7 +1304,7 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
13211304
"RESP" : "resp",
13221305
xfer->hdr.seq, xfer->hdr.status,
13231306
xfer->rx.buf, xfer->rx.len);
1324-
scmi_inc_count(info->dbg->counters, RESPONSE_POLLED_OK);
1307+
scmi_inc_count(info->dbg, RESPONSE_POLLED_OK);
13251308

13261309
if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
13271310
scmi_raw_message_report(info->raw, xfer,
@@ -1336,7 +1319,7 @@ static int scmi_wait_for_reply(struct device *dev, const struct scmi_desc *desc,
13361319
dev_err(dev, "timed out in resp(caller: %pS)\n",
13371320
(void *)_RET_IP_);
13381321
ret = -ETIMEDOUT;
1339-
scmi_inc_count(info->dbg->counters, XFERS_RESPONSE_TIMEOUT);
1322+
scmi_inc_count(info->dbg, XFERS_RESPONSE_TIMEOUT);
13401323
}
13411324
}
13421325

@@ -1420,13 +1403,13 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
14201403
!is_transport_polling_capable(info->desc)) {
14211404
dev_warn_once(dev,
14221405
"Polling mode is not supported by transport.\n");
1423-
scmi_inc_count(info->dbg->counters, SENT_FAIL_POLLING_UNSUPPORTED);
1406+
scmi_inc_count(info->dbg, SENT_FAIL_POLLING_UNSUPPORTED);
14241407
return -EINVAL;
14251408
}
14261409

14271410
cinfo = idr_find(&info->tx_idr, pi->proto->id);
14281411
if (unlikely(!cinfo)) {
1429-
scmi_inc_count(info->dbg->counters, SENT_FAIL_CHANNEL_NOT_FOUND);
1412+
scmi_inc_count(info->dbg, SENT_FAIL_CHANNEL_NOT_FOUND);
14301413
return -EINVAL;
14311414
}
14321415
/* True ONLY if also supported by transport. */
@@ -1461,19 +1444,19 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
14611444
ret = info->desc->ops->send_message(cinfo, xfer);
14621445
if (ret < 0) {
14631446
dev_dbg(dev, "Failed to send message %d\n", ret);
1464-
scmi_inc_count(info->dbg->counters, SENT_FAIL);
1447+
scmi_inc_count(info->dbg, SENT_FAIL);
14651448
return ret;
14661449
}
14671450

14681451
trace_scmi_msg_dump(info->id, cinfo->id, xfer->hdr.protocol_id,
14691452
xfer->hdr.id, "CMND", xfer->hdr.seq,
14701453
xfer->hdr.status, xfer->tx.buf, xfer->tx.len);
1471-
scmi_inc_count(info->dbg->counters, SENT_OK);
1454+
scmi_inc_count(info->dbg, SENT_OK);
14721455

14731456
ret = scmi_wait_for_message_response(cinfo, xfer);
14741457
if (!ret && xfer->hdr.status) {
14751458
ret = scmi_to_linux_errno(xfer->hdr.status);
1476-
scmi_inc_count(info->dbg->counters, ERR_PROTOCOL);
1459+
scmi_inc_count(info->dbg, ERR_PROTOCOL);
14771460
}
14781461

14791462
if (info->desc->ops->mark_txdone)
@@ -3044,9 +3027,6 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_info *info)
30443027
u8 channels[SCMI_MAX_CHANNELS] = {};
30453028
DECLARE_BITMAP(protos, SCMI_MAX_CHANNELS) = {};
30463029

3047-
if (!info->dbg)
3048-
return -EINVAL;
3049-
30503030
/* Enumerate all channels to collect their ids */
30513031
idr_for_each_entry(&info->tx_idr, cinfo, id) {
30523032
/*
@@ -3218,7 +3198,7 @@ static int scmi_probe(struct platform_device *pdev)
32183198
if (!info->dbg)
32193199
dev_warn(dev, "Failed to setup SCMI debugfs.\n");
32203200

3221-
if (IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
3201+
if (info->dbg && IS_ENABLED(CONFIG_ARM_SCMI_RAW_MODE_SUPPORT)) {
32223202
ret = scmi_debugfs_raw_mode_setup(info);
32233203
if (!coex) {
32243204
if (ret)
@@ -3423,6 +3403,9 @@ int scmi_inflight_count(const struct scmi_handle *handle)
34233403
if (IS_ENABLED(CONFIG_ARM_SCMI_DEBUG_COUNTERS)) {
34243404
struct scmi_info *info = handle_to_scmi_info(handle);
34253405

3406+
if (!info->dbg)
3407+
return 0;
3408+
34263409
return atomic_read(&info->dbg->counters[XFERS_INFLIGHT]);
34273410
} else {
34283411
return 0;

drivers/tee/qcomtee/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Qualcomm Trusted Execution Environment Configuration
33
config QCOMTEE
44
tristate "Qualcomm TEE Support"
5+
depends on ARCH_QCOM || COMPILE_TEST
56
depends on !CPU_BIG_ENDIAN
67
select QCOM_SCM
78
select QCOM_TZMEM_MODE_SHMBRIDGE

drivers/tee/qcomtee/call.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static int qcomtee_params_from_args(struct tee_param *params,
308308
}
309309

310310
/* Release any IO and OO objects not processed. */
311-
for (; u[i].type && i < num_params; i++) {
311+
for (; i < num_params && u[i].type; i++) {
312312
if (u[i].type == QCOMTEE_ARG_TYPE_OO ||
313313
u[i].type == QCOMTEE_ARG_TYPE_IO)
314314
qcomtee_object_put(u[i].o);

drivers/tee/qcomtee/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static int qcomtee_prepare_msg(struct qcomtee_object_invoke_ctx *oic,
424424
if (!(u[i].flags & QCOMTEE_ARG_FLAGS_UADDR))
425425
memcpy(msgptr, u[i].b.addr, u[i].b.size);
426426
else if (copy_from_user(msgptr, u[i].b.uaddr, u[i].b.size))
427-
return -EINVAL;
427+
return -EFAULT;
428428

429429
offset += qcomtee_msg_offset_align(u[i].b.size);
430430
ib++;

0 commit comments

Comments
 (0)