[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPaKu7T5Rf+N-T7f-Vh0tB72AdDWx+nipqGjfWDnvDk=sOosGA@mail.gmail.com>
Date: Tue, 10 Jun 2025 16:32:56 -0700
From: Chia-I Wu <olvaffe@...il.com>
To: Karunika Choo <karunika.choo@....com>
Cc: dri-devel@...ts.freedesktop.org, nd@....com,
Boris Brezillon <boris.brezillon@...labora.com>, Steven Price <steven.price@....com>,
Liviu Dudau <liviu.dudau@....com>, Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/7] drm/panthor: Simplify getting the GPU model name
On Mon, Jun 2, 2025 at 8:16 AM Karunika Choo <karunika.choo@....com> wrote:
>
> This patch replaces the panthor_model structure with a simple switch
> case based on the product_id which is in the format of:
> ((arch_major << 24) | product_major)
>
> This simplifies comparison and allows extending of the function to
> accommodate naming differences based on supported GPU features.
>
> Signed-off-by: Karunika Choo <karunika.choo@....com>
> ---
> drivers/gpu/drm/panthor/panthor_hw.c | 63 +++++++-------------------
> drivers/gpu/drm/panthor/panthor_regs.h | 2 +
> 2 files changed, 19 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_hw.c b/drivers/gpu/drm/panthor/panthor_hw.c
> index 576cda231c1c..421f84fde7d0 100644
> --- a/drivers/gpu/drm/panthor/panthor_hw.c
> +++ b/drivers/gpu/drm/panthor/panthor_hw.c
<snipped>
> static void panthor_hw_info_init(struct panthor_device *ptdev)
> {
> - const struct panthor_model *model;
> - u32 arch_major, product_major;
> + const char *gpu_model_name = get_gpu_model_name(ptdev);
Move this to after panthor_gpu_info_init below.
We want to init gpu info before dumping it in general. And in fact,
get_gpu_model_name will depend on gpu_features/shader_present in a
later patch so this is a real bug.
> u32 major, minor, status;
>
> panthor_gpu_info_init(ptdev);
>
> - arch_major = GPU_ARCH_MAJOR(ptdev->gpu_info.gpu_id);
> - product_major = GPU_PROD_MAJOR(ptdev->gpu_info.gpu_id);
> major = GPU_VER_MAJOR(ptdev->gpu_info.gpu_id);
> minor = GPU_VER_MINOR(ptdev->gpu_info.gpu_id);
> status = GPU_VER_STATUS(ptdev->gpu_info.gpu_id);
>
> - for (model = gpu_models; model->name; model++) {
> - if (model->arch_major == arch_major &&
> - model->product_major == product_major)
> - break;
> - }
> -
> drm_info(&ptdev->base,
> - "mali-%s id 0x%x major 0x%x minor 0x%x status 0x%x",
> - model->name ?: "unknown", ptdev->gpu_info.gpu_id >> 16,
> + "%s id 0x%x major 0x%x minor 0x%x status 0x%x",
> + gpu_model_name, ptdev->gpu_info.gpu_id >> 16,
> major, minor, status);
>
> drm_info(&ptdev->base,
> diff --git a/drivers/gpu/drm/panthor/panthor_regs.h b/drivers/gpu/drm/panthor/panthor_regs.h
> index 48bbfd40138c..e7a81686afdb 100644
> --- a/drivers/gpu/drm/panthor/panthor_regs.h
> +++ b/drivers/gpu/drm/panthor/panthor_regs.h
> @@ -19,6 +19,8 @@
> #define GPU_VER_MINOR(x) (((x) & GENMASK(11, 4)) >> 4)
> #define GPU_VER_STATUS(x) ((x) & GENMASK(3, 0))
>
> +#define GPU_PROD_ID_MAKE(arch_major, prod_major) (((arch_major) << 24) | (prod_major))
This macro has no hw significance and is only used to decide the model
conveniently. It should be moved to panthor_hw.c.
> #define GPU_L2_FEATURES 0x4
> #define GPU_L2_FEATURES_LINE_SIZE(x) (1 << ((x) & GENMASK(7, 0)))
>
> --
> 2.49.0
>
Powered by blists - more mailing lists