Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2983447lqp; Mon, 25 Mar 2024 15:36:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUsBbpn8WPTcIXRa++QQIlCz3pxdpGnmEd/cp4uLu3UBCi5CISCr4Fsays8CFqcg4kE8QMIJgG84HKuK/AJtsSog42cnDIjN+4Oj4IqCw== X-Google-Smtp-Source: AGHT+IFOwSkbqfS0ucVxjNPGtdOFH/gxMNcR/aLb12L1PFF0qiS4Iktzbwxhe2jJgFMTRZGTW8Ai X-Received: by 2002:a05:6870:c6a2:b0:229:f2e8:739c with SMTP id cv34-20020a056870c6a200b00229f2e8739cmr8533207oab.20.1711406196310; Mon, 25 Mar 2024 15:36:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711406196; cv=pass; d=google.com; s=arc-20160816; b=DFmWwPVs7eCmAaNGlX9Br16iwDO44lx9txL//19yo0ds3of+K9yuekf7IycQ6MeFsw 2krmJG2bR7IGAZBFt9lhqJp1kOWjpjqVZlgowilk1w18Pnxao+TskrNchnzAM/6HrXmh d6aWcrQYaAEhAlbGBYUWWzRbWDW4LGsEOg6K4ctInhGbO/aQ39GWJsiR0P5ll/SM5mgY mzY5K5cB8EnoG9a01QOd1S4M+cf4JsNlQTH6phtEKIOk0jqFyXWggfPlSj+xv2fKqVEB jSeIZTYieZokdKGHlBypTikS+RAeJHmQRO0FFB1C0y/D0j2v2lERCX0+PMeiepJcrZy1 o7Tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ILZm65Q9zuCBsQG3XUACcz8U+OKpv5CfkMzoKaAIYCo=; fh=WtL5fQT7ZUc/CxFY5ivX7o+R0egHbl7+G/zS94M/DC4=; b=t5glo3Msz219Zw/B3WjzA+ukNM1eW6FlhJMQE/T/IK4n9LYasJO27V4g19vZu12GT7 Hb13TK3Dpil0ulWJLj05Izka5beREzBlE5uX7K085oVA4snO34EvOQKhnOGXGKoWDzmM CM6oy9e7xkHjrR+B+rT58+Z+FfxhdognFUp08gp859zAuj1mTvRcfImEIbvHJ+iPaKaa CRzIn5LQSGT6y9W3GP/Cq5QINh1DuYFCR6JTJRoxo2pRVo03+4/cOhE4v+vVV62BcqEe 2emfC7pz+EFi4C8G4KJKc2DN4I1BwqXvdbBuc8fWwpGtJx2yBuHNUsv/HRqQhJFDcmuO ld/Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-117984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id r31-20020a63fc5f000000b005e8428fe57dsi8188354pgk.454.2024.03.25.15.36.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 15:36:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-117984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6AFDFC623AE for ; Mon, 25 Mar 2024 20:51:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B090759B70; Mon, 25 Mar 2024 20:46:46 +0000 (UTC) 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: 8bit 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 = ERR_PTR(-EINVAL); @@ -921,6 +927,9 @@ static void scmi_handle_notification(struct scmi_chan_info *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, u32 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_scmi/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); } scmi_rx_callback(smbox->cinfo, shmem_read_header(smbox->shmem), NULL); -- 2.44.0