diff mbox series

[1/2] drm/i915/gt: Do not use stolen on MTL

Message ID 20230630170140.17319-1-nirmoy.das@intel.com (mailing list archive)
State New, archived
Headers show
Series [1/2] drm/i915/gt: Do not use stolen on MTL | expand

Commit Message

Nirmoy Das June 30, 2023, 5:01 p.m. UTC
Use smem on MTL due to a HW bug in MTL that prevents
reading from stolen memory using LMEM BAR.

Cc: Oak Zeng <oak.zeng@intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 drivers/gpu/drm/i915/gt/intel_gt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Zeng, Oak July 4, 2023, 3:01 p.m. UTC | #1
Hi Nirmoy,

The changes in this series make sense to me. I searched my code base, there are a few other places where stolen memory is allocated:

1) intel_dpt_create: I don't know what is dpt. Should we also consider this one? Maybe we never read from cpu?
2) create_ring_vma: I think cpu only write ring buffer but never read it. So should be okay.
3) vlv_rc6_init
4) there are a few places calling i915_gem_object_create_stolen_for_preallocated. I think this is also stolen memory?

For integrated gpu like MTL, do we use stolen memory for ggtt? If yes, does CPU only write ggtt/never read? 

Thanks,
Oak

> -----Original Message-----
> From: Das, Nirmoy <nirmoy.das@intel.com>
> Sent: June 30, 2023 1:02 PM
> To: intel-gfx@lists.freedesktop.org
> Cc: Das, Nirmoy <nirmoy.das@intel.com>; Zeng, Oak <oak.zeng@intel.com>; Jani
> Nikula <jani.nikula@linux.intel.com>; Joonas Lahtinen
> <joonas.lahtinen@linux.intel.com>; Andi Shyti <andi.shyti@linux.intel.com>;
> Hajda, Andrzej <andrzej.hajda@intel.com>
> Subject: [PATCH 1/2] drm/i915/gt: Do not use stolen on MTL
> 
> Use smem on MTL due to a HW bug in MTL that prevents
> reading from stolen memory using LMEM BAR.
> 
> Cc: Oak Zeng <oak.zeng@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_gt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c
> b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 33a61046ba58..9f64d61dd5fc 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -466,7 +466,7 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned
> int size)
>  	obj = i915_gem_object_create_lmem(i915, size,
>  					  I915_BO_ALLOC_VOLATILE |
>  					  I915_BO_ALLOC_GPU_ONLY);
> -	if (IS_ERR(obj))
> +	if (IS_ERR(obj) && !IS_METEORLAKE(i915)) /* Wa_22018444074 */
>  		obj = i915_gem_object_create_stolen(i915, size);
>  	if (IS_ERR(obj))
>  		obj = i915_gem_object_create_internal(i915, size);
> --
> 2.39.0
Nirmoy Das July 4, 2023, 3:31 p.m. UTC | #2
Hi Oak,

On 7/4/2023 5:01 PM, Zeng, Oak wrote:
> Hi Nirmoy,
>
> The changes in this series make sense to me. I searched my code base, there are a few other places where stolen memory is allocated:
Thanks for checking all the places.
>
> 1) intel_dpt_create: I don't know what is dpt. Should we also consider this one? Maybe we never read from cpu?
This expects i915_ggtt_has_aperture() which MTL doesn't have.
> 2) create_ring_vma: I think cpu only write ring buffer but never read it. So should be okay.
Same as above.
> 3) vlv_rc6_init
ThisĀ  seems to be only for IS_VALLEYVIEW().
> 4) there are a few places calling i915_gem_object_create_stolen_for_preallocated. I think this is also stolen memory?

Where is this from, do you mean I915_BO_PREALLOC ?


>
> For integrated gpu like MTL, do we use stolen memory for ggtt? If yes, does CPU only write ggtt/never read?

GTT pages only seems to be written.


Thanks,

Nirmoy

>
> Thanks,
> Oak
>
>> -----Original Message-----
>> From: Das, Nirmoy <nirmoy.das@intel.com>
>> Sent: June 30, 2023 1:02 PM
>> To: intel-gfx@lists.freedesktop.org
>> Cc: Das, Nirmoy <nirmoy.das@intel.com>; Zeng, Oak <oak.zeng@intel.com>; Jani
>> Nikula <jani.nikula@linux.intel.com>; Joonas Lahtinen
>> <joonas.lahtinen@linux.intel.com>; Andi Shyti <andi.shyti@linux.intel.com>;
>> Hajda, Andrzej <andrzej.hajda@intel.com>
>> Subject: [PATCH 1/2] drm/i915/gt: Do not use stolen on MTL
>>
>> Use smem on MTL due to a HW bug in MTL that prevents
>> reading from stolen memory using LMEM BAR.
>>
>> Cc: Oak Zeng <oak.zeng@intel.com>
>> Cc: Jani Nikula <jani.nikula@linux.intel.com>
>> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
>> Cc: Andi Shyti <andi.shyti@linux.intel.com>
>> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
>> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
>> ---
>>   drivers/gpu/drm/i915/gt/intel_gt.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c
>> b/drivers/gpu/drm/i915/gt/intel_gt.c
>> index 33a61046ba58..9f64d61dd5fc 100644
>> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
>> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
>> @@ -466,7 +466,7 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned
>> int size)
>>   	obj = i915_gem_object_create_lmem(i915, size,
>>   					  I915_BO_ALLOC_VOLATILE |
>>   					  I915_BO_ALLOC_GPU_ONLY);
>> -	if (IS_ERR(obj))
>> +	if (IS_ERR(obj) && !IS_METEORLAKE(i915)) /* Wa_22018444074 */
>>   		obj = i915_gem_object_create_stolen(i915, size);
>>   	if (IS_ERR(obj))
>>   		obj = i915_gem_object_create_internal(i915, size);
>> --
>> 2.39.0
Zeng, Oak July 4, 2023, 3:41 p.m. UTC | #3
Thanks,
Oak

> -----Original Message-----
> From: Nirmoy Das <nirmoy.das@linux.intel.com>
> Sent: July 4, 2023 11:31 AM
> To: Zeng, Oak <oak.zeng@intel.com>; Das, Nirmoy <nirmoy.das@intel.com>;
> intel-gfx@lists.freedesktop.org
> Cc: Hajda, Andrzej <andrzej.hajda@intel.com>
> Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/gt: Do not use stolen on MTL
> 
> Hi Oak,
> 
> On 7/4/2023 5:01 PM, Zeng, Oak wrote:
> > Hi Nirmoy,
> >
> > The changes in this series make sense to me. I searched my code base, there
> are a few other places where stolen memory is allocated:
> Thanks for checking all the places.
> >
> > 1) intel_dpt_create: I don't know what is dpt. Should we also consider this one?
> Maybe we never read from cpu?
> This expects i915_ggtt_has_aperture() which MTL doesn't have.
> > 2) create_ring_vma: I think cpu only write ring buffer but never read it. So
> should be okay.
> Same as above.
> > 3) vlv_rc6_init
> ThisĀ  seems to be only for IS_VALLEYVIEW().
> > 4) there are a few places calling
> i915_gem_object_create_stolen_for_preallocated. I think this is also stolen
> memory?
> 
> Where is this from, do you mean I915_BO_PREALLOC ?

I looked some internal code, and just realized upstream code is different 
Andrzej Hajda July 5, 2023, 9:51 a.m. UTC | #4
On 30.06.2023 19:01, Nirmoy Das wrote:
> Use smem on MTL due to a HW bug in MTL that prevents
> reading from stolen memory using LMEM BAR.
>
> Cc: Oak Zeng <oak.zeng@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Regards
Andrzej
> ---
>   drivers/gpu/drm/i915/gt/intel_gt.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index 33a61046ba58..9f64d61dd5fc 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -466,7 +466,7 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned int size)
>   	obj = i915_gem_object_create_lmem(i915, size,
>   					  I915_BO_ALLOC_VOLATILE |
>   					  I915_BO_ALLOC_GPU_ONLY);
> -	if (IS_ERR(obj))
> +	if (IS_ERR(obj) && !IS_METEORLAKE(i915)) /* Wa_22018444074 */
>   		obj = i915_gem_object_create_stolen(i915, size);
>   	if (IS_ERR(obj))
>   		obj = i915_gem_object_create_internal(i915, size);
Andi Shyti July 11, 2023, 2:48 p.m. UTC | #5
Hi Nirmoy,

On Fri, Jun 30, 2023 at 07:01:39PM +0200, Nirmoy Das wrote:
> Use smem on MTL due to a HW bug in MTL that prevents
> reading from stolen memory using LMEM BAR.
> 
> Cc: Oak Zeng <oak.zeng@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> Cc: Andi Shyti <andi.shyti@linux.intel.com>
> Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>

Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> 

Andi
Andi Shyti July 11, 2023, 2:50 p.m. UTC | #6
Hi,

On Tue, Jul 04, 2023 at 03:01:01PM +0000, Zeng, Oak wrote:
> Hi Nirmoy,
> 
> The changes in this series make sense to me. I searched my code base, there are a few other places where stolen memory is allocated:
> 
> 1) intel_dpt_create: I don't know what is dpt. Should we also consider this one? Maybe we never read from cpu?
> 2) create_ring_vma: I think cpu only write ring buffer but never read it. So should be okay.
> 3) vlv_rc6_init
> 4) there are a few places calling i915_gem_object_create_stolen_for_preallocated. I think this is also stolen memory?

sounds like we need a wrapper?

Andi

> For integrated gpu like MTL, do we use stolen memory for ggtt? If yes, does CPU only write ggtt/never read? 
> 
> Thanks,
> Oak
> 
> > -----Original Message-----
> > From: Das, Nirmoy <nirmoy.das@intel.com>
> > Sent: June 30, 2023 1:02 PM
> > To: intel-gfx@lists.freedesktop.org
> > Cc: Das, Nirmoy <nirmoy.das@intel.com>; Zeng, Oak <oak.zeng@intel.com>; Jani
> > Nikula <jani.nikula@linux.intel.com>; Joonas Lahtinen
> > <joonas.lahtinen@linux.intel.com>; Andi Shyti <andi.shyti@linux.intel.com>;
> > Hajda, Andrzej <andrzej.hajda@intel.com>
> > Subject: [PATCH 1/2] drm/i915/gt: Do not use stolen on MTL
> > 
> > Use smem on MTL due to a HW bug in MTL that prevents
> > reading from stolen memory using LMEM BAR.
> > 
> > Cc: Oak Zeng <oak.zeng@intel.com>
> > Cc: Jani Nikula <jani.nikula@linux.intel.com>
> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
> > Cc: Andi Shyti <andi.shyti@linux.intel.com>
> > Cc: Andrzej Hajda <andrzej.hajda@intel.com>
> > Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
> > ---
> >  drivers/gpu/drm/i915/gt/intel_gt.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c
> > b/drivers/gpu/drm/i915/gt/intel_gt.c
> > index 33a61046ba58..9f64d61dd5fc 100644
> > --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> > +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> > @@ -466,7 +466,7 @@ static int intel_gt_init_scratch(struct intel_gt *gt, unsigned
> > int size)
> >  	obj = i915_gem_object_create_lmem(i915, size,
> >  					  I915_BO_ALLOC_VOLATILE |
> >  					  I915_BO_ALLOC_GPU_ONLY);
> > -	if (IS_ERR(obj))
> > +	if (IS_ERR(obj) && !IS_METEORLAKE(i915)) /* Wa_22018444074 */
> >  		obj = i915_gem_object_create_stolen(i915, size);
> >  	if (IS_ERR(obj))
> >  		obj = i915_gem_object_create_internal(i915, size);
> > --
> > 2.39.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
index 33a61046ba58..9f64d61dd5fc 100644
--- a/drivers/gpu/drm/i915/gt/intel_gt.c
+++ b/drivers/gpu/drm/i915/gt/intel_gt.c
@@ -466,7 +466,7 @@  static int intel_gt_init_scratch(struct intel_gt *gt, unsigned int size)
 	obj = i915_gem_object_create_lmem(i915, size,
 					  I915_BO_ALLOC_VOLATILE |
 					  I915_BO_ALLOC_GPU_ONLY);
-	if (IS_ERR(obj))
+	if (IS_ERR(obj) && !IS_METEORLAKE(i915)) /* Wa_22018444074 */
 		obj = i915_gem_object_create_stolen(i915, size);
 	if (IS_ERR(obj))
 		obj = i915_gem_object_create_internal(i915, size);