From: Francois Dugast <francois.dugast@intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Matt Atwood <matthew.s.atwood@intel.com>,
<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 3/9] drm/xe/xe3: Generate and store the L3 bank mask
Date: Mon, 9 Sep 2024 14:15:30 +0200 [thread overview]
Message-ID: <Zt7m4qXwFiPs4GAE@fdugast-desk> (raw)
In-Reply-To: <20240906234315.GY5774@mdroper-desk1.amr.corp.intel.com>
On Fri, Sep 06, 2024 at 04:43:15PM -0700, Matt Roper wrote:
> On Fri, Sep 06, 2024 at 02:51:47PM -0700, Matt Atwood wrote:
> > From: Francois Dugast <francois.dugast@intel.com>
> >
> > On Xe3, the register used to indicate which L3 banks are enabled on
> > the system is a new one called MIRROR_L3BANK_ENABLE. Each bit
> > represents one bank enabled in each node.
> > Extend the existing topology code for Xe3 to read this register and
> > generate the correct L3 bank mask, which can be read by user space
> > throug the topology query.
> >
> > Bspec: 72573, 73439
> >
> > Cc: Matt Roper <matthew.d.roper@intel.com>
> > Signed-off-by: Francois Dugast <francois.dugast@intel.com>
> > Signed-off-by: Matt Atwood <matthew.s.atwood@intel.com>
> > ---
> > drivers/gpu/drm/xe/regs/xe_gt_regs.h | 3 +++
> > drivers/gpu/drm/xe/xe_gt_topology.c | 11 ++++++++++-
> > 2 files changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/xe/regs/xe_gt_regs.h b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> > index 0d1a4a9f4e11..8ed855b31e95 100644
> > --- a/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> > +++ b/drivers/gpu/drm/xe/regs/xe_gt_regs.h
> > @@ -218,6 +218,9 @@
> >
> > #define MIRROR_FUSE1 XE_REG(0x911c)
> >
> > +#define MIRROR_L3BANK_ENABLE XE_REG(0x9130)
> > +#define XE3_L3BANK_ENABLE REG_GENMASK(31, 0)
> > +
> > #define XELP_EU_ENABLE XE_REG(0x9134) /* "_DISABLE" on Xe_LP */
> > #define XELP_EU_MASK REG_GENMASK(7, 0)
> > #define XELP_GT_SLICE_ENABLE XE_REG(0x9138)
> > diff --git a/drivers/gpu/drm/xe/xe_gt_topology.c b/drivers/gpu/drm/xe/xe_gt_topology.c
> > index 0662f71c6ede..56571380a2b5 100644
> > --- a/drivers/gpu/drm/xe/xe_gt_topology.c
> > +++ b/drivers/gpu/drm/xe/xe_gt_topology.c
> > @@ -129,7 +129,16 @@ load_l3_bank_mask(struct xe_gt *gt, xe_l3_bank_mask_t l3_bank_mask)
> > struct xe_device *xe = gt_to_xe(gt);
> > u32 fuse3 = xe_mmio_read32(gt, MIRROR_FUSE3);
> >
> > - if (GRAPHICS_VER(xe) >= 20) {
> > + if (GRAPHICS_VER(xe) >= 30) {
> > + xe_l3_bank_mask_t per_node = {};
> > + u32 meml3_en = REG_FIELD_GET(XE2_NODE_ENABLE_MASK, fuse3);
>
> This is a 16-bit mask...
>
> > + u32 mirror_l3bank_enable = xe_mmio_read32(gt, MIRROR_L3BANK_ENABLE);
> > + u32 bank_val = REG_FIELD_GET(XE3_L3BANK_ENABLE, mirror_l3bank_enable);
>
> ...and this is a 32-bit mask...
>
> > +
> > + bitmap_from_arr32(per_node, &bank_val, 32);
> > + gen_l3_mask_from_pattern(xe, l3_bank_mask, per_node, 32,
> > + meml3_en);
>
> ...so when we combine them the resulting mask could potentially be up to
> 16 * 32 = 512 bits. Even if Xe3 platforms don't really have so many
> banks to use all of those bits, we could still read such values from the
> registers (e.g., if a PCI link glitch or other temporary issue causes
> the fuse registers to read out as 0xFFFFFFFF). Since
> XE_MAX_L3_BANK_MASK_BITS is currently just 64, we can potentially run
> past the bounds of the allocated memory for the bitmask and probably
> cause a kernel panic. So I think we need to extend that define to 512
> bits to cover all possible values, even if we don't expect to ever see
> them on a properly functioning system.
This would make the query response unnecessarily large and maybe misleading
if we know already we do not need this size.
I believe the scenario you described is currently not possible. This line
in gen_l3_mask_from_pattern() would warn if the mask would go beyond
XE_MAX_L3_BANK_MASK_BITS:
xe_assert(xe, !mask || patternbits * (__fls(mask) + 1) <= XE_MAX_L3_BANK_MASK_BITS);
Even with the test in xe_assert() compiled out, we should be fine as long
as the last argument passed to the linux/bitmap.h functions bitmap_*() is
XE_MAX_L3_BANK_MASK_BITS, which is the case in gen_l3_mask_from_pattern().
Francois
>
>
> Matt
>
> > + } else if (GRAPHICS_VER(xe) >= 20) {
> > xe_l3_bank_mask_t per_node = {};
> > u32 meml3_en = REG_FIELD_GET(XE2_NODE_ENABLE_MASK, fuse3);
> > u32 bank_val = REG_FIELD_GET(XE2_GT_L3_MODE_MASK, fuse3);
> > --
> > 2.44.0
> >
>
> --
> Matt Roper
> Graphics Software Engineer
> Linux GPU Platform Enablement
> Intel Corporation
next prev parent reply other threads:[~2024-09-09 12:15 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-06 21:51 [PATCH 0/9] Add Xe3 and Panther Lake support Matt Atwood
2024-09-06 21:51 ` [PATCH 1/9] drm/xe/xe3: Xe3 uses the same PAT settings as Xe2 Matt Atwood
2024-09-06 22:39 ` Rodrigo Vivi
2024-09-06 23:12 ` Lucas De Marchi
2024-09-06 21:51 ` [PATCH 2/9] drm/xe/xe3: Define Xe3 feature flags Matt Atwood
2024-09-06 23:34 ` Matt Roper
2024-09-06 21:51 ` [PATCH 3/9] drm/xe/xe3: Generate and store the L3 bank mask Matt Atwood
2024-09-06 23:43 ` Matt Roper
2024-09-09 12:15 ` Francois Dugast [this message]
2024-09-06 21:51 ` [PATCH 4/9] drm/xe/xe3: Add initial set of workarounds Matt Atwood
2024-09-11 18:03 ` Matt Roper
2024-09-06 21:51 ` [PATCH 5/9] drm/xe/xe3: Extend wa_15015404425 for xe3 Matt Atwood
2024-09-06 23:52 ` Matt Roper
2024-09-11 20:17 ` Matt Roper
2024-09-06 21:51 ` [PATCH 6/9] drm/xe/xe3lpm: Add new "instance0" steering table Matt Atwood
2024-09-06 21:51 ` [PATCH 7/9] drm/xe/ptl: PTL re-uses Xe2 MOCS table Matt Atwood
2024-09-10 6:16 ` Chauhan, Shekhar
2024-09-06 21:51 ` [PATCH 8/9] drm/xe/ptl: Add performance tuning settings for PTL Matt Atwood
2024-09-06 23:55 ` Matt Roper
2024-09-10 6:37 ` Chauhan, Shekhar
2024-09-06 21:51 ` [PATCH 9/9] drm/xe/ptl: Add PTL platform definition Matt Atwood
2024-09-06 23:56 ` Matt Roper
2024-09-12 16:56 ` Matt Roper
2024-09-06 23:31 ` ✗ CI.checkpatch: warning for Add Xe3 and Panther Lake support Patchwork
2024-09-06 23:32 ` ✓ CI.KUnit: success " Patchwork
2024-09-06 23:44 ` ✓ CI.Build: " Patchwork
2024-09-06 23:46 ` ✓ CI.Hooks: " Patchwork
2024-09-06 23:48 ` ✓ CI.checksparse: " Patchwork
2024-09-07 0:30 ` ✓ 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=Zt7m4qXwFiPs4GAE@fdugast-desk \
--to=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
--cc=matthew.s.atwood@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