From patchwork Wed Nov 16 07:32:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 625642 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 EE499C4167B for ; Wed, 16 Nov 2022 07:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232546AbiKPHdH (ORCPT ); Wed, 16 Nov 2022 02:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232704AbiKPHdG (ORCPT ); Wed, 16 Nov 2022 02:33:06 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58636B869 for ; Tue, 15 Nov 2022 23:33:04 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id r9-20020a1c4409000000b003cfdd569507so919446wma.4 for ; Tue, 15 Nov 2022 23:33:04 -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=iPPeUQlF89WuMuKsE4L6h0ih48TI+X2n9tqxiV2tD4Q=; b=ImY4GLY1t/Rm4yER2CBeMhVxYLKVOewt7gDiUzCuRDac1mKXRnEUWXCfS1gwlytz7I VDfuGN4n7HXiRl/9Zbc6+zM84UufF2LthkeMQHDmuG+tSfpe1WJFzuzAizwDjnTxUCNf Ymfx4+iAlaYQu36is8mVx7V2LtE2lYkJotNVGb6+bR75g9/YFyXxD4AeoJfa2RK0j2a/ HbgSrIi1RSTXYlD1h7hl32fv4HPw1h/notcrUL1W0yXX9c0Dol0K3kURGIjr9mKZLLxO CS+CtPWcItnQ+nBh0pRZ9Ok7Mwvz165GboELNavCxm/no/pptFlJBCdJNawb4mN5Z8MF 47BQ== 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=iPPeUQlF89WuMuKsE4L6h0ih48TI+X2n9tqxiV2tD4Q=; b=VnkFqOueZpqK31wqyoy0CtSab2P9Pf+17+b1Ufbwhd79QP9n6T+SnSK81Cap65fg1Q gBoxmQQCTqyTCSGkPuGK7H9jpecwQLwWvMrzF6MQG5jA9gul0+/4Symm/55UHDq83hom DvTKiy3g/8KvywI131H7SGxc1vv6AFzuAkCHO0DiaxCiLjpQJ/NVUt8kiY1xm+9uq+iH 8LYpMeos/GJzqySPPQAL6RpA4DcI/3dtV0gZB5WKnazPxvHc7QXXoGIONSRxdUUK8b1S dtD/GtRLxj2dBnL+pl1CT/w8/QHt9w/RiualtTiQkwKkR9+ywXQkU4Re4ipNEJweVwdy 3Olg== X-Gm-Message-State: ANoB5pl4u+6krKQU4wCbZEx9CQIVzF4CjqBLqY+IVq8FbRriNuuLmEjm AjJtWipURBF/7gVslMbl7Qv0Ng== X-Google-Smtp-Source: AA0mqf61rSZif5wCcHsiohgfj7pbnGS/nsbqaryTioIkwNHJgCdkyYmo/qVHdZu7ODJRNJ2O/KmieQ== X-Received: by 2002:a05:600c:3046:b0:3cf:cb16:f242 with SMTP id n6-20020a05600c304600b003cfcb16f242mr1205354wmh.82.1668583982753; Tue, 15 Nov 2022 23:33:02 -0800 (PST) Received: from zoltan.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id g34-20020a05600c4ca200b003cfd4e6400csm1058823wmp.19.2022.11.15.23.33.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 23:33:01 -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, Krzysztof Kozlowski Subject: [PATCH net-next v3 1/5] dt-bindings: net: qcom,ipa: deprecate modem-init Date: Wed, 16 Nov 2022 01:32:52 -0600 Message-Id: <20221116073257.34010-2-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116073257.34010-1-elder@linaro.org> References: <20221116073257.34010-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 Reviewed-by: Krzysztof Kozlowski --- v3: Added Krzysztof's reviewed-by tag. 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 Wed Nov 16 07:32:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 625232 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 E5342C4332F for ; Wed, 16 Nov 2022 07:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232867AbiKPHd2 (ORCPT ); Wed, 16 Nov 2022 02:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232739AbiKPHdG (ORCPT ); Wed, 16 Nov 2022 02:33:06 -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 B8599BC09 for ; Tue, 15 Nov 2022 23:33:05 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id l14so28453857wrw.2 for ; Tue, 15 Nov 2022 23:33:05 -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=DU7zoibqF3VBeTWDB1vEVwMsv4KlatyI3tqd0l3rYwWf91OWuP87YxY4SgVZW5bSja P/AuW06El34WSS9tvrxvmpqlp+Iu7W/jCxl/UUk9jczg1+LrryegvgjlQ92BF7QN8m7E yymio/ffeYE8OJuEs9x2SWrTUyDYP6TgfYL3LtfA6PmSmnPVgvgCNmvrfIRbAbC1+d3D mb2qWhHHyUgmEBaBBEO6OsdRKR4iPwe9qZN3jHsmKu9t4x4HHiICUE/l5ZoMmwnD+q0s caM5y++t4iivpSWgOlOnjFS1OXBeQy67ZtcG9aK4ni7NUIqc6kzCLWRwqYI7cfW+w4RL 3DeQ== 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=L4Jh7gecrSBM2joNp1b52pvWhwlV+hDNwQXOz1eTHuTvg/yZOsG+wdkQR8nWreE0Jv OI15did4njKEvDApBqTcqSAKC+3Jm7waYg56Mc0OZQ3Mtkj+t+N/3K9c3BeVfhCeRK7m 21h5apC9Zu9xdkx/TwO18rQhDYIaBIfa+Bh1dssQr9Px8FsGxt+lAqORTfbhIaoj4okn CQz/uXn4gMehBpuDGsYTR8OitNDlz4uHGqKYsb5o1k79nWGa7oIug/TUkzyDyjNqcVfx Z+MDUqg44CdGe2wMI+YsWju0RGAY8Tm0A/VoB0HOQ+GOjuiz4SULaPIIIuReln1uRr1I hTnQ== X-Gm-Message-State: ANoB5pn8iq/pXzIAtRdSJAnu8XoyINsGDJeHpV6RCXJMx7hYDSR0ZP3s 8Btqh+aVa1ZokKoLICDxxspGqQ== X-Google-Smtp-Source: AA0mqf6cWWDeTZxYs8eiGGu1JwEuX0r4Ne2NcNUJL+s0RO7tr8L1y6+afgEwv7VvBlyhwtpJLHEcrQ== X-Received: by 2002:a5d:5446:0:b0:236:6442:3a65 with SMTP id w6-20020a5d5446000000b0023664423a65mr13222982wrv.84.1668583984173; Tue, 15 Nov 2022 23:33:04 -0800 (PST) Received: from zoltan.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id g34-20020a05600c4ca200b003cfd4e6400csm1058823wmp.19.2022.11.15.23.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 23:33:03 -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 v3 2/5] net: ipa: encapsulate decision about firmware load Date: Wed, 16 Nov 2022 01:32:53 -0600 Message-Id: <20221116073257.34010-3-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116073257.34010-1-elder@linaro.org> References: <20221116073257.34010-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 Wed Nov 16 07:32:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 625641 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 32442C43217 for ; Wed, 16 Nov 2022 07:33:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232760AbiKPHd2 (ORCPT ); Wed, 16 Nov 2022 02:33:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232762AbiKPHdH (ORCPT ); Wed, 16 Nov 2022 02:33:07 -0500 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6213BC37 for ; Tue, 15 Nov 2022 23:33:05 -0800 (PST) Received: by mail-wm1-x334.google.com with SMTP id o30so11280285wms.2 for ; Tue, 15 Nov 2022 23:33:05 -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=AlwDnToVO2of7fWwUMmka1YavMRruNRrWzdBbvlUDfspCxIL90nNvyGeVYFxHCrwSa qiaS3T7X63l9vutvktkMzPsvV8+N7I0qVjejVbxzFPUn4sPaJ9OvXFZQf/3f/5Ln5k/J 27Ef6HD165TVua+NrERnzzR9+lFEZMrxkT+ZvGI5Ar3alJ/9KDz7dwt28z68oxuq6yex NjSkHgdlAHsHw0IWX+vT0UusfXj/zSydp4igAc+jsX7kHqFJvcBcfuPkR1jKh8G9IMZL uyl10CjRKz1Pwp714ZcObGaRQTsbaKt022qSs/ZqnPdqurS8vCUHEnKTzKUM61/2OolN 3GGw== 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=u4nfbpLO9ZQ/NJLkbrqFm0gHujGJ/ZePcFCzqCa0aIYDKJKuuagaqjIy/qVghcBu54 WRQ0nGakkjNp4sqGKk7Zi1LZ9LtKqW79NQbGk4YOxjqV+zLMnC/WnD052enqK7mCHDS1 OVl98uLju+f2HycBmq8dAtgehUdvJTva3ouwIYtEr5DEdWdGLhEwfnQwQ5mrDTBqLdY+ 3tG4PGgrPyRix6R5YbFVUQcWkYPvziqz6VDO/qsZEqZpDXjmnM7eOsxg+nt3N9t5G1E8 q3oEaNHcQQgbvSOKJmOH4L740Fh60dFCZE/OhCsSfiU6HN+avu3Dcp7mKXbb7NANhu0r lQVg== X-Gm-Message-State: ANoB5pkEOc/GtKzHROJL69itlwUQDNNmgPYMOTNM4tS1AqV4uPSYJgmm 8ywYVY/Aia01GrIsirkUu+7V3Q== X-Google-Smtp-Source: AA0mqf62Ld8reiwgFoaddozR7mLXKWhrMlpi/Ugv0wlkVD+1Yr31Rmsy7IfPlu/JMX7DeFk05uwbXQ== X-Received: by 2002:a1c:e914:0:b0:3cf:d055:9138 with SMTP id q20-20020a1ce914000000b003cfd0559138mr1126362wmc.140.1668583985420; Tue, 15 Nov 2022 23:33:05 -0800 (PST) Received: from zoltan.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id g34-20020a05600c4ca200b003cfd4e6400csm1058823wmp.19.2022.11.15.23.33.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 23:33:04 -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 v3 3/5] net: ipa: introduce "qcom,gsi-loader" property Date: Wed, 16 Nov 2022 01:32:54 -0600 Message-Id: <20221116073257.34010-4-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116073257.34010-1-elder@linaro.org> References: <20221116073257.34010-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 Wed Nov 16 07:32:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 625231 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 A7A32C4332F for ; Wed, 16 Nov 2022 07:33:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232947AbiKPHds (ORCPT ); Wed, 16 Nov 2022 02:33:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232868AbiKPHd2 (ORCPT ); Wed, 16 Nov 2022 02:33:28 -0500 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FCD3BE2E for ; Tue, 15 Nov 2022 23:33:08 -0800 (PST) Received: by mail-wr1-x42d.google.com with SMTP id d9so23728391wrm.13 for ; Tue, 15 Nov 2022 23:33:08 -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=nYNlJyihLZjd+VQJNRFqHneq/kxBQWta00+5mLZPhSc=; b=Q6xyqG3ndI5aq/sWqfLQTKiGdcWJAmI3Oa/Et2oMDiAaVp8SKXeCBAYm+UeIJyuqW4 rDGbE0knBMpgYLDgeWCXrntJFy4NVI6BbWbC1awE+okko2B4nyhRfhMmbZBXMyTabEW1 4YVP9uL+hRsrUaaTdPmJUf/ZqRv3UltsxGW0yUmvgDh4fCvv7sy3Hf86RRMGV7OtkqZz x53UtEdMgH3KTjl5gooZHSkHhCTd8Ui9E3DTk/RcF4hZkYOSFn/tun29/7DXGdtPCdYQ uR2TgQIkxDBWOltdF0oInQteekJuOYDRz+Omh6osaYgq6mEqDSGbl+qXs+5hc4Hc34Pc wD8g== 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=nYNlJyihLZjd+VQJNRFqHneq/kxBQWta00+5mLZPhSc=; b=7YxAvSWrUFrEf3tBByaxEy+W8dx5vkL9AreNtVpwGDYTJ0I5q4iSUdIiChMU1DFu+m RfbDXaUotil1J+T2uAxdgRBWdqB0bi6CSS2byQwOwJcAJAuaEU+mQRTF/tI78UbR1fgY 00+3OaMXTpXAH7cEf0y8np4co2H+JIzDuhsAz9R8gzq0+4PXKhSJHURA5mhdKxUssPuV 0qFoFvxRiL1ZrjBZmsKxBbBnC12Ih5KyIOCG4pICac8Js3YEJhmGvT5MseuSdogpxFca FmFvT7esYMmltTRQ5N50AgWI7G6pOpNrz/ux0zQUtYxuepq1TcMLXxi8TuKggNWJamxX EPBA== X-Gm-Message-State: ANoB5plCRY05RhysUUoXBaEr3xpGyEHFW1nvigAWJuMJg/9vEoB4btCw pJ0l5xHKYY/WxgZCElrq5g+cYw== X-Google-Smtp-Source: AA0mqf79Jwm1CZUIvNyOxXNbrSaQyp5YQ46u91JhTruMoD5mNp5fCApJbJqtY2t8ghJQGO5+JRBp0g== X-Received: by 2002:a5d:518d:0:b0:236:4ec6:af52 with SMTP id k13-20020a5d518d000000b002364ec6af52mr12606634wrv.524.1668583986957; Tue, 15 Nov 2022 23:33:06 -0800 (PST) Received: from zoltan.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id g34-20020a05600c4ca200b003cfd4e6400csm1058823wmp.19.2022.11.15.23.33.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 23:33:06 -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, Krzysztof Kozlowski Subject: [PATCH net-next v3 4/5] dt-bindings: net: qcom, ipa: support skipping GSI firmware load Date: Wed, 16 Nov 2022 01:32:55 -0600 Message-Id: <20221116073257.34010-5-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116073257.34010-1-elder@linaro.org> References: <20221116073257.34010-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 --- v3: Added Krzysztof's reviewed-by tag. 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 Wed Nov 16 07:32:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 625640 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 E9BCBC43219 for ; Wed, 16 Nov 2022 07:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233014AbiKPHdy (ORCPT ); Wed, 16 Nov 2022 02:33:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232912AbiKPHdc (ORCPT ); Wed, 16 Nov 2022 02:33:32 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AE20CE3A for ; Tue, 15 Nov 2022 23:33:10 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id ja4-20020a05600c556400b003cf6e77f89cso2534016wmb.0 for ; Tue, 15 Nov 2022 23:33:09 -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=bUEFiyV6kZIbszj2+ZIoMR3VTFJn6PlTsF7tRLl0wEQxGtgtif3Y2dDkmsoG1FumFw JMIFFU92pNjKKcVCF2rJaWSO54zy4tt6BjgnERylWwYu0aBDo1wwX4NKhablIM1r0WRD QneZc8D4GylnFjzHyC0m9IC/xwKZ8K1zBTIyqJdVRzxFP5/X9mHOutth5ynK/jY88dvD 4U+KCK/qE5wFDEEn4FAz7jESpw707XHSacO0QWhyCFHVeWGuVky0qV14WG1NWghbIBi5 0B33Z2c1FpTHhd1h8qTaAQ4aLw1raMYtHH0+VuF4l8x0SCi09v8Yi/rnW07WBAs7Kg8o 4eaA== 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=0gT8PWga+w6w7bIkLTzwVmHV4D3TysFBI52uTgKxebZcgF0+5Y6hn4bRfWwCozj6Ew mJ3YJPjcJL9uAkknNRlgdmFn3/af/kTuYbrf8GipGK4/eFciocQBWRS22uGmKtSvUrT8 O5bJKZftFBEivrdC0mxYdtEdn6c32TKjMne6xgrlAxUiiZ5b/i+BUrwQviKXaQCJWrn9 vJ3bcAfF3ZzWeJlCKyO8nmEG3A4kSgjWU0wJEokZFMtBnIrddUKY1EoFCSVuaFZNkntQ Inm9KMX1xK1ZbzpjkniBc6uCQ0PgQQe89ZoiDazcy92ZsIF656xnwNkbkGJrBK3+KAMf I/Dw== X-Gm-Message-State: ANoB5pkzKYF60C3nPkX5xASz1Ij6EgMdM5QDQuxEzu83cVgf2pn1Jf9H cLoySd3RsQavHhQvKm42p0ydFw== X-Google-Smtp-Source: AA0mqf6IF32dqwD+h34rZGFcpHBXR0x2Q6uB7IJvbcW/F7hh0WTEMrqady8f2Nmk/V07Y7wtvY7O5Q== X-Received: by 2002:a7b:c00a:0:b0:3cf:e8f0:ad11 with SMTP id c10-20020a7bc00a000000b003cfe8f0ad11mr1215370wmb.65.1668583988521; Tue, 15 Nov 2022 23:33:08 -0800 (PST) Received: from zoltan.localdomain ([167.98.215.174]) by smtp.gmail.com with ESMTPSA id g34-20020a05600c4ca200b003cfd4e6400csm1058823wmp.19.2022.11.15.23.33.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 23:33:07 -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 v3 5/5] net: ipa: permit GSI firmware loading to be skipped Date: Wed, 16 Nov 2022 01:32:56 -0600 Message-Id: <20221116073257.34010-6-elder@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221116073257.34010-1-elder@linaro.org> References: <20221116073257.34010-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);