From patchwork Sat Apr 1 11:54:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 78124 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1173022vqo; Sat, 1 Apr 2023 04:58:12 -0700 (PDT) X-Google-Smtp-Source: AKy350bwFtVdhiK70YSsDdcvrxF8UOYm87AzTbY0UDhhsj4p9nKKo0QrU4gM1qLCKVGya8ixxZjY X-Received: by 2002:a17:906:8a41:b0:930:18f5:d016 with SMTP id gx1-20020a1709068a4100b0093018f5d016mr30091152ejc.15.1680350291780; Sat, 01 Apr 2023 04:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680350291; cv=none; d=google.com; s=arc-20160816; b=IPVzJUJS0zVB08MJMHUz8xRrXIpc0VD1LVhvwTKl7H8WoC/mR6koFQsXcooBYoST4P 0rQiVFyWD15A2knUVTt1ho9YVZQo3NEaenoAFjgbpo5P0eQ9MtLN/hN21Bmb8zyl7fBo nP6XGRrbm6AgESGe7swrhx9q0cP+SykWY0kVUyOt8QLaST4UFGZxe+LQpLOaPoFMZh8T dRAnE+P36LbGvoPOPFuY0RPeN5cQx2mYpKEBTOnuXutuMhWzesH1YAncZJ/aDO5QqF1v J//oT5RrEE7CapKq5t09zYrPsqKP1vnW7vVy9bRTTpo+bIePRJ7RnRkb+rP8qLCY06zN p8kQ== 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=p4fj6BZ1SXPCMTA1b95cYrYZNvYyQufsY+lFzyAw5Ag=; b=KjupvhBKXWCrZcn/3Y1PU/eD7WbXqM9xlwJvTdVJvi1l3gKC6bQ210zm34vJKaRdyK 3IS4Ye7jfsvC5B2ij6rAEXUhU8hm09WVSmtI4quvJ7AllZ6NRL+CGD1nl4pR+GA4i7gI DQZvjTW+CqqqXlklOU/Pig5jagHTKZ8mf1+/Z8W4WQaT6KK1EeoAct5TGx5Uk2G4jC22 ajaAEogiIEpCFmeximmrNmD8+61KbES1l+wsQgMlEF4ze4VNaKJFO5wpta7UbXHCfiOw NTUXfXrD5U5BRpDq3MJ0HcEhGBRf+qwM6r3DOF7vxa+nehg+xmOqY8JvsSuVi8CKX8b7 FAWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="mw721N/D"; 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 bh13-20020a170906a0cd00b00947bc373744si3084811ejb.359.2023.04.01.04.57.48; Sat, 01 Apr 2023 04:58: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="mw721N/D"; 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 S230119AbjDAL4J (ORCPT + 99 others); Sat, 1 Apr 2023 07:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230055AbjDALzu (ORCPT ); Sat, 1 Apr 2023 07:55:50 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF2626242 for ; Sat, 1 Apr 2023 04:55:27 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id q16so32198811lfe.10 for ; Sat, 01 Apr 2023 04:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680350127; 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=p4fj6BZ1SXPCMTA1b95cYrYZNvYyQufsY+lFzyAw5Ag=; b=mw721N/DjJT0KciVbCcGyWDWtaWmwE8gtht2z8TW5VCIJQvWOsglmyDB2zr8BPZ0/e 6tVz62UYb15XC3xzkILdF/1p6CThW4hMoCFmMEvYhduqGhMgAKkbAC9X1G0/rhIqz+1Q a52sVCTOY1uSNpI4hhH1pOc4UiLguukjXtNhZGQ/L3rOPWqvv+tJOuAW5YF0RJpo3xsq U0Hs3Irt3RnqYXcDPD2e44LBp8BSe1G2/+IgHpFsdDzc1Is2unSTH1k7DBaTTqQt2KF7 0J7H3jz5lnfw9VKQFfKrUQnBxdhPLeRhyffKEirqq7n152VWW550AFbxDOZCsgRMazUi XjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680350127; 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=p4fj6BZ1SXPCMTA1b95cYrYZNvYyQufsY+lFzyAw5Ag=; b=bfl/7pCXZFjFD0WHtf5gRTnc8RTkyGe/RwjX/FiF6YFd+J9lHXfGLIoKW1vk6PHBM9 8RuVL/9IKd7zzs++6LYoLV5qHG/WXNI1Yf/dtGmiOeakPXKzVjrCIu1QXeIrkjUY0AcI 8m1j7mbUmbel0SqhDcQSONXLpkUDEO9oSPGxxCqwBNwuYLXRCOLIjxL1Xu7dmI1LnI9S HAlvfMpa1G1HeeSstFGUGWmKexmCbF8moHmt3GU41elHgRWcTBj785/MH0801BmElhci QdqRy1Z3LxMMguVryt+GupVby+uLg/fqHW1mpz7Kmq77DPZlwapvF64h2KF+Omt1mQ12 yTWQ== X-Gm-Message-State: AAQBX9cGrAJgioDJY6zE5nbvptD8O+3OBU7IwXbLQ0QtabHA8qvvx/FH rMEhXbAqm3NLISNQR4+rJPIV/A== X-Received: by 2002:a19:ad46:0:b0:4eb:1527:e29d with SMTP id s6-20020a19ad46000000b004eb1527e29dmr4818192lfd.52.1680350127490; Sat, 01 Apr 2023 04:55:27 -0700 (PDT) Received: from [192.168.1.101] (abxj225.neoplus.adsl.tpnet.pl. [83.9.3.225]) by smtp.gmail.com with ESMTPSA id w8-20020ac254a8000000b004e83f386878sm786737lfk.153.2023.04.01.04.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Apr 2023 04:55:27 -0700 (PDT) From: Konrad Dybcio Date: Sat, 01 Apr 2023 13:54:50 +0200 Subject: [PATCH v6 13/15] drm/msm/a6xx: Use adreno_is_aXYZ macros in speedbin matching MIME-Version: 1.0 Message-Id: <20230223-topic-gmuwrapper-v6-13-2034115bb60c@linaro.org> References: <20230223-topic-gmuwrapper-v6-0-2034115bb60c@linaro.org> In-Reply-To: <20230223-topic-gmuwrapper-v6-0-2034115bb60c@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.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1680350084; l=4317; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=gt/XSuRfu9SW3ip+LGRQSjqxQbTtasoADdeZewQY5iA=; b=x1D3Y3w9Xahm2EFcpyOmjiy++nMJd9XXmLM6oFTWaKk04TstuKD29p0VA0n0WTh8uuMm7pO+wHwI HGe6iSIsCo7Q9MZZQLVmSkDHMNTIDlXLYq/ilvSbA12YeA8OkeEE X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1761974987469685561?= X-GMAIL-MSGID: =?utf-8?q?1761974987469685561?= 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. Reviewed-by: Dmitry Baryshkov Signed-off-by: Konrad Dybcio --- 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 a802a29f8173..6c84ef82e504 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -2164,23 +2164,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) { @@ -2193,7 +2193,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; @@ -2212,7 +2212,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) @@ -2333,7 +2333,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 7a5d595d4b99..21513cec038f 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);