Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6370348pxv; Thu, 29 Jul 2021 12:53:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy02STWlmQWW2uNCZkBtgJtcvFumwTzcB3qbQFaY4Ca01UxZPxv2U5OVJ9VtPvikDsEu8KG X-Received: by 2002:a92:1a44:: with SMTP id z4mr5151278ill.244.1627588405589; Thu, 29 Jul 2021 12:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627588405; cv=none; d=google.com; s=arc-20160816; b=mBkmH5PfDNYLNOE6ze9XK6zHsSpCLNqxb6GfNEC9gMsNx1PilxnQyfWbJTQZTyUGOZ BQubd5dJWs9psCVF7LrZMk75BL8e91wI9kUCiniXMbg+WPnbjw9mbNq1ONq0fJpbNMme 6s3rvwcibacOGHCfUOheZX7Z3+NHkjA/O1QBEPuvp4CIrKZY8/DoqKvsIrTsMRn5eqk6 wBEvQkdR2ZkDwqsPGrAl5Hjpjt07Ko0CjQrHCRClwWJov9pcRhvpANgez1PbeMeQWSoK cW5n51D0Je+tUOBx4fwMj6WD/QyRQKAh6Ro7DqgOJP9U0pLkqg8Ir/3R80Fg90CLhMgF oxLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=26S1z0YiPCzAXOVdlNBmKby+y7WMrRGTA3MarF++KxA=; b=oUThoDCS0FSjjma6uaCLfOoEn8GF0iw7SQyz88Dg+5VXbaXmBK8zD8ZVSWTOb/t5dN +CZ5GiqaH0WzXuKJr9B/LDHjziepCOAsMMIH3w/m8gxVMDL8yFI9mxyOmxO/LrDkGLrW lSULn7qe/xV594L1A0q3PGuoO2tQvkZxr+xxY3kEt2ScMOJyAG1yW9APi6drh70b4T5H Y+HpJ5I7k/gbDuxTdLuIMnR/CUG+bl3sm1dDrDWfQ8YyLrEzYa7s+8hisvdG8Gjak2Yw 1BwHGS70hWwKK9C1izJPaTpZHmkFW0YjDXwHYYW1soy2xJDCIR44PumJPLOyavYrDEn3 aW8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ljYdTJjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w33si4598098jal.65.2021.07.29.12.53.13; Thu, 29 Jul 2021 12:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ljYdTJjA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232529AbhG2TwS (ORCPT + 99 others); Thu, 29 Jul 2021 15:52:18 -0400 Received: from so254-9.mailgun.net ([198.61.254.9]:16652 "EHLO so254-9.mailgun.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232249AbhG2TwQ (ORCPT ); Thu, 29 Jul 2021 15:52:16 -0400 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1627588333; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=26S1z0YiPCzAXOVdlNBmKby+y7WMrRGTA3MarF++KxA=; b=ljYdTJjAOZ54swvPbBHb7QXQHm033HfQ2N2qJmi9swvTxvejpXMGQZaV5Wk3E+HFq9jDpkbP /PYoi3y3IG2uausCAZjXA1DLSM2SbV+miesk8I3Z3o+HBWjQpe9wkPBYf4d6rbBGbhIAobR+ 95E0+Z1wwQ7jGHwF+mtjJ801Pb4= X-Mailgun-Sending-Ip: 198.61.254.9 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n06.prod.us-west-2.postgun.com with SMTP id 610306d6e81205dd0ae770e4 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Thu, 29 Jul 2021 19:51:50 GMT Sender: akhilpo=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 917BDC433F1; Thu, 29 Jul 2021 19:51:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from hyd-lnxbld559.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: akhilpo) by smtp.codeaurora.org (Postfix) with ESMTPSA id 72612C433F1; Thu, 29 Jul 2021 19:51:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 72612C433F1 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=akhilpo@codeaurora.org From: Akhil P Oommen To: freedreno , dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Rob Clark Cc: Douglas Anderson , Matthias Kaehlcke , Jordan Crouse , Jonathan Marek , AngeloGioacchino Del Regno , Bjorn Andersson , Daniel Vetter , David Airlie , Iskren Chernev , Konrad Dybcio , Sai Prakash Ranjan , Sean Paul , Sharat Masetty , linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] drm/msm/a6xx: Use rev to identify SKU Date: Fri, 30 Jul 2021 01:21:24 +0530 Message-Id: <20210730011945.v4.2.I286ef007fcadd9e6ee3b2c0ad948f990735f9610@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1627588286-30520-1-git-send-email-akhilpo@codeaurora.org> References: <1627588286-30520-1-git-send-email-akhilpo@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use rev instead of revn to identify the SKU. This is in preparation to the introduction of 7c3 gpu which won't have a revn. Signed-off-by: Akhil P Oommen --- Changes in v4: - Move adreno_cmp_rev() here to fix compilation drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 11 +++++------ drivers/gpu/drm/msm/adreno/adreno_device.c | 16 ++++++++++------ drivers/gpu/drm/msm/adreno/adreno_gpu.h | 4 ++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c index 183b9f9..0da1a66 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c @@ -1675,11 +1675,11 @@ static u32 a618_get_speed_bin(u32 fuse) return UINT_MAX; } -static u32 fuse_to_supp_hw(struct device *dev, u32 revn, u32 fuse) +static u32 fuse_to_supp_hw(struct device *dev, struct adreno_rev rev, u32 fuse) { u32 val = UINT_MAX; - if (revn == 618) + if (adreno_cmp_rev(ADRENO_REV(6, 1, 8, ANY_ID), rev)) val = a618_get_speed_bin(fuse); if (val == UINT_MAX) { @@ -1692,8 +1692,7 @@ static u32 fuse_to_supp_hw(struct device *dev, u32 revn, u32 fuse) return (1 << val); } -static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, - u32 revn) +static int a6xx_set_supported_hw(struct device *dev, struct adreno_rev rev) { u32 supp_hw = UINT_MAX; u16 speedbin; @@ -1714,7 +1713,7 @@ static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, } speedbin = le16_to_cpu(speedbin); - supp_hw = fuse_to_supp_hw(dev, revn, speedbin); + supp_hw = fuse_to_supp_hw(dev, rev, speedbin); done: ret = devm_pm_opp_set_supported_hw(dev, &supp_hw, 1); @@ -1785,7 +1784,7 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev) a6xx_llc_slices_init(pdev, a6xx_gpu); - ret = a6xx_set_supported_hw(&pdev->dev, a6xx_gpu, info->revn); + ret = a6xx_set_supported_hw(&pdev->dev, config->rev); if (ret) { a6xx_destroy(&(a6xx_gpu->base.base)); return ERR_PTR(ret); diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c index 6dad801..7e6fafe 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_device.c +++ b/drivers/gpu/drm/msm/adreno/adreno_device.c @@ -8,8 +8,6 @@ #include "adreno_gpu.h" -#define ANY_ID 0xff - bool hang_debug = false; MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!)"); module_param_named(hang_debug, hang_debug, bool, 0600); @@ -325,6 +323,15 @@ static inline bool _rev_match(uint8_t entry, uint8_t id) return (entry == ANY_ID) || (entry == id); } +bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2) +{ + + return _rev_match(rev1.core, rev2.core) && + _rev_match(rev1.major, rev2.major) && + _rev_match(rev1.minor, rev2.minor) && + _rev_match(rev1.patchid, rev2.patchid); +} + const struct adreno_info *adreno_info(struct adreno_rev rev) { int i; @@ -332,10 +339,7 @@ const struct adreno_info *adreno_info(struct adreno_rev rev) /* identify gpu: */ for (i = 0; i < ARRAY_SIZE(gpulist); i++) { const struct adreno_info *info = &gpulist[i]; - if (_rev_match(info->rev.core, rev.core) && - _rev_match(info->rev.major, rev.major) && - _rev_match(info->rev.minor, rev.minor) && - _rev_match(info->rev.patchid, rev.patchid)) + if (adreno_cmp_rev(info->rev, rev)) return info; } diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h index 8dbe0d1..a368a16 100644 --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h @@ -42,6 +42,8 @@ struct adreno_rev { uint8_t patchid; }; +#define ANY_ID 0xff + #define ADRENO_REV(core, major, minor, patchid) \ ((struct adreno_rev){ core, major, minor, patchid }) @@ -141,6 +143,8 @@ struct adreno_platform_config { __ret; \ }) +bool adreno_cmp_rev(struct adreno_rev rev1, struct adreno_rev rev2); + static inline bool adreno_is_a2xx(struct adreno_gpu *gpu) { return (gpu->revn < 300); -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation.