Message ID | 20230113065303.17727-1-quic_sibis@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp130916wrt; Thu, 12 Jan 2023 23:22:48 -0800 (PST) X-Google-Smtp-Source: AMrXdXsiMKz9OgrnZo0yXQa4b+1Nfqxu4FMLDx4qHL81JQpK3/PvyOkSR143IAIWx9/jMFLdgF2s X-Received: by 2002:a05:6a20:b91c:b0:b2:4327:fa6c with SMTP id fe28-20020a056a20b91c00b000b24327fa6cmr79423962pzb.18.1673594568409; Thu, 12 Jan 2023 23:22:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673594568; cv=none; d=google.com; s=arc-20160816; b=aEza1PGMz/e7xSaeoXH1J7PK3FXA6g4uUd/Mbjuq2CT6i+s8bq/QH41FTqBXM+qboC T8t1odJWy4hkIY4CdXibiXRoX7Hyjt2F2c65fEAjL3JmNSpQghXwpfp8iGqVU4GsMvBT KtD2d4kdRkUWVri6NE5sTx8tQ+iWq5a526O1M0l4cO2MtmGJraNmQdMeRNeRiX5o5aYj IlV8r7uUyvVqHwMofhhSBHaUYVE+C4Mmtr6t0TZ2y86Ma3Xb9NMiHuq3or6KpdOihqj5 BwS7V3/vJ9PW+7nh0SuAna3W1PrVedw5XfdVtENP+X895Zftgc4dSXi2VaG+8ML25Tig wh6g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=HZnJnnwEZlMBESYM6rtfOpHK2ZPlEFDOVBIjxMPrNtM=; b=cUE6vXNghMTf0neaBMf3dFeV7syhCumhgC2F9jPKNIQ0bXEkv+ISTydkvDWWetD30p jJbkJo70tG7fbh4yCLTS1sCc6WZoWneMGXbjBDY9VsTXwbZg6V+AoB4xw2VZoTXwhzYT hPaDstL2AL6un+erPIHW5HC8zAA5+Xggnw/mqAkfF0l45Eo3KxF8Bw5cFjGAGyNvuzxW LGKibEdK0tzroNu+K30Irk1Iv3Oz4y15EI1ytK6sMuDmsX5TemFK1Nokdt2/IJZIBf5l +dvQNAfXlrPCihmFXXDb+0+IGxsvWf29vyMExnedNDmV5UBxgY1g+uPv4xf1PbT5XPYU zrTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=IY6XaaBB; 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 d9-20020a631d09000000b004c5936dd6e1si93689pgd.201.2023.01.12.23.22.35; Thu, 12 Jan 2023 23:22:48 -0800 (PST) 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=IY6XaaBB; 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 S241213AbjAMHGB (ORCPT <rfc822;zhuangel570@gmail.com> + 99 others); Fri, 13 Jan 2023 02:06:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240573AbjAMHF3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 13 Jan 2023 02:05:29 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D8826E422; Thu, 12 Jan 2023 22:54:12 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30D69rPe021783; Fri, 13 Jan 2023 06:54:04 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=qcppdkim1; bh=HZnJnnwEZlMBESYM6rtfOpHK2ZPlEFDOVBIjxMPrNtM=; b=IY6XaaBBTfIc6TRuFVMHQHy034w4ZECr6iod9mUAikFPIIZB/5/0wbV0fuGFkq5REd0O ZxsV41DnuzFMrLQCKDxIte8fWy5+q01z7TvN0uqSWWMGjE9kbmL9grd0t3bq2Fz7MPm8 2NPhCzgshbW7XvgngsSvYGWIkJ2+CVeoQ5ViEN2kVI58ZtT8iu8yOlxz5ViwomVpzH3a XXrhVhXz6rpw4FacP2HRrnhEhvbkMzM7Liqx/AUZxk8r78XCmKZAi56KLCxRHY6LtDUz FyW14QTY3s5l8vkwQvqzZTOdZpHMZ5e1vVm93pMiRomxRY79ZAKwx4pdOciEG3YUQuwi zw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n2wun0g12-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 06:54:03 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30D6s3cd002572 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 13 Jan 2023 06:54:03 GMT Received: from blr-ubuntu-87.ap.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Thu, 12 Jan 2023 22:53:58 -0800 From: Sibi Sankar <quic_sibis@quicinc.com> To: <andersson@kernel.org>, <srinivas.kandagatla@linaro.org> CC: <agross@kernel.org>, <linux-arm-msm@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <robh+dt@kernel.org>, <konrad.dybcio@somainline.org>, <robimarko@gmail.com>, <quic_gurus@quicinc.com>, Sibi Sankar <quic_sibis@quicinc.com> Subject: [PATCH V9 0/2] SCM: Add support for wait-queue aware firmware Date: Fri, 13 Jan 2023 12:23:00 +0530 Message-ID: <20230113065303.17727-1-quic_sibis@quicinc.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: zZaxL6uLv4AbWOj2jauSTfg2N_hyoaa4 X-Proofpoint-GUID: zZaxL6uLv4AbWOj2jauSTfg2N_hyoaa4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-13_03,2023-01-12_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 phishscore=0 malwarescore=0 spamscore=0 bulkscore=0 mlxscore=0 priorityscore=1501 adultscore=0 suspectscore=0 impostorscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301130047 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham 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?1754891098374337663?= X-GMAIL-MSGID: =?utf-8?q?1754891098374337663?= |
Series |
SCM: Add support for wait-queue aware firmware
|
|
Message
Sibi Sankar
Jan. 13, 2023, 6:53 a.m. UTC
This patch series enables the QCOM SCM driver to support firmware (FW) versions that expect the high-level OS (HLOS) to be tolerant of SCM call requests not being processed right away and, instead, being placed on a wait-queue in FW and processed accordingly. The problem this feature is fixing is as follows. In a scenario where there is a VM in addition to HLOS (and an underlying hypervisor): 1. HLOS makes an SMC call on core 5 2. The hypervisor scheduling interrupt interrupts this SMC call. 3. The hypervisor schedules the VM on core 5. 4. The VM makes an SMC call on core 5. 5. The SMC call is non-interruptibly stuck on FW spinlock on core 5. 6. HLOS cannot reschedule since core 5 is not responding to Reschedule IPIs. 7. Watchdog timer expires waiting for core 5. This problem is solved by FW returning a new return code SCM_WAITQ_SLEEP to HLOS right away when it is overwhelmed by the VM's SMC call. HLOS then places the call on a wait-queue and wakes it up when it receives an interrupt that signifies "all-clear". There are two new SMC calls also being defined in this design that, together with one new return code, form the handshake protocol between Linux and FW. This design is also backwards-compatible with existing firmware versions that do not support this feature. V9: - Drop unused complete_all [Srini] v8: - Rename qcom_scm_lookup_wq to qcom_scm_assert_valid_wq_ctx [Bjorn] - Document wq_ctx limitations [Guru] - Drop dev check and add include completion header [Srini] - Rename qcom_scm_lookup_completion to qcom_scm_wait_for_wq_completion. v7: - Move lookup + wait_for_completion into a single function in qcom_scm [Bjorn] - Simplify completion retrieval [Bjorn] v6: - Fix subject of bindings [Krzysztof] - Update commit message to include the SoC supporting the feature [Krzysztof] - Make the interrupt property valid on SM8450 SoC [Krzysztof] - Fix misc. nits in the scm driver [Krzysztof] - Rebased on Krzysztof's narrow clocks and interconnect series. v5: - Pick up R-b - Handle the wake_one/wake_all flags [Guru] - Rename flag handler to qcom_scm_waitq_wakeup [Bjorn] - Resume scm call can return ebusy as well handle that scenario by retrying the original smc call and not the resume call v4: - platform_set_drvdata will be used by __scm_smc_do_quirk_handle_waitq to get access to scm struct from device so retain it - Use a single completion as it satisfies all of the current usecases [Bjorn] - Inline scm_get_wq_ctx [Bjorn] - Convert all pr_err to dev_err [Bjorn] - Handle idr_destroy in a thread safe manner [Bjorn] - Misc. Style fixes [Bjorn] - Qualify bindings [Krzysztoff] v3: - Drop allow-multi-call property since HLOS doesn't completely support it yet. - Fixup irq handling so as not to affect SoCs without the interrupt. - Fix warnings reported by kernel test-bot. v2: - Changes made to patches 4 and 5 are listed therein. - Rebased dt-bindings on top of the YAML conversion patch [1]. Guru Das Srinagesh (2): dt-bindings: firmware: qcom,scm: Add optional interrupt firmware: qcom: scm: Add wait-queue handling logic .../bindings/firmware/qcom,scm.yaml | 18 ++++ drivers/firmware/qcom_scm-smc.c | 87 ++++++++++++++++-- drivers/firmware/qcom_scm.c | 90 ++++++++++++++++++- drivers/firmware/qcom_scm.h | 8 ++ 4 files changed, 195 insertions(+), 8 deletions(-)