Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3277768iog; Mon, 27 Jun 2022 12:46:16 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uVzods/P53BHIrNoXhyzxNpgkdAA4ZmU4l1j2GIvj8IwjlWbvG6OV2SNn//L2Jix9UYwri X-Received: by 2002:a05:6402:294c:b0:435:2155:fbe8 with SMTP id ed12-20020a056402294c00b004352155fbe8mr19136143edb.256.1656359176784; Mon, 27 Jun 2022 12:46:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656359176; cv=none; d=google.com; s=arc-20160816; b=aDn1lBGcABxGk2J3OQ1f1NcNSBTDAKPOUwFkixag/w2FjAnJi63SfiF0Dkm61F0FGq ra4C+832C2tO1Nkygbmk3LdAxBouarfmgBDGCFRe9DfFG7tyIPF6QDgujF/9kuLee4cd HacBMI7mB6AfjwK031ADiLeFqFzknSU8G9JKbKCyBkLzajFQwnuUjS8NK/6Z72LUm2Am 8cJao1zYwth6JHr4ay0GK/ybHOdzleWS/ACLZtwYwDcN4mR3YiG2CQQ9bPyH/nf3IOP5 rztOAYARWpX3iGRzJqE1ec6IUM/wDxB/dmtawp+QF6fF+BQaX7knr5WqEuUgsAfyV/+a GF7Q== 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=EKcrWv1hq/h1NGE3SQ79xrzHsQ93vU4b2aszg+ojf1c=; b=qIQ+eL0zsPz9/e8HZjDhaB7LzroxQScJ2MwnVytDdZ0y5FpdmcYkWuG/Y5ko+cL8T+ kp1QEn8HwRJI5eylI9W9DpQSovcQOrC6obQgoROxXD3bC/2VL5yK29w9FPIhiRzWN3+J k2KPrxx81rQY/EE/fpl7nwTpg1h2T6qj0CXktN7cUK0m3SZ4mhl2T7UKny28JNsOtj2P 6VqZUObY4hT8zcsNhJuEVitGGgeGsiY7lUTzx+egJo8mOTCr81RDtLiSDnOlryzinbuE hZ/eYzAJyj+6X9DPTrYj2Ev7iFFd99WmSiQXbBkZBIZ57GGSaBHxVrMrsbhOayPibil5 52LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=fGEhRVGU; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hu8-20020a170907a08800b00722e080823bsi13785084ejc.385.2022.06.27.12.45.50; Mon, 27 Jun 2022 12:46:16 -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=qcdkim header.b=fGEhRVGU; 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 S240648AbiF0Tou (ORCPT + 99 others); Mon, 27 Jun 2022 15:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231872AbiF0Tot (ORCPT ); Mon, 27 Jun 2022 15:44:49 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1DB419026; Mon, 27 Jun 2022 12:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1656359087; x=1687895087; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EKcrWv1hq/h1NGE3SQ79xrzHsQ93vU4b2aszg+ojf1c=; b=fGEhRVGUIjMIudqUUa0aLDMqwLKzx5iighcz29t594Oag70d/NBx5/pi R67oe+fl4JYHrXOv3mZx7OnKm/I4gqmX7OGKy0mNMdhGap2+f9w5Bd34c H/xCJNrnNQRnT1MC3MxVnfVpCTxxl9QUYvzjLhpw84FYhQN5LPouZANjH Y=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 27 Jun 2022 12:44:47 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 12:44:47 -0700 Received: from hu-gurus-sd.qualcomm.com (10.80.80.8) 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.22; Mon, 27 Jun 2022 12:44:47 -0700 From: Guru Das Srinagesh To: Andy Gross , Bjorn Andersson , Philipp Zabel , , CC: David Heidelberg , Robert Marko , Rajendra Nayak , Elliot Berman , Guru Das Srinagesh Subject: [PATCH 0/5] SCM: Add support for wait-queue aware firmware Date: Mon, 27 Jun 2022 12:44:31 -0700 Message-ID: <1656359076-13018-1-git-send-email-quic_gurus@quicinc.com> X-Mailer: git-send-email 2.7.4 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 nasanex01b.na.qualcomm.com (10.46.141.250) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org 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". This new design also supports scenarios involving only HLOS (and no other VMs). Such scenarios make use of a second new return code SCM_WAITQ_WAKE. There are three new SMC calls also being defined in this design that, together with the two new return codes, form the handshake protocol between Linux and FW. This design is also backwards-compatible with existing firmware versions that do not support this feature. Guru Das Srinagesh (5): dt-bindings: firmware: qcom-scm: Add "allow-multi-call" property firmware: qcom: scm: Optionally remove SCM call serialization dt-bindings: firmware: qcom-scm: Add optional interrupt firmware: qcom: scm: Add wait-queue helper functions firmware: qcom: scm: Add wait-queue handling logic .../devicetree/bindings/firmware/qcom,scm.txt | 4 + drivers/firmware/qcom_scm-smc.c | 143 +++++++++++++++++++-- drivers/firmware/qcom_scm.c | 124 +++++++++++++++++- drivers/firmware/qcom_scm.h | 14 ++ 4 files changed, 275 insertions(+), 10 deletions(-) -- 2.7.4