AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Khatri, Sunil" <sukhatri@amd.com>
To: Alex Deucher <alexdeucher@gmail.com>,
	Sunil Khatri <sunil.khatri@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH v1 06/15] drm/amdgpu: add print support for vcn_v4_0_3 ip dump
Date: Wed, 7 Aug 2024 09:07:44 +0530	[thread overview]
Message-ID: <8daf65f2-7fab-4ec1-81d1-1070846adeb3@amd.com> (raw)
In-Reply-To: <CADnq5_PgwrRWLCRGpx2JMW4TiAbbuWyX_3eAphHreocw1K61cQ@mail.gmail.com>


On 8/7/2024 3:02 AM, Alex Deucher wrote:
> On Tue, Aug 6, 2024 at 4:18 AM Sunil Khatri <sunil.khatri@amd.com> wrote:
>> Add support for logging the registers in devcoredump
>> buffer for vcn_v4_0_3.
>>
>> Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 34 ++++++++++++++++++++++++-
>>   1 file changed, 33 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
>> index dd3baccb2904..033e5c88527c 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
>> @@ -1823,6 +1823,38 @@ static void vcn_v4_0_3_set_irq_funcs(struct amdgpu_device *adev)
>>          adev->vcn.inst->irq.funcs = &vcn_v4_0_3_irq_funcs;
>>   }
>>
>> +static void vcn_v4_0_3_print_ip_state(void *handle, struct drm_printer *p)
>> +{
>> +       struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>> +       int i, j;
>> +       uint32_t reg_count = ARRAY_SIZE(vcn_reg_list_4_0_3);
>> +       uint32_t inst_off, is_powered;
>> +
>> +       if (!adev->vcn.ip_dump)
>> +               return;
>> +
>> +       drm_printf(p, "num_instances:%d\n", adev->vcn.num_vcn_inst);
>> +       for (i = 0; i < adev->vcn.num_vcn_inst; i++) {
>> +               if (adev->vcn.harvest_config & (1 << i)) {
>> +                       drm_printf(p, "\nHarvested Instance:VCN%d Skipping dump\n", i);
>> +                       continue;
>> +               }
>> +
>> +               inst_off = i * reg_count;
>> +               is_powered = (adev->vcn.ip_dump[inst_off] &
>> +                               UVD_POWER_STATUS__UVD_POWER_STATUS_MASK) != 1;
> Actually, we shouldn't be checking whether or not VCN is powered up
> when we print the results.  We've already stored the registers so we
> don't care if VCN is powered at this point or not.  VCN could be
> powered down by the time we print this.  It would be better to just
> store a flag to determine whether or not we logged the registers in
> the first place, then use that to determine whether or not we print
> anything.  Same comment for the other VCN print_ip_state callbacks.
This is exactly the same being done here.

is_powered = (adev->vcn.ip_dump[inst_off] &
+                               UVD_POWER_STATUS__UVD_POWER_STATUS_MASK) != 1;
The above is already stored at the time of capturing the dump, i am just checking the value to make sure if it was
powered up at the time of dump and if yes then add logs to devcore dump else skip. Its done this way rather than using a variable as there could
be multiple instances of VCN and one may be powered or not so power state is captured for each instance and based on that value only its we are printing or logging in devcoredump.

Regards
Sunil khatri

>
> Alex
>
>> +
>> +               if (is_powered) {
>> +                       drm_printf(p, "\nActive Instance:VCN%d\n", i);
>> +                       for (j = 0; j < reg_count; j++)
>> +                               drm_printf(p, "%-50s \t 0x%08x\n", vcn_reg_list_4_0_3[j].reg_name,
>> +                                          adev->vcn.ip_dump[inst_off + j]);
>> +               } else {
>> +                       drm_printf(p, "\nInactive Instance:VCN%d\n", i);
>> +               }
>> +       }
>> +}
>> +
>>   static void vcn_v4_0_3_dump_ip_state(void *handle)
>>   {
>>          struct amdgpu_device *adev = (struct amdgpu_device *)handle;
>> @@ -1871,7 +1903,7 @@ static const struct amd_ip_funcs vcn_v4_0_3_ip_funcs = {
>>          .set_clockgating_state = vcn_v4_0_3_set_clockgating_state,
>>          .set_powergating_state = vcn_v4_0_3_set_powergating_state,
>>          .dump_ip_state = vcn_v4_0_3_dump_ip_state,
>> -       .print_ip_state = NULL,
>> +       .print_ip_state = vcn_v4_0_3_print_ip_state,
>>   };
>>
>>   const struct amdgpu_ip_block_version vcn_v4_0_3_ip_block = {
>> --
>> 2.34.1
>>

  reply	other threads:[~2024-08-07  3:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06  8:18 [PATCH v1 00/15] VCN IP DUMP support for remaining IP's Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 01/15] drm/amdgpu: add vcn_v5_0 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 02/15] drm/amdgpu: add print support for vcn_v5_0 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 03/15] drm/amdgpu: add vcn_v4_0 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 04/15] drm/amdgpu: add print support for vcn_v4_0 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 05/15] drm/amdgpu: add vcn_v4_0_3 ip dump support Sunil Khatri
2024-08-06 21:28   ` Alex Deucher
2024-08-07  3:47     ` Khatri, Sunil
2024-08-07  3:51       ` Alex Deucher
2024-08-08  5:50     ` Lazar, Lijo
2024-08-08  7:06       ` Khatri, Sunil
2024-08-08  7:14         ` Lazar, Lijo
2024-08-08  7:29           ` Khatri, Sunil
2024-08-08  9:29             ` Sundararaju, Sathishkumar
2024-08-06  8:18 ` [PATCH v1 06/15] drm/amdgpu: add print support for vcn_v4_0_3 ip dump Sunil Khatri
2024-08-06 21:32   ` Alex Deucher
2024-08-07  3:37     ` Khatri, Sunil [this message]
2024-08-07  3:41       ` Alex Deucher
2024-08-06  8:18 ` [PATCH v1 07/15] drm/amdgpu: add vcn_v4_0_5 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 08/15] drm/amdgpu: add print support for vcn_v4_0_5 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 09/15] drm/amdgpu: add vcn_v1_0 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 10/15] drm/amdgpu: add print support for vcn_v1_0 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 11/15] drm/amdgpu: add vcn_v2_0 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 12/15] drm/amdgpu: add print support for vcn_v2_0 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 13/15] drm/amdgpu: add vcn_v2_5 ip dump support Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 14/15] drm/amdgpu: add print support for vcn_v2_5 ip dump Sunil Khatri
2024-08-06  8:18 ` [PATCH v1 15/15] drm/amdgpu: add vcn ip dump support for vcn_v2_6 Sunil Khatri
2024-08-07  4:00   ` Alex Deucher

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=8daf65f2-7fab-4ec1-81d1-1070846adeb3@amd.com \
    --to=sukhatri@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=sunil.khatri@amd.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox