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: 190745 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=ham 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 9DD14C33C9E 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 7552220848 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 S1726617AbgAHBjI (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: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 190744 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 65E1AC33CA2 for ; Wed, 8 Jan 2020 01:39:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DB112081E for ; Wed, 8 Jan 2020 01:39:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="PTNrkiZC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726759AbgAHBjK (ORCPT ); Tue, 7 Jan 2020 20:39:10 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:33473 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726111AbgAHBjJ (ORCPT ); Tue, 7 Jan 2020 20:39:09 -0500 Received: by mail-pf1-f194.google.com with SMTP id z16so779646pfk.0; Tue, 07 Jan 2020 17:39:09 -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=MpMZKtCVP5H19ia/f+a2yLDX2x/btP4p2EtO5S2C8R0=; b=PTNrkiZCCRqh7q4+WlA2u3gZ0CPVfLsmHAxEQSzh7KJpFGQvQCJEOjFoc361J5ReoM bDbAX+Gn8kdD9vGVY9Tz9bhALuubM4ufM+ZDpoWs4tKqRQGPKBGt3JLM5zD1RB1viNwx eMD4wP7x49zztbHZ1fry4eCEv6Xh0Vp9Kak+KoDFwt3TMzgjy6ya+gBPi1hepZNQcxyW P7j2t6GX7Qa8W6+ykndCqK8fwWfNpQU2KJJzFiwkpr6aqWuLKZW8j3zJkPBfWyDn9sff vsZ+WglNwLEYTRMpJFibloTFCBYrI23anV5Ar8R1GUouTTCpjYXvmEvx6xpbwz2A+TzT c+ng== 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=MpMZKtCVP5H19ia/f+a2yLDX2x/btP4p2EtO5S2C8R0=; b=Wdqv4mTw3ZNIwMZRGDFZbbnackol3DbzEJQraZkDdYbcwMVVsplwM6+8v8iR1z+YBT FI+L9kihfgg/4+jGmxa02V0OorPshfqkT7FBziVaSU/oKch8obMDdjJc5Zwz/qdvMurB ixk00O+PaBrd7ExCRMxWRgwWyQ+mVF1Yghjv5atuT3M+Q6JQr6aeh3yRag/qMA2Qd6/J JMnQrV2tVIQF09jzq5vMlA0OK3RAJpwp0M7JgNuPQzuZDTdCShhaRbiIfNHlMWtt+/ko TknQCIGIOXpM9VsDCaG/qdF3/QJ7GwzKVxaowpu5f6Bc2fSwHQe/KKirOee7Ru/whMyv faSA== X-Gm-Message-State: APjAAAV9NwUfw+Zphma0PPNn646NZt+7M6mLsRXhEMGjo7kFI1Wceo8d yTYBsWL2w2G6nvY2Fetv9ds= X-Google-Smtp-Source: APXvYqyAgXNYwKw4Qv5zmp1K0i3BPG+Boxcg0LDC+VNeJrhMhkOhY8m0e5wcPQOFGhwdWiZ4i4RQVg== X-Received: by 2002:aa7:982d:: with SMTP id q13mr2477164pfl.152.1578447548749; Tue, 07 Jan 2020 17:39:08 -0800 (PST) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id b42sm814584pjc.27.2020.01.07.17.39.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2020 17:39:08 -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 , Rob Herring , Mark Rutland , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/3] dt-bindings: drm/msm/gpu: Document firmware-name Date: Tue, 7 Jan 2020 17:38:43 -0800 Message-Id: <20200108013847.899170-3-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: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark The firmware-name property in the zap node can be used to specify a device specific zap firmware. Signed-off-by: Rob Clark Reviewed-by: Bjorn Andersson --- Documentation/devicetree/bindings/display/msm/gpu.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/msm/gpu.txt b/Documentation/devicetree/bindings/display/msm/gpu.txt index 3e6cd3f64a78..7edc298a15f2 100644 --- a/Documentation/devicetree/bindings/display/msm/gpu.txt +++ b/Documentation/devicetree/bindings/display/msm/gpu.txt @@ -33,6 +33,8 @@ Required properties: - zap-shader: For a5xx and a6xx devices this node contains a memory-region that points to reserved memory to store the zap shader that can be used to help bring the GPU out of secure mode. +- firmware-name: optional property of the 'zap-shader' node, listing the + relative path of the device specific zap firmware. Example 3xx/4xx/a5xx: @@ -85,6 +87,7 @@ Example a6xx (with GMU): zap-shader { memory-region = <&zap_shader_region>; + firmware-name = "qcom/LENOVO/81JL/qcdxkmsuc850.mbn" }; }; };