diff mbox series

[v2,2/2] drm/i915/display: Do not use stolen on MTL

Message ID 20230711220648.17108-2-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 July 11, 2023, 10:06 p.m. UTC
Use smem on MTL due to a HW bug in MTL that prevents
reading from stolen memory using LMEM BAR.

v2: improve stolen skip detection(Andrzej)

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: Oak Zeng <oak.zeng@intel.com>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
---
 drivers/gpu/drm/i915/display/intel_fbdev.c   | 5 ++++-
 drivers/gpu/drm/i915/display/intel_overlay.c | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

Comments

Nirmoy Das July 13, 2023, 2:45 p.m. UTC | #1
On 7/12/2023 12:06 AM, Nirmoy Das wrote:
> Use smem on MTL due to a HW bug in MTL that prevents
> reading from stolen memory using LMEM BAR.
>
> v2: improve stolen skip detection(Andrzej)
>
> 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: Oak Zeng <oak.zeng@intel.com>
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
> ---
>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 5 ++++-
>   drivers/gpu/drm/i915/display/intel_overlay.c | 5 +++--
>   2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
> index 1cc0ddc6a310..e019bbcd474e 100644
> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
> @@ -187,8 +187,11 @@ static int intelfb_alloc(struct drm_fb_helper *helper,
>   		 * If the FB is too big, just don't use it since fbdev is not very
>   		 * important and we should probably use that space with FBC or other
>   		 * features.
> +		 *
> +		 * Also skip stolen on MTL as Wa_22018444074 mitigation.
>   		 */
> -		if (size * 2 < dev_priv->dsm.usable_size)
> +		if (size * 2 < dev_priv->dsm.usable_size ||
> +		    !(IS_METEORLAKE(dev_priv)))

Just realized  this is wrong, stolen will be picked on non-mtl even if 
the stolen usable size is < 2*size which is not expected.

I will keep this as v1


Regards,

Nirmoy

>   			obj = i915_gem_object_create_stolen(dev_priv, size);
>   		if (IS_ERR(obj))
>   			obj = i915_gem_object_create_shmem(dev_priv, size);
> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
> index d6fe2bbabe55..09c1aa1427ad 100644
> --- a/drivers/gpu/drm/i915/display/intel_overlay.c
> +++ b/drivers/gpu/drm/i915/display/intel_overlay.c
> @@ -1348,11 +1348,12 @@ int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
>   static int get_registers(struct intel_overlay *overlay, bool use_phys)
>   {
>   	struct drm_i915_private *i915 = overlay->i915;
> -	struct drm_i915_gem_object *obj;
> +	struct drm_i915_gem_object *obj = ERR_PTR(-ENODEV);
>   	struct i915_vma *vma;
>   	int err;
>   
> -	obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
> +	if (!IS_METEORLAKE(i915)) /* Wa_22018444074 */
> +		obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
>   	if (IS_ERR(obj))
>   		obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
>   	if (IS_ERR(obj))
Andrzej Hajda July 13, 2023, 2:56 p.m. UTC | #2
On 13.07.2023 16:45, Nirmoy Das wrote:
>
> On 7/12/2023 12:06 AM, Nirmoy Das wrote:
>> Use smem on MTL due to a HW bug in MTL that prevents
>> reading from stolen memory using LMEM BAR.
>>
>> v2: improve stolen skip detection(Andrzej)
>>
>> 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: Oak Zeng <oak.zeng@intel.com>
>> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
>> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 5 ++++-
>>   drivers/gpu/drm/i915/display/intel_overlay.c | 5 +++--
>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
>> b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> index 1cc0ddc6a310..e019bbcd474e 100644
>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>> @@ -187,8 +187,11 @@ static int intelfb_alloc(struct drm_fb_helper 
>> *helper,
>>            * If the FB is too big, just don't use it since fbdev is 
>> not very
>>            * important and we should probably use that space with FBC 
>> or other
>>            * features.
>> +         *
>> +         * Also skip stolen on MTL as Wa_22018444074 mitigation.
>>            */
>> -        if (size * 2 < dev_priv->dsm.usable_size)
>> +        if (size * 2 < dev_priv->dsm.usable_size ||
>> +            !(IS_METEORLAKE(dev_priv)))
>
> Just realized  this is wrong, stolen will be picked on non-mtl even if 
> the stolen usable size is < 2*size which is not expected.

if (!(IS_METEORLAKE(dev_priv)) && size * 2 < dev_priv->dsm.usable_size) ?

Regards
Andrzej

>
> I will keep this as v1
>
>
> Regards,
>
> Nirmoy
>
>>               obj = i915_gem_object_create_stolen(dev_priv, size);
>>           if (IS_ERR(obj))
>>               obj = i915_gem_object_create_shmem(dev_priv, size);
>> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
>> b/drivers/gpu/drm/i915/display/intel_overlay.c
>> index d6fe2bbabe55..09c1aa1427ad 100644
>> --- a/drivers/gpu/drm/i915/display/intel_overlay.c
>> +++ b/drivers/gpu/drm/i915/display/intel_overlay.c
>> @@ -1348,11 +1348,12 @@ int intel_overlay_attrs_ioctl(struct 
>> drm_device *dev, void *data,
>>   static int get_registers(struct intel_overlay *overlay, bool use_phys)
>>   {
>>       struct drm_i915_private *i915 = overlay->i915;
>> -    struct drm_i915_gem_object *obj;
>> +    struct drm_i915_gem_object *obj = ERR_PTR(-ENODEV);
>>       struct i915_vma *vma;
>>       int err;
>>   -    obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
>> +    if (!IS_METEORLAKE(i915)) /* Wa_22018444074 */
>> +        obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
>>       if (IS_ERR(obj))
>>           obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
>>       if (IS_ERR(obj))
Nirmoy Das July 13, 2023, 3:02 p.m. UTC | #3
On 7/13/2023 4:56 PM, Andrzej Hajda wrote:
>
>
> On 13.07.2023 16:45, Nirmoy Das wrote:
>>
>> On 7/12/2023 12:06 AM, Nirmoy Das wrote:
>>> Use smem on MTL due to a HW bug in MTL that prevents
>>> reading from stolen memory using LMEM BAR.
>>>
>>> v2: improve stolen skip detection(Andrzej)
>>>
>>> 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: Oak Zeng <oak.zeng@intel.com>
>>> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
>>> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
>>> ---
>>>   drivers/gpu/drm/i915/display/intel_fbdev.c   | 5 ++++-
>>>   drivers/gpu/drm/i915/display/intel_overlay.c | 5 +++--
>>>   2 files changed, 7 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c 
>>> b/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> index 1cc0ddc6a310..e019bbcd474e 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
>>> @@ -187,8 +187,11 @@ static int intelfb_alloc(struct drm_fb_helper 
>>> *helper,
>>>            * If the FB is too big, just don't use it since fbdev is 
>>> not very
>>>            * important and we should probably use that space with 
>>> FBC or other
>>>            * features.
>>> +         *
>>> +         * Also skip stolen on MTL as Wa_22018444074 mitigation.
>>>            */
>>> -        if (size * 2 < dev_priv->dsm.usable_size)
>>> +        if (size * 2 < dev_priv->dsm.usable_size ||
>>> +            !(IS_METEORLAKE(dev_priv)))
>>
>> Just realized  this is wrong, stolen will be picked on non-mtl even 
>> if the stolen usable size is < 2*size which is not expected.
>
> if (!(IS_METEORLAKE(dev_priv)) && size * 2 < dev_priv->dsm.usable_size) ?


that should work, resent with that.


Thanks,

Nirmoy

>
> Regards
> Andrzej
>
>>
>> I will keep this as v1
>>
>>
>> Regards,
>>
>> Nirmoy
>>
>>>               obj = i915_gem_object_create_stolen(dev_priv, size);
>>>           if (IS_ERR(obj))
>>>               obj = i915_gem_object_create_shmem(dev_priv, size);
>>> diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c 
>>> b/drivers/gpu/drm/i915/display/intel_overlay.c
>>> index d6fe2bbabe55..09c1aa1427ad 100644
>>> --- a/drivers/gpu/drm/i915/display/intel_overlay.c
>>> +++ b/drivers/gpu/drm/i915/display/intel_overlay.c
>>> @@ -1348,11 +1348,12 @@ int intel_overlay_attrs_ioctl(struct 
>>> drm_device *dev, void *data,
>>>   static int get_registers(struct intel_overlay *overlay, bool 
>>> use_phys)
>>>   {
>>>       struct drm_i915_private *i915 = overlay->i915;
>>> -    struct drm_i915_gem_object *obj;
>>> +    struct drm_i915_gem_object *obj = ERR_PTR(-ENODEV);
>>>       struct i915_vma *vma;
>>>       int err;
>>>   -    obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
>>> +    if (!IS_METEORLAKE(i915)) /* Wa_22018444074 */
>>> +        obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
>>>       if (IS_ERR(obj))
>>>           obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
>>>       if (IS_ERR(obj))
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_fbdev.c b/drivers/gpu/drm/i915/display/intel_fbdev.c
index 1cc0ddc6a310..e019bbcd474e 100644
--- a/drivers/gpu/drm/i915/display/intel_fbdev.c
+++ b/drivers/gpu/drm/i915/display/intel_fbdev.c
@@ -187,8 +187,11 @@  static int intelfb_alloc(struct drm_fb_helper *helper,
 		 * If the FB is too big, just don't use it since fbdev is not very
 		 * important and we should probably use that space with FBC or other
 		 * features.
+		 *
+		 * Also skip stolen on MTL as Wa_22018444074 mitigation.
 		 */
-		if (size * 2 < dev_priv->dsm.usable_size)
+		if (size * 2 < dev_priv->dsm.usable_size ||
+		    !(IS_METEORLAKE(dev_priv)))
 			obj = i915_gem_object_create_stolen(dev_priv, size);
 		if (IS_ERR(obj))
 			obj = i915_gem_object_create_shmem(dev_priv, size);
diff --git a/drivers/gpu/drm/i915/display/intel_overlay.c b/drivers/gpu/drm/i915/display/intel_overlay.c
index d6fe2bbabe55..09c1aa1427ad 100644
--- a/drivers/gpu/drm/i915/display/intel_overlay.c
+++ b/drivers/gpu/drm/i915/display/intel_overlay.c
@@ -1348,11 +1348,12 @@  int intel_overlay_attrs_ioctl(struct drm_device *dev, void *data,
 static int get_registers(struct intel_overlay *overlay, bool use_phys)
 {
 	struct drm_i915_private *i915 = overlay->i915;
-	struct drm_i915_gem_object *obj;
+	struct drm_i915_gem_object *obj = ERR_PTR(-ENODEV);
 	struct i915_vma *vma;
 	int err;
 
-	obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
+	if (!IS_METEORLAKE(i915)) /* Wa_22018444074 */
+		obj = i915_gem_object_create_stolen(i915, PAGE_SIZE);
 	if (IS_ERR(obj))
 		obj = i915_gem_object_create_internal(i915, PAGE_SIZE);
 	if (IS_ERR(obj))