From patchwork Wed Jun 26 06:58:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peng Fan (OSS)" X-Patchwork-Id: 13712347 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 60F3EC27C4F for ; Wed, 26 Jun 2024 07:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=zt+mPbe9q0vvsOnZ6oPoWKdBMG MrUZBQ/NJj6SCxlrEtMfbzLMnz6f6D1/1VZGHbHNSRMY8ifUo8QTdaKHs0fw1FUMeOh4TKF1TaaeW U0/FSwT4+EG2ctkQi1jV7ReCWpKj62vYvVds/y0olS9kCCVOH8CUvFgfCEYaAj7w1KOadMIVMVBk6 vILvkpbzPHuV/tsFH33LfSkKiq9BO4/WENmdv9aU+ST6a6hUHomzGKB/NH57lq3IJOaBnakni4gsr 1ioUGeMd7KXucPd3xhGHTd00eR67ClAFAoALyPHw+cIf0oc3N6VTGkBIEnWhoxgwMz2BPU/3mzkpf JfmC1LXQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMhF-00000005fwE-1Lea; Wed, 26 Jun 2024 07:04:01 +0000 Received: from mail-vi1eur05on20601.outbound.protection.outlook.com ([2a01:111:f403:2613::601] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sMMh9-00000005fvA-0EeT for linux-arm-kernel@lists.infradead.org; Wed, 26 Jun 2024 07:03:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0rQVld5PZPQlJ/ckaYZjF5T3hyb97BCT/cFyYCsoM1dsilxwbEzdBtYuUwNtJhd6OKm6dFJocP4K27hT1rkl5pXjLy6lqTN/QCo0LAvsrF/Sn8+I9Wgm8ZGIIHSC68tq9vTz9+iIyas95cX9JypFE3pyMNcn6Gp5ApVd1/pY7NnsJO8JPIGDcymoZbSWPW1wsXi4+ajYdhwyvJDws3SS4/CJrXsw26Ew87V3hY9m9b3CI82eFAT25X5lOWddpSMHzQ9RtJYQWCYE9vJIWUYNnGw6JskOInQeIifF/j6BiRGBRhYRbEg7Aw+Y7mm5hlfK1VNJPvvoOcyfPSHvaomdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=bFi2eMq8BIM37lWqlk+8kBDa1c7X5ERFWUiY9m2huELRlbWk/WKd8XE2yj+VUY0pBBLTKTQ3fdFXx4Z1dNLVgSixJntVaXcz5Nb+Mgs2yE5dn+5tXRjfDoTGIKsXUL6tDlLoABvdjDGa+k7jeptlyZt8K6L4ELvLlCOO+JB0fLrmQ+/Fx9t0a/SPi9RSDR1ypRScv8SI1uBOCuUgavXSwbAjMpBSjvxr9Go6+zxm289hchZeR6/+ZFJTCyIiM0hZMhhZGywtshTo4esEdi3ZCpK8zVLoMYaPbXwmjGg7Lou0Nc+AekEY0aNScU3HAw2Z9xlbLOjM5qEAXML3vxSvag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vXwT7pcoPs4gUA7C/cu1HMPajA9byoLEk5jLA8tUv7Y=; b=cWxjNMhfbekrQia5tMiBKo707fzH7w/yUcv7rECvsXmwq6ar0++fIezdq8pALDoTeY3AGfBGTYpTU3p/NJDFAvNjFn1DcqkVgQ3pSVePNVJLxGzdzXga8ISR5XoZe+n3wwKvr2bOJjXiuVomou/Lm2dejUaLIG443c/p+EoIye0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com; Received: from AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) by PR3PR04MB7449.eurprd04.prod.outlook.com (2603:10a6:102:86::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7698.30; Wed, 26 Jun 2024 06:49:38 +0000 Received: from AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256]) by AM6PR04MB5941.eurprd04.prod.outlook.com ([fe80::9f4e:b695:f5f0:5256%4]) with mapi id 15.20.7698.025; Wed, 26 Jun 2024 06:49:38 +0000 From: "Peng Fan (OSS)" Date: Wed, 26 Jun 2024 14:58:39 +0800 Subject: [PATCH 1/2] firmware: arm_scmi: channel unavailable if no of_node Message-Id: <20240626-scmi-driver-v1-1-f16d777e004a@nxp.com> References: <20240626-scmi-driver-v1-0-f16d777e004a@nxp.com> In-Reply-To: <20240626-scmi-driver-v1-0-f16d777e004a@nxp.com> To: Sudeep Holla , Cristian Marussi Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Peng Fan X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1719385128; l=2477; i=peng.fan@nxp.com; s=20230812; h=from:subject:message-id; bh=RNHjX3icUu5Fa3quGe1D5sfhXIBG5EyoXdwa6hawOCk=; b=g5aclVtPfp6pWAMKhn54fSIHpidP4x6TUuFQI9AUuyXHpSYhGjTyv0A+xhAO9HyJfbQhfjV8J JHT3/Xj/QQXDLCkmj/FjMGsGpPbyWgyrkmfA1XDa06bI5kfHlXBAv4w X-Developer-Key: i=peng.fan@nxp.com; a=ed25519; pk=I4sJg7atIT1g63H7bb5lDRGR2gJW14RKDD0wFL8TT1g= X-ClientProxiedBy: SI1PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:1f5::6) To AM6PR04MB5941.eurprd04.prod.outlook.com (2603:10a6:20b:9e::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB5941:EE_|PR3PR04MB7449:EE_ X-MS-Office365-Filtering-Correlation-Id: ee522686-3e92-4abd-c4a3-08dc95ac25dc X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230038|366014|52116012|376012|1800799022|38350700012; X-Microsoft-Antispam-Message-Info: =?utf-8?q?L4rlDT3nllwqsQO7KCZ2PCtisPO7wxW?= =?utf-8?q?hv99TicVxIGaYkKs1vVj16GDEdo0jDcZjsTED7i2f1BvjLHbA95hvYPWYzDHL2W9F?= =?utf-8?q?/QeKPLp2sY9FDRgsj1qoOf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WoltZUTZ0DO2Gqlc9cjLueMWi6CSiWkiWSlzw?= =?utf-8?q?mWnFIE0cDX9ziZE7Y2HXx0kYkpjJSFXT5gUfC88k2iwN9zNZl3GUjRWHG6KrKW976?= =?utf-8?q?Q+O11Ts77quxRzlgprGkV3Xl0e3P01XIC0zga7IfE7W6Z1zUGUCEkzyYFYLhcoRQ/?= =?utf-8?q?cNLsTMG7rLKO0w3ZdFeQ6fEOvZw0casm7dLZmyurE8kg8X8AYHCknsxMoGuG148aH?= =?utf-8?q?EDC8cDCrVFRYchbE4K82LHWvAHv/5OCp4UImf8Ldbda6JpeWA4Zea6r63cwMcaJS2?= =?utf-8?q?m6skhxC4wBXLtz/dIOKVsxXWJoVxo9Zoqt/EYUakZcIMOzwiN2Dg9I/00WcboDL1O?= =?utf-8?q?uK+Ze0Uu6O/WpJ/sTLIyHbQww4JIn0B6Fw=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB5941.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230038)(366014)(52116012)(376012)(1800799022)(38350700012);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?UzzeILAmwHJ7ndArKhVgDJNtx5Xc?= =?utf-8?q?RcLBB0YkjZ7ndjDa+lQxCGk8hf9I0Rm87FSBv1RNoUxVb/5x1OA4M34wWJsQ9SGaC?= =?utf-8?q?RLUkZCBbLxl5yE9Qih4ZIpNH1hTYsyxHzykUqpNjAeJHg+vmcdx8L7e5i48nzGB48?= =?utf-8?q?bZCe0+EvpMLxb9EthWF7VBN0dJBUy+ZbjSLhzY1N4+FRFyjjQlIbg6GjNZ9IDMHXa?= =?utf-8?q?kHyELteuU6GEmyqgWMHi7prBa+y4kQaiEJeEcYaexSI/X14y2n/RWqcRlUIgojCNd?= =?utf-8?q?fIcppm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e3ShGdAuVKN+pD4J6HrfWkTnLLE9lNsDsPaL8QANeM7bSEHAA2TBA+Hm9+?= =?utf-8?q?fB93tgnGMKusK8aEiDIK8ABwhSoCclC3hna7vRrp4U1Y46DSWTLkIsynoLoQ9VmDr?= =?utf-8?q?CiWKN3oRs5DIF0r9rQ7mbWwSfHJ0cbPH6Bm4Fe0SFHDvhvctaczl9c2up9rE8ef5v?= =?utf-8?q?wKMe7QiBxzq0wIOPRogShdU0duWaFTvz0kJSR3/PkS0ml0ThrQe1UVKOnCYhVpuvP?= =?utf-8?q?eaL40Y2Umxfzq8SIp+0AtzVoZYaRrIipLb8iElom9K00wzVjq3YD9kdxbau/aktHZ?= =?utf-8?q?AoqrlTUX5Gwb+vqGmLpLmXChvtWdeHJuXRRmdaFvGrunOpPSyXrNhwLg6o9spzRGe?= =?utf-8?q?QubTRZ4wEWLM?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee522686-3e92-4abd-c4a3-08dc95ac25dc X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5941.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2024 06:49:38.3499 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: MANfo4IKdSZFoIahUzy87GRh7LnmklVzBxxnOll/o7+qO8gHADXcREODXeJ11WqlQE/nvc91KZmNhXJeSRbKsQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3PR04MB7449 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240626_000355_114533_C21E1AD5 X-CRM114-Status: GOOD ( 11.89 ) 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 From: Peng Fan If there is no of_node for the protocol, there is no per protocol channel, so return false. Then it will reuse the base protocol channel per `scmi_chan_setup`. Signed-off-by: Peng Fan --- drivers/firmware/arm_scmi/mailbox.c | 2 ++ drivers/firmware/arm_scmi/optee.c | 3 +++ drivers/firmware/arm_scmi/smc.c | 7 ++++++- drivers/firmware/arm_scmi/virtio.c | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/firmware/arm_scmi/mailbox.c b/drivers/firmware/arm_scmi/mailbox.c index 0219a12e3209..4f3abc933315 100644 --- a/drivers/firmware/arm_scmi/mailbox.c +++ b/drivers/firmware/arm_scmi/mailbox.c @@ -71,6 +71,8 @@ static bool mailbox_chan_available(struct device_node *of_node, int idx) { int num_mb; + if (!of_node) + return false; /* * Just check if bidirrectional channels are involved, and check the * index accordingly; proper full validation will be made later diff --git a/drivers/firmware/arm_scmi/optee.c b/drivers/firmware/arm_scmi/optee.c index 4e7944b91e38..c0a198baa706 100644 --- a/drivers/firmware/arm_scmi/optee.c +++ b/drivers/firmware/arm_scmi/optee.c @@ -334,6 +334,9 @@ static bool scmi_optee_chan_available(struct device_node *of_node, int idx) { u32 channel_id; + if (!of_node) + return false; + return !of_property_read_u32_index(of_node, "linaro,optee-channel-id", idx, &channel_id); } diff --git a/drivers/firmware/arm_scmi/smc.c b/drivers/firmware/arm_scmi/smc.c index 39936e1dd30e..5af1f781fa10 100644 --- a/drivers/firmware/arm_scmi/smc.c +++ b/drivers/firmware/arm_scmi/smc.c @@ -81,7 +81,12 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data) static bool smc_chan_available(struct device_node *of_node, int idx) { - struct device_node *np = of_parse_phandle(of_node, "shmem", 0); + struct device_node *np; + + if (!of_node) + return false; + + np = of_parse_phandle(of_node, "shmem", 0) if (!np) return false; diff --git a/drivers/firmware/arm_scmi/virtio.c b/drivers/firmware/arm_scmi/virtio.c index 4892058445ce..4d8d6ad3ab5b 100644 --- a/drivers/firmware/arm_scmi/virtio.c +++ b/drivers/firmware/arm_scmi/virtio.c @@ -389,6 +389,9 @@ static bool virtio_chan_available(struct device_node *of_node, int idx) { struct scmi_vio_channel *channels, *vioch = NULL; + if (!of_node) + return false; + if (WARN_ON_ONCE(!scmi_vdev)) return false;