From patchwork Sun Mar 26 20:34:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Marussi X-Patchwork-Id: 13188418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4516C74A5B for ; Sun, 26 Mar 2023 20:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=7clvMeobyeyPbdSbzFp7NtK7yuwnLJ7mBQ3bxpHm2FQ=; b=Wq6+cx7TsRTMgo 87AMiRSYmybvRaxWPtlxtt7MSWk91ethQCGx0w36lLc23BGkge/Y/ijtQTapCBmu5LZHMYjzFU15w I3sLlLzujxHwRYSwg+RHuOEL8WbNX5UNvSC+aofx8wDlfg6pna8YsNiyCds/jy6cBSdBnxX8lWzQR SJ86XVNZ3UVg2Cz4NXNpldQnQDOECFB4akI1AkehO7CnRCNZ4PL4lA2hM3RtAZyR5LZ1AuYUvcXrF UJFLdUez9ak5cSDD00W61dcmF9OPru6d9mXNY8fY21jQ7xrcpIND//SupHLviGEnUQeXAV70U0P+Y fJA7OIgrnD4CXSrtbNGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgX5Q-009Ad8-1Z; Sun, 26 Mar 2023 20:35:32 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pgX5M-009AbX-1Z for linux-arm-kernel@lists.infradead.org; Sun, 26 Mar 2023 20:35:30 +0000 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 2DBA0FEC; Sun, 26 Mar 2023 13:36:04 -0700 (PDT) Received: from e120937-lin.. (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4A9F93F6C4; Sun, 26 Mar 2023 13:35:19 -0700 (PDT) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, cristian.marussi@arm.com Subject: [PATCH] firmware: arm_scmi: Fix xfers allocation on RX channel Date: Sun, 26 Mar 2023 21:34:49 +0100 Message-Id: <20230326203449.3492948-1-cristian.marussi@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230326_133528_587250_BF0E3A15 X-CRM114-Status: GOOD ( 10.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Two distinct pools of xfer descriptors are allocated at initialization time: one (TX) used to provide xfers to track commands and their replies (or delayed replies) and another (RX) to pick xfers from to be used for processing notifications. Such pools, though, are allocated globally to be used by the whole SCMI instance, they are not allocated per-channel and as such the allocation of notifications xfers cannot be simply skipped if no RX channel was found for the Base protocol common channel, because there could be defined more optional per-protocol dedicated channels that instead support RX channels. Change the conditional check to skip allocation for the notification pool only if no RX channel has been detected on any per-channel protocol at all. Fixes: 4ebd8f6dea81 ("firmware: arm_scmi: Add receive buffer support for notifications") Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index 06c56109df38..005e40c3eb32 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -2343,7 +2343,7 @@ static int scmi_xfer_info_init(struct scmi_info *sinfo) return ret; ret = __scmi_xfer_info_init(sinfo, &sinfo->tx_minfo); - if (!ret && idr_find(&sinfo->rx_idr, SCMI_PROTOCOL_BASE)) + if (!ret && !idr_is_empty(&sinfo->rx_idr)) ret = __scmi_xfer_info_init(sinfo, &sinfo->rx_minfo); return ret;