From nobody Sun Feb 8 16:11:50 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7AE415D738 for ; Mon, 25 Mar 2024 20:46:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399604; cv=none; b=p5tKlS9iB7OeDwVeJkkIG973jX8Hbg0jroCqkOqwG/E2J993E8JtzNuMC69WF/8ej9ZbRiW5qySW6r75fAa/fSREQRn9MELb7raYuEKysfUw5K21pxKth765DJK+Na92A0IEj8NwViu1ovi7eFi6YtyKsDyND40c9syIdPQH+Cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399604; c=relaxed/simple; bh=NzoWAmhlNMrynHgIEM+sPtA7EMAquK1BebI41cCyErg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Mj3GR/zqrw6Z0twVfWYUH+husa+Ei+1p/7sezkgglQiEe07Aq1BY7uB2BXphn9Q5WdahTxiHgOP0vVKqHFa+X3WY5VxtA7iju1IaIwBvN3n+H8zHaqHtaCruS91VAsNRtdDreccKGmwTzGAG4fujghUfUNDe5wPdgwCn2PWPO8M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 498BD339; Mon, 25 Mar 2024 13:47:15 -0700 (PDT) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F09D23F64C; Mon, 25 Mar 2024 13:46:40 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, Cristian Marussi Subject: [PATCH v2 1/5] include: trace: Widen the tag buffer in trace_scmi_dump_msg Date: Mon, 25 Mar 2024 20:46:16 +0000 Message-ID: <20240325204620.1437237-2-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240325204620.1437237-1-cristian.marussi@arm.com> References: <20240325204620.1437237-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" A bigger buffer allow for more diverse tag names. Signed-off-by: Cristian Marussi --- include/trace/events/scmi.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/trace/events/scmi.h b/include/trace/events/scmi.h index 422c1ad9484d..127300481123 100644 --- a/include/trace/events/scmi.h +++ b/include/trace/events/scmi.h @@ -7,6 +7,8 @@ =20 #include =20 +#define TRACE_SCMI_MAX_TAG_LEN 6 + TRACE_EVENT(scmi_fc_call, TP_PROTO(u8 protocol_id, u8 msg_id, u32 res_id, u32 val1, u32 val2), TP_ARGS(protocol_id, msg_id, res_id, val1, val2), @@ -150,7 +152,7 @@ TRACE_EVENT(scmi_msg_dump, __field(u8, channel_id) __field(u8, protocol_id) __field(u8, msg_id) - __array(char, tag, 5) + __array(char, tag, TRACE_SCMI_MAX_TAG_LEN) __field(u16, seq) __field(int, status) __field(size_t, len) @@ -162,7 +164,7 @@ TRACE_EVENT(scmi_msg_dump, __entry->channel_id =3D channel_id; __entry->protocol_id =3D protocol_id; __entry->msg_id =3D msg_id; - strscpy(__entry->tag, tag, 5); + strscpy(__entry->tag, tag, TRACE_SCMI_MAX_TAG_LEN); __entry->seq =3D seq; __entry->status =3D status; __entry->len =3D len; --=20 2.44.0 From nobody Sun Feb 8 16:11:50 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4983C5D731 for ; Mon, 25 Mar 2024 20:46:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399605; cv=none; b=HmUaLUrNM0UCk3nmZgqel/aY1HfkTFwi3PN3bsfZgJTr2mYTkf+p1I/E4z+5XACA53FepFThfjGXIVKJD4PojZQJ4xG6Lhl2f6H5gNVANQotzAB3LWqYW4TehvhXce009nUZEkoadzKWVczSGzFcseN72Ot7arZzDFzHoJkVvY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399605; c=relaxed/simple; bh=E9VR4uFNct4R0/K6vDVJzOhucLGN0R2nVU29cih1sI4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=quy0xzWJOAB/C/+m9gVIwLznmilPiyqzxCC+Ay+K2maZtc2lTWDtjxFJ40gmHSsTwcu9HZDVk3sRqKzRKnHIz05ppEkAGyiI5lbTXSKT6aOHjYHH4J6cMJmIl4uewoyL07vUDLeJBF6g54Bc6X2YhPDORO1K4BwFEHPgTbc6Kso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4B81B13D5; Mon, 25 Mar 2024 13:47:16 -0700 (PDT) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE0A83F64C; Mon, 25 Mar 2024 13:46:41 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, Cristian Marussi Subject: [PATCH v2 2/5] firmware: arm_scmi: Add helper to trace bad messages Date: Mon, 25 Mar 2024 20:46:17 +0000 Message-ID: <20240325204620.1437237-3-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240325204620.1437237-1-cristian.marussi@arm.com> References: <20240325204620.1437237-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Upon reception of malformed and unexpected timed-out SCMI messages, it is not possible to trace those bad messages in their entirety, because usually we cannot even retrieve the payload, or it is just not reliable. Add a helper to trace at least the content of the header of the received message while associating a meaningful tag and error code. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/common.h | 11 +++++++++ drivers/firmware/arm_scmi/driver.c | 39 ++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi= /common.h index 6affbfdd1dec..b5ac25dbc1ca 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -301,6 +301,17 @@ extern const struct scmi_desc scmi_optee_desc; =20 void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr, void *pri= v); =20 +enum scmi_bad_msg { + MSG_UNEXPECTED =3D -1, + MSG_INVALID =3D -2, + MSG_UNKNOWN =3D -3, + MSG_NOMEM =3D -4, + MSG_MBOX_SPURIOUS =3D -5, +}; + +void scmi_bad_message_trace(struct scmi_chan_info *cinfo, u32 msg_hdr, + enum scmi_bad_msg err); + /* shmem related declarations */ struct scmi_shared_mem; =20 diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 2709598f3008..7fc1c5b1a2a4 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -696,6 +696,45 @@ scmi_xfer_lookup_unlocked(struct scmi_xfers_info *minf= o, u16 xfer_id) return xfer ?: ERR_PTR(-EINVAL); } =20 +/** + * scmi_bad_message_trace - A helper to trace weird messages + * + * @cinfo: A reference to the channel descriptor on which the message was + * received + * @msg_hdr: Message header to track + * @err: A specific error code used as a status value in traces. + * + * This helper can be used to trace any kind of weird, incomplete, unexpec= ted, + * timed-out message that arrives and as such, can be traced only referrin= g to + * the header content, since the payload is missing/unreliable. + */ +void scmi_bad_message_trace(struct scmi_chan_info *cinfo, u32 msg_hdr, + enum scmi_bad_msg err) +{ + char *tag; + struct scmi_info *info =3D handle_to_scmi_info(cinfo->handle); + + switch (MSG_XTRACT_TYPE(msg_hdr)) { + case MSG_TYPE_COMMAND: + tag =3D "!RESP"; + break; + case MSG_TYPE_DELAYED_RESP: + tag =3D "!DLYD"; + break; + case MSG_TYPE_NOTIFICATION: + tag =3D "!NOTI"; + break; + default: + tag =3D "!UNKN"; + break; + } + + trace_scmi_msg_dump(info->id, cinfo->id, + MSG_XTRACT_PROT_ID(msg_hdr), + MSG_XTRACT_ID(msg_hdr), tag, + MSG_XTRACT_TOKEN(msg_hdr), err, NULL, 0); +} + /** * scmi_msg_response_validate - Validate message type against state of re= lated * xfer --=20 2.44.0 From nobody Sun Feb 8 16:11:50 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46FE86F51D for ; Mon, 25 Mar 2024 20:46:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399606; cv=none; b=oJQPiAXPGx7xL6VBfNnkHFTgIxwKWed67Vsofah7M3RFB7gPjXjhXldzI1bEU+vfB6b4z7jx4gTSJma5I681N2jTU0PH47AxQrCDqEAjEsWwZJNJlKA9XKsAnpuxLLVNOqoLNMuwi6GoHl0TQQ5e9G3Q79F/T9iQlxBP7qwZfUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399606; c=relaxed/simple; bh=8T5ZwzHm+pUzIreu235bdRVnTkVVGfB0nyqODE4kLr0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WK+U6oqqNBVrP7rOyFPpjmcDQ00OjQmRNF2uD/Ci9WDp7PkKIuQ2do7Kwp1mUWJFHGLfbajMi5J4JTVB9zbGGR/3wRvc9JkJDK9mTnjXTlEHdHcGu8tdoPpzcL/9ieL/YpyyktZoEiiBTvmUX2ljKfVEfsqngLjF7w8hWAOmDpQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45808153B; Mon, 25 Mar 2024 13:47:17 -0700 (PDT) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EC2293F64C; Mon, 25 Mar 2024 13:46:42 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, Cristian Marussi Subject: [PATCH v2 3/5] firmware: arm_scmi: Add message dump traces for bad and unexpected replies Date: Mon, 25 Mar 2024 20:46:18 +0000 Message-ID: <20240325204620.1437237-4-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240325204620.1437237-1-cristian.marussi@arm.com> References: <20240325204620.1437237-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Trace also late-timed-out, out-of-order and unexpected/spurious messages. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 10 ++++++++++ drivers/firmware/arm_scmi/mailbox.c | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 7fc1c5b1a2a4..207ed1a52d69 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -861,6 +861,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo,= u32 msg_hdr) "Message for %d type %d is not expected!\n", xfer_id, msg_type); spin_unlock_irqrestore(&minfo->xfer_lock, flags); + + scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNEXPECTED); + return xfer; } refcount_inc(&xfer->users); @@ -885,6 +888,9 @@ scmi_xfer_command_acquire(struct scmi_chan_info *cinfo,= u32 msg_hdr) dev_err(cinfo->dev, "Invalid message type:%d for %d - HDR:0x%X state:%d\n", msg_type, xfer_id, msg_hdr, xfer->state); + + scmi_bad_message_trace(cinfo, msg_hdr, MSG_INVALID); + /* On error the refcount incremented above has to be dropped */ __scmi_xfer_put(minfo, xfer); xfer =3D ERR_PTR(-EINVAL); @@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_i= nfo *cinfo, if (IS_ERR(xfer)) { dev_err(dev, "failed to get free message slot (%ld)\n", PTR_ERR(xfer)); + + scmi_bad_message_trace(cinfo, msg_hdr, MSG_NOMEM); + scmi_clear_channel(info, cinfo); return; } @@ -1040,6 +1049,7 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u= 32 msg_hdr, void *priv) break; default: WARN_ONCE(1, "received unknown msg_type:%d\n", msg_type); + scmi_bad_message_trace(cinfo, msg_hdr, MSG_UNKNOWN); break; } } diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scm= i/mailbox.c index b8d470417e8f..fb0824af7180 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -56,7 +56,9 @@ static void rx_callback(struct mbox_client *cl, void *m) */ if (cl->knows_txdone && !shmem_channel_free(smbox->shmem)) { dev_warn(smbox->cinfo->dev, "Ignoring spurious A2P IRQ !\n"); - return; + return scmi_bad_message_trace(smbox->cinfo, + shmem_read_header(smbox->shmem), + MSG_MBOX_SPURIOUS); } =20 scmi_rx_callback(smbox->cinfo, shmem_read_header(smbox->shmem), NULL); --=20 2.44.0 From nobody Sun Feb 8 16:11:50 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4DF1770CC2 for ; Mon, 25 Mar 2024 20:46:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399607; cv=none; b=A96raJJBquKGAsX5eR1gt91K+gpOtKbhFFhxpPaXEUEbELuTblJYM69xp6fXV6tmti01Kt94RA6zHlsuYfduPPK9u+vHWaLf5Am3gYZen6uLxsSiGsAcg6EZ4AJnsOd088GOBb0CGxnMX55qDp5x/Hw1BLMbMT0/VuTosyPpXmc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399607; c=relaxed/simple; bh=5N73T9GLJexFRc9xgbr743q+8aZOE0ro0e7hvr8o8gg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gl2ZBtGia+B+o4pgT3m5abpurYXWOlQSpA7J7W6OV06ouROqx+WXSlHxBosgNBjCjRp1/qTXkjqha6HG7oF5TAUMLHfJ/9nukSkWQwTh4f6AGeXzk3rI65LnjhpR8N7PYv0GF774l/qMU2Zys1obpfcq+UyIiUY2wuz8XjA6xus= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3F5321595; Mon, 25 Mar 2024 13:47:18 -0700 (PDT) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E5EF23F64C; Mon, 25 Mar 2024 13:46:43 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, Cristian Marussi Subject: [PATCH v2 4/5] firmware: arm_scmi: Simplify scmi_devm_notifier_unregister Date: Mon, 25 Mar 2024 20:46:19 +0000 Message-ID: <20240325204620.1437237-5-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240325204620.1437237-1-cristian.marussi@arm.com> References: <20240325204620.1437237-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Unregistering SCMI notifications using the managed devres interface can be done providing as a reference simply the previously successfully registered notification block since it could have been registered only on one kernel notification_chain: drop any reference to SCMI protocol, events and sources. Devres internal helpers can search for the provided notification block reference and, once found, the associated devres object will already provide the above SCMI references for the event. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/notify.c | 30 ++++-------------------------- include/linux/scmi_protocol.h | 2 -- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi= /notify.c index 27c52531194d..e160ecb22948 100644 --- a/drivers/firmware/arm_scmi/notify.c +++ b/drivers/firmware/arm_scmi/notify.c @@ -1513,17 +1513,12 @@ static int scmi_devm_notifier_register(struct scmi_= device *sdev, static int scmi_devm_notifier_match(struct device *dev, void *res, void *d= ata) { struct scmi_notifier_devres *dres =3D res; - struct scmi_notifier_devres *xres =3D data; + struct notifier_block *nb =3D data; =20 - if (WARN_ON(!dres || !xres)) + if (WARN_ON(!dres || !nb)) return 0; =20 - return dres->proto_id =3D=3D xres->proto_id && - dres->evt_id =3D=3D xres->evt_id && - dres->nb =3D=3D xres->nb && - ((!dres->src_id && !xres->src_id) || - (dres->src_id && xres->src_id && - dres->__src_id =3D=3D xres->__src_id)); + return dres->nb =3D=3D nb; } =20 /** @@ -1531,10 +1526,6 @@ static int scmi_devm_notifier_match(struct device *d= ev, void *res, void *data) * notifier_block for an event * @sdev: A reference to an scmi_device whose embedded struct device is to * be used for devres accounting. - * @proto_id: Protocol ID - * @evt_id: Event ID - * @src_id: Source ID, when NULL register for events coming form ALL possi= ble - * sources * @nb: A standard notifier block to register for the specified event * * Generic devres managed helper to explicitly un-register a notifier_block @@ -1544,25 +1535,12 @@ static int scmi_devm_notifier_match(struct device *= dev, void *res, void *data) * Return: 0 on Success */ static int scmi_devm_notifier_unregister(struct scmi_device *sdev, - u8 proto_id, u8 evt_id, - const u32 *src_id, struct notifier_block *nb) { int ret; - struct scmi_notifier_devres dres; - - dres.handle =3D sdev->handle; - dres.proto_id =3D proto_id; - dres.evt_id =3D evt_id; - if (src_id) { - dres.__src_id =3D *src_id; - dres.src_id =3D &dres.__src_id; - } else { - dres.src_id =3D NULL; - } =20 ret =3D devres_release(&sdev->dev, scmi_devm_release_notifier, - scmi_devm_notifier_match, &dres); + scmi_devm_notifier_match, nb); =20 WARN_ON(ret); =20 diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h index b807141acc14..a3addb07e00a 100644 --- a/include/linux/scmi_protocol.h +++ b/include/linux/scmi_protocol.h @@ -783,8 +783,6 @@ struct scmi_notify_ops { const u32 *src_id, struct notifier_block *nb); int (*devm_event_notifier_unregister)(struct scmi_device *sdev, - u8 proto_id, u8 evt_id, - const u32 *src_id, struct notifier_block *nb); int (*event_notifier_register)(const struct scmi_handle *handle, u8 proto_id, u8 evt_id, --=20 2.44.0 From nobody Sun Feb 8 16:11:50 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0EE6573182 for ; Mon, 25 Mar 2024 20:46:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399607; cv=none; b=IfIbpqlFX9qss4k1PabC5QU4UWN+Zmq8FtVH8pWxPjIMz8F8PyE7ew9GrQa3frMUE84C0VM5ySBBA6Yh0IfAeOIq4AefEzgx77r6dfUouPlu2hQKcrVZaWFZlT7IR8ApXFlghjYYQsdbKeKOJ99rp7OvixrV0sRQFXXKjFWF2Qo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711399607; c=relaxed/simple; bh=COo9h/c3ZOoNfFclLceJbjG5YdpauNjCzeGTguBMgqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hUh/A+y50vA3fI1fD4M8KsSwTeoXvcfUYPPCIlixxZ6g2PpGmHUfXqxIa37jZF5MLNroJ1LcpVruLr89pH1ju6fTS0qBDSgfFec0ZuRN7YvRniNsl2xyhqeZ+qzS57Q04BI4vCrwtDQdfpC8xtVwLtBOxxjh/d+hiyT2Io1nZ9A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3A1F31596; Mon, 25 Mar 2024 13:47:19 -0700 (PDT) Received: from pluto.fritz.box (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0F743F64C; Mon, 25 Mar 2024 13:46:44 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, Cristian Marussi Subject: [PATCH v2 5/5] firmware: arm_scmi: Use dev_err_probe to bail out Date: Mon, 25 Mar 2024 20:46:20 +0000 Message-ID: <20240325204620.1437237-6-cristian.marussi@arm.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240325204620.1437237-1-cristian.marussi@arm.com> References: <20240325204620.1437237-1-cristian.marussi@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use dev_err_probe on the failure path of SCMI core probing. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 34 +++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi= /driver.c index 207ed1a52d69..d0091459a276 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2540,6 +2540,10 @@ scmi_txrx_setup(struct scmi_info *info, struct devic= e_node *of_node, ret =3D 0; } =20 + if (ret) + dev_err(info->dev, + "failed to setup channel for protocol:0x%X\n", prot_id); + return ret; } =20 @@ -2809,6 +2813,7 @@ static int scmi_debugfs_raw_mode_setup(struct scmi_in= fo *info) static int scmi_probe(struct platform_device *pdev) { int ret; + char *err_str =3D "probe failure\n"; struct scmi_handle *handle; const struct scmi_desc *desc; struct scmi_info *info; @@ -2859,27 +2864,37 @@ static int scmi_probe(struct platform_device *pdev) =20 if (desc->ops->link_supplier) { ret =3D desc->ops->link_supplier(dev); - if (ret) + if (ret) { + err_str =3D "transport not ready\n"; goto clear_ida; + } } =20 /* Setup all channels described in the DT at first */ ret =3D scmi_channels_setup(info); - if (ret) + if (ret) { + err_str =3D "failed to setup channels\n"; goto clear_ida; + } =20 ret =3D bus_register_notifier(&scmi_bus_type, &info->bus_nb); - if (ret) + if (ret) { + err_str =3D "failed to register bus notifier\n"; goto clear_txrx_setup; + } =20 ret =3D blocking_notifier_chain_register(&scmi_requested_devices_nh, &info->dev_req_nb); - if (ret) + if (ret) { + err_str =3D "failed to register device notifier\n"; goto clear_bus_notifier; + } =20 ret =3D scmi_xfer_info_init(info); - if (ret) + if (ret) { + err_str =3D "failed to init xfers pool\n"; goto clear_dev_req_notifier; + } =20 if (scmi_top_dentry) { info->dbg =3D scmi_debugfs_common_setup(info); @@ -2916,9 +2931,11 @@ static int scmi_probe(struct platform_device *pdev) */ ret =3D scmi_protocol_acquire(handle, SCMI_PROTOCOL_BASE); if (ret) { - dev_err(dev, "unable to communicate with SCMI\n"); - if (coex) + err_str =3D "unable to communicate with SCMI\n"; + if (coex) { + dev_err(dev, err_str); return 0; + } goto notification_exit; } =20 @@ -2972,7 +2989,8 @@ static int scmi_probe(struct platform_device *pdev) scmi_cleanup_txrx_channels(info); clear_ida: ida_free(&scmi_id, info->id); - return ret; + + return dev_err_probe(dev, ret, err_str); } =20 static void scmi_remove(struct platform_device *pdev) --=20 2.44.0