From patchwork Sat Nov 12 20:07:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1412073wru; Sat, 12 Nov 2022 12:09:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4mbddk3bXpnE71b94JXB9QXLvpKqH6d7XhJw0BTV32fY74Jhyqk0Ms4IPuqXrUc2gSpxBj X-Received: by 2002:a63:f908:0:b0:475:2f42:7638 with SMTP id h8-20020a63f908000000b004752f427638mr5083689pgi.439.1668283753438; Sat, 12 Nov 2022 12:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668283753; cv=none; d=google.com; s=arc-20160816; b=m+5HWcyC79SUWYZ4PNzoa55uuZvm/uyfK1db5GIB8tLNBoPICqQXcEwjc0oepe8hnE /gGi45ygh6R9kktxliWg6rsqVjiogfgzUHe1VJCyolzH0C0BHn6KRCYkvOQW69jTNbyl jNVjOAkXRGF3Bk/I+3hf5JnDqhxw6ysmdOGJjxFLR9sdO36Db7TlenPD8bDnaoBfIq76 UNh0sGhXe13KY62OWah40lTgeRyqbfmqCJ4jOzKn6l5mwQZSnqU8z6iCFIqodN7U3sZe 7KADrJJpKRDt4pkqQil9JGwQuh71gGxerDlq874w0iFZLDHBPVrkC0AUODughkZu+LWr Jbjg== 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=aloX78xpt1ZUhhk2B4r0yIdFbVyMyxb0348xtj6qFfc=; b=oR9mBfx647KZM5ZMsk77YZAj6Gf+XyECNqZ1/VRpkfZyCvCDKTyFdqV93mdUmZkhP1 MCbmqaG1XyF3t7T9dRfXcsUhS4eAZl2RAPpqFNZwBgTSlDinDuiJE0+DbWiEwq3Aklwc YRrjH5e9vnULxZY4aAPFfEigDsUqXvxXtN3ROkkotTpHG4Br/6vn6py8UIViIJ5K8uqI WmaoiGY67cXcpd5xwSs+mup0chdJQU+CWiMLFpAduyQ4cndjuw/a8m3iATDCpmcLzNWb /LWmxPshsxdMzBeH5RVBLFJW3THpTRcu9xw30cnwukeqINlQJX/sjovk2g1DETkMBRQk UYmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TT3fdj5l; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e128-20020a636986000000b0046b2752dcbcsi6137408pgc.590.2022.11.12.12.08.59; Sat, 12 Nov 2022 12:09:13 -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=@linaro.org header.s=google header.b=TT3fdj5l; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234922AbiKLUHe (ORCPT + 99 others); Sat, 12 Nov 2022 15:07:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbiKLUH0 (ORCPT ); Sat, 12 Nov 2022 15:07:26 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26ED315A21 for ; Sat, 12 Nov 2022 12:07:24 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id c7so3028884iof.13 for ; Sat, 12 Nov 2022 12:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aloX78xpt1ZUhhk2B4r0yIdFbVyMyxb0348xtj6qFfc=; b=TT3fdj5lcRdlBtkMD5vkH+ZZoUO3bL/WA3FBAh0BI7eO+orVVn1dNt7qAlAegJ0Lss UemR8GUQyxIv6pQufwfd6UaPhavZRdvi5PuzA+bLQD8c0BQ6fXIN0qqeIdt6J4ZGj+X2 wisjKxowPvttRKTgiyUy0zTgxcSrpgXShkJdmGUIzojI84JPdhWW8f3LMw5ZZiy+rbgD 5+x7Yzr9FaF8OTiZplpQB9FKZaWoHRgzKN+sPJvtgSwoPK36TE0xHYB3qBjORbGKZj3n j4F4BTi/qO0yIJamHJMEEJDHFLAcxb97dlxm6RtK2OaRVmMV0GFoqx4kgNT0q3PGxS2p xGeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aloX78xpt1ZUhhk2B4r0yIdFbVyMyxb0348xtj6qFfc=; b=UCS5aLrquV8gBpRJUv5yxhdE6jBwv6tSb/xOjF3FQA9j0KUIn+3L110ijBAFtIjzx7 t/RjafJrEkO+ybe1EbITeC01ubMyLYNYQ+RceAhhTgAbOngIFH4O5KPBtDAM7Vh3v89s HI7w4zEicuw5SoY+bt2Ow1Yg9Sx1F208nmodwEdeIzEia/6ozq4DFrMQlmcMVeVLPebp RmZ9sYOfzPCVbxPtPgKoqM5tizlu/MhTlHHoaGNF3KQfNhhj0rIlTQKk5NSGvQKj5EMj G5QZ/JsflHLT2FntDJEmBtYBoEZo3cPWNdo/bPVLUNHgFKQKfYiWK/nIsVlWQ4JAKME8 NnTw== X-Gm-Message-State: ANoB5pn0sOVEWzmv4DPNr8AzVNmja+V+raW4FJbSqLiyAFOnzTYgAzDi +gbRPEWLTHUgX7IA8u1zECNo2A== X-Received: by 2002:a6b:6318:0:b0:6ca:6cbb:cb83 with SMTP id p24-20020a6b6318000000b006ca6cbbcb83mr3221089iog.44.1668283643477; Sat, 12 Nov 2022 12:07:23 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id j28-20020a02cb1c000000b00363dee286edsm2036870jap.60.2022.11.12.12.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 12:07:22 -0800 (PST) From: Alex Elder To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/5] dt-bindings: net: qcom,ipa: deprecate modem-init Date: Sat, 12 Nov 2022 14:07:13 -0600 Message-Id: <20221112200717.1533622-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112200717.1533622-1-elder@linaro.org> References: <20221112200717.1533622-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749322304912748163?= X-GMAIL-MSGID: =?utf-8?q?1749322304912748163?= GSI firmware for IPA must be loaded during initialization, either by the AP or by the modem. The loader is currently specified based on whether the Boolean modem-init property is present. Instead, use a new property with an enumerated value to indicate explicitly how GSI firmware gets loaded. With this in place, a third approach can be added in an upcoming patch. The new qcom,gsi-loader property has two defined values: - self: The AP loads GSI firmware - modem: The modem loads GSI firmware The modem-init property must still be supported, but is now marked deprecated. Signed-off-by: Alex Elder --- .../devicetree/bindings/net/qcom,ipa.yaml | 59 +++++++++++++++---- 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml index e752b76192df0..0dfd6c721e045 100644 --- a/Documentation/devicetree/bindings/net/qcom,ipa.yaml +++ b/Documentation/devicetree/bindings/net/qcom,ipa.yaml @@ -124,12 +124,22 @@ properties: - const: ipa-clock-enabled-valid - const: ipa-clock-enabled + qcom,gsi-loader: + enum: + - self + - modem + description: + This indicates how GSI firmware should be loaded. If the AP loads + and validates GSI firmware, this property has value "self". If the + modem does this, this property has value "modem". + modem-init: + deprecated: true type: boolean description: - If present, it indicates that the modem is responsible for - performing early IPA initialization, including loading and - validating firwmare used by the GSI. + This is the older (deprecated) way of indicating how GSI firmware + should be loaded. If present, the modem loads GSI firmware; if + absent, the AP loads GSI firmware. memory-region: maxItems: 1 @@ -155,15 +165,36 @@ required: - interconnects - qcom,smem-states -# If modem-init is not present, the AP loads GSI firmware, and -# memory-region must be specified -if: - not: - required: - - modem-init -then: - required: - - memory-region +allOf: + # If qcom,gsi-loader is present, modem-init must not be present + - if: + required: + - qcom,gsi-loader + then: + properties: + modem-init: false + + # If qcom,gsi-loader is "self", the AP loads GSI firmware, and + # memory-region must be specified + if: + properties: + qcom,gsi-loader: + contains: + const: self + then: + required: + - memory-region + else: + # If qcom,gsi-loader is not present, we use deprecated behavior. + # If modem-init is not present, the AP loads GSI firmware, and + # memory-region must be specified. + if: + not: + required: + - modem-init + then: + required: + - memory-region additionalProperties: false @@ -196,7 +227,9 @@ examples: ipa@1e40000 { compatible = "qcom,sdm845-ipa"; - modem-init; + qcom,gsi-loader = "self"; + memory-region = <&ipa_fw_mem>; + firmware-name = "qcom/sc7180-trogdor/modem-nolte/mba.mbn"; iommus = <&apps_smmu 0x720 0x3>; reg = <0x1e40000 0x7000>, From patchwork Sat Nov 12 20:07:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19234 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1412116wru; Sat, 12 Nov 2022 12:09:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6nBwObPfywtXtc39o1oKzGSs4lJpiPdv672bpBjMXBP5aKFvXsv5KnbEk+x0e0Szftpr7M X-Received: by 2002:a17:902:e8ce:b0:188:a1eb:9a8a with SMTP id v14-20020a170902e8ce00b00188a1eb9a8amr7449329plg.153.1668283760894; Sat, 12 Nov 2022 12:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668283760; cv=none; d=google.com; s=arc-20160816; b=VuM9FejP6CjU/y7KRTJ5BlylFNETJJtYP+wrjmCBnmrDiwOcbFoQkW7HFfoq8EL26t WTAmkD678TsNgU2ffEiXl2XBlHG6XUMY/DZYcCcMOokiyoxaXIjrP6NVHpdvf+SRi5tA wEH+6LtZ++wCzR6hJKe6QiO4UjCCDkfLIUyShBuvZyCWn6tR0eFnrMzw24ZaPEPYyDrX 148AIxUS7kdich6pZrX2hvXCDfCS9GCYPigPtriId0j4oZbW6BBxgGN6pe3r3Bbg8aZ4 eEIFzk1pMbk6uyoN1TT3MNIM4bXPtJfizBsAoLrtjRzblxKoAuM2Cvv92zTBtmG8aLov z8pg== 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=IbFCvRl1cs7XC6NWdvqbuTmw/rqE6VsOAXoQYLExO5Q=; b=iPJQt9fcBuh+1bzwI05FEmVGSmiPaybXZ/zzcqu/7cAGEQTpyntMpFtj4ChruBZTLw 9yI64+yxl0BEA2MQNfgeyy9eiCIzuerhctftxgCpMGmb4WhUzkmsQI1ZE+6wDPIXpFjh K/lCvKju9ut6w0/3EQsFgXZV/aFxT89eVXWnuJUghlMVrso4E0ve6neT9+E8IRQruwmO vUKfgDhh74xT9+QVwujdsTCqgibETdtUnSUPAXoschw7mRTsFfRBTDt6hdiFGB0QYhmr RdpGRRnddjsM1zuFQrONmMlUVb+N0QXGEM+e4UNyBFTo2ajkMCtXcIHzSkfNTImJ/wfL Gfyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQdrYZsu; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a170902ed8c00b0017f580f646fsi5205142plj.304.2022.11.12.12.09.07; Sat, 12 Nov 2022 12:09:20 -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=@linaro.org header.s=google header.b=kQdrYZsu; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235056AbiKLUHh (ORCPT + 99 others); Sat, 12 Nov 2022 15:07:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234928AbiKLUH0 (ORCPT ); Sat, 12 Nov 2022 15:07:26 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99ED41277D for ; Sat, 12 Nov 2022 12:07:25 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id q21so5735624iod.4 for ; Sat, 12 Nov 2022 12:07:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IbFCvRl1cs7XC6NWdvqbuTmw/rqE6VsOAXoQYLExO5Q=; b=kQdrYZsuJaVebDpUK1qll7fwMnM+JhAIDP0wsHb48mI9g/xXQwhDQ58vxgd8IOZmAn jREThxZltYYSej0l4guj6s7C0OLAbh4hiXfVjLgcIvkER/xnaGciGUWRh2in+9r7Tvaa LH8pJX0cLpnzOD/AD87PHklH+eKyUlyCV3JmeBKTUPyg67uQ+7Z1qMOBBaQCqtNs/jGW dkS45ArZEfQmsd66/or6Y6Ni9LfrjTg//FXAeJlnErIctxlPMyX5bLG5oVRvaCSSIKjA AqKZMRfn2AN5Ef942CZDRi80FYpxtpKuiDY9mo1yG+8PQ93wdgV1yd3gVHID7Ksaa5Md uLBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IbFCvRl1cs7XC6NWdvqbuTmw/rqE6VsOAXoQYLExO5Q=; b=UQR8os6CA2Bn4q9JoTNJPhlYsX4FbbZjhdBWFaE8dxI/0BCMPjzvtrsrShfvBSKCHE JMcctVncnQJqLpyYjcyJQCsckjeVaiqvt8L4iI43O5dqR57zyTKGXyHa7ASy7QseNdp0 3hifCMZemBRUaYvJbv4fcUUgd0wkgjU7CacVDWOWGPkcpP03Wk5LbJY5+wRIklVd8/hj Pay3BQk+dB4Ez1qgf+U+K9nV3x9VDSfr6eBXXlEgUoOEvUtfmo3oD/o0U0by6kb3OKbj wAlUkFKTVdbK/QU7PBgG/xTE1fApkod5UDN5C12FvpkjXbrck1Aqfy5s8i14RVjNU0f+ hJpw== X-Gm-Message-State: ANoB5pncJPsFceXmEyYLJ27T8vxZYtK0/JPjnCWy30tQdKDNUEfSDfZy sMirlsbVnEsS5rRu9P4vBC+L8g== X-Received: by 2002:a6b:6c19:0:b0:6bc:4a3a:4de2 with SMTP id a25-20020a6b6c19000000b006bc4a3a4de2mr3097956ioh.207.1668283644942; Sat, 12 Nov 2022 12:07:24 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id j28-20020a02cb1c000000b00363dee286edsm2036870jap.60.2022.11.12.12.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 12:07:24 -0800 (PST) From: Alex Elder To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/5] net: ipa: encapsulate decision about firmware load Date: Sat, 12 Nov 2022 14:07:14 -0600 Message-Id: <20221112200717.1533622-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112200717.1533622-1-elder@linaro.org> References: <20221112200717.1533622-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749322312906839161?= X-GMAIL-MSGID: =?utf-8?q?1749322312906839161?= The GSI layer used for IPA requires firmware to be loaded. Currently either the AP or the modem loads the firmware, distinguished by whether the "modem-init" Device Tree property is defined. Some newer systems implement a third option. In preparation for that, encapsulate the code that determines how the GSI firmware gets loaded in a new function, ipa_firmware_loader(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 39 ++++++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index ebb6c9b311eb9..9e43b79d233e9 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -81,6 +81,19 @@ /* Divider for 19.2 MHz crystal oscillator clock to get common timer clock */ #define IPA_XO_CLOCK_DIVIDER 192 /* 1 is subtracted where used */ +/** + * enum ipa_firmware_loader: How GSI firmware gets loaded + * + * @IPA_LOADER_DEFER: System not ready; try again later + * @IPA_LOADER_SELF: AP loads GSI firmware + * @IPA_LOADER_MODEM: Modem loads GSI firmware, signals when done + */ +enum ipa_firmware_loader { + IPA_LOADER_DEFER, + IPA_LOADER_SELF, + IPA_LOADER_MODEM, +}; + /** * ipa_setup() - Set up IPA hardware * @ipa: IPA pointer @@ -696,6 +709,18 @@ static void ipa_validate_build(void) BUILD_BUG_ON(!ipa_aggr_granularity_val(IPA_AGGR_GRANULARITY)); } +static enum ipa_firmware_loader ipa_firmware_loader(struct device *dev) +{ + if (of_property_read_bool(dev->of_node, "modem-init")) + return IPA_LOADER_MODEM; + + /* We need Trust Zone to load firmware; make sure it's available */ + if (qcom_scm_is_available()) + return IPA_LOADER_SELF; + + return IPA_LOADER_DEFER; +} + /** * ipa_probe() - IPA platform driver probe function * @pdev: Platform device pointer @@ -722,9 +747,9 @@ static void ipa_validate_build(void) static int ipa_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; + enum ipa_firmware_loader loader; const struct ipa_data *data; struct ipa_power *power; - bool modem_init; struct ipa *ipa; int ret; @@ -747,11 +772,9 @@ static int ipa_probe(struct platform_device *pdev) return -EINVAL; } - /* If we need Trust Zone, make sure it's available */ - modem_init = of_property_read_bool(dev->of_node, "modem-init"); - if (!modem_init) - if (!qcom_scm_is_available()) - return -EPROBE_DEFER; + loader = ipa_firmware_loader(dev); + if (loader == IPA_LOADER_DEFER) + return -EPROBE_DEFER; /* The clock and interconnects might not be ready when we're * probed, so might return -EPROBE_DEFER. @@ -796,7 +819,7 @@ static int ipa_probe(struct platform_device *pdev) if (ret) goto err_endpoint_exit; - ret = ipa_smp2p_init(ipa, modem_init); + ret = ipa_smp2p_init(ipa, loader == IPA_LOADER_MODEM); if (ret) goto err_table_exit; @@ -815,7 +838,7 @@ static int ipa_probe(struct platform_device *pdev) * call to ipa_setup() when it has finished. In that case we're * done here. */ - if (modem_init) + if (loader == IPA_LOADER_MODEM) goto done; /* Otherwise we need to load the firmware and have Trust Zone validate From patchwork Sat Nov 12 20:07:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19230 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1411831wru; Sat, 12 Nov 2022 12:08:29 -0800 (PST) X-Google-Smtp-Source: AA0mqf4Hvk7oeNFGfOaqmgXn5IxFoXFwp3W6eeUJIT7jSXXIGWVBYV+NrIiIANQNVLDxPWfhoINS X-Received: by 2002:a17:902:a407:b0:172:86a2:8e68 with SMTP id p7-20020a170902a40700b0017286a28e68mr7887860plq.27.1668283708868; Sat, 12 Nov 2022 12:08:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668283708; cv=none; d=google.com; s=arc-20160816; b=laZOlP5pQtZCS9RaZrNPQL8JcZXGRDpqh33VVrEsgaSj0nmYHbt8/IL671OrJ6ioaq hi61c7ufIsVWv2MZqGFFW4XyOvLmxNNVzLO1hg1IObV01udVIme4K0tRHS/ebFAUwOgg IIF5O3CT3e0d8chbFIF3XgjRZUc1KFdx6PN8jEXSkKd3WVYxEtQvnhJOmxC5NUpr4W1a GrrSWup6GmY0c5K54kI6X4bPuOWFLhDjGVvngVhRLZIaVS0rPvFRoU+wqKsWfehQ5S2Z XLjLNepbAjlOfA9p3SOmj4aIP1bKR90z6Trr9luwxWTAWHjj9IvcrWHIJWYjpaiEHhGh oliQ== 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=QmJK2z6YewxghveqGIb9UQBF6OMvTjY+OevUyUnH0xk=; b=sE4NlElucaAZpBacQRVm9rocwioSueRT9Yf/n3IrvIjb32jK0razlFs7k7ulgeu+T6 FU3JBfvo5fRQ+eAXpTfHyQMPYOa4iMdiTkgZPBrCAmCGQVpP6Dzkg6tLsjdIGUStTIyq fMYt9FRHlx9wStDo5+p9VywR5ajrerZYgFR+1hKdpSab6B2JSGsDn17vteUpD3MERaTY pf0RM/IUDf6FU+098DHECnope2TwXhMmgLYLvGNXBH/xGiINeXt397OOJ5y7NTy209wz paDbeadLIMe3BlBZX5KIFOrwXs9w3BYw9Atou2XqIMH2d5YdzFNqmxxcZRRWqlKSOghb 44oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qvii5+Yf; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id np15-20020a17090b4c4f00b0020055731860si6720273pjb.105.2022.11.12.12.08.15; Sat, 12 Nov 2022 12:08:28 -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=@linaro.org header.s=google header.b=qvii5+Yf; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235069AbiKLUHl (ORCPT + 99 others); Sat, 12 Nov 2022 15:07:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234959AbiKLUH1 (ORCPT ); Sat, 12 Nov 2022 15:07:27 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D643411A25 for ; Sat, 12 Nov 2022 12:07:26 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id e189so5749213iof.1 for ; Sat, 12 Nov 2022 12:07:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QmJK2z6YewxghveqGIb9UQBF6OMvTjY+OevUyUnH0xk=; b=qvii5+YfRDQV27AwF5yXB+bnAxlzBNOOdUYYa7xFW6WdfwigOKyjOcCHQsCgakTjDL CNqJRFb5amTb6a2JWTIc9XauQSvZ7IkVA+8sRVfu7WUax+6QvchktbNfBl1F2qaErOxh Ey51lKVbJINQ/MsI7Ex7U5qcdqNO0tWea6LlikYU+YAzhaW0JHnCMT8hVNErVCDwlW0y BtFulbBZGuMu6ZeP3EpBgxLuL3DHUZM3bMR+0TRlP/MFhYotrKkRPqeJw8SbNOYFXU71 et2euDBzpAx4Ld1pFNXvjCGdyGB02RMqSpuad9qMblCDto8WyZFm2UB4sljofOTulyKM Af+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QmJK2z6YewxghveqGIb9UQBF6OMvTjY+OevUyUnH0xk=; b=OY42zbuuzkGQmj0oi1iIeeiG1kpON0DGoZM1FxipX3eLpG4s4GJb0wA0oi+/B0LfLC 77dM6VmeY/bsZOuzM/B2QyT3edWYLXxwA2J7CfEnZ6r6dcBlWdidxcgopP3lYT9Cx+/U Agnr8LOWzpF7K/RhggzL3YTNHti9x8jCQ7S9z4nM8WNNAaa1vWqPnGVkP/OE6lQDndTq 4NT0l5Ir4qZlrpWuunb5lj0DBCC62mKrdEZL8J+WAeG7iQeGc7fEhXQqRj0hjrG6aIBg Y/umhKviSegtfX72ql6c8F5/YO93b4nhx6jxO/kubSPNPhRh04enImDDHR0/vWY3Fv0y ylFA== X-Gm-Message-State: ANoB5pm49ce8awdtWZOY8zQeas9P975O37Ng2IOEvjDW/NCM4FYjrPiA DdGVFMaGDx4o5bZLMpaDJiFguA== X-Received: by 2002:a02:cd34:0:b0:363:c1cc:ce75 with SMTP id h20-20020a02cd34000000b00363c1ccce75mr3164137jaq.125.1668283646526; Sat, 12 Nov 2022 12:07:26 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id j28-20020a02cb1c000000b00363dee286edsm2036870jap.60.2022.11.12.12.07.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 12:07:25 -0800 (PST) From: Alex Elder To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net: ipa: introduce "qcom,gsi-loader" property Date: Sat, 12 Nov 2022 14:07:15 -0600 Message-Id: <20221112200717.1533622-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112200717.1533622-1-elder@linaro.org> References: <20221112200717.1533622-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749322258367063212?= X-GMAIL-MSGID: =?utf-8?q?1749322258367063212?= Introduce a new way of specifying how the GSI firmware gets loaded for IPA. Currently, this is indicated by the presence or absence of the Boolean "modem-init" Device Tree property. The new property must have a value--either "self" or "modem"--which indicates whether the AP or modem is the GSI firmware loader, respectively. For legacy systems, the new property will not exist, and the "modem-init" property will be used. For newer systems, the "qcom,gsi-loader" property *must* exist, and must have one of the two prescribed values. It is an error to have both properties defined, and it is an error for the new property to have an unrecognized value. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 44 ++++++++++++++++++++++++++++++++------ 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 9e43b79d233e9..214e524dce795 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -87,11 +87,13 @@ * @IPA_LOADER_DEFER: System not ready; try again later * @IPA_LOADER_SELF: AP loads GSI firmware * @IPA_LOADER_MODEM: Modem loads GSI firmware, signals when done + * @IPA_LOADER_INVALID: GSI firmware loader specification is invalid */ enum ipa_firmware_loader { IPA_LOADER_DEFER, IPA_LOADER_SELF, IPA_LOADER_MODEM, + IPA_LOADER_INVALID, }; /** @@ -711,9 +713,37 @@ static void ipa_validate_build(void) static enum ipa_firmware_loader ipa_firmware_loader(struct device *dev) { - if (of_property_read_bool(dev->of_node, "modem-init")) + bool modem_init; + const char *str; + int ret; + + /* Look up the old and new properties by name */ + modem_init = of_property_read_bool(dev->of_node, "modem-init"); + ret = of_property_read_string(dev->of_node, "qcom,gsi-loader", &str); + + /* If the new property doesn't exist, it's legacy behavior */ + if (ret == -EINVAL) { + if (modem_init) + return IPA_LOADER_MODEM; + goto out_self; + } + + /* Any other error on the new property means it's poorly defined */ + if (ret) + return IPA_LOADER_INVALID; + + /* New property value exists; if old one does too, that's invalid */ + if (modem_init) + return IPA_LOADER_INVALID; + + /* Modem loads GSI firmware for "modem" */ + if (!strcmp(str, "modem")) return IPA_LOADER_MODEM; + /* Any value other than "self" is an error */ + if (strcmp(str, "self")) + return IPA_LOADER_INVALID; +out_self: /* We need Trust Zone to load firmware; make sure it's available */ if (qcom_scm_is_available()) return IPA_LOADER_SELF; @@ -773,6 +803,8 @@ static int ipa_probe(struct platform_device *pdev) } loader = ipa_firmware_loader(dev); + if (loader == IPA_LOADER_INVALID) + return -EINVAL; if (loader == IPA_LOADER_DEFER) return -EPROBE_DEFER; @@ -834,20 +866,18 @@ static int ipa_probe(struct platform_device *pdev) dev_info(dev, "IPA driver initialized"); - /* If the modem is doing early initialization, it will trigger a - * call to ipa_setup() when it has finished. In that case we're - * done here. + /* If the modem is loading GSI firmware, it will trigger a call to + * ipa_setup() when it has finished. In that case we're done here. */ if (loader == IPA_LOADER_MODEM) goto done; - /* Otherwise we need to load the firmware and have Trust Zone validate - * and install it. If that succeeds we can proceed with setup. - */ + /* The AP is loading GSI firmware; do so now */ ret = ipa_firmware_load(dev); if (ret) goto err_deconfig; + /* GSI firmware is loaded; proceed to setup */ ret = ipa_setup(ipa); if (ret) goto err_deconfig; From patchwork Sat Nov 12 20:07:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19233 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1412117wru; Sat, 12 Nov 2022 12:09:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf60wqgjF+Dnhg/Myom/IRj5tJRM4VIZLKnJJJIXhog6aXZ2lfg8bZ15z4hTUvk/oP6Fey62 X-Received: by 2002:a63:b5b:0:b0:46f:3dfb:8fb3 with SMTP id a27-20020a630b5b000000b0046f3dfb8fb3mr6235759pgl.121.1668283760999; Sat, 12 Nov 2022 12:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668283760; cv=none; d=google.com; s=arc-20160816; b=C/Xb0ZTIamKuA97tB6Pe4vWpyPFSEhCEjEluBkXaO9A18In6BzlNZTg1NI+TGQlsoh 4y8AGdJQWccNwfg36fwS+wvfEg1rd0FU+HLnCxJINPA7vLVv/mt2A1WInXRyaRUr/whS jZsL07QhhASLe3nR+nWpl985DyIVn9u+sFxN6xPSTwpnuUwIGR710xysyiBqe/X2+xmu JNECxyXXwjbzIk7/UlnFCJjcA5W9LwJyvO6iRuGgbBZ04v14NhqSZFOvJjwjC1DWRyLd k4XEHrtkgf2sVHpkNeJJdnQrPhyt/VO2mrLAnR1jFy9eCfCk0h5XkC0fJwS8Ml5e2nP8 ITcw== 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=bQMtM7EzKXE7g7Q8ii/1nYLdfGgJeyG5qgm6GFG0MaY=; b=HL3gdG83tQS7xPeubvQasPyeiOlVPuPFRDgGZvZdY0EkrMxP/78ARZRCWLJuOYE2ag ozhZs6MBTYTXU/cs88CkQgvNsAxXd8e4KiT9jMtqKSEERIuM+QmTBDTpX2eRzm3VaW96 2qg0wNAzC3uSBbGTDqFdsQmwwqVjaxrMiSZI1OZES3jwsao+LNRrhuW6S3+7pwnmTzhe n5ZE0VnsMwgkzMkwGSlwBcXxFmdMs/VtD3drOYu/fpRFC+ltKWbIxt0OS20xe+EV1NXt qLKmVwm9TtValSY7mWjX7AV9m1PyFgtaiGu3whxRfQVslC7DS26We9epfrvoXqzm6PQe K7lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Su3MklfM; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i3-20020a6551c3000000b0046fea833b07si5603457pgq.123.2022.11.12.12.09.07; Sat, 12 Nov 2022 12:09:20 -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=@linaro.org header.s=google header.b=Su3MklfM; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235116AbiKLUHr (ORCPT + 99 others); Sat, 12 Nov 2022 15:07:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234995AbiKLUH3 (ORCPT ); Sat, 12 Nov 2022 15:07:29 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861B614D19 for ; Sat, 12 Nov 2022 12:07:28 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id z9so4015353ilu.10 for ; Sat, 12 Nov 2022 12:07:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bQMtM7EzKXE7g7Q8ii/1nYLdfGgJeyG5qgm6GFG0MaY=; b=Su3MklfMJY8596qFSlI2fMYVrgpgXSRkl7MDteWVnD97GFCt9qVLEfOqMen13UD9F6 3L5IXY1n9+ZbSmUwWZUSk20mvOdXvMdNkUsH+w22RUejchFD+p2Yhxi8TimgOVA9uTDV qphlkjc96DUqQwpTxOeRh5qQb+1zmiE7wusxwDojYsckuyZSfCVemRpzqMc5T3DHrvdy 6FrbtLcoYBK1D3QVSGn326jqrzllaj9i/U7hZZWlP2ShmXfSa+v3c4mHsknmpTTOc8hG NnmrR64LB48M3a4yu7Q5oNiLMFLjqv6cW3bSTFIvXrTlD7nUpjbr6VjwstJVQ/QDIZCT 2LAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bQMtM7EzKXE7g7Q8ii/1nYLdfGgJeyG5qgm6GFG0MaY=; b=vlMuVSiZvZjwG7NDTr1WgVY/sf1hXnuNaw4kxzPGWkQgU33HbQOYQNx4DVOJbxg/bR YkhUL8e/GpY19warBROpeneJngyuDUYKKza89VurU3vxnKll+VnXL0xpZqC9C/enthom SFbjxYq6LLNiYvkdItBnFRLZQKZ2hVTC06xKvX/jTttSlKlYf/ED7wpHln0ikHYhKrMg +0puswzKrYneXrsTbJYligpN3/9C2ciDWepN+QEDAxDu9IgcNu/HW4snEOW+pvetwbmb 7+H1pdmgXaQnK4CtPBsK9cYkaV8p1jLCuAf7v9hVHvU22JQQySB8ZESLj9og0r/TBlSs szOA== X-Gm-Message-State: ANoB5pmvO2n7EDCMHgtvYsrnbsOsFWE5hRXO1DbGFy8cOCxQTEbMhRQY EfNQczEtaldS7Nm+Vm24WhKoUQ== X-Received: by 2002:a92:cd0d:0:b0:300:c497:d6a0 with SMTP id z13-20020a92cd0d000000b00300c497d6a0mr3594798iln.27.1668283647907; Sat, 12 Nov 2022 12:07:27 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id j28-20020a02cb1c000000b00363dee286edsm2036870jap.60.2022.11.12.12.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 12:07:27 -0800 (PST) From: Alex Elder To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/5] dt-bindings: net: qcom,ipa: support skipping GSI firmware load Date: Sat, 12 Nov 2022 14:07:16 -0600 Message-Id: <20221112200717.1533622-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112200717.1533622-1-elder@linaro.org> References: <20221112200717.1533622-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749322312917526686?= X-GMAIL-MSGID: =?utf-8?q?1749322312917526686?= Add a new enumerated value to those defined for the qcom,gsi-loader property. If the qcom,gsi-loader is "skip", the GSI firmware will already be loaded, so neither the AP nor modem is required to load GSI firmware. Signed-off-by: Alex Elder Reviewed-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/net/qcom,ipa.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml index 0dfd6c721e045..3d63505d1b802 100644 --- a/Documentation/devicetree/bindings/net/qcom,ipa.yaml +++ b/Documentation/devicetree/bindings/net/qcom,ipa.yaml @@ -128,10 +128,12 @@ properties: enum: - self - modem + - skip description: This indicates how GSI firmware should be loaded. If the AP loads and validates GSI firmware, this property has value "self". If the - modem does this, this property has value "modem". + modem does this, this property has value "modem". Otherwise, "skip" + means GSI firmware loading is not required. modem-init: deprecated: true From patchwork Sat Nov 12 20:07:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 19231 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1412000wru; Sat, 12 Nov 2022 12:09:01 -0800 (PST) X-Google-Smtp-Source: AA0mqf7Vnn6cyzyEwhQPBecW2GYIy5/GOlPOWga6rxj5tWaUG4EV8ZTNwDo67V1b1O5IvCR90pu1 X-Received: by 2002:a63:310a:0:b0:46f:3a91:361c with SMTP id x10-20020a63310a000000b0046f3a91361cmr6317955pgx.261.1668283741153; Sat, 12 Nov 2022 12:09:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668283741; cv=none; d=google.com; s=arc-20160816; b=b8S65MYZHFihOQv412ekwgFnMmMkp22DOJJgs6LLVbKhKX0G+qPwGNciSNyN4Iut3p OtMcJXr6jYVXwYnQGGEfIPpNb45wYiHXVeWv45qiLz52q/ycjFy4ImSKdGKjPIsEnW3a DvA49mlDK4JTMA24RpS1VtVaJ40ZACqex3gT2ay13muaZM23KZ3WAckBgcb3tHGutqyE tbRRgXIpGzUD5nZORk453FjytAygJTwZPH4vnnRPfkd0aYi5CJQ1LFbFqWqpf0rjfamI 7/Y6dcczOJe7iycqXBV8k+UJi2sG1B/nTsmk9jc/PEgGS47vl638waxctsiA/+vVn1yZ Oj9Q== 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=umpLk1dbP5jy5ZPV4Q21UM7cr1nZKFjsXDStFsdzpxA=; b=XIBLwnYm/RDHcrbyxwZq8pWygsDFRyEQbl1RJKco5RF7GcysMJCgkVFFxH6GWsJEB2 0oTeCqIdSKjusQS4BwM6HM+hsGlzQ+aNLBx/A4OJryTrA+2Qa3kwu2wEM3vtYBzL2TOU XjZKhUZeGbZiggHXvNrtc5MZNJe+G54owwPr/LBEEh2VPB47rpOtktZnaySj+6E2Y/DI 7V6vvQ79LaAlzMvP1slLIyHo2tLeO/EKav/URRXBg0Mk8CriIksTJMrH8+JDRleX4+ma C1DOQGW5y14NrPpx6sC/BJdv1fUy4e2QLUIbo3qS8WBGIs/UPUb+E3AJX0nB96fIOVzQ /L5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Ut/gqy52"; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f27-20020a63555b000000b0046efd063864si5825235pgm.109.2022.11.12.12.08.47; Sat, 12 Nov 2022 12:09:01 -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=@linaro.org header.s=google header.b="Ut/gqy52"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235120AbiKLUHy (ORCPT + 99 others); Sat, 12 Nov 2022 15:07:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235016AbiKLUHb (ORCPT ); Sat, 12 Nov 2022 15:07:31 -0500 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801F1165B9 for ; Sat, 12 Nov 2022 12:07:30 -0800 (PST) Received: by mail-il1-x129.google.com with SMTP id m15so4030208ilq.2 for ; Sat, 12 Nov 2022 12:07:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=umpLk1dbP5jy5ZPV4Q21UM7cr1nZKFjsXDStFsdzpxA=; b=Ut/gqy52LOxFagWry8zJuDnyu69bte+omzwmYqNJjdvDmQX60UlPpo692bej4Zhl9C tiH32C6p562bFsgNQA8qY2bXfS9xVCJDURVWy9Axdoe4EDtoH3XEqI0TZ2T7qjHfcFJB PaY2LK/FfpGEuv0LrqIoWWh6tWDsbtR+x8kK1rs4TBR9zzW2uRrVBikuYPEPu/LI/3vX BRKu2HCJ9gP608jB7pEpv+zCebScrj1VyC87MTS0v8ueM5/5I6Ilt3hRJUlw1su3zUAf wkjT+etQqpiHzS1wCY+eYesaBbyEXYjEPwEMwYfygSVfg68S6NMNma9zaalqmkK3WA77 QdPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=umpLk1dbP5jy5ZPV4Q21UM7cr1nZKFjsXDStFsdzpxA=; b=CednvVMvaHvsMsd4F0ERgSt3MXP+YDx8borQm+1bVukfHT33RIVndxmLkfqK2cWXc3 JgCd0a7Ckvjf0ZzPZ6WyN1gZWoKLY3j83vlX74QJzNdm+NbZpkpyoOe5cUeDC8eBx9Yw XjEjB5cuyMkqRzzFmuJahm+CfOwOCLqNfCJc5oykkINiWIa21FVNTmf+d5bfI9nDYhzb Q+t7n3pYSDCMLk6KwStI2i9r3Vgni9EvV0sicmHvGEA2iQs1siIuDeN1uEdVB4YgwMv/ UZeuUqYcryhc9gZV/arQHG+zTh/aaw4PkHIeE6ABoBrpnOui0B41jy0Rz++5BayPSB91 38CQ== X-Gm-Message-State: ANoB5pm1+iSJSHzWUq1kuqEj9XrA26fYXNHiZVZ4H8sbPbc/UZOtJfYR D9ITsJaHyZTET/yqRDuV99pDdg== X-Received: by 2002:a92:da45:0:b0:302:568e:b493 with SMTP id p5-20020a92da45000000b00302568eb493mr210216ilq.183.1668283649429; Sat, 12 Nov 2022 12:07:29 -0800 (PST) Received: from presto.localdomain ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id j28-20020a02cb1c000000b00363dee286edsm2036870jap.60.2022.11.12.12.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Nov 2022 12:07:28 -0800 (PST) From: Alex Elder To: robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Cc: andersson@kernel.org, konrad.dybcio@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/5] net: ipa: permit GSI firmware loading to be skipped Date: Sat, 12 Nov 2022 14:07:17 -0600 Message-Id: <20221112200717.1533622-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221112200717.1533622-1-elder@linaro.org> References: <20221112200717.1533622-1-elder@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749322291896183660?= X-GMAIL-MSGID: =?utf-8?q?1749322291896183660?= Define a new value "skip" for the "qcom,gsi-loader" Device Tree property. If used, it indicates that neither the AP nor the modem need to load GSI firmware (because it has already been loaded--for example by the boot loader). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 214e524dce795..8f20825675a1a 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -87,12 +87,14 @@ * @IPA_LOADER_DEFER: System not ready; try again later * @IPA_LOADER_SELF: AP loads GSI firmware * @IPA_LOADER_MODEM: Modem loads GSI firmware, signals when done + * @IPA_LOADER_SKIP: Neither AP nor modem need to load GSI firmware * @IPA_LOADER_INVALID: GSI firmware loader specification is invalid */ enum ipa_firmware_loader { IPA_LOADER_DEFER, IPA_LOADER_SELF, IPA_LOADER_MODEM, + IPA_LOADER_SKIP, IPA_LOADER_INVALID, }; @@ -740,6 +742,10 @@ static enum ipa_firmware_loader ipa_firmware_loader(struct device *dev) if (!strcmp(str, "modem")) return IPA_LOADER_MODEM; + /* No GSI firmware load is needed for "skip" */ + if (!strcmp(str, "skip")) + return IPA_LOADER_SKIP; + /* Any value other than "self" is an error */ if (strcmp(str, "self")) return IPA_LOADER_INVALID; @@ -872,10 +878,12 @@ static int ipa_probe(struct platform_device *pdev) if (loader == IPA_LOADER_MODEM) goto done; - /* The AP is loading GSI firmware; do so now */ - ret = ipa_firmware_load(dev); - if (ret) - goto err_deconfig; + if (loader == IPA_LOADER_SELF) { + /* The AP is loading GSI firmware; do so now */ + ret = ipa_firmware_load(dev); + if (ret) + goto err_deconfig; + } /* Otherwise loader == IPA_LOADER_SKIP */ /* GSI firmware is loaded; proceed to setup */ ret = ipa_setup(ipa);