From patchwork Tue Nov 15 11:31: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: 13043531 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22145C4332F for ; Tue, 15 Nov 2022 11:31:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232701AbiKOLbc (ORCPT ); Tue, 15 Nov 2022 06:31:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232227AbiKOLb2 (ORCPT ); Tue, 15 Nov 2022 06:31:28 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D91111A212 for ; Tue, 15 Nov 2022 03:31:26 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id l14so23736771wrw.2 for ; Tue, 15 Nov 2022 03:31: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=//f8EyB8LSqoVSjEW+GVHDxH1+750hjBFR+YGqa4pV0=; b=jOQPJlYPnNW9IUDitc6PpH0x42P8nRMNN76WIopGX4H6ZdAX2i+7ToPcxs9pg5AQgd Iyv6vdhXzotGfB9gbnJyJZfzsGK7SeVOYj4k8v0xcH2bMDB463fnj0fGgaEvACF4RjEz tzF6R0iDGH8rgg3wvI0Z6mQx+GUrCsFcQOuYcqKeyTOp4YQmOkQIcbq9gdTkxu6EOrL5 G7D1JfR7dPPJWVegWKyRXag0Rc85AQPcftM8S+pLyqQyJHzKZVT0ehD7CprlRBUCFQCO 99akSAAUFhhXELzvfLqyG+itTD6SukYvFdS+OVPE2R/Ox29nLjMr63abXVx8mUpeodhJ yijg== 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=//f8EyB8LSqoVSjEW+GVHDxH1+750hjBFR+YGqa4pV0=; b=t73wB/jq1U9JbJm9+HWto1APil7DEaxrHd3n35KnbEMPdWnU2XgN49/jBugfYrga6q VPkaRym4PStT+yf7ztjCCXUPIIpXOneQZAJfqpapBM6lTAfcMbnnOFLR08ruuBu/ufEt m4A8Fj9tfmpV6R1482XBx+V6tbvq6PGk3FFWKnvDaw1pupjTF+Lt5POCeGqlxtEceQ4I rWBBc5HSMcuUMWQ08iFSs28PElp52r1zlXT1cd2PDxS7INzZ9ZSDOZCgECX0FU+CsPHR Q8T2Qc7hWVwZAVAkjz5RvDhghdR4W9VWJkJSBnNiQ8a5MzZvAq/6OpL9C0/tO3bPc5mY SXnw== X-Gm-Message-State: ANoB5pmIUcOAv9zsn2LAuAs4DbtrZzyr4cmZRCZy0wuLF2NA6pYqhlGM c67O3n8zvBj0nDucvDzcRI20Vg== X-Google-Smtp-Source: AA0mqf5DtAxOcotMdQwLAmHvLj0dquk5n3MaUKK4x40Gtp7hZirmSFAT1G4XkBFw8E8GxpCQt6cCUQ== X-Received: by 2002:adf:fac3:0:b0:22e:244d:687a with SMTP id a3-20020adffac3000000b0022e244d687amr10329018wrs.82.1668511885176; Tue, 15 Nov 2022 03:31:25 -0800 (PST) Received: from zoltan.localdomain ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b00238df11940fsm12273091wrm.16.2022.11.15.03.31.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 03:31: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 v2 1/5] dt-bindings: net: qcom,ipa: deprecate modem-init Date: Tue, 15 Nov 2022 05:31:15 -0600 Message-Id: <20221115113119.249893-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115113119.249893-1-elder@linaro.org> References: <20221115113119.249893-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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. Update the example so it represents the SC7180 SoC, and provide examples for the qcom,gsi-loader, memory-region, and firmware-name properties. Signed-off-by: Alex Elder Reviewed-by: Krzysztof Kozlowski --- v2: Updated description, switched example completely to SC7180. .../devicetree/bindings/net/qcom,ipa.yaml | 76 ++++++++++++++----- 1 file changed, 55 insertions(+), 21 deletions(-) diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml index e752b76192df0..d0f34763b9383 100644 --- a/Documentation/devicetree/bindings/net/qcom,ipa.yaml +++ b/Documentation/devicetree/bindings/net/qcom,ipa.yaml @@ -124,19 +124,29 @@ properties: - const: ipa-clock-enabled-valid - const: ipa-clock-enabled + qcom,gsi-loader: + enum: + - self + - modem + description: + 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 description: If present, a phandle for a reserved memory area that holds the firmware passed to Trust Zone for authentication. Required - when Trust Zone (not the modem) performs early initialization. + when the AP (not the modem) performs early initialization. firmware-name: $ref: /schemas/types.yaml#/definitions/string @@ -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 @@ -194,14 +225,17 @@ examples: }; ipa@1e40000 { - compatible = "qcom,sdm845-ipa"; + compatible = "qcom,sc7180-ipa"; - modem-init; + qcom,gsi-loader = "self"; + memory-region = <&ipa_fw_mem>; + firmware-name = "qcom/sc7180-trogdor/modem/modem.mdt"; - iommus = <&apps_smmu 0x720 0x3>; + iommus = <&apps_smmu 0x440 0x0>, + <&apps_smmu 0x442 0x0>; reg = <0x1e40000 0x7000>, - <0x1e47000 0x2000>, - <0x1e04000 0x2c000>; + <0x1e47000 0x2000>, + <0x1e04000 0x2c000>; reg-names = "ipa-reg", "ipa-shared", "gsi"; @@ -219,9 +253,9 @@ examples: clock-names = "core"; interconnects = - <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_EBI1>, - <&rsc_hlos MASTER_IPA &rsc_hlos SLAVE_IMEM>, - <&rsc_hlos MASTER_APPSS_PROC &rsc_hlos SLAVE_IPA_CFG>; + <&aggre2_noc MASTER_IPA 0 &mc_virt SLAVE_EBI1 0>, + <&aggre2_noc MASTER_IPA 0 &system_noc SLAVE_IMEM 0>, + <&gem_noc MASTER_APPSS_PROC 0 &config_noc SLAVE_IPA_CFG 0>; interconnect-names = "memory", "imem", "config"; From patchwork Tue Nov 15 11:31: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: 13043532 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9803AC433FE for ; Tue, 15 Nov 2022 11:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbiKOLbf (ORCPT ); Tue, 15 Nov 2022 06:31:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232464AbiKOLb3 (ORCPT ); Tue, 15 Nov 2022 06:31:29 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CCE8D11F for ; Tue, 15 Nov 2022 03:31:28 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id h9so23768720wrt.0 for ; Tue, 15 Nov 2022 03:31: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=IbFCvRl1cs7XC6NWdvqbuTmw/rqE6VsOAXoQYLExO5Q=; b=cYbRnUjqpEjManEKkdqcrYyuXoBez9/oOJAeEmcI2tRlNTl1NoyEzlzIPXCdit1eE5 y4D3xv5gQauvoixnhhcrDQFN4mYEOSGSb+btX02JoZrVFSik0N8I1kAr2aLRC/lB3BSP fcG3BL7lkVp3a+n+C/WKugTduGRsbVe4FqsctV268gfJKOjriumE4V7YaO0inFJyLFNP AIPQiTykLvbSFahIuowc6lGqgxvN636Wt/Jq3kbT46mSkNiSt7OmwDzO/cdAA5zcPU/L HMRBuZ2VJIDa8bXa8oXKHlRr37PSPgOYZMUGhwjyJ/lW/A/zOUp25/csQaESL47qnnaw mDRg== 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=Gp+Ayr5Gw5jkCWBJ4Np/kX1AnshX7e//G8OEnJgijRhNIuwckywwc6bFJ2rBhXVSZa I0/Kc05UYz1mGgtep4qGVDH8rkz0iW7mDMqVTdTlSvRqIeeyPfqE4SwbGifRRWeNkkZY BKLkFATz6ofU/8kdZ6tN/yK7Ig/eYDtvefHWKnFaJL1Ym22ngeX/P0aWbhwN2LD6qf1g 7Bq/SuJz0nXUvB/8+U62kAYRgwqCaiNm++J7cmKCl36fmETagc/76uKYpqtx3M9RFao/ BtXAVe2lFKx4sW3bBGLUvTkVDxWsgbV+fEbSP7DULd+wodV2or48FYPZZldNf5nZPlDX YbLw== X-Gm-Message-State: ANoB5pmbuuJIFTn/RwVvVU3UO2yph/4ITonzPAS6tTUqtiU8eXKi0BqU koKSxytm8UWXWdUTp9LweZ7N8g== X-Google-Smtp-Source: AA0mqf6N5t4rvy2Ue9i7XG8n9ajha5IUsHqryq/2dLXNE/Vlf/iVvJTCgSvQPJvMOWlQH6GLHmZcEw== X-Received: by 2002:adf:fc8c:0:b0:235:9aae:35a6 with SMTP id g12-20020adffc8c000000b002359aae35a6mr9921596wrr.686.1668511886775; Tue, 15 Nov 2022 03:31:26 -0800 (PST) Received: from zoltan.localdomain ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b00238df11940fsm12273091wrm.16.2022.11.15.03.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 03:31:26 -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 v2 2/5] net: ipa: encapsulate decision about firmware load Date: Tue, 15 Nov 2022 05:31:16 -0600 Message-Id: <20221115113119.249893-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115113119.249893-1-elder@linaro.org> References: <20221115113119.249893-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Tue Nov 15 11:31: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: 13043533 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26A1DC433FE for ; Tue, 15 Nov 2022 11:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237684AbiKOLbh (ORCPT ); Tue, 15 Nov 2022 06:31:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230187AbiKOLbb (ORCPT ); Tue, 15 Nov 2022 06:31:31 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C821F1A3BA for ; Tue, 15 Nov 2022 03:31:30 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id j15so23767513wrq.3 for ; Tue, 15 Nov 2022 03:31: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=QmJK2z6YewxghveqGIb9UQBF6OMvTjY+OevUyUnH0xk=; b=k4Wk8SJzRhqnAXgbsU5UoMU6S3GG5pKKmOwOlxbFHnJZK2Gd1ISJplEGnPTTgav2Io p7LEnsWo+qY65f9r4bO1QhQR6I4KnqEVRZPkC1UPoU1BJcIcIfyqLGVFB7l9ytX6LKg6 RmVHalJsc+Af9sEHGLvpgJLFysuZSAyGXkcXC8TD/7d1jjz3gJPLcr3em5oZDNlj6u0h Koi50OZFkn26y6VCrs6mCrl4zccZ3ee9sJ20m7msyngMafejHfgADR+HiVh/QPIcHx9f zkEl0TlYx7/uSs54/CmF2F3cGX0vHoxQB4RFA8oVgsyUlOVRS+DVFxyZm9d/jsCxKiHn uOUw== 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=7uimhxF8n22+phsfEHKu5SiMH4EeidYU90tjtsm03L03dMRuNXD8B4iwW0fMeAa8p4 TpalHsDMEmTjPVHu7OcaKFXJ2dk1oSQgt7Et80aS6txArweab9SS9saSQPorpQi7JJVX 4gk5CQkR1Am9QDZAbw0p4DvKBjzl2Vygkv++V9uTcPzNLMBPM+KVWdkRlvSyc8y82wFU d21m4bpL+XNmbUXebLsqh9oaHpQDmV/TSDxxx5kwiqV1a3xr3Kgvuwc8Nb8j0ZsTexG7 gdGdU/7+JQgVGjmMATIVFL6hvksPGm8DlBru+8pcKnpcvYo/SISPxtMmxDEF5/+InLXY JpLQ== X-Gm-Message-State: ANoB5pnOHX/NQ18CLA1A6aDCPk2xlEiFkyhojAOY2iizaL1j2AB0HO/d +udwtlnRikXqOS205/MbG1eBlQ== X-Google-Smtp-Source: AA0mqf5T/TlbfoU3tRLzxMxknGknMiobNOGrTYTtHcl5JPzD7NAwIFrBv5OSukCtRDjOYMCppujbXA== X-Received: by 2002:a5d:4903:0:b0:236:87f4:75d with SMTP id x3-20020a5d4903000000b0023687f4075dmr10004008wrq.447.1668511889176; Tue, 15 Nov 2022 03:31:29 -0800 (PST) Received: from zoltan.localdomain ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b00238df11940fsm12273091wrm.16.2022.11.15.03.31.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 03:31: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 v2 3/5] net: ipa: introduce "qcom,gsi-loader" property Date: Tue, 15 Nov 2022 05:31:17 -0600 Message-Id: <20221115113119.249893-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115113119.249893-1-elder@linaro.org> References: <20221115113119.249893-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 Tue Nov 15 11:31:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13043534 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAF44C433FE for ; Tue, 15 Nov 2022 11:31:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbiKOLbr (ORCPT ); Tue, 15 Nov 2022 06:31:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232984AbiKOLbc (ORCPT ); Tue, 15 Nov 2022 06:31:32 -0500 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 614A0D11F for ; Tue, 15 Nov 2022 03:31:31 -0800 (PST) Received: by mail-wr1-x42a.google.com with SMTP id v1so23701571wrt.11 for ; Tue, 15 Nov 2022 03:31:31 -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=8v8FoH1On1F2wnSoCme92GBkJZmxbbw7MltkC0PFYms=; b=fV81m0WSB0Y0qWL64erh+PxRX/0jfKH6EuUYi1t5kjQz8PuFyAd/DioBHcf1HQT1db OddtrRrcbbaPvBsbdaXjpnNFSM8I5foNs2TU2VHwWYfJfWJMz3jJWdko60QZC1c9W2+K x04Jka6V9I2ds31GZRRI7ZwSHNYHKBUgVHXYO2ZuTlvGyZWXgbWMetK/aWK/O+eNT5SQ TTMkr5aMtu0YG3tnX6tWeNIoPYlgqieK07001dSLFGfH+0PoCe+hlvZEmNXP2oOLqKRd YYjhFulu7AC/oG076eU0IV4Xc3400GQwJ6NAYXFDu5aowI0gVPXvwjawC5ID9sLV9ZI5 FcTg== 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=8v8FoH1On1F2wnSoCme92GBkJZmxbbw7MltkC0PFYms=; b=mathZfyqG9d6TXyZZIyvhx5kIuazKNQerF1q+VhKATTS+rwcaPbi1LQmLJgPe/COTy zJR4DrfK++XlUgV7U0oYCh5Igyfdn+juqU0VCpIWYsTLK3nwvqnE46nVtISgzT9hdiMp 8VZrWGlrbtn+7iRFRESb3eB9aVafr1XKXqZJrhLKMtDyWep1lGa7fyW3W3yJgdVOBsA6 vHghrMi9RY1bILTuQaRpATaTxiSwME8ash18FET/ZRtvslOLLrWcVJhJOJtV2JKsNhoF W07nrtbXvWVEsZw3mMhDFB2cEY23kHtOdOc4Ydf3ef4fNWo80V7arRLFdeh/YlJ7vSwC 3snw== X-Gm-Message-State: ANoB5pk3yxzSjxSWsz5ahhZNxMJfgj2mEliqlONKd/ouqoAzRNGrlGeu HV36sIThINlspAvjBVENk/VJgA== X-Google-Smtp-Source: AA0mqf4rBCbH8yVrbONUMZtbsOjGvs/+gFwoCFUHPTxOJOfNsDMlOXKvZ7JDtRGqVf/ZjSQQ60BhCg== X-Received: by 2002:adf:ec8f:0:b0:236:ae0d:e833 with SMTP id z15-20020adfec8f000000b00236ae0de833mr10196617wrn.155.1668511890934; Tue, 15 Nov 2022 03:31:30 -0800 (PST) Received: from zoltan.localdomain ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b00238df11940fsm12273091wrm.16.2022.11.15.03.31.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 03:31:29 -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 v2 4/5] dt-bindings: net: qcom,ipa: support skipping GSI firmware load Date: Tue, 15 Nov 2022 05:31:18 -0600 Message-Id: <20221115113119.249893-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115113119.249893-1-elder@linaro.org> References: <20221115113119.249893-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml index d0f34763b9383..9e81b9ec7cfdd 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: 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". + Otherwise, "skip" means GSI firmware loading is not required. modem-init: deprecated: true From patchwork Tue Nov 15 11:31:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 13043535 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4328C433FE for ; Tue, 15 Nov 2022 11:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230023AbiKOLcI (ORCPT ); Tue, 15 Nov 2022 06:32:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237221AbiKOLbg (ORCPT ); Tue, 15 Nov 2022 06:31:36 -0500 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA0C21D32D for ; Tue, 15 Nov 2022 03:31:32 -0800 (PST) Received: by mail-wr1-x435.google.com with SMTP id a14so23753453wru.5 for ; Tue, 15 Nov 2022 03:31:32 -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=D8EGa8htGFTrwr+uWFdhGjdWi5azQWY7WKuZsWKqSGl7DOBh5SqcqwVODSBoQ5raO3 16AhnKECzyxTxO7lN0ueLWY2nuYw2CdMPY/TbAJfSzrSkwxtx1hodXF27VnVR3P1SJwA wDO79WtzmOQyTP+Hy9qWADtHJAB2b2DxfGDlH8/j8SdN5KygAJ4KVfqjfABAjmxKamZl Gamru9txX23IdiJM7YAAh5W8WZfXelXG2MdFpSx2khyzXBPdwMHdllb5kf1+/UXPmw2y E5jfGp8Vv0HZ60B2wDiJQrYWgF/CpkTkZmYgOn5gJZNWsdBSnK08LXQSpPxY8pxRj12Y O3qQ== 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=sG3+5gOHrnPs8vxOw/lmFvQhenzEnbbwMGqKzT4L3nNfvzkh3pobPcRqKD8TDm20iB 6OR9XtaR9AJf97aRCTb+QNKql7ebzMvyFO41fTqcC8fhMhOIsFLVIXB8AmSinZhk66OI GBkx8F2kifbQBdPqU/0a7o2yDhRamKCBz6XZuV0CcA0TinXTxPvMdnwttYQ35jTzVwP/ RN/JIp6eoj8CAc1EbyA2Y5fiGYCQPKiZGVe2jadkKHrpqpxShBT7Q5QMeerTcx2FkV0Q LHhNc/vqlOEhl9y6ZFPj3dHwuxhDD/XXP+8FBzN+g33AapXBqtNs2uTUCGL1jwGxA7Jl Ik4w== X-Gm-Message-State: ANoB5pmrHhCMK8jGr9A6opumNwJzxx1KFnv/A+5L0myiWS5Dk/TV/nf0 kMlClYqnAqg0b4d7+yR4y+IRVQ== X-Google-Smtp-Source: AA0mqf5jBv+V66YDQSGDY5sxfIA+tTGVm91bEfy16sYi3/by6+Igxb52m7WTZXG/KVa3dltkOhZuIg== X-Received: by 2002:a5d:58c3:0:b0:238:8896:7876 with SMTP id o3-20020a5d58c3000000b0023888967876mr10459521wrf.645.1668511892383; Tue, 15 Nov 2022 03:31:32 -0800 (PST) Received: from zoltan.localdomain ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r18-20020adfe692000000b00238df11940fsm12273091wrm.16.2022.11.15.03.31.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 03:31:31 -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 v2 5/5] net: ipa: permit GSI firmware loading to be skipped Date: Tue, 15 Nov 2022 05:31:19 -0600 Message-Id: <20221115113119.249893-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221115113119.249893-1-elder@linaro.org> References: <20221115113119.249893-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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);