From patchwork Tue Mar 14 15:28:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69684 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1825455wrd; Tue, 14 Mar 2023 08:30:43 -0700 (PDT) X-Google-Smtp-Source: AK7set/3cJYA3FU8hqSkQAAbPr+/bPeYPp7SKVnrOfOHHe1L++ssmpnV8CLrz9SIWHVCWsTCp3u0 X-Received: by 2002:a17:90b:1d8f:b0:237:161e:3329 with SMTP id pf15-20020a17090b1d8f00b00237161e3329mr37957163pjb.40.1678807843068; Tue, 14 Mar 2023 08:30:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678807843; cv=none; d=google.com; s=arc-20160816; b=TGzq6FrM3TsbE8z15Jxg0xSjRBmpj+4sKEilTs4ggOpo2UkH0xoBKfPCWiw3rqLoBY /m0U0R/uh9I4jDikvrlRPq+Q3FA44xZqC8EBRkVppUCtq81wNunyeZXGKIUYHwMSN4OP /EuSjefk496XlyVJUSDmC1fXXl+c2+40NIGbnSvqeylLay2myRDWbRQ5US7RaMF7VHfP 11juMSCcFS/D5o1swRYdQD9eux56bsnXnhakzn7PAkbdU8uMRaADbcBqtsPRk6xvY9Ff tbpBeh+Ket3+Hd4ytHo9RMby5bXk/c6lZ0wRjDHb71ZMzw11TjIMKsjOpRUT9MVyRiyq xwVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=dDrs6JyeTYzM6UbBJjwqEiLM0mM7HZ/Cu05l6aEARFA=; b=wfIdex3QPbFpJoRMh+K0tW3FoMErMqic7qyJpREOaubUxO2+Ho4j+eDxImQYGx5Cv5 DRqtaR5441462MidwA6pNcmUS2lycHSpM7y7COQk5HJHJmcPy8CljBWIMAtUjDmXnI+y m0upwyHHXkiu/xRGw6cBpQ+dXYL908I00NPlGlbnOnQJn7CRDll5x2/M7tHY8MrfPBUt N9OVSAYdGCbwXzFgK/8Pf9gyEXDY2zW29XfAZf7HhADTwlrcQrN78Iit9XegBdwCYrhH 9eY4+VnSrdYM8RgSR01Nzon9ExHgyqlQLaX7N0kfAcIeqRKX9xVp4g+tlB1MJTaqIt6s ehsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IFE6Gu3p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 143-20020a630695000000b0050318a8f921si2349241pgg.780.2023.03.14.08.30.30; Tue, 14 Mar 2023 08:30:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IFE6Gu3p; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbjCNP2r (ORCPT + 99 others); Tue, 14 Mar 2023 11:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbjCNP2o (ORCPT ); Tue, 14 Mar 2023 11:28:44 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B616743467 for ; Tue, 14 Mar 2023 08:28:41 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id t14so16423502ljd.5 for ; Tue, 14 Mar 2023 08:28:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807720; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dDrs6JyeTYzM6UbBJjwqEiLM0mM7HZ/Cu05l6aEARFA=; b=IFE6Gu3pkatgASwbx1ImpERuqNfGoEv4bKaRQZJgSsFYmX9pyq789ui74anr0GCEgf 2xhhKtZyoTkYjXzPauAL1Zp41IK+Vpjlwq+hoO13s91dFAMtE6VgaJnabahi+PpOaeQo 7cDgmExTSrb/GiJspQc4v8qgRrsmpmSSEM7cUYx38aDmKcw+l1lyUJ+yGQkPUySaOkpL 1jT0ETnMz6lohpMpRS3SwQcgxd/g2g4M6hw4mQ2lAJYlCijRKOLW0Y5X40UVcfpE3jPE 885KfrBnSHaQMS1LZzaG2dZVEoQFavz1LBj4jqiCpXSqIda3x3QRT0E1SgBQ7WHVOlY9 cTAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807720; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dDrs6JyeTYzM6UbBJjwqEiLM0mM7HZ/Cu05l6aEARFA=; b=zq7o/B/JY9UfBtW2YlLEUqRNg/ib9BvgYlcConxAcjFUqg+M9HUmZM6JU71xbuD3Te lEGbn6sICekqc2cwC2TOAIw+gMH/zUIY0yWNL2LzMyDAXmILX9wSUQTTgnpJIUIblz4S GHkU4wo4KrLjMgVWEPxcgcZTyRV59R0DiUwbRqWh5J1NjeYi2o+D3EgFuUPKZXLNY24e uD5Q/u6i/FWPaUxg2G0qidHMlDA6QLFhKYbnusJn70ob2lI202/dyTRTAtCx+fjWwP1s rjSDhyfey6CgiG8hM7eZTLoc/VYgDC6IjNxxOvIEdCYaQKNVlFGT1M1ofqVAPq4ADUkD 4ixg== X-Gm-Message-State: AO0yUKVLSqHkPI91EL36jQP2Gjcw3YM83fRDXEDWUhl8u77MA7Rkftay R/MUneNPIysy6y0+Zg0+G9YyoQ== X-Received: by 2002:a2e:83c6:0:b0:293:5360:162b with SMTP id s6-20020a2e83c6000000b002935360162bmr4084469ljh.11.1678807719958; Tue, 14 Mar 2023 08:28:39 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:39 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:32 +0100 Subject: [PATCH v4 01/14] dt-bindings: display/msm: gpu: Document GMU wrapper-equipped A6xx MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-1-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=3204; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=6sAUPUwHP7+WUPx0qnkXu1yRwFCLU2UOzBhHFKkRGTM=; b=mV+9zzv7CDxkMqctTdkZFuDUkQFR5lB3OtJchHXfOYHhrrpWJ/oHSNLECv+KrnMciFrDa+s7/Rx9 dsByIHe1CGn7Aexc8isUndJ0jhglIt6f9uZXVUBWv3VqK6RfeBKH X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357612732660071?= X-GMAIL-MSGID: =?utf-8?q?1760357612732660071?= The "GMU Wrapper" is Qualcomm's name for "let's treat the GPU blocks we'd normally assign to the GMU as if they were a part of the GMU, even though they are not". It's a (good) software representation of the GMU_CX and GMU_GX register spaces within the GPUSS that helps us programatically treat these de-facto GMU-less parts in a way that's very similar to their GMU-equipped cousins, massively saving up on code duplication. The "wrapper" register space was specifically designed to mimic the layout of a real GMU, though it rather obviously does not have the M3 core et al. GMU wrapper-equipped A6xx GPUs require clocks and clock-names to be specified under the GPU node, just like their older cousins. Account for that. Signed-off-by: Konrad Dybcio --- .../devicetree/bindings/display/msm/gpu.yaml | 57 ++++++++++++++++++---- 1 file changed, 48 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/display/msm/gpu.yaml b/Documentation/devicetree/bindings/display/msm/gpu.yaml index d4191cca71fb..ac1a9bce2042 100644 --- a/Documentation/devicetree/bindings/display/msm/gpu.yaml +++ b/Documentation/devicetree/bindings/display/msm/gpu.yaml @@ -36,10 +36,7 @@ properties: reg-names: minItems: 1 - items: - - const: kgsl_3d0_reg_memory - - const: cx_mem - - const: cx_dbgc + maxItems: 3 interrupts: maxItems: 1 @@ -157,16 +154,58 @@ allOf: required: - clocks - clock-names + - if: properties: compatible: contains: - pattern: '^qcom,adreno-6[0-9][0-9]\.[0-9]$' - - then: # Since Adreno 6xx series clocks should be defined in GMU + enum: + - qcom,adreno-610.0 + - qcom,adreno-619.1 + then: properties: - clocks: false - clock-names: false + clock-names: + items: + - const: core + description: GPU Core clock + - const: iface + description: GPU Interface clock + - const: mem_iface + description: GPU Memory Interface clock + - const: alt_mem_iface + description: GPU Alternative Memory Interface clock + - const: gmu + description: CX GMU clock + - const: xo + description: GPUCC clocksource clock + + reg-names: + minItems: 1 + items: + - const: kgsl_3d0_reg_memory + - const: cx_dbgc + + required: + - clocks + - clock-names + else: + if: + properties: + compatible: + contains: + pattern: '^qcom,adreno-6[0-9][0-9]\.[0-9]$' + + then: # Starting with A6xx, the clocks are usually defined in the GMU node + properties: + clocks: false + clock-names: false + + reg-names: + minItems: 1 + items: + - const: kgsl_3d0_reg_memory + - const: cx_mem + - const: cx_dbgc examples: - | From patchwork Tue Mar 14 15:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1830007wrd; Tue, 14 Mar 2023 08:39:11 -0700 (PDT) X-Google-Smtp-Source: AK7set+ylusLgPtS4Wm4Px2Jw0MTB+oK04jLpYv3OCZkUaaaKv/kPxWPqKjAOPzuIHjquJe2ggOX X-Received: by 2002:a05:6a20:9143:b0:d3:f0af:4707 with SMTP id x3-20020a056a20914300b000d3f0af4707mr8588582pzc.20.1678808351344; Tue, 14 Mar 2023 08:39:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808351; cv=none; d=google.com; s=arc-20160816; b=MI/o/HrbIDX6dn4jo0XRt1f1E1Hmdn6pJt32Z8m+ek5K+As8umhdP3Jgb/zBGNF1NI mvEm3Gucca8ewml00Ti3zmTBuWRzlV4Ac1Uiohm5aEdsmUmwK0BanPEOOZmMWzWKRiXK qnl2/upZE3QewFUW4n7xL+LGFS+wDpkwJTecjMsSM5hOgkPF2n2D3b+RICp2yH1pJzOx fkIAdeoI8lkhasohzm3V/Xvf7LGjadCXhV+D1rfmmwrJjQaN7vgXJG6rghS+0A+L/qX2 Pev//KVrsvjNFi6u5GlVkoKufuaefDvN3rSeQvL8UoiEAuDOzhqIRtJnw4KVBm17Aw3V RcQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=FfpC0lXYq1ll6nbzoGKkSBMv0WmddnDy3ZKS7f0bm/s=; b=V6GAlBzvn7WeAwBlHagndryKODGg5CQs569912IsUrN05DTMsDhkawx47lvybV26No kS+DXyL5e0sa443N2O00SPnOqjsQn51A98Ji4QJw7gggfnc+JvgzwGtqmRDwHV918MBu zLHaJL4ZaAh6Pmz+aCT9WrwM0Y8ttt/jdgQRxw/jt7mzU13zMtJiHeVEsGN7C6XVnM8i KO1tSqOVKJDWgO9v2Ed2NS+pM5D/Akm14sTQV9aguCuWmMZtQ3Iy+B9kB9cz4Fq98WfK fzOc92rTvy8riEfjMKFtC7YtdNjhBrKDSIP343ZTh+GbvoJ+gm77YQyIY/mxXfwPyivW AeBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nuXeOgG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a20-20020a630b54000000b00502f0d858e9si2388652pgl.174.2023.03.14.08.38.56; Tue, 14 Mar 2023 08:39:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nuXeOgG3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231599AbjCNP24 (ORCPT + 99 others); Tue, 14 Mar 2023 11:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230521AbjCNP2s (ORCPT ); Tue, 14 Mar 2023 11:28:48 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 808E53801F for ; Tue, 14 Mar 2023 08:28:43 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id a32so16412421ljr.9 for ; Tue, 14 Mar 2023 08:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807721; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FfpC0lXYq1ll6nbzoGKkSBMv0WmddnDy3ZKS7f0bm/s=; b=nuXeOgG35nLhpQRRtNMHfnLyZD6r104D193hTDJ6SUD6UTROZX49ztDyCxB5b/yXQL Rqb9pP3md5/C8Pu3IazHspSOZQQVt6W22h0N8rTzTPk8yL945NI0eDpXxvOZh69Nnhfs TRklrmiV3rQZHKy6dGYTuwmTbUntIN6lfgzEuNuJNcgyR/Xieck5pWDmV7+LPzgoZZt4 UDwFts4TWGaGsk6Xz/9N4rVmOXQ9JM27IvkiXSBEjZtHVhlPpIM1T8jxGBF9WQoJz3IU wCS5jes6BWXkCB+bOFcYDWwwKfFxpQGAxDdRge+5gd4JroLTe6+UmvpmXAUOXiD4DVwu vSqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807721; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FfpC0lXYq1ll6nbzoGKkSBMv0WmddnDy3ZKS7f0bm/s=; b=wp+RWFnZQlja8Yz9bGpxfpE4gGAWf9Y4k2JiMia/xQ/kdMoPLf6rR76fVGDrEhrLlL 4gcUkhkEIyjSzKiQBBTCZz11n1BgUzamrvolrYtuBKOh83dc98dp058v30PoDFnGPlS1 w5nER6MKbdTB4XPRg6MIvA/UGIb9R873N5Op2bETilwci8KWjblhPw88ZHqlhhrMjOyJ +DaVSUvxM85eaVYLlx2gB+jpeH2JC/pn9DFwq5yuUdWx2vR1PvWs5WK8ajUcg0jdbwsX g52mCA8dHn367UjoXnzs/lmCkvztvt/ZrV89Y+0WEF3WmfZzOq1vwsDRWDIofg3m2V1m Mr0A== X-Gm-Message-State: AO0yUKXkpRl3yZSIc/DOt5xkbBPfks5lpMqqqBG8CdDu0/EaQCMsaksa XQYZD1le+85x2k5DU9IVPA9Mpw== X-Received: by 2002:a2e:93c6:0:b0:295:a33f:5349 with SMTP id p6-20020a2e93c6000000b00295a33f5349mr11157007ljh.26.1678807721760; Tue, 14 Mar 2023 08:28:41 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:41 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:33 +0100 Subject: [PATCH v4 02/14] dt-bindings: display/msm/gmu: Add GMU wrapper MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-2-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=3283; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=UT3xDmXTHRxoAqg/suyw+w4CBgyq4mbs1kv24/YUgS4=; b=Yj3XYeUYs1m8xSmfDaz+G1H2jht5+3yszWDs4/x/w6AR5a0OpS9HKzKChzuLlKQk2FjWMjVL954/ cJyNHPETCk3lA8OCiyigoRSsoyRRc0ziAMQ3HyyxyrTvcopQdhtW X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358145981570584?= X-GMAIL-MSGID: =?utf-8?q?1760358145981570584?= The "GMU Wrapper" is Qualcomm's name for "let's treat the GPU blocks we'd normally assign to the GMU as if they were a part of the GMU, even though they are not". It's a (good) software representation of the GMU_CX and GMU_GX register spaces within the GPUSS that helps us programatically treat these de-facto GMU-less parts in a way that's very similar to their GMU-equipped cousins, massively saving up on code duplication. The "wrapper" register space was specifically designed to mimic the layout of a real GMU, though it rather obviously does not have the M3 core et al. To sum it all up, the GMU wrapper is essentially a register space within the GPU, which Linux sees as a dumbed-down regular GMU: there's no clocks, interrupts, multiple reg spaces, iommus and OPP. Document it. Signed-off-by: Konrad Dybcio Reviewed-by: Krzysztof Kozlowski --- .../devicetree/bindings/display/msm/gmu.yaml | 49 ++++++++++++++++------ 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/Documentation/devicetree/bindings/display/msm/gmu.yaml b/Documentation/devicetree/bindings/display/msm/gmu.yaml index ab14e81cb050..021373e686e1 100644 --- a/Documentation/devicetree/bindings/display/msm/gmu.yaml +++ b/Documentation/devicetree/bindings/display/msm/gmu.yaml @@ -19,16 +19,18 @@ description: | properties: compatible: - items: - - pattern: '^qcom,adreno-gmu-6[0-9][0-9]\.[0-9]$' - - const: qcom,adreno-gmu + oneOf: + - items: + - pattern: '^qcom,adreno-gmu-6[0-9][0-9]\.[0-9]$' + - const: qcom,adreno-gmu + - const: qcom,adreno-gmu-wrapper reg: - minItems: 3 + minItems: 1 maxItems: 4 reg-names: - minItems: 3 + minItems: 1 maxItems: 4 clocks: @@ -44,7 +46,6 @@ properties: - description: GMU HFI interrupt - description: GMU interrupt - interrupt-names: items: - const: hfi @@ -72,14 +73,8 @@ required: - compatible - reg - reg-names - - clocks - - clock-names - - interrupts - - interrupt-names - power-domains - power-domain-names - - iommus - - operating-points-v2 additionalProperties: false @@ -216,6 +211,27 @@ allOf: - const: cxo - const: axi - const: memnoc + - if: + properties: + compatible: + contains: + const: qcom,adreno-gmu-wrapper + then: + properties: + reg: + items: + - description: GMU wrapper register space + reg-names: + items: + - const: gmu + else: + required: + - clocks + - clock-names + - interrupts + - interrupt-names + - iommus + - operating-points-v2 examples: - | @@ -249,3 +265,12 @@ examples: iommus = <&adreno_smmu 5>; operating-points-v2 = <&gmu_opp_table>; }; + + gmu_wrapper: gmu@596a000 { + compatible = "qcom,adreno-gmu-wrapper"; + reg = <0x0596a000 0x30000>; + reg-names = "gmu"; + power-domains = <&gpucc GPU_CX_GDSC>, + <&gpucc GPU_GX_GDSC>; + power-domain-names = "cx", "gx"; + }; From patchwork Tue Mar 14 15:28:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1828948wrd; Tue, 14 Mar 2023 08:36:57 -0700 (PDT) X-Google-Smtp-Source: AK7set+k9Fr0FuJjnvc/D1V7+iqQGTgsxQTg8TjOmwOCqs2Mykf6CSGKmmuZwkNM5j8+Qi0TGxCP X-Received: by 2002:a17:902:b203:b0:19a:ae30:3a42 with SMTP id t3-20020a170902b20300b0019aae303a42mr10958682plr.21.1678808217354; Tue, 14 Mar 2023 08:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808217; cv=none; d=google.com; s=arc-20160816; b=f2XUZcXTR1p0BXp493AHs9ub+vxnnyR3G+McCLZP6Izl6RXNYQwz2F8d1w2vagBPde /QEbWyD0RWymnwkasJ4sBbkjflJR6dYLOOAU17LYYm9n7BINv3QN7HBfUEUSTRQ13+9V N8m7VuXeZDiSI/B76jAenJEyJYu2LB8XRd+lMolUun1iqqHp8dxAuJdNs8ohDrmFBqrR D0h9Rbm4cvkRF5kD3MWWstUu6dYhsNUOugBqCkTY+qO4Jc6ZEQ44N4nCrBqpbddMW10j gm4XbFrRhaDDQ6EFcUSTIzfbxjv0w1x2d5wW3ymu6Amgl8uJI9Nhy/ZjQ7kAqmMeZYo1 Q6sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=RO255zxGak2RBrs2vsC3RJabBdwukiR9Uly/c7vQ0CM=; b=RlLXKlL9H6qEqLcDEheg3/Eyi0w02x8USMOgChnUN1ImceVMgoRlIgIbQs5Omv+qxF qnyV30lK0NeSKb8EVWJljEUwrgouvXhvZctdEoCgWL6MZ1entqUqL4TwkBM+fphIVvIU 0O1GjwKUKIeR3+r9oLBzuG++6J4rdKOHQahoS8HfyygrBOXzW1FItMmh9ItrewMDSOuM oXbzLCzEkYWdh4LvLP+wybM3V7l92DeEQyrq8pE7/oyCm4KjA9FIoj+ZfRRm7DoC2NnA sShladZAwoeajm5GLRx+wppjfIwhoMo0qxTNsEfhUumhe+tyMHaEaNqoEQGqWV8FWuj/ ochw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMdGMEyj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p2-20020a170902eac200b0019e698b3cefsi2696032pld.311.2023.03.14.08.36.40; Tue, 14 Mar 2023 08:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XMdGMEyj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbjCNP27 (ORCPT + 99 others); Tue, 14 Mar 2023 11:28:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231240AbjCNP2s (ORCPT ); Tue, 14 Mar 2023 11:28:48 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165773B222 for ; Tue, 14 Mar 2023 08:28:45 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id i20so16399622lja.11 for ; Tue, 14 Mar 2023 08:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807723; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=RO255zxGak2RBrs2vsC3RJabBdwukiR9Uly/c7vQ0CM=; b=XMdGMEyjB8dFRiheqepFSBLS1yBnSgwVDtYG0k25vKhV2B+dlbK+4rqhOZR/f5eQUf spakIlGLGNtFd5/rU+56vYuo0KrIzAVAuZfTqyDlOOsZ94AlFUIgu98hLV8FaJ3dE4Zk 9yqi8FZwAgT80An6knPij1UpD7EYrELJs1ohiVkGfnSHcjC/XD+fqxOtqlcRm9nA5K04 wNeALyWefwCNWEWqAQrUBfJVbC4jXMB3cfLAAKdrnJ2L9mKHd1rclALn8mQ/wlEvKdRm EM/HM7vX91H/yLn2pdaaUSOBQMAou+HKElwt5VEFWDomjsDkdpj47nS849HBUCJSnmnU 95Iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807723; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RO255zxGak2RBrs2vsC3RJabBdwukiR9Uly/c7vQ0CM=; b=4VIeSbJEZEW5WCNUfk12gNZNZiMuz7/fs966EzszWrinofT9iYcS4lgROWLv9QCcoX k3pfK9VoG0LNVcqMZSxeoAmnAkOWVuanZqr1suYX2cRwHsxUKi9KFlB8E8ILaWdX3R9y MohA6/PyTQdqGyJ5bsOuK+PdEamn0fBSvtagWKsRSrpIo972Jg6ajWj/nXrYUM3pr9yW ngNgC/guT0l0u8iTIoOe9IRSDo7+4/AhjapTMkSSPP62JOEoBMdQWh+V6L2m4BUtCUMP D4snWCdPuCtEgfAI8aIyHe26iu8+rJDFQOSJ8xCCf3dhG7Z9G6xOw4y50OUdKQsPoAsR BzPA== X-Gm-Message-State: AO0yUKWmiqwqnTfjYIXcUDqM4jYwx1aiCP2qffTDmDVa7GnqOEzmJ7sX AbKCaF/5DSbdGBvrvM1AMXm+sQ== X-Received: by 2002:a2e:9946:0:b0:295:a8cc:f15a with SMTP id r6-20020a2e9946000000b00295a8ccf15amr10470723ljj.29.1678807723306; Tue, 14 Mar 2023 08:28:43 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:42 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:34 +0100 Subject: [PATCH v4 03/14] drm/msm/a6xx: Remove static keyword from sptprac en/disable functions MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-3-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1711; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=7a+b5UGAg3EywTm3Uz73qntLItaZJqfx37WBN0HlPAs=; b=nGHMAsiP7jw60z7u0RxD1MZvX6xpxMT/U4RR1/OORWCr6Gmp5pj7vlJSu7Jgx9C5U0bGHsMdGnx7 8M/TtP8aCXwuBmw8476mylKRj9+t1k+V1KQ2ahR0JZW3s8YcaOQu X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358005143975360?= X-GMAIL-MSGID: =?utf-8?q?1760358005143975360?= These two will be reused by at least A619_holi in the non-gmu paths. Turn them non-static them to make it possible. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 4 ++-- drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 7f5bc73b2040..229a54ec82b4 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -354,7 +354,7 @@ void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state) } /* Enable CPU control of SPTP power power collapse */ -static int a6xx_sptprac_enable(struct a6xx_gmu *gmu) +int a6xx_sptprac_enable(struct a6xx_gmu *gmu) { int ret; u32 val; @@ -376,7 +376,7 @@ static int a6xx_sptprac_enable(struct a6xx_gmu *gmu) } /* Disable CPU control of SPTP power power collapse */ -static void a6xx_sptprac_disable(struct a6xx_gmu *gmu) +void a6xx_sptprac_disable(struct a6xx_gmu *gmu) { u32 val; int ret; diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h index e034935b3986..ec28abdd327b 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h @@ -186,5 +186,7 @@ int a6xx_hfi_set_freq(struct a6xx_gmu *gmu, int index); bool a6xx_gmu_gx_is_on(struct a6xx_gmu *gmu); bool a6xx_gmu_sptprac_is_on(struct a6xx_gmu *gmu); +void a6xx_sptprac_disable(struct a6xx_gmu *gmu); +int a6xx_sptprac_enable(struct a6xx_gmu *gmu); #endif From patchwork Tue Mar 14 15:28:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1829607wrd; Tue, 14 Mar 2023 08:38:20 -0700 (PDT) X-Google-Smtp-Source: AK7set8twEiR8si/2wRVpdvwvJdf1NuD3YzyYPFHEU8N14d160vzsMzXwb+3XFjcUg6oLNBvmz+I X-Received: by 2002:a05:6a20:1581:b0:d4:c806:bdb6 with SMTP id h1-20020a056a20158100b000d4c806bdb6mr6331900pzj.45.1678808299652; Tue, 14 Mar 2023 08:38:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808299; cv=none; d=google.com; s=arc-20160816; b=pDNHqVnfbx+PfQM6i0uoXH8kDWDDDm97+Vn1lg2fZgFibXCf4LFnsP1qGdCsvxu4OG DMUgDoyvSkp64UzHt9VWVc5ttbScAohl+BKxS35I9By6DqyRQbtZ2WU3hSmSAmCT/u11 V9cPwwJl512D/xVDPYDouYZcxMiLmFKEe4KUWGiaBBvAvlfKoDT03gjdD75hiNx0JnB4 BSuHUy+jZ3dBTGih2pWqfqD/5ZCZeTXduBAkjgGLEZd4GBmi0SPrkjlqbT1wxEjaxGWy YyMXuf0SOmsHysQ1hBPz9j1jKRwvx1l9Y2DOfwOXSfdW9tcR2ERVb2onQryabbgFXDgB +GIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=hsp+OP49dyvTA0hg06hKxLnq+WOs2dGZ48Sal52G9bk=; b=RQ56Evdd7gXnO7pLKoHpsH5myR2e4nXNyjlvMpUYqRnO6wmZE7BgEcTtif50WATjM8 W1n0u5ZTJsmKEZUsBF7z12m0qOh4Xt2esr6sVKDBQ3iKCSjD57u2E4WOICjS5EceJcCP zQM3WS5koidqBzA3wBQr4NJPRNpEerlKX1Vsy+AHKwfB9YyEhchiR5zijxDWPJT3SmRk Ig5H+zmT0zV6TVWaxsRbi3pMVojUfFdM15xPXuwDAL/zcHN9WBzgEKPdj7NQi5hN5X0L SCwterq9Vnxd6by77mrwNCZ0MsDY+ocAFN74HodNpUOaBxnrezdGXKes+b/JQiHBsRJc jBVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CGXtFAlr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d8-20020a63fd08000000b00502f344050csi2496871pgh.313.2023.03.14.08.38.04; Tue, 14 Mar 2023 08:38:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CGXtFAlr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231715AbjCNP3C (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231329AbjCNP2y (ORCPT ); Tue, 14 Mar 2023 11:28:54 -0400 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [IPv6:2a00:1450:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FA3E3B3DB for ; Tue, 14 Mar 2023 08:28:45 -0700 (PDT) Received: by mail-lj1-x22a.google.com with SMTP id h3so16400061lja.12 for ; Tue, 14 Mar 2023 08:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807725; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=hsp+OP49dyvTA0hg06hKxLnq+WOs2dGZ48Sal52G9bk=; b=CGXtFAlrCUIohL3loQwAGHDCaABKaw299PVDfZQOpH39MnvHu5Y6d5mR6o5KNPW/RH sbdHMKHhmPBHZOXInm/6RCNkxYyERcbYtFn6fYVtuOotl7+ML6oYAyCC445gHTGsnED8 KmdxxshSquUUC31++k5Mu3svyEVywEpoJq/1IqnEzROsO+31zLxSHqRG5ohDR2uiFbvr q/v+ajfSH9Oa0RRLqX5hVneyoDMXGhqb2Nw02L6wdfplCLcr53IkxkXyhBKmFeEGsTir ODkFSKcOJZYTaxB8Fg5ppXhkTFlHw0IAbg2ORzqi8mV3EjxdqYOBjgpwGrlkuRl30VPc adVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807725; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hsp+OP49dyvTA0hg06hKxLnq+WOs2dGZ48Sal52G9bk=; b=EiPk/mQN1BLm8Z+++nTxLc9XUM0ohNhKCu+H04iB53ty7yABxddH25CLltEiJkFmjs fQ+cZE3k34gq5goE7c1sM/4xRRrLjxHn8EM3ThZHXqrophf4hB6AfZpfTMjp2ZjE/GqK cWQTeNm3awzENVIS/SIkXMRLkyfXrs9xZZELVRI4ZIU0m/ZS0piAn2Lmm8JLBKZhtW0/ gNSFtcUvVDscGMOMmbl5JDxTQMF+64r10Dr0rQmm3CwrcmmOlw2n7Tq0yXYn+izyPo2p FAxP5GYiP8nYBi+5z1x7gmCIduAT+3EepKBE4EbuUphRiMqZNcPbA34vIX4ZUIhLgPV4 UKrQ== X-Gm-Message-State: AO0yUKWLthB5x2OKo6T9asFL6kVqW7YVQ9TB7BqlgS8+Mbc+UkgMAbv0 0o7bVBmC2g6KFTnByzXe40FL9w== X-Received: by 2002:a2e:131a:0:b0:295:93eb:1c01 with SMTP id 26-20020a2e131a000000b0029593eb1c01mr11806514ljt.25.1678807725141; Tue, 14 Mar 2023 08:28:45 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:44 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:35 +0100 Subject: [PATCH v4 04/14] drm/msm/a6xx: Extend and explain UBWC config MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-4-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=2979; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=jfJopFwWQyGceVNOEMOJgd5qDKEUsswtNczspv0fE70=; b=GTW6adG8HrXjwT99h/qJn2ktz6+O907jU1DOFTqH811t7emgC9lzJjXGPyflNTe1eTdiM0XxIn/g 1PeE0h08DwJHYz2iaT40X2IGJnlgctdBEFToirOL7OamNhxVZhKl X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358091891294991?= X-GMAIL-MSGID: =?utf-8?q?1760358091891294991?= Rename lower_bit to hbb_lo and explain what it signifies. Add explanations (wherever possible to other tunables). Port setting min_access_length, ubwc_mode and hbb_hi from downstream. Signed-off-by: Konrad Dybcio Reviewed-by: Rob Clark --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 39 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index a849db8252f2..2f55dac52833 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -786,10 +786,25 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu) static void a6xx_set_ubwc_config(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); - u32 lower_bit = 2; - u32 amsbc = 0; + /* Unknown, introduced with A650 family, related to UBWC mode/ver 4 */ u32 rgb565_predicator = 0; + /* Unknown, introduced with A650 family */ u32 uavflagprd_inv = 0; + /* Whether the minimum access length is 64 bits */ + u32 min_acc_len = 0; + /* Entirely magic, per-GPU-gen value */ + u32 ubwc_mode = 0; + /* + * The Highest Bank Bit value represents the bit of the highest DDR bank. + * We then subtract 13 from it (13 is the minimum value allowed by hw) and + * write the lowest two bits of the remaining value as hbb_lo and the + * one above it as hbb_hi to the hardware. This should ideally use DRAM + * type detection. + */ + u32 hbb_hi = 0; + u32 hbb_lo = 2; + /* Unknown, introduced with A640/680 */ + u32 amsbc = 0; /* a618 is using the hw default values */ if (adreno_is_a618(adreno_gpu)) @@ -800,25 +815,31 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) if (adreno_is_a650(adreno_gpu) || adreno_is_a660(adreno_gpu)) { /* TODO: get ddr type from bootloader and use 2 for LPDDR4 */ - lower_bit = 3; + hbb_lo = 3; amsbc = 1; rgb565_predicator = 1; uavflagprd_inv = 2; } if (adreno_is_7c3(adreno_gpu)) { - lower_bit = 1; + hbb_lo = 1; amsbc = 1; rgb565_predicator = 1; uavflagprd_inv = 2; } gpu_write(gpu, REG_A6XX_RB_NC_MODE_CNTL, - rgb565_predicator << 11 | amsbc << 4 | lower_bit << 1); - gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, lower_bit << 1); - gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL, - uavflagprd_inv << 4 | lower_bit << 1); - gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, lower_bit << 21); + rgb565_predicator << 11 | hbb_hi << 10 | amsbc << 4 | + min_acc_len << 3 | hbb_lo << 1 | ubwc_mode); + + gpu_write(gpu, REG_A6XX_TPL1_NC_MODE_CNTL, hbb_hi << 4 | + min_acc_len << 3 | hbb_lo << 1 | ubwc_mode); + + gpu_write(gpu, REG_A6XX_SP_NC_MODE_CNTL, hbb_hi << 10 | + uavflagprd_inv << 4 | min_acc_len << 3 | + hbb_lo << 1 | ubwc_mode); + + gpu_write(gpu, REG_A6XX_UCHE_MODE_CNTL, min_acc_len << 23 | hbb_lo << 21); } static int a6xx_cp_init(struct msm_gpu *gpu) From patchwork Tue Mar 14 15:28:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69685 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1825780wrd; Tue, 14 Mar 2023 08:31:09 -0700 (PDT) X-Google-Smtp-Source: AK7set9kZoxJqwEmm2ncJWUlq62omKfJOTVQdNBIDlQKGZy79wgwbcFVPh+MfZdcssKrwGLIh5mT X-Received: by 2002:a17:903:1105:b0:19a:9406:b234 with SMTP id n5-20020a170903110500b0019a9406b234mr47670980plh.45.1678807869036; Tue, 14 Mar 2023 08:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678807869; cv=none; d=google.com; s=arc-20160816; b=CWdBYXH4gXFyuwlo3y5+MJ71u7mN3cbXPUyRFFJRD0HPwBJIrlsNdjcGRbT9I0Nd1W d/zppU/G8qUdx4cTT7+IHj5dY51cIz7DA5gUTQOBW5d5xkfcjBCdTvaIAJRdlQWAI4HP 5I9mUuQHkCggJ6OJLQO/ptrrVQx8u2/dEwiZGRt5T4fCskrcDsW/RLNaUi17vau8vUC1 AtcRdD6jgzdkvTUwkUrIhxvujjStgnM0hdlshPhyR+Uti49Ptsha5gcVNOM7GJIlYmQM ektyj06nuCOTu4NRUmTLkX1/9aamB7KXCvGqy2e1Ktnmt+ijQk0u2Fi3FNDnXk6cDXD+ QjYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=St31qEiBWKoRteqqRq8R4XXaVrODiETBsusFnrIXDy0=; b=BoufObtpoGmLfYgP04dLB8F/7O350sulBdzgWP/vmxJew54qVvBHfau9AcifHrHJHq iEJb1EPR9VsqtWX+0xwK4aNCg9vwIf/xm/JsFrnIgH65iJBZVVBGGnyTXWv9t4H68y7A tpSuK9+jenwk5iJBrxH6o3JmniTadoSpRTruCB7OkyEKKWw8B9mYkPbfFQMvgVNA0CLh zNIHuEu0XvowO3WLQF94g5erF2PYRaT3yLOd+zX1tLjz2lR005HWsiynCd6JO+LEC6eU UcN9R/ihyVr7Wrou2mHnnKuTBoK6MPHRsg4JMNHQxhU5/Kivov5MtrouTPOEAGpeFauA 68rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GzXSp7KS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kc15-20020a17090333cf00b0019f269f06fbsi2585638plb.3.2023.03.14.08.30.55; Tue, 14 Mar 2023 08:31:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GzXSp7KS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231266AbjCNP3J (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjCNP2z (ORCPT ); Tue, 14 Mar 2023 11:28:55 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FC5C9FBFD for ; Tue, 14 Mar 2023 08:28:48 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id z5so16399576ljc.8 for ; Tue, 14 Mar 2023 08:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807727; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=St31qEiBWKoRteqqRq8R4XXaVrODiETBsusFnrIXDy0=; b=GzXSp7KSnCAoQGOyLE8PUdsR6qJiFoVrOSNzF8GVBiP4WVV9GNKn2BgH6cSjbjmG+X OKtxmT/OfjcdsRsc05JjD0UunbXdOayz8v4uIst4y7fVa6f4CB1Gbw80m2OGRvrOKmlm K1aJaYGpdv6tjcx3ua5g+5OxTymuIT6v1D3BXXheCaXhhAs2zNnkx8Fcxeby9V128g7Y 4OgpjitS/jvzZWETPdNtNsU9Int03mj3kKgoIy9BGLYNJhq9It3BP7wguOeJm88h5NK1 gJuK1ZHHah+50B5eEU697A04oUY4JLeKlkNx4kDHpOi54vz9fHqJSb6b8NR34sVAw7rI 57Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807727; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=St31qEiBWKoRteqqRq8R4XXaVrODiETBsusFnrIXDy0=; b=vs7+r44zeLamPN8c/3NOsU7mUdyzbH4UoBYW73SrrOjgoI/gG3Rssq4c6puMUWMOtp t0oK4Jdfvei1BUgsXHYFD+h7LRnrKL7fSBavxH6ZaX3sPQPta0+KAmXbR9asAus+G5rg wed+KL0S0gnTzKYWsbXiOC24LkVZdVE07DKCBNxTjI4FHd+KAtwc0OdJRoEX/jiaJrjF 42oq/HNINMzEtirzyOEJLPI9DeteRjmlAW9cKVQvRiBQXkjcqAm9Lxt8kGT5xRB03Ix6 vuH44KKQj+2gsNTWupoOgIBRPHaP9O5/FWprEsieDSg/MsC3EVcsxCYkKI0yFPgYBqjR tUUA== X-Gm-Message-State: AO0yUKVE80ZEgDtz4pvg7qmQnkSc1T2zizzvgns9y7QX+1sFx7uzdqm4 /c1/tT4z4BK7BaOe5U2UpX31TA== X-Received: by 2002:a2e:7804:0:b0:295:b3df:4942 with SMTP id t4-20020a2e7804000000b00295b3df4942mr11344510ljc.40.1678807726789; Tue, 14 Mar 2023 08:28:46 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:46 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:36 +0100 Subject: [PATCH v4 05/14] drm/msm/a6xx: Introduce GMU wrapper support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-5-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=19221; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=jpS8eOVezzz/F28mXHuOAM+A63HkjMpcKU5ZfGuiRds=; b=WrvnUl6YG5UiNc2LVPjd+AW0IU8Q7/F9SncvXEXLDYcONd1ve9ty8IOfblApWmKrmOBPyY5s/Tm9 G2wdbZcJBOGLWdKNqdA2EvkGOSjJfPp2H306zT93nI6q09vSGqSw X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357640154409256?= X-GMAIL-MSGID: =?utf-8?q?1760357640154409256?= Some (particularly SMD_RPM, a.k.a non-RPMh) SoCs implement A6XX GPUs but don't implement the associated GMUs. This is due to the fact that the GMU directly pokes at RPMh. Sadly, this means we have to take care of enabling & scaling power rails, clocks and bandwidth ourselves. Reuse existing Adreno-common code and modify the deeply-GMU-infused A6XX code to facilitate these GPUs. This involves if-ing out lots of GMU callbacks and introducing a new type of GMU - GMU wrapper (it's the actual name that Qualcomm uses in their downstream kernels). This is essentially a register region which is convenient to model as a device. We'll use it for managing the GDSCs. The register layout matches the actual GMU_CX/GX regions on the "real GMU" devices and lets us reuse quite a bit of gmu_read/write/rmw calls. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 53 +++++- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 244 +++++++++++++++++++++++++--- drivers/gpu/drm/msm/adreno/a6xx_gpu.h | 1 + drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 14 +- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 6 + 5 files changed, 282 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 229a54ec82b4..4ba059157177 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1474,6 +1474,7 @@ static int a6xx_gmu_get_irq(struct a6xx_gmu *gmu, struct platform_device *pdev, void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) { + struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct a6xx_gmu *gmu = &a6xx_gpu->gmu; struct platform_device *pdev = to_platform_device(gmu->dev); @@ -1493,10 +1494,12 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) gmu->mmio = NULL; gmu->rscc = NULL; - a6xx_gmu_memory_free(gmu); + if (!adreno_has_gmu_wrapper(adreno_gpu)) { + a6xx_gmu_memory_free(gmu); - free_irq(gmu->gmu_irq, gmu); - free_irq(gmu->hfi_irq, gmu); + free_irq(gmu->gmu_irq, gmu); + free_irq(gmu->hfi_irq, gmu); + } /* Drop reference taken in of_find_device_by_node */ put_device(gmu->dev); @@ -1504,6 +1507,50 @@ void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu) gmu->initialized = false; } +int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) +{ + struct platform_device *pdev = of_find_device_by_node(node); + struct a6xx_gmu *gmu = &a6xx_gpu->gmu; + int ret; + + if (!pdev) + return -ENODEV; + + gmu->dev = &pdev->dev; + + of_dma_configure(gmu->dev, node, true); + + pm_runtime_enable(gmu->dev); + + /* Mark legacy for manual SPTPRAC control */ + gmu->legacy = true; + + /* Map the GMU registers */ + gmu->mmio = a6xx_gmu_get_mmio(pdev, "gmu"); + if (IS_ERR(gmu->mmio)) { + ret = PTR_ERR(gmu->mmio); + goto err_mmio; + } + + /* Get a link to the GX power domain to reset the GPU */ + gmu->gxpd = dev_pm_domain_attach_by_name(gmu->dev, "gx"); + if (IS_ERR(gmu->gxpd)) + goto err_mmio; + + gmu->initialized = true; + + return 0; + +err_mmio: + iounmap(gmu->mmio); + ret = -ENODEV; + + /* Drop reference taken in of_find_device_by_node */ + put_device(gmu->dev); + + return ret; +} + int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) { struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 2f55dac52833..a90847a3379a 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -20,9 +20,11 @@ static inline bool _a6xx_check_idle(struct msm_gpu *gpu) struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); - /* Check that the GMU is idle */ - if (!a6xx_gmu_isidle(&a6xx_gpu->gmu)) - return false; + if (!adreno_has_gmu_wrapper(adreno_gpu)) { + /* Check that the GMU is idle */ + if (!a6xx_gmu_isidle(&a6xx_gpu->gmu)) + return false; + } /* Check tha the CX master is idle */ if (gpu_read(gpu, REG_A6XX_RBBM_STATUS) & @@ -612,13 +614,15 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state) return; /* Disable SP clock before programming HWCG registers */ - gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 1, 0); + if (!adreno_has_gmu_wrapper(adreno_gpu)) + gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 1, 0); for (i = 0; (reg = &adreno_gpu->info->hwcg[i], reg->offset); i++) gpu_write(gpu, reg->offset, state ? reg->value : 0); /* Enable SP clock */ - gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 0, 1); + if (!adreno_has_gmu_wrapper(adreno_gpu)) + gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 0, 1); gpu_write(gpu, REG_A6XX_RBBM_CLOCK_CNTL, state ? clock_cntl_on : 0); } @@ -1002,10 +1006,13 @@ static int hw_init(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + struct a6xx_gmu *gmu = &a6xx_gpu->gmu; int ret; - /* Make sure the GMU keeps the GPU on while we set it up */ - a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET); + if (!adreno_has_gmu_wrapper(adreno_gpu)) { + /* Make sure the GMU keeps the GPU on while we set it up */ + a6xx_gmu_set_oob(&a6xx_gpu->gmu, GMU_OOB_GPU_SET); + } /* Clear GBIF halt in case GX domain was not collapsed */ if (a6xx_has_gbif(adreno_gpu)) @@ -1131,6 +1138,17 @@ static int hw_init(struct msm_gpu *gpu) 0x3f0243f0); } + if (adreno_has_gmu_wrapper(adreno_gpu)) { + /* Do it here, as GMU wrapper only inits the GMU for memory reservation etc. */ + + /* Set up the CX GMU counter 0 to count busy ticks */ + gmu_write(gmu, REG_A6XX_GPU_GMU_AO_GPU_CX_BUSY_MASK, 0xff000000); + + /* Enable power counter 0 */ + gmu_rmw(gmu, REG_A6XX_GMU_CX_GMU_POWER_COUNTER_SELECT_0, 0xff, BIT(5)); + gmu_write(gmu, REG_A6XX_GMU_CX_GMU_POWER_COUNTER_ENABLE, 1); + } + /* Protect registers from the CP */ a6xx_set_cp_protect(gpu); @@ -1239,6 +1257,8 @@ static int hw_init(struct msm_gpu *gpu) } out: + if (adreno_has_gmu_wrapper(adreno_gpu)) + return ret; /* * Tell the GMU that we are done touching the GPU and it can start power * management @@ -1273,6 +1293,9 @@ static void a6xx_dump(struct msm_gpu *gpu) adreno_dump(gpu); } +#define GBIF_GX_HALT_MASK BIT(0) +#define GBIF_CLIENT_HALT_MASK BIT(0) +#define GBIF_ARB_HALT_MASK BIT(1) #define VBIF_RESET_ACK_TIMEOUT 100 #define VBIF_RESET_ACK_MASK 0x00f0 @@ -1304,7 +1327,8 @@ static void a6xx_recover(struct msm_gpu *gpu) * Turn off keep alive that might have been enabled by the hang * interrupt */ - gmu_write(&a6xx_gpu->gmu, REG_A6XX_GMU_GMU_PWR_COL_KEEPALIVE, 0); + if (!adreno_has_gmu_wrapper(adreno_gpu)) + gmu_write(&a6xx_gpu->gmu, REG_A6XX_GMU_GMU_PWR_COL_KEEPALIVE, 0); pm_runtime_dont_use_autosuspend(&gpu->pdev->dev); @@ -1328,6 +1352,35 @@ static void a6xx_recover(struct msm_gpu *gpu) /* Call into gpucc driver to poll for cx gdsc collapse */ reset_control_reset(gpu->cx_collapse); + /* Software-reset the GPU */ + if (adreno_has_gmu_wrapper(adreno_gpu)) { + /* Halt the GX side of GBIF */ + gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, GBIF_GX_HALT_MASK); + spin_until(gpu_read(gpu, REG_A6XX_RBBM_GBIF_HALT_ACK) & + GBIF_GX_HALT_MASK); + + /* Halt new client requests on GBIF */ + gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_CLIENT_HALT_MASK); + spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) & + (GBIF_CLIENT_HALT_MASK)) == GBIF_CLIENT_HALT_MASK); + + /* Halt all AXI requests on GBIF */ + gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_ARB_HALT_MASK); + spin_until((gpu_read(gpu, REG_A6XX_GBIF_HALT_ACK) & + (GBIF_ARB_HALT_MASK)) == GBIF_ARB_HALT_MASK); + + /* Clear the halts */ + gpu_write(gpu, REG_A6XX_GBIF_HALT, 0); + + if (adreno_is_a619_holi(adreno_gpu)) + gpu_write(gpu, 0x18, 0); + else + gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, 0); + + /* This *really* needs to go through before we do anything else! */ + mb(); + } + pm_runtime_use_autosuspend(&gpu->pdev->dev); if (active_submits) @@ -1512,7 +1565,8 @@ static void a6xx_fault_detect_irq(struct msm_gpu *gpu) * Force the GPU to stay on until after we finish * collecting information */ - gmu_write(&a6xx_gpu->gmu, REG_A6XX_GMU_GMU_PWR_COL_KEEPALIVE, 1); + if (!adreno_has_gmu_wrapper(adreno_gpu)) + gmu_write(&a6xx_gpu->gmu, REG_A6XX_GMU_GMU_PWR_COL_KEEPALIVE, 1); DRM_DEV_ERROR(&gpu->pdev->dev, "gpu fault ring %d fence %x status %8.8X rb %4.4x/%4.4x ib1 %16.16llX/%4.4x ib2 %16.16llX/%4.4x\n", @@ -1673,7 +1727,7 @@ static void a6xx_llc_slices_init(struct platform_device *pdev, a6xx_gpu->llc_mmio = ERR_PTR(-EINVAL); } -static int a6xx_pm_resume(struct msm_gpu *gpu) +static int a6xx_gmu_pm_resume(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); @@ -1693,10 +1747,48 @@ static int a6xx_pm_resume(struct msm_gpu *gpu) a6xx_llc_activate(a6xx_gpu); - return 0; + return ret; } -static int a6xx_pm_suspend(struct msm_gpu *gpu) +static int a6xx_pm_resume(struct msm_gpu *gpu) +{ + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); + struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + struct a6xx_gmu *gmu = &a6xx_gpu->gmu; + int ret; + + gpu->needs_hw_init = true; + + trace_msm_gpu_resume(0); + + mutex_lock(&a6xx_gpu->gmu.lock); + + pm_runtime_resume_and_get(gmu->dev); + pm_runtime_resume_and_get(gmu->gxpd); + + /* Set the core clock, having VDD scaling in mind */ + ret = dev_pm_opp_set_rate(&gpu->pdev->dev, gpu->fast_rate); + if (ret) + goto err; + + ret = clk_bulk_prepare_enable(gpu->nr_clocks, gpu->grp_clks); + if (ret) + goto err; + + ret = clk_prepare_enable(gpu->ebi1_clk); + if (ret) + goto err; + +err: + mutex_unlock(&a6xx_gpu->gmu.lock); + + if (!ret) + msm_devfreq_resume(gpu); + + return ret; +} + +static int a6xx_gmu_pm_suspend(struct msm_gpu *gpu) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); @@ -1723,11 +1815,62 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) return 0; } +static int a6xx_pm_suspend(struct msm_gpu *gpu) +{ + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); + struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + struct a6xx_gmu *gmu = &a6xx_gpu->gmu; + unsigned long freq = 0; + struct dev_pm_opp *opp; + int i, ret; + + trace_msm_gpu_suspend(0); + + opp = dev_pm_opp_find_freq_ceil(&gpu->pdev->dev, &freq); + dev_pm_opp_put(opp); + + msm_devfreq_suspend(gpu); + + mutex_lock(&a6xx_gpu->gmu.lock); + + clk_disable_unprepare(gpu->ebi1_clk); + + clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks); + + /* Set frequency to the minimum supported level (no 27MHz on A6xx!) */ + ret = dev_pm_opp_set_rate(&gpu->pdev->dev, freq); + if (ret) + goto err; + + pm_runtime_put_sync(gmu->gxpd); + pm_runtime_put_sync(gmu->dev); + + mutex_unlock(&a6xx_gpu->gmu.lock); + + if (a6xx_gpu->shadow_bo) + for (i = 0; i < gpu->nr_rings; i++) + a6xx_gpu->shadow[i] = 0; + + gpu->suspend_count++; + + return 0; + +err: + mutex_unlock(&a6xx_gpu->gmu.lock); + + return ret; +} + static int a6xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) { struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu); + if (adreno_has_gmu_wrapper(adreno_gpu)) { + *value = gpu_read64(gpu, REG_A6XX_CP_ALWAYS_ON_COUNTER_LO); + return 0; + } + mutex_lock(&a6xx_gpu->gmu.lock); /* Force the GPU power on so we can read this register */ @@ -1765,7 +1908,8 @@ static void a6xx_destroy(struct msm_gpu *gpu) drm_gem_object_put(a6xx_gpu->shadow_bo); } - a6xx_llc_slices_destroy(a6xx_gpu); + if (!adreno_has_gmu_wrapper(adreno_gpu)) + a6xx_llc_slices_destroy(a6xx_gpu); mutex_lock(&a6xx_gpu->gmu.lock); a6xx_gmu_remove(a6xx_gpu); @@ -2005,8 +2149,8 @@ static const struct adreno_gpu_funcs funcs = { .get_param = adreno_get_param, .set_param = adreno_set_param, .hw_init = a6xx_hw_init, - .pm_suspend = a6xx_pm_suspend, - .pm_resume = a6xx_pm_resume, + .pm_suspend = a6xx_gmu_pm_suspend, + .pm_resume = a6xx_gmu_pm_resume, .recover = a6xx_recover, .submit = a6xx_submit, .active_ring = a6xx_active_ring, @@ -2030,6 +2174,34 @@ static const struct adreno_gpu_funcs funcs = { .get_timestamp = a6xx_get_timestamp, }; +static const struct adreno_gpu_funcs funcs_gmuwrapper = { + .base = { + .get_param = adreno_get_param, + .set_param = adreno_set_param, + .hw_init = a6xx_hw_init, + .pm_suspend = a6xx_pm_suspend, + .pm_resume = a6xx_pm_resume, + .recover = a6xx_recover, + .submit = a6xx_submit, + .active_ring = a6xx_active_ring, + .irq = a6xx_irq, + .destroy = a6xx_destroy, +#if defined(CONFIG_DRM_MSM_GPU_STATE) + .show = a6xx_show, +#endif + .gpu_busy = a6xx_gpu_busy, +#if defined(CONFIG_DRM_MSM_GPU_STATE) + .gpu_state_get = a6xx_gpu_state_get, + .gpu_state_put = a6xx_gpu_state_put, +#endif + .create_address_space = a6xx_create_address_space, + .create_private_address_space = a6xx_create_private_address_space, + .get_rptr = a6xx_get_rptr, + .progress = a6xx_progress, + }, + .get_timestamp = a6xx_get_timestamp, +}; + struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; @@ -2051,18 +2223,36 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) adreno_gpu->registers = NULL; + /* Check if there is a GMU phandle and set it up */ + node = of_parse_phandle(pdev->dev.of_node, "qcom,gmu", 0); + /* FIXME: How do we gracefully handle this? */ + BUG_ON(!node); + + adreno_gpu->gmu_is_wrapper = of_device_is_compatible(node, "qcom,adreno-gmu-wrapper"); + /* * We need to know the platform type before calling into adreno_gpu_init * so that the hw_apriv flag can be correctly set. Snoop into the info * and grab the revision number */ info = adreno_info(config->rev); - - if (info && (info->revn == 650 || info->revn == 660 || - adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), info->rev))) + if (!info) + return ERR_PTR(-EINVAL); + + /* Assign these early so that we can use the is_aXYZ helpers */ + /* Numeric revision IDs (e.g. 630) */ + adreno_gpu->revn = info->revn; + /* New-style ADRENO_REV()-only */ + adreno_gpu->rev = info->rev; + /* Quirk data */ + adreno_gpu->info = info; + + if (adreno_is_a650(adreno_gpu) || adreno_is_a660_family(adreno_gpu)) adreno_gpu->base.hw_apriv = true; - a6xx_llc_slices_init(pdev, a6xx_gpu); + /* No LLCC on non-RPMh (and by extension, non-GMU) SoCs */ + if (!adreno_has_gmu_wrapper(adreno_gpu)) + a6xx_llc_slices_init(pdev, a6xx_gpu); ret = a6xx_set_supported_hw(&pdev->dev, config->rev); if (ret) { @@ -2070,7 +2260,10 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) return ERR_PTR(ret); } - ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); + if (adreno_has_gmu_wrapper(adreno_gpu)) + ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs_gmuwrapper, 1); + else + ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1); if (ret) { a6xx_destroy(&(a6xx_gpu->base.base)); return ERR_PTR(ret); @@ -2083,13 +2276,10 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) if (adreno_is_a618(adreno_gpu) || adreno_is_7c3(adreno_gpu)) priv->gpu_clamp_to_idle = true; - /* Check if there is a GMU phandle and set it up */ - node = of_parse_phandle(pdev->dev.of_node, "qcom,gmu", 0); - - /* FIXME: How do we gracefully handle this? */ - BUG_ON(!node); - - ret = a6xx_gmu_init(a6xx_gpu, node); + if (adreno_has_gmu_wrapper(adreno_gpu)) + ret = a6xx_gmu_wrapper_init(a6xx_gpu, node); + else + ret = a6xx_gmu_init(a6xx_gpu, node); of_node_put(node); if (ret) { a6xx_destroy(&(a6xx_gpu->base.base)); diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h index eea2e60ce3b7..51a7656072fa 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.h +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.h @@ -76,6 +76,7 @@ int a6xx_gmu_set_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state); void a6xx_gmu_clear_oob(struct a6xx_gmu *gmu, enum a6xx_gmu_oob_state state); int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); +int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node); void a6xx_gmu_remove(struct a6xx_gpu *a6xx_gpu); void a6xx_gmu_set_freq(struct msm_gpu *gpu, struct dev_pm_opp *opp, diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c index b7e217d00a22..e11e8a02ac22 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c @@ -1041,16 +1041,18 @@ struct msm_gpu_state *a6xx_gpu_state_get(struct msm_gpu *gpu) /* Get the generic state from the adreno core */ adreno_gpu_state_get(gpu, &a6xx_state->base); - a6xx_get_gmu_registers(gpu, a6xx_state); + if (!adreno_has_gmu_wrapper(adreno_gpu)) { + a6xx_get_gmu_registers(gpu, a6xx_state); - a6xx_state->gmu_log = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.log); - a6xx_state->gmu_hfi = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.hfi); - a6xx_state->gmu_debug = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.debug); + a6xx_state->gmu_log = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.log); + a6xx_state->gmu_hfi = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.hfi); + a6xx_state->gmu_debug = a6xx_snapshot_gmu_bo(a6xx_state, &a6xx_gpu->gmu.debug); - a6xx_snapshot_gmu_hfi_history(gpu, a6xx_state); + a6xx_snapshot_gmu_hfi_history(gpu, a6xx_state); + } /* If GX isn't on the rest of the data isn't going to be accessible */ - if (!a6xx_gmu_gx_is_on(&a6xx_gpu->gmu)) + if (!adreno_has_gmu_wrapper(adreno_gpu) && !a6xx_gmu_gx_is_on(&a6xx_gpu->gmu)) return &a6xx_state->base; /* Get the banks of indexed registers */ diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index b4f9b1343d63..2c0f0ef094cb 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -115,6 +115,7 @@ struct adreno_gpu { * code (a3xx_gpu.c) and stored in this common location. */ const unsigned int *reg_offsets; + bool gmu_is_wrapper; }; #define to_adreno_gpu(x) container_of(x, struct adreno_gpu, base) @@ -145,6 +146,11 @@ struct adreno_platform_config { bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2); +static inline bool adreno_has_gmu_wrapper(struct adreno_gpu *gpu) +{ + return gpu->gmu_is_wrapper; +} + static inline bool adreno_is_a2xx(struct adreno_gpu *gpu) { return (gpu->revn < 300); From patchwork Tue Mar 14 15:28:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1829497wrd; Tue, 14 Mar 2023 08:38:06 -0700 (PDT) X-Google-Smtp-Source: AK7set9QDIPGeozslMnopHRrOBSKSRzG7aw6DopSp5rU2HKUSltJPV+pxrUGEXr7u+6loMR/XSgy X-Received: by 2002:a05:6a20:1615:b0:d5:a476:b159 with SMTP id l21-20020a056a20161500b000d5a476b159mr1890492pzj.61.1678808286488; Tue, 14 Mar 2023 08:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808286; cv=none; d=google.com; s=arc-20160816; b=DOe8adFDedJkoczWdAPPKqaE5FzL8Mtwi0xta+ZsWMqbyKClkDPm8DHaOBuhH3DqXU aRZf2pdg3yP4o6xpvmdZ2NG4TqOLxyC87wzgYRDIWy1As9+x1v/7rCwmjsrwwqLufp2F 2Xc6PXMYQ9NC6gcbnRAE4cj7+YQueEpsA+3fSSFn04t1w5wr+AIHF9I7yzF1VJEZ0WU7 q1nYrgMH+KtKihcWJulUaSGait7/2Inr6rKe1xGpiBfxH7nfYChv4s30P/+PzyqTA+XX 3/qgRLmFR4tjXqGY8zEHpm+K5GVNfY1O5VCRK5KXUlI1lMZPlSEzIHXoD9zNj9KJ4cvg xjfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=159lZK1VC8AnArbTbfywvfz47MuAlqr+e0q9A9rUbAY=; b=NWKceH37HgJ7YKAYUtWo+P7Ee0Wjli+K3Mge1fvIgfo26Zl5WfhrcMWt1LTvuZCL4+ L9F+vVdt5ACweZWUB6WiLLUMVtt6qOWKr92B1VVXclerlVOLGy/wUzrEJ2Ez9ptNzHIu E5uIQiupxEmD64QkyyIIRG5GMF+BYkMKXq9LaWivIFoNljBV+0d6tjr4YdLquglE2gEC G56+FKCJtkOSvtn/XNznv8FiS1+LHONvlzVDkfNdfWOpjbGqQ8Yae9Jf+TDOljSAZN0E O/Yre6TzX04WS6zmuVr3a3k1NEnLzjRP9d0agRFzVnyAR3BejSZlW7qPNQsSWH9Lvu19 jQZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybkS1ks8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w189-20020a6382c6000000b005074f2e8480si2484691pgd.425.2023.03.14.08.37.50; Tue, 14 Mar 2023 08:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ybkS1ks8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231727AbjCNP3E (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231439AbjCNP2y (ORCPT ); Tue, 14 Mar 2023 11:28:54 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6E33A614E for ; Tue, 14 Mar 2023 08:28:48 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id g18so16449285ljl.3 for ; Tue, 14 Mar 2023 08:28:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807728; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=159lZK1VC8AnArbTbfywvfz47MuAlqr+e0q9A9rUbAY=; b=ybkS1ks85NwBg0oo4KVc4YOEPbJDHyxaTPYyY5Ix/0wWYBycqMFQxYFzrOVQ6wjypO fQmQycMbmWZvRFv7EduPzK10eesNeyMeiZJvpoHNqbbImGbWHlCu0F/fNvwSaVttOIlN JSbW0fOGV5ZttCFGvf6VYxPo8gUKcGGVxpMglgQDoUl30mV6R4KoNhgzpaQ2j9Glukbz RMENp5oNU5cfRTprvVqD6orxx+uicybh/W3zYauQtLBj6JZRMKQ45UVZCOvhq+SHvDd6 lJWX0KvsUlPjFe6eyjd21Ka+W3Hcqs8eiTJMKR6z32H0p0/HpJqW2tyDrqH1IaokaCXz +56A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807728; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=159lZK1VC8AnArbTbfywvfz47MuAlqr+e0q9A9rUbAY=; b=CeuBd5+9nv5ULJ+S9T2xQw3sM9sjsWjQD6HQWdSef1bXcFBzg4vwO+ND+fsLlzhVHi mRRjYMqJres6BxFNhfhhMMp6Eo4HooGV7ZvXEZIJ/A8w2iT6sqw50Z+FsRHvL+6VKr3+ A4CEjy3HJOrB/OfWs9/MXrglVl0plbWxDnS/4fW8qRMAuv8/hRyJxr3j1fst4iz1wlo6 sMVPgc3Up7wIk62tHZvLwojY3/r3FgzFyetxDO8ToqkLumv2xqkzarKHVWJJZVtSzfEz iGj3p66yYKe4fiB47uS0le4xpLpChBiQ3yS5KX2RTk17RJ+53dkqnt9LrxjS77YSffMS tjKw== X-Gm-Message-State: AO0yUKXIYE/pOdO4khJJXIV6b+DBrY8o5JvAhYdHceeKgS4B+XmysvvH Hi8oMByFV+76aNsPspMFGbqlVQ== X-Received: by 2002:a05:651c:1059:b0:295:b96e:ca99 with SMTP id x25-20020a05651c105900b00295b96eca99mr14017598ljm.50.1678807728292; Tue, 14 Mar 2023 08:28:48 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:48 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:37 +0100 Subject: [PATCH v4 06/14] drm/msm/a6xx: Remove both GBIF and RBBM GBIF halt on hw init MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-6-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1251; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=SQf5xqv6dgkFv8lqaRaSsqR3oatLGI4JEKv+JlvqW4k=; b=j0wqavMQyp9JVzEUb+dyZ3aehx3l+F1HEWpU/j8PV1u7+qyWbwNnPl8Ix1vohsIlZY8QP7XOf0G8 gFxAnV4NCSDkUzx+xsz2mPlEqsuMhpdcxfpQLRfk7YgDSyVTBnNy X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358077616801460?= X-GMAIL-MSGID: =?utf-8?q?1760358077616801460?= Currently we're only deasserting REG_A6XX_RBBM_GBIF_HALT, but we also need REG_A6XX_GBIF_HALT to be set to 0. For GMU-equipped GPUs this is done in a6xx_bus_clear_pending_transactions(), but for the GMU-less ones we have to do it *somewhere*. Unhalting both side by side sounds like a good plan and it won't cause any issues if it's unnecessary. Also, add a memory barrier to ensure it's gone through. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index a90847a3379a..70e9bd21ba3b 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1015,8 +1015,12 @@ static int hw_init(struct msm_gpu *gpu) } /* Clear GBIF halt in case GX domain was not collapsed */ - if (a6xx_has_gbif(adreno_gpu)) + if (a6xx_has_gbif(adreno_gpu)) { + gpu_write(gpu, REG_A6XX_GBIF_HALT, 0); gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, 0); + /* Let's make extra sure that the GPU can access the memory.. */ + mb(); + } gpu_write(gpu, REG_A6XX_RBBM_SECVID_TSB_CNTL, 0); From patchwork Tue Mar 14 15:28:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69686 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1825979wrd; Tue, 14 Mar 2023 08:31:25 -0700 (PDT) X-Google-Smtp-Source: AK7set//UCvTbuCFCr0Vns+a+ekiPdB6ChCsnV1KBF5c7er+9+boVunij+w1BS5U+LqFgQBlk0Xv X-Received: by 2002:aa7:9508:0:b0:5e0:3038:2300 with SMTP id b8-20020aa79508000000b005e030382300mr36698700pfp.20.1678807884847; Tue, 14 Mar 2023 08:31:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678807884; cv=none; d=google.com; s=arc-20160816; b=zDMgrTDotnZ777+llHxcIPzmYGk4QeLVI6ALVVITyr8nYIzx4laM3DiRQwm6aAZ1Fr j5tkQ0GhilGMyanuS+O0EjvaJ1VGXXBCofLljOYdNhUD/eFu63OSgLx5jHB7K0txPnbw CJZgvWySfekQYMWL9anbf6u4m16vTzZo7CWymDBPJ1tMpcenrUCVhcYS1dMPxf8WWNlZ RHxVDt0UfTxcX/0yJezVIaIE6FyFwm3i8estBgwD0l1pXGEC6BR2OQ3Yosxt3CGxQA8F i3KZ9pOl8BlMKol/0nsp6dQWrs80Nw6Wua9KCm4oyUS/B/KP3hJ1g4Vp4gnofMVVW8iR xmkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=WABs2uqkSr8euv93L/sU63WnoiH4PZRdu/LdvY8ve98=; b=b0ZK2fZdqTHrb/AlkglTTnXzSDKIKFBP/lLmyCISQmnjAMh7eLBAROrAHQDJ51AQOR WLKAQXWlzo1yj2zlOY/dEO5L6L3WBecJarLqq3uMhv2tcjPuQnk3UjjeRwSL7xhFT4f+ pkSzlc4prwT9HqoXmhH/78DcZt7dywBhcYdd3YmfoHxmg0GTjT/zAxloMqC7rUitebrh TqFoOSfzIUsxfMEq2cT8ZMbLA5FtiAZz2T/dAWCPFpJlGTkpYfl+pR7WjiC3zqLAUO+c JynOrkKBtxrrcP6DEdumuhHFvCWu1eAfyvvRIsaSmtaU74lZvenWAKV+9Hlw0T/OmNpz nD9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e4HxELOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z63-20020a626542000000b005a0c57eac92si2361626pfb.232.2023.03.14.08.31.11; Tue, 14 Mar 2023 08:31:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=e4HxELOY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231770AbjCNP3X (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231618AbjCNP25 (ORCPT ); Tue, 14 Mar 2023 11:28:57 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9021172036 for ; Tue, 14 Mar 2023 08:28:51 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id g18so16449392ljl.3 for ; Tue, 14 Mar 2023 08:28:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807730; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=WABs2uqkSr8euv93L/sU63WnoiH4PZRdu/LdvY8ve98=; b=e4HxELOY7IfiLDgpEbVVOCpGxJQiGn7MmAADHLeIQ9dSonULA0bldiz8CgMI2737lY rOYV31erKzdYtlM7ceiSmc4zGlTZSeSSeyEkywbYCAfh92/Oxa7gr0GGEXdLxtwTNR2V ai9M1XsFH/RFvDU6O1udDwUKU5YAnpsfNSyFV0bvD/OrN0ZHX7R9UpaN/uTE7lkFnlXh 9fJTy5GbjRFmoTRlViDpEun63yit9z8jUaQX2/CJnYEbnaw3RySP5xBWpzFUpAPX0hI7 8Vp0HsbB95wYBXPFG+N/BlrhRc/mdCCI/fdDT98qBSu10uo7fpWu4/XOcLnq36C3O/zu oGLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807730; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WABs2uqkSr8euv93L/sU63WnoiH4PZRdu/LdvY8ve98=; b=Ktek1pcnVdKw+3Gc2CX8kPkQJ9XoKF3L7BOj48c/BNr4eG3vX+KnblAauWFoli7xKO dPQOO3QR0m8P0ikfZyBh6mHXaj1oD67MiVGvEa10LX+AJjbDUKQ/228zIx/4bqBXMCQU 5LYnAAsX3Eno9wfvpLgk0h58vXZYyFtVdChVFcHokS1f3H4FHcDdwRziwEn+E4beGDvy wApF9aubcLap9fSYwY3VHRbMiWl8dWV3VaIv7N+EaYflP0bZtvr0ptzvP9ZqxrI8hVkH lvV46K2r72C94EG0o0Rbb3Ji44P9EMAnfMcIcMBIPDeWSWVMGNK3rvvFEcJNIxZ8mgH7 LWSA== X-Gm-Message-State: AO0yUKX32GSensWfeNOQ9w71vKzMrj1pEiu6ZlNliKfG+VR9LaA449W1 0eEieih03UumHJf7+M7VQcmhkA== X-Received: by 2002:a2e:9911:0:b0:295:a50b:3693 with SMTP id v17-20020a2e9911000000b00295a50b3693mr10743151lji.44.1678807729879; Tue, 14 Mar 2023 08:28:49 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:49 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:38 +0100 Subject: [PATCH v4 07/14] drm/msm/adreno: Disable has_cached_coherent in GMU wrapper configurations MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-7-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1374; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=BrQq/uUq7axESPCyxyyfFuley6Eq3n1FbD/qjV9Gfd4=; b=I4rxN89h6z/5WvdM1z4Z8cq5KsNXVn/10Wqx0Zr2wNmgPlC7+VHm5VhNifsczU7WOBF58BWKvqWC uCkX0n4MCwgu+b3mjjVKTvTab+06TYtgi6LYzZfedym+c58dba/a X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357657120392881?= X-GMAIL-MSGID: =?utf-8?q?1760357657120392881?= A610 and A619_holi don't support the feature. Disable it to make the GPU stop crashing after almost each and every submission - the received data on the GPU end was simply incomplete in garbled, resulting in almost nothing being executed properly. Extend the disablement to adreno_has_gmu_wrapper, as none of the GMU wrapper Adrenos that don't support yet seem to feature it. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/adreno_device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index f35392c034f7..6513c6094865 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -540,7 +540,6 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) config.rev.minor, config.rev.patchid); priv->is_a2xx = config.rev.core == 2; - priv->has_cached_coherent = config.rev.core >= 6; gpu = info->init(drm); if (IS_ERR(gpu)) { @@ -552,6 +551,10 @@ static int adreno_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; + if (config.rev.core >= 6) + if (!adreno_has_gmu_wrapper(to_adreno_gpu(gpu))) + priv->has_cached_coherent = true; + return 0; } From patchwork Tue Mar 14 15:28:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69701 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1830327wrd; Tue, 14 Mar 2023 08:39:56 -0700 (PDT) X-Google-Smtp-Source: AK7set85mQVTAlrjWU0LsDOlbg0VI0f+5MwTu5V3sOnn8FkhDn8N39pZ+3qDu7R3oa4AhZ0hjcnR X-Received: by 2002:a17:902:e550:b0:1a0:42c0:b2a5 with SMTP id n16-20020a170902e55000b001a042c0b2a5mr10024547plf.24.1678808396183; Tue, 14 Mar 2023 08:39:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808396; cv=none; d=google.com; s=arc-20160816; b=ca9hekgt+tiMhlyijww3ZxAJK/ZuadrVl6d207xmsqT8HQ1K5nX+5fzMmgnMdEasDw 5zUetYHWJMdLnVF5aaFawm9nD2xl0kCXGzH+EA+FD0UebYgj6eXrDLsFc1JAHPVMAfUl 60OHL5A3tlv+FpTJM7uRDMc1CCfrKXMm8+DdTyIiGpKan/Cf7vxLKERqr0D+A10vn4Ep KRmPG+yaLdIkFs8fWwXoi0U6RL37p0UbFiCMcvTPhIWFYNC46WpOUMZeqnSyxrEyU7oB kYmWZgRYK9EjWKKoyt6KyytpHXGtrcZfoaQfafxROWDeDTFIVv+yQnebppuGW2F4g1kt P27Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=0QBfkwBASk6EqehMpj5iBWVthwGOhEMOaMUH5eoHlaw=; b=g4nQgQEdUL4Sk3GhfoS+ax8FR2CCZDd27h5sNoo4wQe5gqMI0CbzQmjn5yDX78YfS5 BfVbvGDFRvIHDgda3Y+eCD/sfaJnco6l4GYc20jua67lJ9ttvsbXRqLXg1Y9MSBBeXz7 j5E/EH3XPegWi4eAnZkjzigYydOu+9ZrkOssPm9q1zDKBLbRSOcvpANqNQeUcOACXhv2 gE8mkIw02x7+ufF+yhdL70VIIHh1oXx7Yj5SXBOpLHyEHnAR01fogkqppPyS+Z6+kOfj sYCJB471z/uWavee11DOjj4LiX8HdGhAStGvK7WljH8q3E6hQil7ghH9ciqsyrJc6vRv nqJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UepBCxqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a17090ae00800b0023bfddf2a84si2570435pjy.63.2023.03.14.08.39.40; Tue, 14 Mar 2023 08:39:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UepBCxqm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231809AbjCNP30 (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231702AbjCNP26 (ORCPT ); Tue, 14 Mar 2023 11:28:58 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63E3D279BA for ; Tue, 14 Mar 2023 08:28:53 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id b10so16450414ljr.0 for ; Tue, 14 Mar 2023 08:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807731; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=0QBfkwBASk6EqehMpj5iBWVthwGOhEMOaMUH5eoHlaw=; b=UepBCxqmyQ8a7htSDlTFI0ShFtEB7diji/pbqGjwg56DIr/pGL1FMQG23Kn4gVFUIH NWU7NEQOg6QEPw+QBNKkfk0e3g7KdwuL54ChUUC95zetLCTFMuNkWeytTRsZmOoAlBPh 6oKBWQ+Zrt2mvYnaj1zpDOe5mfV6hGiVgV8S4nFnuK92cLLCnctMeMoH5uimRkorSjJC hi7HBB16Btn0M0sTQJkP9rlv0qMBsA6gH2fdDc36OWvkMN9RwmYFYtyGhAjMCcaOXdv7 Iu3w3ma+ue36QNvHTEAvVstExQCK4oYWWSW8+plHHOxbDvNQ+AjF0T3Vli78h9Ec6XHk l0BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807731; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0QBfkwBASk6EqehMpj5iBWVthwGOhEMOaMUH5eoHlaw=; b=YcthHZCWmY69JQr5ORb2YeWrXZ1x3IgqV2kSINH5DNdgUyGK9sXOr9evRbwr0blmj+ ohrRz/CoRoHdlUuSt+aMLB843YwWF0Uq/CuJGQSCLIKlQG7gAOEfNMREt/xSDglL7CDU ykeaamMDYNOC0MRFYaEv+dLlJXTFEtSb1bl6wY/A8EAy08fPn7CTM6ubN38QrqyZ8lw8 E9qq77XzqNja0MC61HyoyRXIu5FoMA1tIftv6oLTRCTMAYJVmSDDZUA2RRVvOcuSLrlU CsLbYsiSIhqu4w2kgsRd5c1zlHCBogYFP+tu0wjWyQmJiDLKsWut7M1wZ7Elyis5aOXU nB/A== X-Gm-Message-State: AO0yUKX65fLN/74aEi5mu88Trku9JHMKETXwboF2D/R/o8DWnxPT7k8d Si/3Fo7Kq9RDecV0CZWM0zQFUg== X-Received: by 2002:a2e:909a:0:b0:295:a829:1c57 with SMTP id l26-20020a2e909a000000b00295a8291c57mr12082944ljg.20.1678807731546; Tue, 14 Mar 2023 08:28:51 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:51 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:39 +0100 Subject: [PATCH v4 08/14] drm/msm/a6xx: Add support for A619_holi MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-8-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=4940; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=RIb1PwuaJxl26QOFy9hE9BbhqyB0PIh+V+WoOWu9KIo=; b=h7jUht1chOrWGuBBXbU8DzuW6yjeui4Q0sDTGbH6GAeYwsfIT23zHYJDwYLDz3LenakP9X/KTBJ5 izASb5SjDlR6KxM03YuJv1h7kgCC7iusu/S20201Ob3fWj/jky89 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358192709835727?= X-GMAIL-MSGID: =?utf-8?q?1760358192709835727?= A619_holi is a GMU-less variant of the already-supported A619 GPU. It's present on at least SM4350 (holi) and SM6375 (blair). No mesa changes are required. Add the required kernel-side support for it. Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 42 ++++++++++++++++++++++++++------- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 5 ++++ 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 70e9bd21ba3b..1c0e5e1df89c 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -614,14 +614,16 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state) return; /* Disable SP clock before programming HWCG registers */ - if (!adreno_has_gmu_wrapper(adreno_gpu)) + if (!adreno_has_gmu_wrapper(adreno_gpu) || + adreno_is_a619_holi(adreno_gpu)) gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 1, 0); for (i = 0; (reg = &adreno_gpu->info->hwcg[i], reg->offset); i++) gpu_write(gpu, reg->offset, state ? reg->value : 0); /* Enable SP clock */ - if (!adreno_has_gmu_wrapper(adreno_gpu)) + if (!adreno_has_gmu_wrapper(adreno_gpu) || + adreno_is_a619_holi(adreno_gpu)) gmu_rmw(gmu, REG_A6XX_GPU_GMU_GX_SPTPRAC_CLOCK_CONTROL, 0, 1); gpu_write(gpu, REG_A6XX_RBBM_CLOCK_CNTL, state ? clock_cntl_on : 0); @@ -814,6 +816,9 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) if (adreno_is_a618(adreno_gpu)) return; + if (adreno_is_a619_holi(gpu)) + hbb_lo = 0; + if (adreno_is_a640_family(adreno_gpu)) amsbc = 1; @@ -1015,7 +1020,12 @@ static int hw_init(struct msm_gpu *gpu) } /* Clear GBIF halt in case GX domain was not collapsed */ - if (a6xx_has_gbif(adreno_gpu)) { + if (adreno_is_a619_holi(adreno_gpu)) { + gpu_write(gpu, REG_A6XX_GBIF_HALT, 0); + gpu_write(gpu, 0x18, 0); + /* Let's make extra sure that the GPU can access the memory.. */ + mb(); + } else if (a6xx_has_gbif(adreno_gpu)) { gpu_write(gpu, REG_A6XX_GBIF_HALT, 0); gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, 0); /* Let's make extra sure that the GPU can access the memory.. */ @@ -1024,6 +1034,9 @@ static int hw_init(struct msm_gpu *gpu) gpu_write(gpu, REG_A6XX_RBBM_SECVID_TSB_CNTL, 0); + if (adreno_is_a619_holi(adreno_gpu)) + a6xx_sptprac_enable(gmu); + /* * Disable the trusted memory range - we don't actually supported secure * memory rendering at this point in time and we don't want to block off @@ -1301,7 +1314,8 @@ static void a6xx_dump(struct msm_gpu *gpu) #define GBIF_CLIENT_HALT_MASK BIT(0) #define GBIF_ARB_HALT_MASK BIT(1) #define VBIF_RESET_ACK_TIMEOUT 100 -#define VBIF_RESET_ACK_MASK 0x00f0 +#define VBIF_RESET_ACK_MASK 0xF0 +#define GPR0_GBIF_HALT_REQUEST 0x1E0 static void a6xx_recover(struct msm_gpu *gpu) { @@ -1358,10 +1372,16 @@ static void a6xx_recover(struct msm_gpu *gpu) /* Software-reset the GPU */ if (adreno_has_gmu_wrapper(adreno_gpu)) { - /* Halt the GX side of GBIF */ - gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, GBIF_GX_HALT_MASK); - spin_until(gpu_read(gpu, REG_A6XX_RBBM_GBIF_HALT_ACK) & - GBIF_GX_HALT_MASK); + if (adreno_is_a619_holi(adreno_gpu)) { + gpu_write(gpu, 0x18, GPR0_GBIF_HALT_REQUEST); + spin_until((gpu_read(gpu, REG_A6XX_RBBM_VBIF_GX_RESET_STATUS) & + (VBIF_RESET_ACK_MASK)) == VBIF_RESET_ACK_MASK); + } else { + /* Halt the GX side of GBIF */ + gpu_write(gpu, REG_A6XX_RBBM_GBIF_HALT, GBIF_GX_HALT_MASK); + spin_until(gpu_read(gpu, REG_A6XX_RBBM_GBIF_HALT_ACK) & + GBIF_GX_HALT_MASK); + } /* Halt new client requests on GBIF */ gpu_write(gpu, REG_A6XX_GBIF_HALT, GBIF_CLIENT_HALT_MASK); @@ -1783,6 +1803,9 @@ static int a6xx_pm_resume(struct msm_gpu *gpu) if (ret) goto err; + if (adreno_is_a619_holi(adreno_gpu)) + a6xx_sptprac_enable(gmu); + err: mutex_unlock(&a6xx_gpu->gmu.lock); @@ -1837,6 +1860,9 @@ static int a6xx_pm_suspend(struct msm_gpu *gpu) mutex_lock(&a6xx_gpu->gmu.lock); + if (adreno_is_a619_holi(adreno_gpu)) + a6xx_sptprac_disable(gmu); + clk_disable_unprepare(gpu->ebi1_clk); clk_bulk_disable_unprepare(gpu->nr_clocks, gpu->grp_clks); diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 2c0f0ef094cb..92ece15ec7d8 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -252,6 +252,11 @@ static inline int adreno_is_a619(struct adreno_gpu *gpu) return gpu->revn == 619; } +static inline int adreno_is_a619_holi(struct adreno_gpu *gpu) +{ + return adreno_is_a619(gpu) && adreno_has_gmu_wrapper(gpu); +} + static inline int adreno_is_a630(struct adreno_gpu *gpu) { return gpu->revn == 630; From patchwork Tue Mar 14 15:28:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1829683wrd; Tue, 14 Mar 2023 08:38:28 -0700 (PDT) X-Google-Smtp-Source: AK7set8aD0C30wTiy+jogjU5XcpF2L+83bE2hmEsEZcyQEN6cFjWHBzBYsrUa0buJBnw6p9gEhXH X-Received: by 2002:a17:90b:4f4a:b0:237:1f17:6842 with SMTP id pj10-20020a17090b4f4a00b002371f176842mr40004448pjb.10.1678808308325; Tue, 14 Mar 2023 08:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808308; cv=none; d=google.com; s=arc-20160816; b=T+vtxiovAwstbmKTWa4yVNyzApyoUVN8XgbgHuUn8syO5eFVGlCdAOAh+rdoOmIk5L L+CRy843IiyhLoXkNXswzFEY5tBFLVrWjEudL957vdTXyOCZGpGsVmmuBDUlJmdveAat gCTfEs0e/uTVSPfnD+zU02K9G+EAztc5rrF4uckoowFlWgszykzdu/8pNy0N1zRs7fGz Lay07aIoelIrFlXoF7N2HHaZ4ledFSeoyK0Y06AX2LwCWNZTF0A4KwwQDbgPlf1MoZIf zF4NWcnwTYHFCFiytcLNufWMfIzeBh21EHSz6BtJlfVJF0xlSXxBa4z9hoHR5N7LdANz bakA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=fXTfCUosgONHkPH3WHp9dv+Zje+/84j0Qp13k529vPc=; b=tvKlAqJ6My3bSvEeFvi/Gyz4YEuiIfUPBGCiMapc0IYO/Tm4PAm4CKlvkutlNl76Od Gue6qeZ0gNjXvAXPdg5K1A9E1A2YMAIDmEF0S2ljNMW9u9bN16CrZ1ExIDyXGGaLdDX7 QCQ4OuWHJlY0ziw183yeprnIv0iY4oFpxlcDPTQ5OHz+RjqPXCPUhzcZU299rVQzFkU5 pqzDMZ81IPXMrJ1wsrAriuVD/xTdcFY7bGaW2c/wpHmwJadxQzXjI0lCTFW3DT/5pmmH ++Fli7/HZFFYLTbOLD0rFQVUCIyHLw5Dc5rXWHp4ek4ob5TyRCCGIBI0umeOijcekamP f3vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yFyiIGBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq11-20020a17090b380b00b0023b31667ebdsi3037753pjb.123.2023.03.14.08.38.11; Tue, 14 Mar 2023 08:38:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yFyiIGBE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbjCNP3d (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231422AbjCNP27 (ORCPT ); Tue, 14 Mar 2023 11:28:59 -0400 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17BA95B40E for ; Tue, 14 Mar 2023 08:28:54 -0700 (PDT) Received: by mail-lj1-x229.google.com with SMTP id z42so16374656ljq.13 for ; Tue, 14 Mar 2023 08:28:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807733; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fXTfCUosgONHkPH3WHp9dv+Zje+/84j0Qp13k529vPc=; b=yFyiIGBEryS6g3BE0kAsvlI7VrvAbvzY7f69uIqeL7aioodkHWfOC6PycwPFEYXIdN i2BN9qW67OS8za9vHYk2uqzz/p2GLOSxo38bFt82llBz0AIpZD3+l1R8r8scnMPRLtjF TfJIORAEXV4fTGkiDiZAr9WfsmX4OKtRnVtimwtoaG5ppXusdc4jLJr41vsoeD6eQa8P tGQktg5oTzFO5l8oDQGkCMtQK2il9NstTjt/rOsCVx8QHVTxLYkLo0q9Q1WnIlwVndB6 DDVgOoK2ldjIIICtLNRQJmIn+xp6G8rbUObbVUWzcpiqJYOtJnxXGAGILVXUTy9x0I2p TJ3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807733; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fXTfCUosgONHkPH3WHp9dv+Zje+/84j0Qp13k529vPc=; b=4Wp9cGFKK4tHp7BROSsx51rVa+EVvhlKYGlp0QFskEYmZlgv1XotlcETg+HVPvdD9w +mE8pwkTs0YKzQiWqXh+G5cw7ZAl+J3mEeDvgHDoE/b9CehFsG48dgPtquSEZvQo8CJT YjQShGp2YguZHMte8Wr6spidyTT2EJeaU756A2gyorP+t+7g0lmktC3kqdlJTqYejTse dtDhXgFs8ekNRO9rs9r1No+WjDrrP2XtsAYhOvyS/aH9UiXjhiRegL+2yt+PEwOXoA4d C8rt/oSgX5SbjYG3wGf4757OuK2kv2FVUH4x4IzkMMwPg5v4Dn0KxKnvyHgf3l2otbNK AALA== X-Gm-Message-State: AO0yUKX1xE+pWKY/DgTzni/Kh/S1fipeXhezdtNTA4A29lajDwdBOnc/ Qqp6E1HGC2kEoGsXZPgqZPYd/g== X-Received: by 2002:a05:651c:221a:b0:295:b0c6:834c with SMTP id y26-20020a05651c221a00b00295b0c6834cmr15474830ljq.41.1678807733300; Tue, 14 Mar 2023 08:28:53 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:52 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:40 +0100 Subject: [PATCH v4 09/14] drm/msm/a6xx: Add A610 support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-9-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=10110; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=yX69Ivd086Dc5UnroWXcsijiO2iKVyHQnWKLjNauN9k=; b=w6D0ffth+LwTBLfATPjEGGFXgaaggsk7tjD3JXFsmExBIZSetnVjkjfuERyG7/XchrGM3riJQUOq rb3Xezr6CUc4roBdr8Yczg1sCijuPOtjxPvHFCl38vfy/ZcroL2o X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358100742581458?= X-GMAIL-MSGID: =?utf-8?q?1760358100742581458?= A610 is one of (if not the) lowest-tier SKUs in the A6XX family. It features no GMU, as it's implemented solely on SoCs with SMD_RPM. What's more interesting is that it does not feature a VDDGX line either, being powered solely by VDDCX and has an unfortunate hardware quirk that makes its reset line broken - after a couple of assert/ deassert cycles, it will hang for good and will not wake up again. This GPU requires mesa changes for proper rendering, and lots of them at that. The command streams are quite far away from any other A6XX GPU and hence it needs special care. This patch was validated both by running an (incomplete) downstream mesa with some hacks (frames rendered correctly, though some instructions made the GPU hangcheck which is expected - garbage in, garbage out) and by replaying RD traces captured with the downstream KGSL driver - no crashes there, ever. Add support for this GPU on the kernel side, which comes down to pretty simply adding A612 HWCG tables, altering a few values and adding a special case for handling the reset line. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 97 +++++++++++++++++++++++++++--- drivers/gpu/drm/msm/adreno/adreno_device.c | 12 ++++ drivers/gpu/drm/msm/adreno/adreno_gpu.h | 8 ++- 3 files changed, 107 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 1c0e5e1df89c..776db13e2a26 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -254,6 +254,56 @@ static void a6xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit) a6xx_flush(gpu, ring); } +const struct adreno_reglist a612_hwcg[] = { + {REG_A6XX_RBBM_CLOCK_CNTL_SP0, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_CNTL2_SP0, 0x02222220}, + {REG_A6XX_RBBM_CLOCK_DELAY_SP0, 0x00000081}, + {REG_A6XX_RBBM_CLOCK_HYST_SP0, 0x0000f3cf}, + {REG_A6XX_RBBM_CLOCK_CNTL_TP0, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_CNTL2_TP0, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_CNTL3_TP0, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_CNTL4_TP0, 0x00022222}, + {REG_A6XX_RBBM_CLOCK_DELAY_TP0, 0x11111111}, + {REG_A6XX_RBBM_CLOCK_DELAY2_TP0, 0x11111111}, + {REG_A6XX_RBBM_CLOCK_DELAY3_TP0, 0x11111111}, + {REG_A6XX_RBBM_CLOCK_DELAY4_TP0, 0x00011111}, + {REG_A6XX_RBBM_CLOCK_HYST_TP0, 0x77777777}, + {REG_A6XX_RBBM_CLOCK_HYST2_TP0, 0x77777777}, + {REG_A6XX_RBBM_CLOCK_HYST3_TP0, 0x77777777}, + {REG_A6XX_RBBM_CLOCK_HYST4_TP0, 0x00077777}, + {REG_A6XX_RBBM_CLOCK_CNTL_RB0, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_CNTL2_RB0, 0x01202222}, + {REG_A6XX_RBBM_CLOCK_CNTL_CCU0, 0x00002220}, + {REG_A6XX_RBBM_CLOCK_HYST_RB_CCU0, 0x00040f00}, + {REG_A6XX_RBBM_CLOCK_CNTL_RAC, 0x05522022}, + {REG_A6XX_RBBM_CLOCK_CNTL2_RAC, 0x00005555}, + {REG_A6XX_RBBM_CLOCK_DELAY_RAC, 0x00000011}, + {REG_A6XX_RBBM_CLOCK_HYST_RAC, 0x00445044}, + {REG_A6XX_RBBM_CLOCK_CNTL_TSE_RAS_RBBM, 0x04222222}, + {REG_A6XX_RBBM_CLOCK_MODE_VFD, 0x00002222}, + {REG_A6XX_RBBM_CLOCK_MODE_GPC, 0x02222222}, + {REG_A6XX_RBBM_CLOCK_DELAY_HLSQ_2, 0x00000002}, + {REG_A6XX_RBBM_CLOCK_MODE_HLSQ, 0x00002222}, + {REG_A6XX_RBBM_CLOCK_DELAY_TSE_RAS_RBBM, 0x00004000}, + {REG_A6XX_RBBM_CLOCK_DELAY_VFD, 0x00002222}, + {REG_A6XX_RBBM_CLOCK_DELAY_GPC, 0x00000200}, + {REG_A6XX_RBBM_CLOCK_DELAY_HLSQ, 0x00000000}, + {REG_A6XX_RBBM_CLOCK_HYST_TSE_RAS_RBBM, 0x00000000}, + {REG_A6XX_RBBM_CLOCK_HYST_VFD, 0x00000000}, + {REG_A6XX_RBBM_CLOCK_HYST_GPC, 0x04104004}, + {REG_A6XX_RBBM_CLOCK_HYST_HLSQ, 0x00000000}, + {REG_A6XX_RBBM_CLOCK_CNTL_UCHE, 0x22222222}, + {REG_A6XX_RBBM_CLOCK_HYST_UCHE, 0x00000004}, + {REG_A6XX_RBBM_CLOCK_DELAY_UCHE, 0x00000002}, + {REG_A6XX_RBBM_ISDB_CNT, 0x00000182}, + {REG_A6XX_RBBM_RAC_THRESHOLD_CNT, 0x00000000}, + {REG_A6XX_RBBM_SP_HYST_CNT, 0x00000000}, + {REG_A6XX_RBBM_CLOCK_CNTL_GMU_GX, 0x00000222}, + {REG_A6XX_RBBM_CLOCK_DELAY_GMU_GX, 0x00000111}, + {REG_A6XX_RBBM_CLOCK_HYST_GMU_GX, 0x00000555}, + {}, +}; + /* For a615 family (a615, a616, a618 and a619) */ const struct adreno_reglist a615_hwcg[] = { {REG_A6XX_RBBM_CLOCK_CNTL_SP0, 0x02222222}, @@ -604,6 +654,8 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state) if (adreno_is_a630(adreno_gpu)) clock_cntl_on = 0x8aa8aa02; + else if (adreno_is_a610(adreno_gpu)) + clock_cntl_on = 0xaaa8aa82; else clock_cntl_on = 0x8aa8aa82; @@ -812,6 +864,13 @@ static void a6xx_set_ubwc_config(struct msm_gpu *gpu) /* Unknown, introduced with A640/680 */ u32 amsbc = 0; + if (adreno_is_a610(adreno_gpu)) { + /* HBB = 14 */ + hbb_lo = 1; + min_acc_len = 1; + ubwc_mode = 1; + } + /* a618 is using the hw default values */ if (adreno_is_a618(adreno_gpu)) return; @@ -1063,13 +1122,13 @@ static int hw_init(struct msm_gpu *gpu) a6xx_set_hwcg(gpu, true); /* VBIF/GBIF start*/ - if (adreno_is_a640_family(adreno_gpu) || + if (adreno_is_a610(adreno_gpu) || + adreno_is_a640_family(adreno_gpu) || adreno_is_a650_family(adreno_gpu)) { gpu_write(gpu, REG_A6XX_GBIF_QSB_SIDE0, 0x00071620); gpu_write(gpu, REG_A6XX_GBIF_QSB_SIDE1, 0x00071620); gpu_write(gpu, REG_A6XX_GBIF_QSB_SIDE2, 0x00071620); gpu_write(gpu, REG_A6XX_GBIF_QSB_SIDE3, 0x00071620); - gpu_write(gpu, REG_A6XX_GBIF_QSB_SIDE3, 0x00071620); gpu_write(gpu, REG_A6XX_RBBM_GBIF_CLIENT_QOS_CNTL, 0x3); } else { gpu_write(gpu, REG_A6XX_RBBM_VBIF_CLIENT_QOS_CNTL, 0x3); @@ -1100,18 +1159,26 @@ static int hw_init(struct msm_gpu *gpu) gpu_write(gpu, REG_A6XX_UCHE_FILTER_CNTL, 0x804); gpu_write(gpu, REG_A6XX_UCHE_CACHE_WAYS, 0x4); - if (adreno_is_a640_family(adreno_gpu) || - adreno_is_a650_family(adreno_gpu)) + if (adreno_is_a640_family(adreno_gpu) || adreno_is_a650_family(adreno_gpu)) { gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_2, 0x02000140); - else + gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_1, 0x8040362c); + } else if (adreno_is_a610(adreno_gpu)) { + gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_2, 0x00800060); + gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_1, 0x40201b16); + } else { gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_2, 0x010000c0); - gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_1, 0x8040362c); + gpu_write(gpu, REG_A6XX_CP_ROQ_THRESHOLDS_1, 0x8040362c); + } if (adreno_is_a660_family(adreno_gpu)) gpu_write(gpu, REG_A6XX_CP_LPAC_PROG_FIFO_SIZE, 0x00000020); /* Setting the mem pool size */ - gpu_write(gpu, REG_A6XX_CP_MEM_POOL_SIZE, 128); + if (adreno_is_a610(adreno_gpu)) { + gpu_write(gpu, REG_A6XX_CP_MEM_POOL_SIZE, 48); + gpu_write(gpu, REG_A6XX_CP_MEM_POOL_DBG_ADDR, 47); + } else + gpu_write(gpu, REG_A6XX_CP_MEM_POOL_SIZE, 128); /* Setting the primFifo thresholds default values, * and vccCacheSkipDis=1 bit (0x200) for A640 and newer @@ -1122,6 +1189,8 @@ static int hw_init(struct msm_gpu *gpu) gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00200200); else if (adreno_is_a650(adreno_gpu) || adreno_is_a660(adreno_gpu)) gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00300200); + else if (adreno_is_a610(adreno_gpu)) + gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00080000); else gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00180000); @@ -1137,8 +1206,10 @@ static int hw_init(struct msm_gpu *gpu) a6xx_set_ubwc_config(gpu); /* Enable fault detection */ - gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, - (1 << 30) | 0x1fffff); + if (adreno_is_a610(adreno_gpu)) + gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, (1 << 30) | 0x3ffff); + else + gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, (1 << 30) | 0x1fffff); gpu_write(gpu, REG_A6XX_UCHE_CLIENT_PF, 1); @@ -1372,6 +1443,14 @@ static void a6xx_recover(struct msm_gpu *gpu) /* Software-reset the GPU */ if (adreno_has_gmu_wrapper(adreno_gpu)) { + /* 11nm chips (i.e. A610-hosting ones) have HW issues with the reset line */ + if (!adreno_is_a610(adreno_gpu)) { + gpu_write(gpu, REG_A6XX_RBBM_SW_RESET_CMD, 1); + gpu_read(gpu, REG_A6XX_RBBM_SW_RESET_CMD); + udelay(100); + gpu_write(gpu, REG_A6XX_RBBM_SW_RESET_CMD, 0); + } + if (adreno_is_a619_holi(adreno_gpu)) { gpu_write(gpu, 0x18, GPR0_GBIF_HALT_REQUEST); spin_until((gpu_read(gpu, REG_A6XX_RBBM_VBIF_GX_RESET_STATUS) & diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index 6513c6094865..17db8e99ff88 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -253,6 +253,18 @@ static const struct adreno_info gpulist[] = { .quirks = ADRENO_QUIRK_LMLOADKILL_DISABLE, .init = a5xx_gpu_init, .zapfw = "a540_zap.mdt", + }, { + .rev = ADRENO_REV(6, 1, 0, ANY_ID), + .revn = 610, + .name = "A610", + .fw = { + [ADRENO_FW_SQE] = "a630_sqe.fw", + }, + .gmem = (SZ_128K + SZ_4K), + .inactive_period = 500, + .init = a6xx_gpu_init, + .zapfw = "a610_zap.mdt", + .hwcg = a612_hwcg, }, { .rev = ADRENO_REV(6, 1, 8, ANY_ID), .revn = 618, diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 92ece15ec7d8..27c30a7694f4 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -55,7 +55,8 @@ struct adreno_reglist { u32 value; }; -extern const struct adreno_reglist a615_hwcg[], a630_hwcg[], a640_hwcg[], a650_hwcg[], a660_hwcg[]; +extern const struct adreno_reglist a612_hwcg[], a615_hwcg[], a630_hwcg[], a640_hwcg[], a650_hwcg[]; +extern const struct adreno_reglist a660_hwcg[]; struct adreno_info { struct adreno_rev rev; @@ -242,6 +243,11 @@ static inline int adreno_is_a540(struct adreno_gpu *gpu) return gpu->revn == 540; } +static inline int adreno_is_a610(struct adreno_gpu *gpu) +{ + return gpu->revn == 610; +} + static inline int adreno_is_a618(struct adreno_gpu *gpu) { return gpu->revn == 618; From patchwork Tue Mar 14 15:28:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69687 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1826092wrd; Tue, 14 Mar 2023 08:31:38 -0700 (PDT) X-Google-Smtp-Source: AK7set+tHGDVuqi/0dGiuHlr4z9PiC12GBH5fPZZ9RuIO1zFSrKexNYaMW0KogOce8w43s35KIxW X-Received: by 2002:a17:902:e88e:b0:19d:b02:cca5 with SMTP id w14-20020a170902e88e00b0019d0b02cca5mr47640393plg.12.1678807897725; Tue, 14 Mar 2023 08:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678807897; cv=none; d=google.com; s=arc-20160816; b=y2JwgcYFerSjI8wb+RfJvDwZkHoBb+mFh+PWKD3LdrEolkn9MtJ/Zw95tDFeobIAid 7/RmEfmQS3sr9xRVZ5l3HV2vzvZulc8GrUZcTAJ0VGi4741B+IMPtLcurfxsuXx/jcrk eu8J7zJ+cXPkYRM4KS8OFm70SV19QFcMH6NxnpX/glYXwg7uLaBhX9Xa94NgG7e583g7 cf4K7i0nCiqGg7PKJsy+O4PkZcusCo6g4g2zoWGsgCGUVXRo1h6icnXDufCILVVK7aDo C6viiglBEFcChsA+uQdJ5Wh7jo9UpeQ5XNooVWeqDxdhn2fpFwYPkb3Nq1RQUHbfSuCH ZO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=bWjB1jo2oF2xwJJ102jTozy9p5TkFnrvHvYrl8qyrB0=; b=UnvLkL6XXE1owYoA8qb8njewk5+zsh1S39P0x++xr2J9qU+xyEsgOg9MTnp+3BKX3r hDPCROcIMxE1i7/5E6Zw5LC87km6Qif58MwblBpfpG4Aq9bcfIYtd0rhC8Kmy5NmSpT0 PW7ns5bAHAqCy1xFmi8lVpCellkcvHH4zSTs0tQEYvWNOnBfgse6bbJV1j/GUvRjdYd8 p6JRWohlvffo542Hpr98900OCm5NovH+ECVvRD7h+1AYBeux2jyX2Btk4TA7dr5OlnqB SqTpgvqK0hwR9Mcm7u/oPBnoR+H8RrEKt5t/wBwPZjpvV4LHZ+NU3a8DkyuS6sRBbz5o Vblw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U0ylajaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090301c500b0019e4154578esi2842411plh.76.2023.03.14.08.31.24; Tue, 14 Mar 2023 08:31:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=U0ylajaB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbjCNP33 (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjCNP3B (ORCPT ); Tue, 14 Mar 2023 11:29:01 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 968E562864 for ; Tue, 14 Mar 2023 08:28:55 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id h3so16400548lja.12 for ; Tue, 14 Mar 2023 08:28:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807734; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bWjB1jo2oF2xwJJ102jTozy9p5TkFnrvHvYrl8qyrB0=; b=U0ylajaB+0wEsxIxOVeE8bp50nV7CxYFnDZwn01TsEpGvlJ41XzLpFge1lExLCKA9M dbXm6jRnmJIUBJdfmw5M3RlaseAPDoqOaqEgPaUpipy9RJ/OHPmMMykVp4TRuJTtj2y+ XoSiXksOSBu0WS26LywUay2yycutMKGIa9/leF/5wCs0gatjRzQXcrWCvzemR8aQZGAy 1ME3wTX9eyLGePVQjhw0HTSlJmj9LDlRGUgTZRdY0CEVPTAAs3l3q2be0W12kJtJiL1U gYqn1DQqY1NKeN8ckLrmIDlQiK2LD3BlINgPocgW6JEVbg8VNMpVgnIMyAHfN1PycoQk wqaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807734; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bWjB1jo2oF2xwJJ102jTozy9p5TkFnrvHvYrl8qyrB0=; b=1c/D4bBnLGB/as4FAZ4RNBOAJJj4h5sFL/SDyDTBMKHiSKdxrhjTfEhguukNqVLHZb 8u365EX5QR0WeqBUsQuVUTIlNik0GEOUE6Euhlsxp/E/RcxcM+USdHFSy/sIpjVsTNMD lcQVvFw93iHumMPZet4eHz/N0xagLYHbsUwCofJ08v6x/SgrLzQ9qwVLQj2h0QaCFy/d 8K+HrHtitVLAhX1DIO42fcLMRSxAktw6dJPxXM42zfVvJeW0QS0oub6QK1ZKpLlV99pO S56J2WDtym1CK5NrUp2OMRQy/LkF2Sdaap7XrDIfej8/WB/Y91vb3Y9BDm/S6IFf3ceW PwqQ== X-Gm-Message-State: AO0yUKXAiahGdAXWGf/Yd1WgftXnk3pEFnuYXB+Wstlhfc+Egh1p3Bo4 MoI+VZMW6mDh9TFAuibaqSwPqw== X-Received: by 2002:a2e:97d1:0:b0:298:9fbf:61dd with SMTP id m17-20020a2e97d1000000b002989fbf61ddmr875311ljj.16.1678807734836; Tue, 14 Mar 2023 08:28:54 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:54 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:41 +0100 Subject: [PATCH v4 10/14] drm/msm/a6xx: Fix some A619 tunables MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-10-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1537; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=WDcj/M9aJ/8+tdxnVyFZAeDamawmN6hQgw+VzGKE91s=; b=T/5InnJU8B58RuzS79qY+AAoksalL8zOQ+JCAG2th1CRtFEh87n1KTepybkSWQo5GP+tt8vPUvkn 2Rj3TBOJD5wBtfFVeCWxK/FzGecgL0PHuYjTC/Z1POdGewZZIxo7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357670037057559?= X-GMAIL-MSGID: =?utf-8?q?1760357670037057559?= Adreno 619 expects some tunables to be set differently. Make up for it. Fixes: b7616b5c69e6 ("drm/msm/adreno: Add A619 support") Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 776db13e2a26..f699f326021f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1189,6 +1189,8 @@ static int hw_init(struct msm_gpu *gpu) gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00200200); else if (adreno_is_a650(adreno_gpu) || adreno_is_a660(adreno_gpu)) gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00300200); + else if (adreno_is_a619(adreno_gpu)) + gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00018000); else if (adreno_is_a610(adreno_gpu)) gpu_write(gpu, REG_A6XX_PC_DBG_ECO_CNTL, 0x00080000); else @@ -1206,7 +1208,9 @@ static int hw_init(struct msm_gpu *gpu) a6xx_set_ubwc_config(gpu); /* Enable fault detection */ - if (adreno_is_a610(adreno_gpu)) + if (adreno_is_a619(adreno_gpu)) + gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, (1 << 30) | 0x3fffff); + else if (adreno_is_a610(adreno_gpu)) gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, (1 << 30) | 0x3ffff); else gpu_write(gpu, REG_A6XX_RBBM_INTERFACE_HANG_INT_CNTL, (1 << 30) | 0x1fffff); From patchwork Tue Mar 14 15:28:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1828855wrd; Tue, 14 Mar 2023 08:36:44 -0700 (PDT) X-Google-Smtp-Source: AK7set8Jchfm1NtKxcBC2j3cXJTYgM6xWz/evtol24ETSjZyYEUawqn2k+28CnNMvpVuMb9OwDDs X-Received: by 2002:a05:6a20:4b1f:b0:d4:9cb2:9030 with SMTP id fp31-20020a056a204b1f00b000d49cb29030mr5280304pzb.24.1678808204027; Tue, 14 Mar 2023 08:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808203; cv=none; d=google.com; s=arc-20160816; b=1JV+DFMNa/IdlY6IIsW1+GSmDI9FQKXDEc6lvSdROmd/21+QiKGWQdv+G2Z+Rv9rqd 4vlcXY/sz1CAEXPX1+KwvsmDB3QkcCgg6YrW5LxibxQ1Frhtc8ttQsi/Zhtp2yWnGX3B FDoxNB3LPX5ZEMCWkai+0VQf/RS8YAKbXXl3fSJpgUuLsCtAiuVBIsCA6IwCqs9f61Wq MpBlB/tTjpYnbN0WMM+7Rz3SX5ASBJQ0We1duaZXXcrkz73idLULgGrX2+m6rBl6/eWz xawg3lSGNxK8EjaBtjkMDuk7wwpnnj6xq920cmHvcPIu/hQfs2TOB53B1UOcQfTSjQDj 2wWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=fdwglER2agYNfLVPprMx0FPmVS9IVmz+s6GuV4eeQlY=; b=yIsJ4v+nW6i4Z0N5Vrr5vJh7597kSKSC971l0zIrYOKZq+0NygrLNVmS2euqze6G5x wA8N/uYifbbfBPk8hgSQ56NaJR1CGICZSQlYp0aJ+VOf81PbSU3pk/DsCLe2WtNV4fkt Jpz4Z7H21yf+Jj/Uhi5/RCxv22QOUJilmVQg5ZhKNJGYlFn6bFn6Ytp9MlxV427kF+uR hBVwBGchvONp61wrFwlizarrL57h5klT3rFcTvT1zhvW+TONsPKN613pzxHmGGRrVkFJ 8pkvYilnQZiNzjiZBlystHJbH63fHed6BbTrrX3Jh4i+e3N3bDpglzNotcMn6NQCiUVc Xx1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lKp64Clb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a631f4c000000b004fab9a24dddsi2429015pgm.732.2023.03.14.08.36.27; Tue, 14 Mar 2023 08:36:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lKp64Clb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231285AbjCNPaG (ORCPT + 99 others); Tue, 14 Mar 2023 11:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231740AbjCNP3J (ORCPT ); Tue, 14 Mar 2023 11:29:09 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E55056157 for ; Tue, 14 Mar 2023 08:28:58 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id i20so16400323lja.11 for ; Tue, 14 Mar 2023 08:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807736; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fdwglER2agYNfLVPprMx0FPmVS9IVmz+s6GuV4eeQlY=; b=lKp64Clb2weIN9LxcJaV7Z/cFUCUng+k5gejt9AiaR21/aN4vDzDPvhnnqAQMxtLvV 5cOdn/hBnhe521EMwa26x2IMAoVau/YhZvrGCymgpYmFAjVmE4YoaneoXvU7QYVV7W09 RJtavZi4t2J2NbcXXQBlGm0z6Pf2M7AQk/z+x01Veig1sikXb4vVqjSRBV/nCuI0Rfmu mr+1Mb31xbNiAp7QmC9neHPhs7XiuwXNWQz4ZSOaKk5wLWzg8cCL3nX0vmkV5xz1Adso B+Zu+3Gy52wzS20RAj2X5SAw4SsTsYyB87kRExR1LSx7g1G4NyeiZSQqvPk79SU0ABMb TUkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807736; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fdwglER2agYNfLVPprMx0FPmVS9IVmz+s6GuV4eeQlY=; b=KoMfVRoXZwm/73Aeck17VO3BVwEH6O4cfQEgmZUaKoWr2f4DoWMVJIXVcf53JsE9Nf oIQ5OjIiUGoWIvrG6AOVNHUbVydBlfFasGfjjrmK7XjvBIjve2rPWf/1pKWD5L4ricSy MAt8GNu3w9M40RghnPp3Zs642gyFbrzalofIw8drjTy30WKh9suxRfJVBrQQ42xFBaW5 h6oqMsMepZbVnzjf7iY4iPAJY9Th4+YvcLhO6fQ1wCcVJWW8fKYPeEdisUG+b0rFtyAG Co/5PHQt7HForrvR6tMZAX5++EkrqN3jNVBqmRSGE0dWzKhOFO/yBfd3OyGOalWy5DwC PuiQ== X-Gm-Message-State: AO0yUKUcB+393oDblQtTAcmWFqf8XLLJe7braltywZ1Lx4nY0PsuV2Wt 3ZYTqMEv5R9Qt83osXEuQQwL1A== X-Received: by 2002:a05:651c:2211:b0:298:6e2e:2224 with SMTP id y17-20020a05651c221100b002986e2e2224mr9543190ljq.47.1678807736338; Tue, 14 Mar 2023 08:28:56 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:56 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:42 +0100 Subject: [PATCH v4 11/14] drm/msm/a6xx: Use "else if" in GPU speedbin rev matching MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-11-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1434; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=D3QGn+nYvlP8x3swaH1kHJwlzdjGFbaFa9zhDHv4lx4=; b=ZOerBhWO9wapKFAmKihwL/xjhmOBckfMZSqJGmKAHuDSBy94K3mEfpFoTQaJo9CdyzfCJdViZmhq 8ZeJc1z3BqzNORvpz6NPoC45eGj51K48M3uSZAPNbuiTEVkmGm0I X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357991241799210?= X-GMAIL-MSGID: =?utf-8?q?1760357991241799210?= The GPU can only be one at a time. Turn a series of ifs into if + elseifs to save some CPU cycles. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index f699f326021f..dfd2d735e57f 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2207,16 +2207,16 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse) if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev)) val = a618_get_speed_bin(fuse); - if (adreno_cmp_rev(ADRENO_REV(6, 1, 9, ANY_ID), rev)) + else if (adreno_cmp_rev(ADRENO_REV(6, 1, 9, ANY_ID), rev)) val = a619_get_speed_bin(fuse); - if (adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), rev)) + else if (adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), rev)) val = adreno_7c3_get_speed_bin(fuse); - if (adreno_cmp_rev(ADRENO_REV(6, 4, 0, ANY_ID), rev)) + else if (adreno_cmp_rev(ADRENO_REV(6, 4, 0, ANY_ID), rev)) val = a640_get_speed_bin(fuse); - if (adreno_cmp_rev(ADRENO_REV(6, 5, 0, ANY_ID), rev)) + else if (adreno_cmp_rev(ADRENO_REV(6, 5, 0, ANY_ID), rev)) val = a650_get_speed_bin(fuse); if (val == UINT_MAX) { From patchwork Tue Mar 14 15:28:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1828827wrd; Tue, 14 Mar 2023 08:36:39 -0700 (PDT) X-Google-Smtp-Source: AK7set8Qm5kh8ZKkksw72LVK5H27oL5fmmCTvKpe8iRJt7IiMcv0pRhcW2brgSXGmFw9TOivLlpX X-Received: by 2002:a17:90a:1c3:b0:237:b702:4990 with SMTP id 3-20020a17090a01c300b00237b7024990mr37511272pjd.26.1678808199100; Tue, 14 Mar 2023 08:36:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808199; cv=none; d=google.com; s=arc-20160816; b=0Q+9deOAiqjxB5fOvxoMpEdqSSm67EX5pjalpWpb9vwKjPtGapdHlfzIIox5F7uNHV vyuUeRxMVKvSuDQLlv/j1UXuY98m5Rbc83We6CMc3m/ckQ3a81KnRD5pdDt/IH2RByeI F6Sy3mITFPdNiQrLcUJb6HuejRF63KhbHMHH/128rG58C3lVqjT8AJNWfaoFvJ8X8Ybq FThXRrhFfnvcqSnX3b/szJS/tC8w0Cs0YdccrzOwKgNKgAIaawyZjy5ffdwd1RpuxTNX kEAEVg/ESCRJ3Sjwq9m6E3vUs2hyXWXE5Eq2CHkSe8Fvj3hS6MvMYxNWPpRk9X3Re7ef bCnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=b3xe4S3Sg3+fXQE7o6Jl9Wyr4UR5G14unF7soZYaMbg=; b=NvrlcXoE1E/6B77DYYb7x2ZBl5fhEDuYjjv9FVJkGcUqQrPI2Sftu2wxRTXHGVji9Z g8UrqXv3GNtlX9H3QIkmhnGAAPHF/vIMAtdZqAzS99H8ok+wMAH0TaqkjRpEqhWadjgz Mnz5CAfEyoqjHNNfeVo2Hy9lMhBiPay5YQ29m5E7zsque6ZXqFwImVrNcMLS9E+7dKzV GCt1pObMm3Foe2C8DkHQ4qOhXgDARcV2kGbWE8o3bAzr6jEVSOwPGRy6u/+SYF+ojZtp jkf69JALSmdX1JQDVZw2Khp5HI0+JQP5XAT+lPugyqOUhm1mPZYgSWM7yP4E+g3+IBKt mZsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QZm8aOm8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a17090a9b8c00b0023b3401ef14si2686325pjp.62.2023.03.14.08.36.23; Tue, 14 Mar 2023 08:36:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QZm8aOm8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231422AbjCNP3g (ORCPT + 99 others); Tue, 14 Mar 2023 11:29:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229999AbjCNP3I (ORCPT ); Tue, 14 Mar 2023 11:29:08 -0400 Received: from mail-lj1-x236.google.com (mail-lj1-x236.google.com [IPv6:2a00:1450:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70B0E6BC1F for ; Tue, 14 Mar 2023 08:28:58 -0700 (PDT) Received: by mail-lj1-x236.google.com with SMTP id f16so16402629ljq.10 for ; Tue, 14 Mar 2023 08:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807738; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=b3xe4S3Sg3+fXQE7o6Jl9Wyr4UR5G14unF7soZYaMbg=; b=QZm8aOm8RbNlY40Q4XQU5d2gjJPbZzE/EPGKd9wIFP3yFDp4M3cFgET0nkBnXMXe/L bEm79j/TVkoRw9F/2BGgKcTpiB6bky/NEmE9CkdF1Z/Zt8U8C39U244fW229NNObm34/ ccvJGgfuH4axu1SJlvkP/6/4XO+BwbpLyyiFz6GRw87GBHcW+XBsZDK4hAKZFGo+cuOo DarmyslHPlLwRnDH/H/zNfF59z1r1exJ0qGBHH2zx/iuB2WjeuJB1ULy0DtcSbOCDMZO sP5NL6fM6M6Txdr9OTPBSZJem424Ayv4dnyf+wAht8gy5tn7P6ezpWFnvf1QofADTlXo +2dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807738; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b3xe4S3Sg3+fXQE7o6Jl9Wyr4UR5G14unF7soZYaMbg=; b=Gy5fIuR2nxz6e4r22nX6KfD5rrWvJDmhHXSV5V3biJgddj/4ad7ujr8KRroiZt4eeE r1270cJImAlw+fZ6UJZFkhGJalzSGTUPGWoLb1XG1auUvCvYiCm5nT0QvdzoON2nc53v br5O6pIiBdXuoUu5DlQJ2QH6uMaLWZHWwvCtn7ZcTu+YyNOxF9DS2xF0b6Rlewg/YeUA XeG9F3BWZgHlDAKpWFaRGTt1kbEBltbQycz4xvPDnzVTru+h5HB+mykWgrk4LYAeKUea q6vUFjxUARcEGhSY9u/ynFoNfSwYogkP8Zh/jxdZs350PqySviz7D4PZj0RuReUUYaEd tn+Q== X-Gm-Message-State: AO0yUKW7iUsVNFvIJpChiV91dOeNJPlVonMsg2wrWHkcliSsv+GnLXoT /NZT93qtTH6YrD6+JVUU9LA4yg== X-Received: by 2002:a2e:8807:0:b0:295:9a9f:3f55 with SMTP id x7-20020a2e8807000000b002959a9f3f55mr11475513ljh.0.1678807737857; Tue, 14 Mar 2023 08:28:57 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:57 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:43 +0100 Subject: [PATCH v4 12/14] drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-12-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=4256; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=k8ecRBr+PHIYBEN3eyTaSM0Q8/LOQMVQTU2+Qd88W0A=; b=3gvGXi1wDp8tvJizG2mCmembimJ6NEiodLsZGbAy715EhpeRtk7EXD8RLR26pFDIaz0VuTQeZ6k/ aWuHcLqxBjAMtTLuKKm/kvw2K8xAB56xwcwGeEjUcfSn3z7+hmO7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357985825166960?= X-GMAIL-MSGID: =?utf-8?q?1760357985825166960?= Before transitioning to using per-SoC and not per-Adreno speedbin fuse values (need another patchset to land elsewhere), a good improvement/stopgap solution is to use adreno_is_aXYZ macros in place of explicit revision matching. Do so to allow differentiating between A619 and A619_holi. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 18 +++++++++--------- drivers/gpu/drm/msm/adreno/adreno_gpu.h | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index dfd2d735e57f..71950a5fcc96 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2200,23 +2200,23 @@ static u32 adreno_7c3_get_speed_bin(u32 fuse) return UINT_MAX; } -static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse) +static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u32 fuse) { u32 val = UINT_MAX; - if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev)) + if (adreno_is_a618(adreno_gpu)) val = a618_get_speed_bin(fuse); - else if (adreno_cmp_rev(ADRENO_REV(6, 1, 9, ANY_ID), rev)) + else if (adreno_is_a619(adreno_gpu)) val = a619_get_speed_bin(fuse); - else if (adreno_cmp_rev(ADRENO_REV(6, 3, 5, ANY_ID), rev)) + else if (adreno_is_7c3(adreno_gpu)) val = adreno_7c3_get_speed_bin(fuse); - else if (adreno_cmp_rev(ADRENO_REV(6, 4, 0, ANY_ID), rev)) + else if (adreno_is_a640(adreno_gpu)) val = a640_get_speed_bin(fuse); - else if (adreno_cmp_rev(ADRENO_REV(6, 5, 0, ANY_ID), rev)) + else if (adreno_is_a650(adreno_gpu)) val = a650_get_speed_bin(fuse); if (val == UINT_MAX) { @@ -2229,7 +2229,7 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse) return (1 << val); } -static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev) +static int a6xx_set_supported_hw(struct device *dev, struct adreno_gpu *adreno_gpu) { u32 supp_hw; u32 speedbin; @@ -2248,7 +2248,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev) return ret; } - supp_hw = fuse_to_supp_hw(dev, rev, speedbin); + supp_hw = fuse_to_supp_hw(dev, adreno_gpu, speedbin); ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1); if (ret) @@ -2367,7 +2367,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) if (!adreno_has_gmu_wrapper(adreno_gpu)) a6xx_llc_slices_init(pdev, a6xx_gpu); - ret = a6xx_set_supported_hw(&pdev->dev, config->rev); + ret = a6xx_set_supported_hw(&pdev->dev, adreno_gpu); if (ret) { a6xx_destroy(&(a6xx_gpu->base.base)); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 27c30a7694f4..da9f45a13b5d 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -268,9 +268,9 @@ static inline int adreno_is_a630(struct adreno_gpu *gpu) return gpu->revn == 630; } -static inline int adreno_is_a640_family(struct adreno_gpu *gpu) +static inline int adreno_is_a640(struct adreno_gpu *gpu) { - return (gpu->revn == 640) || (gpu->revn == 680); + return gpu->revn == 640; } static inline int adreno_is_a650(struct adreno_gpu *gpu) @@ -289,6 +289,11 @@ static inline int adreno_is_a660(struct adreno_gpu *gpu) return gpu->revn == 660; } +static inline int adreno_is_a680(struct adreno_gpu *gpu) +{ + return gpu->revn == 680; +} + /* check for a615, a616, a618, a619 or any derivatives */ static inline int adreno_is_a615_family(struct adreno_gpu *gpu) { @@ -306,6 +311,11 @@ static inline int adreno_is_a650_family(struct adreno_gpu *gpu) return gpu->revn == 650 || gpu->revn == 620 || adreno_is_a660_family(gpu); } +static inline int adreno_is_a640_family(struct adreno_gpu *gpu) +{ + return adreno_is_a640(gpu) || adreno_is_a680(gpu); +} + u64 adreno_private_address_space_size(struct msm_gpu *gpu); int adreno_get_param(struct msm_gpu *gpu, struct msm_file_private *ctx, uint32_t param, uint64_t *value, uint32_t *len); From patchwork Tue Mar 14 15:28:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69688 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1826383wrd; Tue, 14 Mar 2023 08:32:07 -0700 (PDT) X-Google-Smtp-Source: AK7set/5aiuT1zeAoniHXzVICMkPUu8jglEY5w3fYSScxJsgF1tP/TIkKhTPptku26q4jdjsUW2h X-Received: by 2002:a17:902:d2ca:b0:19f:8bbf:9c56 with SMTP id n10-20020a170902d2ca00b0019f8bbf9c56mr11318664plc.3.1678807927271; Tue, 14 Mar 2023 08:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678807927; cv=none; d=google.com; s=arc-20160816; b=zOnp4tKU5NXGTsFKLHPsvwEEwoLwIVoidrI+LhMWG1Jo+G0CM+/X+1L0fTzfT+3V4f lzRgWCjFSjlChVNWWKFNOpfMTY4un49UpVUy/jtXja6sZmVhNxlY0+c1QfR2I4mLNm+v cP/j9SoB7wpefnC7XRvPrf6N1yhEKWBUNNzHXS2a2m5n6l8OEpRZEh8ETuLqEkWJQ5wc 3DFEioGj/OvvqkCWdYCM4M5CYXhFMzzqm5Z1DTSyuqYw8RYkMaaY8gUwEa7eU2sgp56Q zm4haIDoVw+HZiuK2gnkhlRua9nD7AllkXnWsGRkjk6nr4KZINDQjhMb10HgcVPSxTzB jhfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=j2eEYWuGcq9/XbTV0ihUo6//o0TPXB2yKOJ5coGxbig=; b=tz4noyYqvDcfPHV8ktNrfXr7EKaYXVBBPMMfDMLpSfgXe1VH0WK55iIzf6UIuUQ0+n ApFz96kwG2uzIaBi6TDsd+dlYhplJmdbUzpocepHHg3NWI7YVQSwM+8Q67izFvBaebSR W2lwHrrUf/eovs/IQ8O3H5T9ps3HiSrzQq83Y4yD6jemIyGzLD9OpXI09CUbTl9cXlZ8 nDhKzRA4WNqgRYfXQA2DI/NDqYiq4qh0+wkvVkegvBheDlFe/nPZIL48ZnSQPew/O32G z7B9GHDgSHcAwesivQPuRz79k+bQSHEdTQn24o05PEmFvhB/jZMOhtGG7hHixHIseYOh Hmog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Uzol4Md/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jc10-20020a17090325ca00b001a05baafdb4si2614867plb.525.2023.03.14.08.31.54; Tue, 14 Mar 2023 08:32:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Uzol4Md/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231611AbjCNPaK (ORCPT + 99 others); Tue, 14 Mar 2023 11:30:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231673AbjCNP3W (ORCPT ); Tue, 14 Mar 2023 11:29:22 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D29A21A0E for ; Tue, 14 Mar 2023 08:29:01 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id a32so16413334ljr.9 for ; Tue, 14 Mar 2023 08:29:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807739; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=j2eEYWuGcq9/XbTV0ihUo6//o0TPXB2yKOJ5coGxbig=; b=Uzol4Md/G1W/pzYZwQoB3jGmnQryqDT9lSjtfbnPEJsMuuIAT/rm+rH9GGfFYFc9x1 NJ7PXtMsH3QnX8E9evFky454dBOsH96V1JasUM0vLVM6Npfn32ijhf67azhMw/cJjDQC DMywU42oXTzkYOPlBsPOT/raFojuHwEbkKyacUbHNQmHXLMIPklH+ed9E1R79gVVOZeh UXF3hThDdQPew3cOhG8DhIShnLtEzshjthaTt7xbM1WK60eLZjhmPRBSx5qq9Tce3stT z0P+qiorh7YadcM7HlL+d2rHp9bbUTd5l6MaUJ2DtSjPtMAgusHCcEfdmC9A1SmELhgN 7+3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807739; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j2eEYWuGcq9/XbTV0ihUo6//o0TPXB2yKOJ5coGxbig=; b=TMZhtaUhoehn7BRP/Kcjq+T8D5aTjVGvRSJYQ8+lw+dCPVp91wIrJBaoCgTpM1fcql N/yJdhsoqYW2nFjD5DSTLKwuStkK28joWQ+j0BVporgjpLh9l4c1MYlsZP9fKM0aZDPQ AxlBLPNodvFQDXG4VrLNPu+VGC7ifeJX8NslybKGcCb0VFfyRAwHODIsYlRo5kz14RHx kg3IvH2Q4cfZZkR4g7aoqtQX+uL/8qcoBAt4xWczUuKW62wUuQHZ3KySWmPpiH3dsRrH 98S50ApPY9LTBJVN5J1DkNCRLIp92vUQDr3JaAHSB3nIpjqWGaaQTBIIWpnvU+1LHhq5 xaKA== X-Gm-Message-State: AO0yUKX8Fj55l2mpLgqx91eYvVy+1qUJ0GM00RNWOSLuddoQVQQAdxiF d+9YM+m7tuViVJwNbabkJ/5cFQ== X-Received: by 2002:a2e:994f:0:b0:294:6235:b18e with SMTP id r15-20020a2e994f000000b002946235b18emr12097562ljj.14.1678807739431; Tue, 14 Mar 2023 08:28:59 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:28:59 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:44 +0100 Subject: [PATCH v4 13/14] drm/msm/a6xx: Add A619_holi speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-13-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1972; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=YbHID1ebzUgv4FADFLbdTcRo/0BAqs1RT5mt5WqUfTo=; b=s3HhnOhKViZbWBYgyMxuzL4UDJa8iVASyV+mQYW3iO3PGPZl+eP/2Aeaw6ZMhwFz3SwSFoCG0y33 Q/Rx0heHCR/EvUr6sEUzL8fuAOHOSGF3DRC9eEc/4mROb2FGKAb7 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760357700819269147?= X-GMAIL-MSGID: =?utf-8?q?1760357700819269147?= A619_holi is implemented on at least two SoCs: SM4350 (holi) and SM6375 (blair). This is what seems to be a first occurrence of this happening, but it's easy to overcome by guarding the SoC-specific fuse values with of_machine_is_compatible(). Do just that to enable frequency limiting on these SoCs. Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 71950a5fcc96..27b96a335039 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2148,6 +2148,34 @@ static u32 a618_get_speed_bin(u32 fuse) return UINT_MAX; } +static u32 a619_holi_get_speed_bin(u32 fuse) +{ + /* + * There are (at least) two SoCs implementing A619_holi: SM4350 (holi) + * and SM6375 (blair). Limit the fuse matching to the corresponding + * SoC to prevent bogus frequency setting (as improbable as it may be, + * given unexpected fuse values are.. unexpected! But still possible.) + */ + + if (fuse == 0) + return 0; + + if (of_machine_is_compatible("qcom,sm4350")) { + if (fuse == 138) + return 1; + else if (fuse == 92) + return 2; + } else if (of_machine_is_compatible("qcom,sm6375")) { + if (fuse == 190) + return 1; + else if (fuse == 177) + return 2; + } else + pr_warn("Unknown SoC implementing A619_holi!\n"); + + return UINT_MAX; +} + static u32 a619_get_speed_bin(u32 fuse) { if (fuse == 0) @@ -2207,6 +2235,9 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u3 if (adreno_is_a618(adreno_gpu)) val = a618_get_speed_bin(fuse); + else if (adreno_is_a619_holi(adreno_gpu)) + val = a619_holi_get_speed_bin(fuse); + else if (adreno_is_a619(adreno_gpu)) val = a619_get_speed_bin(fuse); From patchwork Tue Mar 14 15:28:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 69703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1830552wrd; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) X-Google-Smtp-Source: AK7set+Yg/x7pspZvBTFh/pUL7Y7P0GbTvJcJ4sJS+jObi2qaa+rqeIFKyjqyfGDhzx+osfj6tN0 X-Received: by 2002:a05:6a20:7d86:b0:c6:bd82:ea2d with SMTP id v6-20020a056a207d8600b000c6bd82ea2dmr53963407pzj.2.1678808426564; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678808426; cv=none; d=google.com; s=arc-20160816; b=frANajqc9mJGHQo6VD+jmweewhz0/yPrpPjckKZ41JumpNTrU+Jb9JzJXu3Yiu+MJV xVWmBgy3r35/lgjopSN4IztX47ERwRQZT+2bqTYuS62NOAoCf5tOfOTkbxzhThnrqSX9 OlEwl0/5CGknQOrNuMJ0+0wqG2zoy96sy+tP5wnJCOIP4wSCNwj0obrb1tYeDcrUqsV4 C8XkY4Jrx1EYiWN2btBLLGqLnHz0TCFGYeWe+cOYSDL9ovkD9N6I1jfbLqpXE7ySHm55 xr7eD/JVPGOz2l9QRYGAGr13xLrZDDsj/2YnMXa1IZvQ/VPNzWdqj1sRaX61Xr1Wiazj Y/uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=M2E5GdUkfSHJuSWqCfd0m9SKOM1S112SBcZGfZ2SN2AXy5M5ZXK7jVw1kn56Too+iH ikz/zf8gwEZcWfuQM4I494urOjwIOeYNppSn1zmTCrR0qGZXNPMOHPy60q8iFU2E96bI aBvoNrg5IMpCtBmFEFlsp4b4laVhJZwk18AOIExEKWOvFlTAHwWg7R8tTPu0Ocrc9WnM c0wdU2I1kYYA6ZRbZj6+j3yA1eTXDMnH3nxol2/xy6FJW9Wo8tkZlRrDfIIX/6RXKxud lB68e1MUl22ibyF+XSpPADiJ3u51/yp9czW/XGeezpFW7SNsdtwkRDX0A1ltQo2+HmeM IqFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GV/tteMa"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j30-20020a63595e000000b004fbfeed0848si2373696pgm.798.2023.03.14.08.40.10; Tue, 14 Mar 2023 08:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GV/tteMa"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231704AbjCNPaO (ORCPT + 99 others); Tue, 14 Mar 2023 11:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231690AbjCNP3X (ORCPT ); Tue, 14 Mar 2023 11:29:23 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C6C62DAF for ; Tue, 14 Mar 2023 08:29:02 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id h9so16425051ljq.2 for ; Tue, 14 Mar 2023 08:29:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1678807741; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=GV/tteMajEXLkq7QRWvhGA9tMlhuJp/N2TPtYTY0YtLZQlTqkOTuIJ+KJwU0HqvSND xGSr/TymnSrZqWdGV3dGwJHCHSX1GpSUcYgNQe/A8PGmW7SKKznrUpk5ALLQAEMeG9rx /XG2RkujzSZ+Ciah38NKKTrq7vN5WRpzPlvjCFFRy/bNyFYfVt8Ef5kxiuulvIT59XoI vXAa566h15OVTxr35Iz+0GhOW2Nhhnr+7TqUu03lv+f2t6bBBKynYOG4NnrqcVpOFWKJ Zy+TVLtPGwdAQWe9s5RudeIOFXfuel+dLMcI4I3dKyvLmaAfUblEGKcxmRuzgLfwKDD1 HIdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678807741; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/rMi4z3KYpk1VOXDtleM/+v4nMkai2X+NZaj5fWAot0=; b=VJAXRSQxNz/iNAH6fdBct89K6AN7Qk7TDcnM9eA3MGd01dMoVgQeamP+L2GBRILUkJ LqL3UNh9OLBmPDFT7NOqAUtYRfcNPn5mXH0ahLiFHPhqFWqAK15ied3nXSgkfFTHIkPP 1YSzF+Wz60D1pC6YbKzj6BogMLK7Ji2HdrYVd7ZSNDb6xEVDfc9cNMXFxerpUEgjgMQY noZ05SeIiM9H5Nhjt6x6c/Z3HyTss7TOg8zOr9NSMoJBLC5J/XESMlnB2cuwNLfWEeCE Lw3j1JMLA9SZCsFsH6XWMcLdXJAI0502KZ2Jd515d7yt65iQA7Lg1eGcxLzkpkSyeXLW 4bdA== X-Gm-Message-State: AO0yUKXgv2ydy5MTJYXBsjwJjl6vxzzykBurbGtHO9tpKT0ODXOTpS6F s4ESQbhataVizdONIXVQVdwijg== X-Received: by 2002:a2e:3610:0:b0:295:acb9:8610 with SMTP id d16-20020a2e3610000000b00295acb98610mr12822310lja.25.1678807740930; Tue, 14 Mar 2023 08:29:00 -0700 (PDT) Received: from [192.168.1.101] (abyj16.neoplus.adsl.tpnet.pl. [83.9.29.16]) by smtp.gmail.com with ESMTPSA id 27-20020a2e165b000000b002986a977bf2sm491529ljw.90.2023.03.14.08.28.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Mar 2023 08:29:00 -0700 (PDT) From: Konrad Dybcio Date: Tue, 14 Mar 2023 16:28:45 +0100 Subject: [PATCH v4 14/14] drm/msm/a6xx: Add A610 speedbin support MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v4-14-e987eb79d03f@linaro.org> References: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v4-0-e987eb79d03f@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Bjorn Andersson , Konrad Dybcio , Akhil P Oommen Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Clark , Marijn Suijten , Konrad Dybcio X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1678807716; l=1852; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=ZWxWz95kNFsOaOSTnUEHkUaKyj0DdIwF1Eu3I3PdtGk=; b=KpKsSEXRQhg/MQJAmTRWDZjQlF+2ofojhmqZlx7eSqwxni5o+DCOvcHjBxCErE0ijWM2Fb5c/ZYL mYoD898IBUAF5lQbLmP9ZrsLEqozfQMp+QSYOnwJjDo2iYl97Y1+ X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_HTTP,RCVD_IN_SORBS_SOCKS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760358225138016667?= X-GMAIL-MSGID: =?utf-8?q?1760358225138016667?= A610 is implemented on at least three SoCs: SM6115 (bengal), SM6125 (trinket) and SM6225 (khaje). Trinket does not support speed binning (only a single SKU exists) and we don't yet support khaje upstream. Hence, add a fuse mapping table for bengal to allow for per-chip frequency limiting. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 27b96a335039..f9f1a6c50f65 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2136,6 +2136,30 @@ static bool a6xx_progress(struct msm_gpu *gpu, struct msm_ringbuffer *ring) return progress; } +static u32 a610_get_speed_bin(u32 fuse) +{ + /* + * There are (at least) three SoCs implementing A610: SM6125 (trinket), + * SM6115 (bengal) and SM6225 (khaje). Trinket does not have speedbinning, + * as only a single SKU exists and we don't support khaje upstream yet. + * Hence, this matching table is only valid for bengal and can be easily + * expanded if need be. + */ + + if (fuse == 0) + return 0; + else if (fuse == 206) + return 1; + else if (fuse == 200) + return 2; + else if (fuse == 157) + return 3; + else if (fuse == 127) + return 4; + + return UINT_MAX; +} + static u32 a618_get_speed_bin(u32 fuse) { if (fuse == 0) @@ -2232,6 +2256,9 @@ static u32 fuse_to_supp_hw(struct device *dev, struct adreno_gpu *adreno_gpu, u3 { u32 val = UINT_MAX; + if (adreno_is_a610(adreno_gpu)) + val = a610_get_speed_bin(fuse); + if (adreno_is_a618(adreno_gpu)) val = a618_get_speed_bin(fuse);