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: 625685 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 BE361C4167B for ; Tue, 15 Nov 2022 11:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229505AbiKOLba (ORCPT ); Tue, 15 Nov 2022 06:31:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229990AbiKOLb2 (ORCPT ); Tue, 15 Nov 2022 06:31:28 -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 B2B3517E3E for ; Tue, 15 Nov 2022 03:31:26 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id h9so23768594wrt.0 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=azHBX7OgJJVie+nRjkEg6XNqBeE5AmrMT/yaEa0BocPQOPMUnIQ9aCnfm7+t3k5rjf RetLgSVF55HSJzg1CU9KTkMMgjrQ6MVD7kRaLtiQHNdfAJSsnVe5Jyxl/IaHXPVVBcs6 n5kdJCBPQ9ECUCqyNM0lGsQn2jKP6hSTqyaeHYg6CDmxZUEC6iMFElGjY0J1SLxWzjXm HzFGkiLRBLJww4mbbbj8UwQtGem7DVaKa4kdvKF7P+VGJ1Y6tv2WKviKWDCRXi6RK2Au zwEvjqQdHz4IwxLdcDkcKvjw/ghKSZBR4abqya1Ga9x6JK5KLcQsYSRerYuH/t6/CQUf ZnVQ== X-Gm-Message-State: ANoB5plu433brRFMc7N9VA+o9G1tOSITbR/cp/Mn5mU0PuUZE+j4m9fz Y4aL2PoAOefN/d+XyLKs4tB5pQ== 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: linux-arm-msm@vger.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 --- 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: 624915 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 4ACE2C4321E for ; Tue, 15 Nov 2022 11:31:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232736AbiKOLbc (ORCPT ); Tue, 15 Nov 2022 06:31:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbiKOLb3 (ORCPT ); Tue, 15 Nov 2022 06:31:29 -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 4CDB217E16 for ; Tue, 15 Nov 2022 03:31:28 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id j15so23767342wrq.3 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=2JJu3h7XUMl102uO6mQeHpWz4eulSvQQDrX8T4pHcnajDF4JNhB8IvEsd8UreBHqXX BKwpQW2AZm4A0e1oEoVHGOV7HKAyM0O+bwJZnjR2RNvD88G5O9Qg7aOsdZst1tGJxkDy JtclPAyvd9rW2q2RO1BoEetiDBXywfWJ2lHMkW3nTafHoJiKh2VLQnv6tSHAlazmBMme et6ljCwzO3hbwu++t4Z5ciS2fP9EhELHQyRYDP6I63uACslbnGqXE9zncl8DUv2e23Wg GDMa2C7bWW4y5ZHxON5pWRwV/51m8M7Xnvmy4mljs7LSjz9oOjnX4/3SrbqXBV/tO7f9 vdAA== X-Gm-Message-State: ANoB5pkK3dwhftSV1yIwz54zkEb7hAUn6EhQuodD8V3UsmKivvVFOsAo g8Sxd9EH9/mYbwTLErU4DwFJtw== 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: linux-arm-msm@vger.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: 625684 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 CF453C4332F for ; Tue, 15 Nov 2022 11:31:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230332AbiKOLbh (ORCPT ); Tue, 15 Nov 2022 06:31:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232439AbiKOLbc (ORCPT ); Tue, 15 Nov 2022 06:31:32 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83C91A814 for ; Tue, 15 Nov 2022 03:31:30 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id d9so19025744wrm.13 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=GSORQLTBP/cOE9VxGK6Q0f1FzGKq1goP8eO9KtSIi/SQyKue7aIJWln7OPypNSnUu6 iN3hW5FdPjjlFfCIkcIMhcDRlqmEPRRl831NHChDuWdnRTakSMEg6+Y5CrxnEoFOxPd0 EM4yBSQjUoNjOLE2RteQEf+Qk/ux7/axQ9iNZQhRCUiK3b9RaiXVYdTfcG5DD0Rs3RJ2 tGtfE53GALDNVfqHxkrmErCRFToTMQ5lEhkfeUjYYOnmwUL1loMgb4gr3Qv8ueUt3A9J AWh0GizBAFx0ZgSNsQMsVtcfd2nvYFdGoCMV9CoVevL4RXgXNVQCOffFZ/JUnATaYO8G UQjw== X-Gm-Message-State: ANoB5pn9QAhJbtKXRFIU8tGWsbbgMDTeoOvOykmAPlspkAlW0URqhVTZ jB8HkmCGqZ8M5pHJ/De4xyjETw== 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: linux-arm-msm@vger.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: 624914 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 3AD62C4332F for ; Tue, 15 Nov 2022 11:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbiKOLbi (ORCPT ); Tue, 15 Nov 2022 06:31:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232860AbiKOLbc (ORCPT ); Tue, 15 Nov 2022 06:31:32 -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 6214117E2E for ; Tue, 15 Nov 2022 03:31:31 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id l14so23737188wrw.2 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=V/Y4kj8/QcDbS+cCekKIWelkwQble13y9ss3oJqFkyvqaf40epva4F8BaByvHarQVO x8kLee5D7pmFdQ7mKtJ9Pl0U8CJ3YkuJxHCsGs9MBNG1AmBD4DjV9SBkjc58m38t7Xa+ Rkdls1LQf5+IP307LmCdnor9UUui9RYR1VlE5aE0XzgBF0JT0PGwjXn2/nTMa2yQ57fo DXphR4PX44SazUEtpjRCcQ8p/CybCXYtVoTeGoGR1PKkq08f/h4mUt0eozwm0Mzcet+V iJFmGdiYN2r7TXnMkrSP8xLUOqRjUMrOWumwrAW/8xLpKRCXXBzYYSZ+99nF396729UP YDUg== X-Gm-Message-State: ANoB5pnjPnKNIrbTgg5h8PRYZ1uuFm5iDbquTxCaNPFUCfXk82t+qfhY cSKuyOmam1fMJfOImQ+TGE18/A== 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: linux-arm-msm@vger.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: 625683 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 9CDFFC4332F for ; Tue, 15 Nov 2022 11:32:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238096AbiKOLcG (ORCPT ); Tue, 15 Nov 2022 06:32:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236796AbiKOLbf (ORCPT ); Tue, 15 Nov 2022 06:31:35 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D923B1D0FB for ; Tue, 15 Nov 2022 03:31:32 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id o4so23626232wrq.6 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=x5FSxoq6F0uRSnAqlXoC3Umkd4MOvlZWx0IAzLaPotKgheFkvAFH2IZtzaKW6PZgXO UDrS6H8SNU+ebvo1dKlQaFj/iFMHwx1LcSx835IKwzSrysHCkIJXUi7pAwZYsxvZlpdT c1gHYdQDhTG27S4Vn2/nLIf4XwnHFFsDwFACPwE+OKl0mna5qTOaAGijeqZmSFZsctBn 2eXsCZ+hFong8msKnNhjorm29A6PtgBqRVCK8luLYNcj/BsW6tHFj8+tCL42TJ/aNOZ8 Jz8nlBGIbJZyubCktdmsz+N1QYK0Ue6qbmaD/Lp1fmWp5GPJNAVn3siMJr8ZK0Z6R4ak /1CA== X-Gm-Message-State: ANoB5pmNXh1ZdXdCBOpATwIYDCrg833H6TWRUCJmJ7NnI8Ych+brVmCx Ou9X8ux03foo1tTf+f0LQRdQ7Q== 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: linux-arm-msm@vger.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);