Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp1046418imi; Fri, 22 Jul 2022 16:02:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vh0qsay/k6qqKoRGt5kPG0FA5vfM2r+uRWfWEgYNPUAdFvgbDWE98D7vzHp/hdN8aGulEN X-Received: by 2002:a05:6a00:bc5:b0:52b:49c9:d26c with SMTP id x5-20020a056a000bc500b0052b49c9d26cmr1932648pfu.73.1658530928622; Fri, 22 Jul 2022 16:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658530928; cv=none; d=google.com; s=arc-20160816; b=tLNLCdvq186rc9cdRBYkB/Li8Vj9Rx9R44/24jBpaowJUdF/m8IUn3tj1lKqaGcVzQ cgD8TKRUkS7p7p2IGQQlcRUYWbA78SZ7sosn6843S7T5WOgLpn0QiYewBGNguqEnFdyM 0nTOfTtQuIx+xSaQjU4VLbAA8GGjUVahX94zIbxcGG9MTfRKlEAuzk0biWRKLlQrhMEi b8XIPNKp/UkaEiegBc3CqmPL1c6FRfQH25ggle3GCBgzRypz8gIwYe0KqrfmxEFcQC5c 9a+xCN6F+WqbR3S4CF7INJT8vgMbWsAbjzZK19R/bNRHwCsNRJiTJYcR446JphDmG32g JiWQ== 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=GKC8VfcyGF4rHCVnV7RvZpNWBnM1QHRzWAdSlQXvS9I=; b=dbQJNtprzEaXZIObKYdoF7QxiXvURBKHzI8Yf2kuCxFhVhTYhNC+ELpiVQqqwO+Lkf IdBfwrN+E8xH3Mn2hsYhM3EqbEriarnyrinx5RwMD1UTj7k01ox9897ktyRhHdMXFZVF p6f78HPDqLKD1ipeGW2ck+qrVCdbc+rJBfyAdOmq4sxhi+G43YM3ZSxwLnIvpPw1YZMF DrtYmlWvRHcfELj9qLi2VPqJx1qEYCxRv66KelYvxhtOct4vBxkVeV8O6tI6p0VySRqF aCID2aHi83ASCAkDlXV+gAnAFw3G5zAPswm38Yc7TPLI2OsA4vimFP5KidrmxBU4Xldw zoWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=SXXqrNYw; 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 e16-20020a17090301d000b0016a71886b5bsi7879218plh.160.2022.07.22.16.01.53; Fri, 22 Jul 2022 16:02:08 -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=SXXqrNYw; 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 S237071AbiGVWkW (ORCPT + 99 others); Fri, 22 Jul 2022 18:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236966AbiGVWkB (ORCPT ); Fri, 22 Jul 2022 18:40:01 -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 31D9B20F47; Fri, 22 Jul 2022 15:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1658529498; x=1690065498; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=GKC8VfcyGF4rHCVnV7RvZpNWBnM1QHRzWAdSlQXvS9I=; b=SXXqrNYw4fxD8U99utCIfrl/T4mAmwfrD/sbG5fAZAvzMaRwF8PRRtIh CvSa9ozqhYrWFiPng7NWgpGJ267YElNVb/nMiG0qSiV+eNZlIpkamLCqV JeJZiTHf05VXHAyVMx5k/pc+dMG/P4qTlEIyaIcaVs8iQlB/E9WJDOkBI U=; Received: from unknown (HELO ironmsg-SD-alpha.qualcomm.com) ([10.53.140.30]) by alexa-out-sd-02.qualcomm.com with ESMTP; 22 Jul 2022 15:37:25 -0700 X-QCInternal: smtphost Received: from nasanex01b.na.qualcomm.com ([10.46.141.250]) by ironmsg-SD-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jul 2022 15:37:25 -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; Fri, 22 Jul 2022 15:37:25 -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 v2 0/5] SCM: Add support for wait-queue aware firmware Date: Fri, 22 Jul 2022 15:37:13 -0700 Message-ID: <1658529438-9234-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 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. --- v2: - Changes made to patches 4 and 5 are listed therein. - Rebased dt-bindings on top of the YAML conversion patch [1]. [1] https://lore.kernel.org/lkml/20220708090431.30437-1-david@ixit.cz/ --- 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.yaml | 10 ++ drivers/firmware/qcom_scm-smc.c | 140 +++++++++++++++++++-- drivers/firmware/qcom_scm.c | 125 +++++++++++++++++- drivers/firmware/qcom_scm.h | 14 +++ 4 files changed, 279 insertions(+), 10 deletions(-) -- 2.7.4