[Intel-xe] [PATCH] drm/xe: Fix wopcm size

Balasubramani Vivekanandan balasubramani.vivekanandan at intel.com
Mon Feb 20 10:06:38 UTC 2023


On 16.02.2023 15:17, Lucas De Marchi wrote:
> On Wed, Feb 15, 2023 at 07:33:29PM +0530, Balasubramani Vivekanandan wrote:
> > The wopcm size returned by xe_wopcm_size function is used in calculating
> > the GuC wopcm base offset and the GuC wopcm size. It is also used to
> > find the size of the wopcm space to be reserved at the bottom of the
> > GGTT address space. So it is the per-GT wopcm size and not the total
> > wopcm area used by all GTs.
> > Fix the wopcm size to 2MB which is the wopcm size per-GT for platforms
> > above Gen11.
> 
> Bspec 67948 contradicts this. It says WOPCM may be 1, 2, 4 or 8 MB and
> you have to read the registers set up by BIOS to figure that out.

Agree Bpsec 67948 (rather actually the next page 44982) says wopcm size
can be 1/2/4/8 MB in size.
But the *_WOPCM_SIZE macros in question here is not really used by the
driver for any wopcm size related purpose. Driver does not dictate or define
the wopcm size based on this macros, but the macros are used by the
driver to find the offsets of other regions within wopcm like the offset
of the guc base, end of guc etc. Top of the GuC region within wopcm is
calculated as a fixed offset of the *_WOPCM_SIZE macro. So the macro
value is actually impacting the guc wopcm size not the total wopcm size.

Also with most wopcm code reused from i915, *_WOPMC_SIZE macros also
exist in i915 and it is fixed as 2MB for all platforms from Gen11.

The original code is trying to define this macros as a multiple of 2MB
for multitile platforms. For platforms with 2-tile configuration it has
defined the macros as 4MB (2 x 2MB).
But the driver is not really using this macro for wopcm size related
purposes. The offset calculations based on the macro would go wrong.
The macros should remain fixed even for multitile platforms.

Regards,
Bala

> 
> It seems there's some confusion in xe_wopcm between WOPCM_SIZE
> (the total size of WOPCM) and GUC_WOPCM_SIZE (the GuC's size in the
> wopcm region)?
> 
> Lucas De Marchi
> 
> > 
> > Signed-off-by: Balasubramani Vivekanandan <balasubramani.vivekanandan at intel.com>
> > ---
> > drivers/gpu/drm/xe/xe_wopcm.c | 10 +---------
> > 1 file changed, 1 insertion(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/xe/xe_wopcm.c b/drivers/gpu/drm/xe/xe_wopcm.c
> > index 8fe182afa06c..a88d02357cb6 100644
> > --- a/drivers/gpu/drm/xe/xe_wopcm.c
> > +++ b/drivers/gpu/drm/xe/xe_wopcm.c
> > @@ -46,12 +46,6 @@
> >  */
> > 
> > /* Default WOPCM size is 2MB from Gen11, 1MB on previous platforms */
> > -#define DGFX_WOPCM_SIZE			SZ_4M	/* FIXME: Larger size require
> > -						   for 2 tile PVC, do a proper
> > -						   probe sooner or later */
> > -#define MTL_WOPCM_SIZE			SZ_4M	/* FIXME: Larger size require
> > -						   for MTL, do a proper probe
> > -						   sooner or later */
> > #define GEN11_WOPCM_SIZE		SZ_2M
> > /* 16KB WOPCM (RSVD WOPCM) is reserved from HuC firmware top. */
> > #define WOPCM_RESERVED_SIZE		SZ_16K
> > @@ -178,9 +172,7 @@ static int __wopcm_init_regs(struct xe_device *xe, struct xe_gt *gt,
> > 
> > u32 xe_wopcm_size(struct xe_device *xe)
> > {
> > -	return IS_DGFX(xe) ? DGFX_WOPCM_SIZE :
> > -		xe->info.platform == XE_METEORLAKE ? MTL_WOPCM_SIZE :
> > -		GEN11_WOPCM_SIZE;
> > +	return GEN11_WOPCM_SIZE;
> > }
> > 
> > /**
> > -- 
> > 2.34.1
> > 


More information about the Intel-xe mailing list