Message ID | 20230323191527.1472695-4-quic_eberman@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp3091659wrt; Thu, 23 Mar 2023 12:21:51 -0700 (PDT) Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Zypnxxwj X-Google-Smtp-Source: AK7set9UQtgCadDwGsBH59gNWIJIgMDvWT4S40/gdg9dpHtbkHdWdp/wWwuwSM985Pk3Jhp2SazU X-Received: by 2002:a17:90a:520c:b0:23f:618a:6bec with SMTP id v12-20020a17090a520c00b0023f618a6becmr8070557pjh.49.1679599311197; Thu, 23 Mar 2023 12:21:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679599311; cv=none; d=google.com; s=arc-20160816; b=gIZlOCFL01VCLjovoTVoNf7i1LdJ1OiVgEvTTjhq0Bknx2CSXGo29FFLyR79XzrhpD Igp0AnFZR8InXMshUAvco8ib5/PPyBLj0+8aseQtWpSB7KyG+EonNjk4RMWfaF0GEFKH csOei8kiCVrr/kW2LFn9KnDSplwINHkT/O6gqgjqINZUbD8Ey7a2lQDIVQ/ym5FqQULv 7YWZ1CYz9H8EmvOkBpnmSBU3ydsp/Z0UcXJBfZP8uyIm7V6/hU97wONqWbiDH7uKTDg3 0y69x3JD90UI8QRKA6TtQPRygysZfj2JfjW/XrVXyP39+LJLgu6blT1cJmWU7pnk/QME H3kQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AsLuWZMU0pEXcJlZrbFHzc7hyBlA/hDA5NWZw9Nnua0=; b=vy3iCVq50Jm59HNglO9WZeHHvLDpotzskP2rt50QUJFLGSF7GwCCE/U7TrrDJxxD9Q Jrskv0jbE6XYwqeHAxtHZ60q3cmKfdnrr4FZ9AVxVySUKcDvyKQGO1lIwYGcVYPIh4Ew lfYVRXHjw77O/2Q9UoRe8SMvoKXBH1mH0R9idGtWANsQGeClcggGhPZzhhN1oON0vVlB wLMdVWDcE/4N0TKlvNH+QRXrYRetF/d1NjOVg5dyzJKwr4Y1+9XfFwwpJUkIbb7MTxPY /svb+gjDKSm/bw8Pz7A+SGQThSGZj8jVYZX14ewiwlEpSV95DnRzCJ+QICmz7jRJGHpW XaQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Zypnxxwj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h15-20020a17090a648f00b00234ac7c8061si2483975pjj.175.2023.03.23.12.21.37; Thu, 23 Mar 2023 12:21:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=Zypnxxwj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231649AbjCWTQS (ORCPT <rfc822;ezelljr.billy@gmail.com> + 99 others); Thu, 23 Mar 2023 15:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230399AbjCWTQN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 23 Mar 2023 15:16:13 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 972C19000; Thu, 23 Mar 2023 12:16:12 -0700 (PDT) Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32NJ0Iuk026875; Thu, 23 Mar 2023 19:16:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=AsLuWZMU0pEXcJlZrbFHzc7hyBlA/hDA5NWZw9Nnua0=; b=Zypnxxwjo+Hr7M4zzmbQ69wqnivBcUAY4c/aPoIksT382qE5yXCtYSI1NRd+51f/xzht uVZ8FMXijvx9GPu7ybyx4kKGJXH5Zj/8aBl4yxPzLcuUbRe/SHyRls7+xzLEK493EY19 NKrwyST8eRvxpzr5Bn18TdiptR1lqAMkOVBvaGfkEn/htSAqD2vDy9TSDHdZgd2cwxmo p0TZjON2Neo2BiDyE++g0cDcK/0IyWG5CMpNQVEQHh21GUBHCwWeDFWVZmAZIRGoTNtZ wKE0OC0j1kMwD+hdFQHPVO8q4TMdPWKZxHQ3wZEkfjDSTHlZ8hnYzmbY0aUMYMibv6G+ fw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pgfv6a42m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 19:16:08 +0000 Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32NJG81i019385 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 23 Mar 2023 19:16:08 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 23 Mar 2023 12:16:07 -0700 From: Elliot Berman <quic_eberman@quicinc.com> To: Jassi Brar <jassisinghbrar@gmail.com>, Sudeep Holla <sudeep.holla@arm.com> CC: Elliot Berman <quic_eberman@quicinc.com>, <linux-kernel@vger.kernel.org>, <linux-acpi@vger.kernel.org>, <linux-arm-msm@vger.kernel.org> Subject: [PATCH v2 3/3] mailbox: pcc: Use mbox_bind_client Date: Thu, 23 Mar 2023 12:15:27 -0700 Message-ID: <20230323191527.1472695-4-quic_eberman@quicinc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230323191527.1472695-1-quic_eberman@quicinc.com> References: <20230323191527.1472695-1-quic_eberman@quicinc.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01a.na.qualcomm.com (10.47.209.196) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: dhYEWwJk9JL_NKKvzPjdnsCS3gGzx6lw X-Proofpoint-ORIG-GUID: dhYEWwJk9JL_NKKvzPjdnsCS3gGzx6lw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-23_12,2023-03-23_02,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 suspectscore=0 adultscore=0 mlxlogscore=665 malwarescore=0 mlxscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 impostorscore=0 clxscore=1015 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303150002 definitions=main-2303230141 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761187527171767821?= X-GMAIL-MSGID: =?utf-8?q?1761187527171767821?= |
Series |
mailbox: Allow direct registration to a channel
|
|
Commit Message
Elliot Berman
March 23, 2023, 7:15 p.m. UTC
Use generic mbox_bind_client() to bind omap mailbox channel to a client. mbox_bind_client is identical to the replaced lines, except that it: - Does the operation under con_mutex which prevents possible races in removal path - Sets TXDONE_BY_ACK if pcc uses TXDONE_BY_POLL and the client knows when tx is done. TXDONE_BY_ACK is already set if there's no interrupt, so this is not applicable. - Calls chan->mbox->ops->startup. This is usecase for requesting irq: move the devm_request_irq into the startup callback and unregister it in the shutdown path. Tested-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> --- drivers/mailbox/pcc.c | 82 ++++++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 37 deletions(-)
Comments
Hi Elliot, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on 6ccbe33a39523f6d62b22c5ee99c6695993c935e] url: https://github.com/intel-lab-lkp/linux/commits/Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 base: 6ccbe33a39523f6d62b22c5ee99c6695993c935e patch link: https://lore.kernel.org/r/20230323191527.1472695-4-quic_eberman%40quicinc.com patch subject: [PATCH v2 3/3] mailbox: pcc: Use mbox_bind_client config: ia64-allyesconfig (https://download.01.org/0day-ci/archive/20230324/202303240551.fGGqFGmo-lkp@intel.com/config) compiler: ia64-linux-gcc (GCC) 12.1.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/5db6edf9f393224193ab13e82d63e0d7616c74c9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 git checkout 5db6edf9f393224193ab13e82d63e0d7616c74c9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303240551.fGGqFGmo-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/mailbox/pcc.c: In function 'pcc_mbox_request_channel': >> drivers/mailbox/pcc.c:285:24: warning: variable 'dev' set but not used [-Wunused-but-set-variable] 285 | struct device *dev; | ^~~ drivers/mailbox/pcc.c: At top level: >> drivers/mailbox/pcc.c:355:5: warning: no previous prototype for 'pcc_startup' [-Wmissing-prototypes] 355 | int pcc_startup(struct mbox_chan *chan) | ^~~~~~~~~~~ >> drivers/mailbox/pcc.c:378:6: warning: no previous prototype for 'pcc_shutdown' [-Wmissing-prototypes] 378 | void pcc_shutdown(struct mbox_chan *chan) | ^~~~~~~~~~~~ vim +/dev +285 drivers/mailbox/pcc.c aca314efb177274 hotran 2016-08-15 267 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 268 /** 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 269 * pcc_mbox_request_channel - PCC clients call this function to 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 270 * request a pointer to their PCC subspace, from which they 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 271 * can get the details of communicating with the remote. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 272 * @cl: Pointer to Mailbox client, so we know where to bind the 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 273 * Channel. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 274 * @subspace_id: The PCC Subspace index as parsed in the PCC client 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 275 * ACPI package. This is used to lookup the array of PCC 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 276 * subspaces as parsed by the PCC Mailbox controller. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 277 * 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 278 * Return: Pointer to the PCC Mailbox Channel if successful or ERR_PTR. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 279 */ 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 280 struct pcc_mbox_chan * 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 281 pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id) 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 282 { 80b2bdde002c521 Sudeep Holla 2021-09-17 283 struct pcc_chan_info *pchan; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 284 struct mbox_chan *chan; ce028702ddbc697 Sudeep Holla 2021-09-17 @285 struct device *dev; 5db6edf9f393224 Elliot Berman 2023-03-23 286 int rc; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 287 ce028702ddbc697 Sudeep Holla 2021-09-17 288 if (subspace_id < 0 || subspace_id >= pcc_chan_count) 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 289 return ERR_PTR(-ENOENT); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 290 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 291 pchan = chan_info + subspace_id; 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 292 chan = pchan->chan.mchan; d311a28a5853857 Sudip Mukherjee 2015-09-16 293 if (IS_ERR(chan) || chan->cl) { 960c4056aadcf61 Sudeep Holla 2021-12-09 294 pr_err("Channel not found for idx: %d\n", subspace_id); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 295 return ERR_PTR(-EBUSY); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 296 } ce028702ddbc697 Sudeep Holla 2021-09-17 297 dev = chan->mbox->dev; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 298 5db6edf9f393224 Elliot Berman 2023-03-23 299 rc = mbox_bind_client(chan, cl); 5db6edf9f393224 Elliot Berman 2023-03-23 300 if (rc) 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 301 return ERR_PTR(rc); aca314efb177274 hotran 2016-08-15 302 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 303 return &pchan->chan; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 304 } 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 305 EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 306 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 307 /** 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 308 * pcc_mbox_free_channel - Clients call this to free their Channel. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 309 * 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 310 * @pchan: Pointer to the PCC mailbox channel as returned by 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 311 * pcc_mbox_request_channel() 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 312 */ 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 313 void pcc_mbox_free_channel(struct pcc_mbox_chan *pchan) 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 314 { 7b6da7fe7bba1cd Sudeep Holla 2021-09-17 315 struct mbox_chan *chan = pchan->mchan; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 316 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 317 if (!chan || !chan->cl) 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 318 return; 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 319 5db6edf9f393224 Elliot Berman 2023-03-23 320 mbox_free_channel(chan); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 321 } 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 322 EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 323 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 324 /** 33350e6b1833b15 Ashwin Chaugule 2015-01-27 325 * pcc_send_data - Called from Mailbox Controller code. Used 33350e6b1833b15 Ashwin Chaugule 2015-01-27 326 * here only to ring the channel doorbell. The PCC client 33350e6b1833b15 Ashwin Chaugule 2015-01-27 327 * specific read/write is done in the client driver in 33350e6b1833b15 Ashwin Chaugule 2015-01-27 328 * order to maintain atomicity over PCC channel once 33350e6b1833b15 Ashwin Chaugule 2015-01-27 329 * OS has control over it. See above for flow of operations. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 330 * @chan: Pointer to Mailbox channel over which to send data. 33350e6b1833b15 Ashwin Chaugule 2015-01-27 331 * @data: Client specific data written over channel. Used here 33350e6b1833b15 Ashwin Chaugule 2015-01-27 332 * only for debug after PCC transaction completes. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 333 * 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 334 * Return: Err if something failed else 0 for success. 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 335 */ 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 336 static int pcc_send_data(struct mbox_chan *chan, void *data) 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 337 { c45ded7e11352d7 Sudeep Holla 2021-09-17 338 int ret; bf18123e78f4d13 Sudeep Holla 2021-09-17 339 struct pcc_chan_info *pchan = chan->con_priv; 8b0f57889843af6 Prakash, Prashanth 2016-02-17 340 c45ded7e11352d7 Sudeep Holla 2021-09-17 341 ret = pcc_chan_reg_read_modify_write(&pchan->cmd_update); c45ded7e11352d7 Sudeep Holla 2021-09-17 342 if (ret) c45ded7e11352d7 Sudeep Holla 2021-09-17 343 return ret; c45ded7e11352d7 Sudeep Holla 2021-09-17 344 bf18123e78f4d13 Sudeep Holla 2021-09-17 345 return pcc_chan_reg_read_modify_write(&pchan->db); 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 346 } 86c22f8c9a3b71d Ashwin Chaugule 2014-11-12 347 5db6edf9f393224 Elliot Berman 2023-03-23 348 /** 5db6edf9f393224 Elliot Berman 2023-03-23 349 * pcc_startup - Called from Mailbox Controller code. Used here 5db6edf9f393224 Elliot Berman 2023-03-23 350 * to request the interrupt. 5db6edf9f393224 Elliot Berman 2023-03-23 351 * @chan: Pointer to Mailbox channel to startup. 5db6edf9f393224 Elliot Berman 2023-03-23 352 * 5db6edf9f393224 Elliot Berman 2023-03-23 353 * Return: Err if something failed else 0 for success. 5db6edf9f393224 Elliot Berman 2023-03-23 354 */ 5db6edf9f393224 Elliot Berman 2023-03-23 @355 int pcc_startup(struct mbox_chan *chan) 5db6edf9f393224 Elliot Berman 2023-03-23 356 { 5db6edf9f393224 Elliot Berman 2023-03-23 357 struct pcc_chan_info *pchan = chan->con_priv; 5db6edf9f393224 Elliot Berman 2023-03-23 358 int rc; 5db6edf9f393224 Elliot Berman 2023-03-23 359 5db6edf9f393224 Elliot Berman 2023-03-23 360 if (pchan->plat_irq > 0) { 5db6edf9f393224 Elliot Berman 2023-03-23 361 rc = devm_request_irq(chan->mbox->dev, pchan->plat_irq, pcc_mbox_irq, 0, 5db6edf9f393224 Elliot Berman 2023-03-23 362 MBOX_IRQ_NAME, chan); 5db6edf9f393224 Elliot Berman 2023-03-23 363 if (unlikely(rc)) { 5db6edf9f393224 Elliot Berman 2023-03-23 364 dev_err(chan->mbox->dev, "failed to register PCC interrupt %d\n", 5db6edf9f393224 Elliot Berman 2023-03-23 365 pchan->plat_irq); 5db6edf9f393224 Elliot Berman 2023-03-23 366 return rc; 5db6edf9f393224 Elliot Berman 2023-03-23 367 } 5db6edf9f393224 Elliot Berman 2023-03-23 368 } 5db6edf9f393224 Elliot Berman 2023-03-23 369 5db6edf9f393224 Elliot Berman 2023-03-23 370 return 0; 5db6edf9f393224 Elliot Berman 2023-03-23 371 } 5db6edf9f393224 Elliot Berman 2023-03-23 372 5db6edf9f393224 Elliot Berman 2023-03-23 373 /** 5db6edf9f393224 Elliot Berman 2023-03-23 374 * pcc_shutdown - Called from Mailbox Controller code. Used here 5db6edf9f393224 Elliot Berman 2023-03-23 375 * to free the interrupt. 5db6edf9f393224 Elliot Berman 2023-03-23 376 * @chan: Pointer to Mailbox channel to shutdown. 5db6edf9f393224 Elliot Berman 2023-03-23 377 */ 5db6edf9f393224 Elliot Berman 2023-03-23 @378 void pcc_shutdown(struct mbox_chan *chan) 5db6edf9f393224 Elliot Berman 2023-03-23 379 { 5db6edf9f393224 Elliot Berman 2023-03-23 380 struct pcc_chan_info *pchan = chan->con_priv; 5db6edf9f393224 Elliot Berman 2023-03-23 381 5db6edf9f393224 Elliot Berman 2023-03-23 382 if (pchan->plat_irq > 0) 5db6edf9f393224 Elliot Berman 2023-03-23 383 devm_free_irq(chan->mbox->dev, pchan->plat_irq, chan); 5db6edf9f393224 Elliot Berman 2023-03-23 384 } 5db6edf9f393224 Elliot Berman 2023-03-23 385
Hi Elliot, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on 6ccbe33a39523f6d62b22c5ee99c6695993c935e] url: https://github.com/intel-lab-lkp/linux/commits/Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 base: 6ccbe33a39523f6d62b22c5ee99c6695993c935e patch link: https://lore.kernel.org/r/20230323191527.1472695-4-quic_eberman%40quicinc.com patch subject: [PATCH v2 3/3] mailbox: pcc: Use mbox_bind_client config: i386-randconfig-a015 (https://download.01.org/0day-ci/archive/20230324/202303241039.usKTcpEw-lkp@intel.com/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/5db6edf9f393224193ab13e82d63e0d7616c74c9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 git checkout 5db6edf9f393224193ab13e82d63e0d7616c74c9 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/mailbox/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303241039.usKTcpEw-lkp@intel.com/ All warnings (new ones prefixed by >>): drivers/mailbox/pcc.c:285:17: warning: variable 'dev' set but not used [-Wunused-but-set-variable] struct device *dev; ^ >> drivers/mailbox/pcc.c:355:5: warning: no previous prototype for function 'pcc_startup' [-Wmissing-prototypes] int pcc_startup(struct mbox_chan *chan) ^ drivers/mailbox/pcc.c:355:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int pcc_startup(struct mbox_chan *chan) ^ static >> drivers/mailbox/pcc.c:378:6: warning: no previous prototype for function 'pcc_shutdown' [-Wmissing-prototypes] void pcc_shutdown(struct mbox_chan *chan) ^ drivers/mailbox/pcc.c:378:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void pcc_shutdown(struct mbox_chan *chan) ^ static 3 warnings generated. vim +/pcc_startup +355 drivers/mailbox/pcc.c 347 348 /** 349 * pcc_startup - Called from Mailbox Controller code. Used here 350 * to request the interrupt. 351 * @chan: Pointer to Mailbox channel to startup. 352 * 353 * Return: Err if something failed else 0 for success. 354 */ > 355 int pcc_startup(struct mbox_chan *chan) 356 { 357 struct pcc_chan_info *pchan = chan->con_priv; 358 int rc; 359 360 if (pchan->plat_irq > 0) { 361 rc = devm_request_irq(chan->mbox->dev, pchan->plat_irq, pcc_mbox_irq, 0, 362 MBOX_IRQ_NAME, chan); 363 if (unlikely(rc)) { 364 dev_err(chan->mbox->dev, "failed to register PCC interrupt %d\n", 365 pchan->plat_irq); 366 return rc; 367 } 368 } 369 370 return 0; 371 } 372 373 /** 374 * pcc_shutdown - Called from Mailbox Controller code. Used here 375 * to free the interrupt. 376 * @chan: Pointer to Mailbox channel to shutdown. 377 */ > 378 void pcc_shutdown(struct mbox_chan *chan) 379 { 380 struct pcc_chan_info *pchan = chan->con_priv; 381 382 if (pchan->plat_irq > 0) 383 devm_free_irq(chan->mbox->dev, pchan->plat_irq, chan); 384 } 385
Hi Elliot, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on 6ccbe33a39523f6d62b22c5ee99c6695993c935e] url: https://github.com/intel-lab-lkp/linux/commits/Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 base: 6ccbe33a39523f6d62b22c5ee99c6695993c935e patch link: https://lore.kernel.org/r/20230323191527.1472695-4-quic_eberman%40quicinc.com patch subject: [PATCH v2 3/3] mailbox: pcc: Use mbox_bind_client config: x86_64-randconfig-s022 (https://download.01.org/0day-ci/archive/20230324/202303241233.htC8Sxvg-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-8) 11.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.4-39-gce1a6720-dirty # https://github.com/intel-lab-lkp/linux/commit/5db6edf9f393224193ab13e82d63e0d7616c74c9 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Elliot-Berman/mailbox-Allow-direct-registration-to-a-channel/20230324-031813 git checkout 5db6edf9f393224193ab13e82d63e0d7616c74c9 # save the config file mkdir build_dir && cp config build_dir/.config make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 olddefconfig make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/mailbox/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303241233.htC8Sxvg-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/mailbox/pcc.c:355:5: sparse: sparse: symbol 'pcc_startup' was not declared. Should it be static? >> drivers/mailbox/pcc.c:378:6: sparse: sparse: symbol 'pcc_shutdown' was not declared. Should it be static?
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c index 105d46c9801b..3a025415c5d5 100644 --- a/drivers/mailbox/pcc.c +++ b/drivers/mailbox/pcc.c @@ -283,7 +283,7 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id) struct pcc_chan_info *pchan; struct mbox_chan *chan; struct device *dev; - unsigned long flags; + int rc; if (subspace_id < 0 || subspace_id >= pcc_chan_count) return ERR_PTR(-ENOENT); @@ -296,30 +296,9 @@ pcc_mbox_request_channel(struct mbox_client *cl, int subspace_id) } dev = chan->mbox->dev; - spin_lock_irqsave(&chan->lock, flags); - chan->msg_free = 0; - chan->msg_count = 0; - chan->active_req = NULL; - chan->cl = cl; - init_completion(&chan->tx_complete); - - if (chan->txdone_method == TXDONE_BY_POLL && cl->knows_txdone) - chan->txdone_method = TXDONE_BY_ACK; - - spin_unlock_irqrestore(&chan->lock, flags); - - if (pchan->plat_irq > 0) { - int rc; - - rc = devm_request_irq(dev, pchan->plat_irq, pcc_mbox_irq, 0, - MBOX_IRQ_NAME, chan); - if (unlikely(rc)) { - dev_err(dev, "failed to register PCC interrupt %d\n", - pchan->plat_irq); - pcc_mbox_free_channel(&pchan->chan); - return ERR_PTR(rc); - } - } + rc = mbox_bind_client(chan, cl); + if (rc) + return ERR_PTR(rc); return &pchan->chan; } @@ -333,23 +312,12 @@ EXPORT_SYMBOL_GPL(pcc_mbox_request_channel); */ void pcc_mbox_free_channel(struct pcc_mbox_chan *pchan) { - struct pcc_chan_info *pchan_info = to_pcc_chan_info(pchan); struct mbox_chan *chan = pchan->mchan; - unsigned long flags; if (!chan || !chan->cl) return; - if (pchan_info->plat_irq > 0) - devm_free_irq(chan->mbox->dev, pchan_info->plat_irq, chan); - - spin_lock_irqsave(&chan->lock, flags); - chan->cl = NULL; - chan->active_req = NULL; - if (chan->txdone_method == TXDONE_BY_ACK) - chan->txdone_method = TXDONE_BY_POLL; - - spin_unlock_irqrestore(&chan->lock, flags); + mbox_free_channel(chan); } EXPORT_SYMBOL_GPL(pcc_mbox_free_channel); @@ -377,8 +345,48 @@ static int pcc_send_data(struct mbox_chan *chan, void *data) return pcc_chan_reg_read_modify_write(&pchan->db); } +/** + * pcc_startup - Called from Mailbox Controller code. Used here + * to request the interrupt. + * @chan: Pointer to Mailbox channel to startup. + * + * Return: Err if something failed else 0 for success. + */ +int pcc_startup(struct mbox_chan *chan) +{ + struct pcc_chan_info *pchan = chan->con_priv; + int rc; + + if (pchan->plat_irq > 0) { + rc = devm_request_irq(chan->mbox->dev, pchan->plat_irq, pcc_mbox_irq, 0, + MBOX_IRQ_NAME, chan); + if (unlikely(rc)) { + dev_err(chan->mbox->dev, "failed to register PCC interrupt %d\n", + pchan->plat_irq); + return rc; + } + } + + return 0; +} + +/** + * pcc_shutdown - Called from Mailbox Controller code. Used here + * to free the interrupt. + * @chan: Pointer to Mailbox channel to shutdown. + */ +void pcc_shutdown(struct mbox_chan *chan) +{ + struct pcc_chan_info *pchan = chan->con_priv; + + if (pchan->plat_irq > 0) + devm_free_irq(chan->mbox->dev, pchan->plat_irq, chan); +} + static const struct mbox_chan_ops pcc_chan_ops = { .send_data = pcc_send_data, + .startup = pcc_startup, + .shutdown = pcc_shutdown, }; /**