Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Nilawar, Badal" <badal.nilawar@intel.com>
To: John Harrison <john.c.harrison@intel.com>,
	<intel-xe@lists.freedesktop.org>
Cc: <anshuman.gupta@intel.com>, <lucas.demarchi@intel.com>,
	<matthew.d.roper@intel.com>
Subject: Re: [PATCH 1/2] drm/xe/guc: Add support for w/a KLVs
Date: Tue, 19 Mar 2024 20:51:34 +0530	[thread overview]
Message-ID: <57fdb710-399a-4351-ac87-76a85f0e8c64@intel.com> (raw)
In-Reply-To: <e4dcce08-40fe-4a8e-bff7-2cf70a404766@intel.com>



On 19-03-2024 03:41, John Harrison wrote:
> On 3/15/2024 04:21, Badal Nilawar wrote:
>> To prevent running out of bits, new w/a enable flags are being added
>> via a KLV system instead of a 32 bit flags word.
>>
>> Cc: John Harrison <John.C.Harrison@intel.com>
>> Signed-off-by: Badal Nilawar <badal.nilawar@intel.com>
>> ---
>>   drivers/gpu/drm/xe/xe_guc_ads.c       | 68 ++++++++++++++++++++++++++-
>>   drivers/gpu/drm/xe/xe_guc_ads_types.h |  2 +
>>   drivers/gpu/drm/xe/xe_guc_fwif.h      |  5 +-
>>   3 files changed, 72 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ads.c 
>> b/drivers/gpu/drm/xe/xe_guc_ads.c
>> index 6ad4c1a90a78..ee48cf01fe22 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ads.c
>> +++ b/drivers/gpu/drm/xe/xe_guc_ads.c
>> @@ -80,6 +80,10 @@ ads_to_map(struct xe_guc_ads *ads)
>>    *      +---------------------------------------+
>>    *      | padding                               |
>>    *      +---------------------------------------+ <== 4K aligned
>> + *      | w/a KLVs                              |
>> + *      +---------------------------------------+
>> + *      | padding                               |
>> + *      +---------------------------------------+ <== 4K aligned
>>    *      | capture lists                         |
>>    *      +---------------------------------------+
>>    *      | padding                               |
>> @@ -131,6 +135,11 @@ static size_t guc_ads_golden_lrc_size(struct 
>> xe_guc_ads *ads)
>>       return PAGE_ALIGN(ads->golden_lrc_size);
>>   }
>> +static u32 guc_ads_waklv_size(struct xe_guc_ads *ads)
>> +{
>> +    return PAGE_ALIGN(ads->ads_waklv_size);
>> +}
>> +
>>   static size_t guc_ads_capture_size(struct xe_guc_ads *ads)
>>   {
>>       /* FIXME: Allocate a proper capture list */
>> @@ -167,12 +176,22 @@ static size_t guc_ads_golden_lrc_offset(struct 
>> xe_guc_ads *ads)
>>       return PAGE_ALIGN(offset);
>>   }
>> +static size_t guc_ads_waklv_offset(struct xe_guc_ads *ads)
>> +{
>> +    u32 offset;
>> +
>> +    offset = guc_ads_golden_lrc_offset(ads) +
>> +         guc_ads_golden_lrc_size(ads);
>> +
>> +    return PAGE_ALIGN(offset);
>> +}
>> +
>>   static size_t guc_ads_capture_offset(struct xe_guc_ads *ads)
>>   {
>>       size_t offset;
>> -    offset = guc_ads_golden_lrc_offset(ads) +
>> -        guc_ads_golden_lrc_size(ads);
>> +    offset = guc_ads_waklv_offset(ads) +
>> +         guc_ads_waklv_size(ads);
>>       return PAGE_ALIGN(offset);
>>   }
>> @@ -260,6 +279,48 @@ static size_t calculate_golden_lrc_size(struct 
>> xe_guc_ads *ads)
>>       return total_size;
>>   }
>> +#define GUC_VER(maj, min, pat)    (((maj) << 16) | ((min) << 8) | (pat))
> This should be in a common header file, not duplicated in every source 
> file that wants to use it. But see below...
> 
>> +
>> +static void guc_waklv_init(struct xe_guc_ads *ads)
>> +{
>> +    u32 addr_ggtt, offset, remain, size;
>> +    struct xe_uc_fw *uc_fw = &ads_to_guc(ads)->fw;
>> +    struct xe_uc_fw_version *version = 
>> &uc_fw->versions.found[XE_UC_FW_VER_RELEASE];
>> +
>> +    if (GUC_VER(version->major, version->minor, version->patch) >= 
>> GUC_VER(70, 10, 0))
> Note that Xe will not be supporting anything below 70.19 once this patch 
> lands:
> https://patchwork.freedesktop.org/series/130677/
> 
> Which means that any test for <70.19 will need to be removed again.
I think I will remove version check from this patch.

Badal
> 
> John.
> 
>> +        return;
>> +
>> +    offset = guc_ads_waklv_offset(ads);
>> +    remain = guc_ads_waklv_size(ads);
>> +
>> +    /*
>> +     * Add workarounds here:
>> +     *
>> +     * if (want_wa_<name>) {
>> +     *      size = guc_waklv_<name>(guc, offset, remain);
>> +     *      offset += size;
>> +     *      remain -= size;
>> +     * }
>> +     */
>> +
>> +    size = guc_ads_waklv_size(ads) - remain;
>> +    if (!size)
>> +        return;
>> +
>> +    offset = guc_ads_waklv_offset(ads);
>> +    addr_ggtt = xe_bo_ggtt_addr(ads->bo) + offset;
>> +
>> +    ads_blob_write(ads, ads.wa_klv_addr_lo, addr_ggtt);
>> +    ads_blob_write(ads, ads.wa_klv_addr_hi, 0);
>> +    ads_blob_write(ads, ads.wa_klv_size, size);
>> +}
>> +
>> +static int calculate_waklv_size(struct xe_guc_ads *ads)
>> +{
>> +    /* Fudge something chunky for now: */
>> +    return PAGE_SIZE;
>> +}
>> +
>>   #define MAX_GOLDEN_LRC_SIZE    (SZ_4K * 64)
>>   int xe_guc_ads_init(struct xe_guc_ads *ads)
>> @@ -271,6 +332,7 @@ int xe_guc_ads_init(struct xe_guc_ads *ads)
>>       ads->golden_lrc_size = calculate_golden_lrc_size(ads);
>>       ads->regset_size = calculate_regset_size(gt);
>> +    ads->ads_waklv_size = calculate_waklv_size(ads);
>>       bo = xe_managed_bo_create_pin_map(xe, tile, guc_ads_size(ads) + 
>> MAX_GOLDEN_LRC_SIZE,
>>                         XE_BO_CREATE_SYSTEM_BIT |
>> @@ -597,6 +659,8 @@ void xe_guc_ads_populate(struct xe_guc_ads *ads)
>>       guc_mapping_table_init(gt, &info_map);
>>       guc_capture_list_init(ads);
>>       guc_doorbell_init(ads);
>> +    /* Workaround KLV list */
>> +    guc_waklv_init(ads);
>>       if (xe->info.has_usm) {
>>           guc_um_init_params(ads);
>> diff --git a/drivers/gpu/drm/xe/xe_guc_ads_types.h 
>> b/drivers/gpu/drm/xe/xe_guc_ads_types.h
>> index 4afe44bece4b..62235b2a6fe3 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_ads_types.h
>> +++ b/drivers/gpu/drm/xe/xe_guc_ads_types.h
>> @@ -20,6 +20,8 @@ struct xe_guc_ads {
>>       size_t golden_lrc_size;
>>       /** @regset_size: size of register set passed to GuC for 
>> save/restore */
>>       u32 regset_size;
>> +    /** @ads_waklv_size: waklv size */
>> +    u32 ads_waklv_size;
>>   };
>>   #endif
>> diff --git a/drivers/gpu/drm/xe/xe_guc_fwif.h 
>> b/drivers/gpu/drm/xe/xe_guc_fwif.h
>> index c281fdbfd2d6..52503719d2aa 100644
>> --- a/drivers/gpu/drm/xe/xe_guc_fwif.h
>> +++ b/drivers/gpu/drm/xe/xe_guc_fwif.h
>> @@ -207,7 +207,10 @@ struct guc_ads {
>>       u32 
>> capture_instance[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES];
>>       u32 
>> capture_class[GUC_CAPTURE_LIST_INDEX_MAX][GUC_MAX_ENGINE_CLASSES];
>>       u32 capture_global[GUC_CAPTURE_LIST_INDEX_MAX];
>> -    u32 reserved[14];
>> +    u32 wa_klv_addr_lo;
>> +    u32 wa_klv_addr_hi;
>> +    u32 wa_klv_size;
>> +    u32 reserved[11];
>>   } __packed;
>>   /* Engine usage stats */
> 

  reply	other threads:[~2024-03-19 15:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 11:21 [PATCH 0/2] Add support for Wa KLVs Badal Nilawar
2024-03-15 11:12 ` ✓ CI.Patch_applied: success for " Patchwork
2024-03-15 11:12 ` ✓ CI.checkpatch: " Patchwork
2024-03-15 11:15 ` ✓ CI.KUnit: " Patchwork
2024-03-15 11:21 ` [PATCH 1/2] drm/xe/guc: Add support for w/a KLVs Badal Nilawar
2024-03-18 22:11   ` John Harrison
2024-03-19 15:21     ` Nilawar, Badal [this message]
2024-03-15 11:21 ` [PATCH 2/2] drm/xe/lnl: Enable GuC Wa_14019882105 Badal Nilawar
2024-03-18 22:06   ` John Harrison
2024-03-19 15:16     ` Nilawar, Badal
2024-03-15 11:25 ` ✓ CI.Build: success for Add support for Wa KLVs Patchwork
2024-03-15 11:28 ` ✓ CI.Hooks: " Patchwork
2024-03-15 11:29 ` ✓ CI.checksparse: " Patchwork
2024-03-15 11:51 ` ✓ CI.BAT: " Patchwork

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=57fdb710-399a-4351-ac87-76a85f0e8c64@intel.com \
    --to=badal.nilawar@intel.com \
    --cc=anshuman.gupta@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=john.c.harrison@intel.com \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.d.roper@intel.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