All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karunika Choo <karunika.choo@arm.com>
To: Chia-I Wu <olvaffe@gmail.com>
Cc: dri-devel@lists.freedesktop.org, nd@arm.com,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Steven Price <steven.price@arm.com>,
	Liviu Dudau <liviu.dudau@arm.com>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/7] drm/panthor: Simplify getting the GPU model name
Date: Mon, 21 Jul 2025 12:33:24 +0100	[thread overview]
Message-ID: <db1f5919-6d94-4563-9158-922cfd9c636b@arm.com> (raw)
In-Reply-To: <CAPaKu7T5Rf+N-T7f-Vh0tB72AdDWx+nipqGjfWDnvDk=sOosGA@mail.gmail.com>

On 11/06/2025 00:32, Chia-I Wu wrote:
> On Mon, Jun 2, 2025 at 8:16 AM Karunika Choo <karunika.choo@arm.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@arm.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.
>
>
I have addressed both points in PATCH 2/6 of v5
- https://lore.kernel.org/all/20250721111344.1610250-3-karunika.choo@arm.com/
 >>  #define GPU_L2_FEATURES                                        0x4
>>  #define  GPU_L2_FEATURES_LINE_SIZE(x)                  (1 << ((x) & GENMASK(7, 0)))
>>
>> --
>> 2.49.0
>>


  reply	other threads:[~2025-07-21 11:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 14:32 [PATCH v4 0/7] Add GPU specific initialization framework to support new Mali GPUs Karunika Choo
2025-06-02 14:32 ` [PATCH v4 1/7] drm/panthor: Add GPU specific initialization framework Karunika Choo
2025-06-10 23:12   ` Chia-I Wu
2025-07-21 11:28     ` Karunika Choo
2025-06-02 14:32 ` [PATCH v4 2/7] drm/panthor: Move GPU info initialization into panthor_hw.c Karunika Choo
2025-06-02 14:32 ` [PATCH v4 3/7] drm/panthor: Simplify getting the GPU model name Karunika Choo
2025-06-10 23:32   ` Chia-I Wu
2025-07-21 11:33     ` Karunika Choo [this message]
2025-06-02 14:32 ` [PATCH v4 4/7] drm/panthor: Add support for Mali-G710, Mali-G510 and Mali-G310 Karunika Choo
2025-06-02 14:32 ` [PATCH v4 5/7] drm/panthor: Add support for Mali-Gx15 family of GPUs Karunika Choo
2025-06-02 14:32 ` [PATCH v4 6/7] drm/panthor: Support GPU_CONTROL cache flush based on feature bit Karunika Choo
2025-06-10 23:42   ` Chia-I Wu
2025-07-21 11:35     ` Karunika Choo
2025-06-23 10:23   ` Steven Price
2025-07-21 11:39     ` Karunika Choo
2025-06-02 14:32 ` [PATCH v4 7/7] drm/panthor: Add support for Mali-Gx20 and Mali-Gx25 GPUs Karunika Choo
2025-06-10 23:45   ` Chia-I Wu
2025-07-21 11:44     ` Karunika Choo
2025-06-23 10:23 ` [PATCH v4 0/7] Add GPU specific initialization framework to support new Mali GPUs Steven Price

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=db1f5919-6d94-4563-9158-922cfd9c636b@arm.com \
    --to=karunika.choo@arm.com \
    --cc=airlied@gmail.com \
    --cc=boris.brezillon@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=nd@arm.com \
    --cc=olvaffe@gmail.com \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.