From patchwork Wed Jan 8 01:38:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 206045 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CADDEC33C9B for ; Wed, 8 Jan 2020 01:39:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A09B42087F for ; Wed, 8 Jan 2020 01:39:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RLBhSXVp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726462AbgAHBjI (ORCPT ); Tue, 7 Jan 2020 20:39:08 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:41707 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgAHBjH (ORCPT ); Tue, 7 Jan 2020 20:39:07 -0500 Received: by mail-pg1-f196.google.com with SMTP id x8so731649pgk.8; Tue, 07 Jan 2020 17:39:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qmrdZKjfoj5CPPpFPntvvUb8XA6zxvuRpATASktYgx8=; b=RLBhSXVpuH7bSToM7ryiPRACsQBWcixdah7WbPGr3+ch0C2MAzFehC4pepjTsc+vVP xNiK5Fxxzl+cV/ntZjvoCz0VY5LDpmrib9uDBk2fC2O54Q0Tl0VjA/FCgFmsKwho/oyd gWoZWPrXx3rZ8CzgKHIT4KiSU4PcMGDE7zXv9xmhm5sQkK4NAVJVFnIvYp3FY+qijYrl R1KdCkSnjAd3P7yIvGRsNaoTqM/X/Eb+maIZ+/4Jb96uudk78emR41mqefCTDhU80mPt yBx1K6qaFffaVuTz0d/Wdw5p3QfpTFrozHnxxBW10HED3MND5AJnBPuHsHKp6ce6ym5u m0ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qmrdZKjfoj5CPPpFPntvvUb8XA6zxvuRpATASktYgx8=; b=lKWekUWTfQY7OB+grRhMJnqRgsqKazQ7YkIRkhXzes8NJlFl0IQtR9DarvkkaDgXWn ucQsRafFEeRktrMkFA0kqLr0oekFjoSAmqVdqwqTMuYjTTUg9CVAppGfIpNZHWuU7Ybp JtJrDXRPLxvFhly9CJxvSZRxuC99FsLNjuWv/Qp7rlWsgmym8ev7mHfmAZpCwd67wRGd SuEIwtvCO4yLH/1tZaKZJW55uO8VMnKpuAGcFR31aOtKwFXvMnsSwvfbpeVzSz9lCfb4 DxaNEE5mVMKSAKx/r02/sQIju3odJm8PdeOmTVc7NvMSUxz8jn+BCUR+xyulpiwCCLXu Bd8Q== X-Gm-Message-State: APjAAAXNUDJfpIdQiTJgJ37P2wUxH9YbF09gKBf+uFZw4eLMr9ogIlaT Yko5KYkTEwSt0EWkLx+kMwg= X-Google-Smtp-Source: APXvYqw3ceWxjw28vQ+TgLakMSeqysklWmwq8fwM3OqFKNf2PYqo7dzAgVYBAG4GXWDjHotd4QIKBA== X-Received: by 2002:aa7:82d5:: with SMTP id f21mr2448554pfn.245.1578447546754; Tue, 07 Jan 2020 17:39:06 -0800 (PST) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id j2sm867160pfi.22.2020.01.07.17.39.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 17:39:06 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: devicetree@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Bjorn Andersson , Jordan Crouse , Sharat Masetty , Rob Clark , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Greg Kroah-Hartman , Douglas Anderson , Brian Masney , Fabio Estevam , Thomas Gleixner , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 1/3] drm/msm: support firmware-name for zap fw Date: Tue, 7 Jan 2020 17:38:42 -0800 Message-Id: <20200108013847.899170-2-robdclark@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200108013847.899170-1-robdclark@gmail.com> References: <20200108013847.899170-1-robdclark@gmail.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rob Clark Since zap firmware can be device specific, allow for a firmware-name property in the zap node to specify which firmware to load, similarly to the scheme used for dsp/wifi/etc. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 32 ++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c index 112e8b8a261e..aa8737bd58db 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c @@ -26,6 +26,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname, { struct device *dev = &gpu->pdev->dev; const struct firmware *fw; + const char *signed_fwname = NULL; struct device_node *np, *mem_np; struct resource r; phys_addr_t mem_phys; @@ -58,8 +59,33 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname, mem_phys = r.start; - /* Request the MDT file for the firmware */ - fw = adreno_request_fw(to_adreno_gpu(gpu), fwname); + /* + * Check for a firmware-name property. This is the new scheme + * to handle firmware that may be signed with device specific + * keys, allowing us to have a different zap fw path for different + * devices. + * + * If the firmware-name property is found, we bypass the + * adreno_request_fw() mechanism, because we don't need to handle + * the /lib/firmware/qcom/* vs /lib/firmware/* case. + * + * If the firmware-name property is not found, for backwards + * compatibility we fall back to the fwname from the gpulist + * table. + */ + of_property_read_string_index(np, "firmware-name", 0, &signed_fwname); + if (signed_fwname) { + fwname = signed_fwname; + ret = request_firmware_direct(&fw, signed_fwname, gpu->dev->dev); + if (ret) { + DRM_DEV_ERROR(dev, "could not load signed zap firmware: %d\n", ret); + fw = ERR_PTR(ret); + } + } else { + /* Request the MDT file for the firmware */ + fw = adreno_request_fw(to_adreno_gpu(gpu), fwname); + } + if (IS_ERR(fw)) { DRM_DEV_ERROR(dev, "Unable to load %s\n", fwname); return PTR_ERR(fw); @@ -95,7 +121,7 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname, * not. But since we've already gotten through adreno_request_fw() * we know which of the two cases it is: */ - if (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY) { + if (signed_fwname || (to_adreno_gpu(gpu)->fwloc == FW_LOCATION_LEGACY)) { ret = qcom_mdt_load(dev, fw, fwname, pasid, mem_region, mem_phys, mem_size, NULL); } else { From patchwork Wed Jan 8 01:38:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 206044 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7EAFC33C9B for ; Wed, 8 Jan 2020 01:39:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEDEA2146E for ; Wed, 8 Jan 2020 01:39:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bFJiDvvz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726814AbgAHBjM (ORCPT ); Tue, 7 Jan 2020 20:39:12 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35803 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgAHBjL (ORCPT ); Tue, 7 Jan 2020 20:39:11 -0500 Received: by mail-pf1-f196.google.com with SMTP id i23so777310pfo.2; Tue, 07 Jan 2020 17:39:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=THEg3QFZEQa/O6HzLLi2uHWnREbCmXjTJPDpWzYvpYE=; b=bFJiDvvzRPYy9tdXQ0hkK/djyuBrFTMSlg2q0m8p/LFtm9htcOMfpSjWHqApL/PkM1 hjQIkMC5uFV8SbB/E1pKh54o/9vCh+9nmWdBu3HaR3xo4o6SpQHrIBL9bgxcIM7XM5n5 ligtnEa3e6CeS/jpbKV9flDmO4A/oM+A1c7e25lpjOkA+FpY+zHr/ot9xfxSlu60X6C8 S85g2bu68aqCM+Tpg2hGTVHvaNjPvHj6zCHJklt8o17So2Co3W96UWMIXT8C0pLGT1pg qdNQMPfkQKuBTx8p1/poFS+aWKOBCPydbaELEEYgcN7FF4LNdOzP1VJBlt996eRPax/w hMYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=THEg3QFZEQa/O6HzLLi2uHWnREbCmXjTJPDpWzYvpYE=; b=LlOafNyLwBOkPYr2zTQPriSoZsq1LAammv4vH+FYFjBcu2gXTRcUVSmBF96qN8DHXt 6gJ4xEhR/a8VsmcuaiVVqcj/jMS8az+zD2zan/5TyXxoYQ+47zUU48BX9AiFF7B89m3q 0KmuGnIURkNYPi1kEulSNhSwqySd2n+FPnKJ9iBR79dNLcMPEoiys0tfuEeXKDmsw6+S oQkN34JFp0RMZIp5bKviKZ6McOdBj3Oc1+airqvrEthegXS3OUvU+fQZMrfUZukcVBj2 C9GPPp39qHu4EzKiT8izClNWVxdViF8iV+lNlZcnrBCng1dLpHD4SWAUKMM91b/g6EqX qy4A== X-Gm-Message-State: APjAAAV+6ZIc1VPleR/+oA1NITjqVvTPnJmZ/hms4CKM3YXaCGRIT/9R vzYBVtpWxw7Fi3VtHNJBHLU= X-Google-Smtp-Source: APXvYqyW+M9y0psHwU0NpMvkTavrh7MZTxAMiyVpc4pqn2yNLfg6OeaTa33ovYQ/omgdDo7LgmmXpQ== X-Received: by 2002:a62:1944:: with SMTP id 65mr2476029pfz.151.1578447550936; Tue, 07 Jan 2020 17:39:10 -0800 (PST) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id a6sm994334pgg.25.2020.01.07.17.39.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 17:39:10 -0800 (PST) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: devicetree@vger.kernel.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Bjorn Andersson , Jordan Crouse , Sharat Masetty , Rob Clark , Andy Gross , Rob Herring , Mark Rutland , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 3/3] arm64: dts: sdm845: move gpu zap nodes to per-device dts Date: Tue, 7 Jan 2020 17:38:44 -0800 Message-Id: <20200108013847.899170-4-robdclark@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200108013847.899170-1-robdclark@gmail.com> References: <20200108013847.899170-1-robdclark@gmail.com> MIME-Version: 1.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org From: Rob Clark We want to specify per-device firmware-name, so move the zap node into the .dts file for individual boards/devices. This lets us get rid of the /delete-node/ for cheza, which does not use zap. Signed-off-by: Rob Clark --- arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi | 1 - arch/arm64/boot/dts/qcom/sdm845-db845c.dts | 7 +++++++ arch/arm64/boot/dts/qcom/sdm845-mtp.dts | 8 ++++++++ arch/arm64/boot/dts/qcom/sdm845.dtsi | 6 +----- arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 7 +++++++ 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi index 9a4ff57fc877..2db79c1ecdac 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845-cheza.dtsi @@ -165,7 +165,6 @@ panel_in_edp: endpoint { /delete-node/ &venus_mem; /delete-node/ &cdsp_mem; /delete-node/ &cdsp_pas; -/delete-node/ &zap_shader; /delete-node/ &gpu_mem; /* Increase the size from 120 MB to 128 MB */ diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts index d100f46791a6..c472195e44fb 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-db845c.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-db845c.dts @@ -352,6 +352,13 @@ &gcc { ; }; +&gpu { + zap-shader { + memory-region = <&gpu_mem>; + firmware-name = "qcom/db845c/a630_zap.mbn"; + }; +}; + &pm8998_gpio { vol_up_pin_a: vol-up-active { pins = "gpio6"; diff --git a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts index c57548b7b250..876155fc0547 100644 --- a/arch/arm64/boot/dts/qcom/sdm845-mtp.dts +++ b/arch/arm64/boot/dts/qcom/sdm845-mtp.dts @@ -360,6 +360,14 @@ &gcc { ; }; +&gpu { + zap-shader { + memory-region = <&gpu_mem>; + // TODO presumably mtp can use same "test key" signed zap? + firmware-name = "qcom/db845c/a630_zap.mbn"; + }; +}; + &i2c10 { status = "okay"; clock-frequency = <400000>; diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi index ddb1f23c936f..601c57cc9b6d 100644 --- a/arch/arm64/boot/dts/qcom/sdm845.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi @@ -2804,7 +2804,7 @@ dsi1_phy: dsi-phy@ae96400 { }; }; - gpu@5000000 { + gpu: gpu@5000000 { compatible = "qcom,adreno-630.2", "qcom,adreno"; #stream-id-cells = <16>; @@ -2824,10 +2824,6 @@ gpu@5000000 { qcom,gmu = <&gmu>; - zap_shader: zap-shader { - memory-region = <&gpu_mem>; - }; - gpu_opp_table: opp-table { compatible = "operating-points-v2"; diff --git a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts index 13dc619687f3..b255be3a4a0a 100644 --- a/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +++ b/arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts @@ -245,6 +245,13 @@ &gcc { ; }; +&gpu { + zap-shader { + memory-region = <&gpu_mem>; + firmware-name = "qcom/LENOVO/81JL/qcdxkmsuc850.mbn"; + }; +}; + &i2c1 { status = "okay"; clock-frequency = <400000>;