All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: add workaround for some arm hardware issue
@ 2021-12-22  5:51 Victor Zhao
  2021-12-22  8:11 ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Victor Zhao @ 2021-12-22  5:51 UTC (permalink / raw)
  To: amd-gfx; +Cc: Victor Zhao

Some Arm based platform has hardware issue which may
generate incorrect addresses when receiving writes from the CPU
with a discontiguous set of byte enables. This affects the writes
with write combine property.

Workaround by change PROT_NORMAL_NC to PROT_DEVICE_nGnRE on arm.
As this is an issue with some specific arm based cpu, adding
a ttm parameter to control.

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
---
 drivers/gpu/drm/ttm/ttm_module.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_module.c b/drivers/gpu/drm/ttm/ttm_module.c
index e87f40674a4d..b27473cbbd52 100644
--- a/drivers/gpu/drm/ttm/ttm_module.c
+++ b/drivers/gpu/drm/ttm/ttm_module.c
@@ -41,6 +41,12 @@
 
 #include "ttm_module.h"
 
+static int enable_use_wc = 1;
+
+MODULE_PARM_DESC(enable_use_wc,
+	"control write combine usage on arm platform due to hardware issue with write combine found on some specific arm cpu (1 = enable(default), 0 = disable)");
+module_param(enable_use_wc, int, 0644);
+
 /**
  * ttm_prot_from_caching - Modify the page protection according to the
  * ttm cacing mode
@@ -63,7 +69,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp)
 #endif
 #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
 	defined(__powerpc__) || defined(__mips__)
-	if (caching == ttm_write_combined)
+	if (caching == ttm_write_combined && enable_use_wc != 0)
 		tmp = pgprot_writecombine(tmp);
 	else
 		tmp = pgprot_noncached(tmp);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
  2021-12-22  5:51 [PATCH] drm/ttm: add workaround for some arm hardware issue Victor Zhao
@ 2021-12-22  8:11 ` Christian König
  2021-12-22  8:18   ` Deng, Emily
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2021-12-22  8:11 UTC (permalink / raw)
  To: Victor Zhao, amd-gfx

Am 22.12.21 um 06:51 schrieb Victor Zhao:
> Some Arm based platform has hardware issue which may
> generate incorrect addresses when receiving writes from the CPU
> with a discontiguous set of byte enables. This affects the writes
> with write combine property.

Can you point out which arm platforms are that exactly?

> Workaround by change PROT_NORMAL_NC to PROT_DEVICE_nGnRE on arm.
> As this is an issue with some specific arm based cpu, adding
> a ttm parameter to control.

Something as fundamental as this should not be made controllable by an 
module parameter.

Write combining is very important for good performance and so we should 
only disable it on boards where we know that this won't work correctly.

Regards,
Christian.

>
> Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_module.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_module.c b/drivers/gpu/drm/ttm/ttm_module.c
> index e87f40674a4d..b27473cbbd52 100644
> --- a/drivers/gpu/drm/ttm/ttm_module.c
> +++ b/drivers/gpu/drm/ttm/ttm_module.c
> @@ -41,6 +41,12 @@
>   
>   #include "ttm_module.h"
>   
> +static int enable_use_wc = 1;
> +
> +MODULE_PARM_DESC(enable_use_wc,
> +	"control write combine usage on arm platform due to hardware issue with write combine found on some specific arm cpu (1 = enable(default), 0 = disable)");
> +module_param(enable_use_wc, int, 0644);
> +
>   /**
>    * ttm_prot_from_caching - Modify the page protection according to the
>    * ttm cacing mode
> @@ -63,7 +69,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching caching, pgprot_t tmp)
>   #endif
>   #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
>   	defined(__powerpc__) || defined(__mips__)
> -	if (caching == ttm_write_combined)
> +	if (caching == ttm_write_combined && enable_use_wc != 0)
>   		tmp = pgprot_writecombine(tmp);
>   	else
>   		tmp = pgprot_noncached(tmp);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] drm/ttm: add workaround for some arm hardware issue
  2021-12-22  8:11 ` Christian König
@ 2021-12-22  8:18   ` Deng, Emily
  2021-12-22 14:11     ` Alex Deucher
  0 siblings, 1 reply; 5+ messages in thread
From: Deng, Emily @ 2021-12-22  8:18 UTC (permalink / raw)
  To: Christian König, Zhao, Victor, amd-gfx

[AMD Official Use Only]

Currently, only ampere found this issue, but it is hard to detect ampere board, especially on arm passthrough environment.

Best wishes
Emily Deng



>-----Original Message-----
>From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
>Christian König
>Sent: Wednesday, December 22, 2021 4:11 PM
>To: Zhao, Victor <Victor.Zhao@amd.com>; amd-gfx@lists.freedesktop.org
>Subject: Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
>
>Am 22.12.21 um 06:51 schrieb Victor Zhao:
>> Some Arm based platform has hardware issue which may generate
>> incorrect addresses when receiving writes from the CPU with a
>> discontiguous set of byte enables. This affects the writes with write
>> combine property.
>
>Can you point out which arm platforms are that exactly?
>
>> Workaround by change PROT_NORMAL_NC to PROT_DEVICE_nGnRE on arm.
>> As this is an issue with some specific arm based cpu, adding a ttm
>> parameter to control.
>
>Something as fundamental as this should not be made controllable by an
>module parameter.
>
>Write combining is very important for good performance and so we should
>only disable it on boards where we know that this won't work correctly.
>
>Regards,
>Christian.
>
>>
>> Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_module.c | 8 +++++++-
>>   1 file changed, 7 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_module.c
>> b/drivers/gpu/drm/ttm/ttm_module.c
>> index e87f40674a4d..b27473cbbd52 100644
>> --- a/drivers/gpu/drm/ttm/ttm_module.c
>> +++ b/drivers/gpu/drm/ttm/ttm_module.c
>> @@ -41,6 +41,12 @@
>>
>>   #include "ttm_module.h"
>>
>> +static int enable_use_wc = 1;
>> +
>> +MODULE_PARM_DESC(enable_use_wc,
>> +    "control write combine usage on arm platform due to hardware issue
>> +with write combine found on some specific arm cpu (1 =
>> +enable(default), 0 = disable)"); module_param(enable_use_wc, int,
>> +0644);
>> +
>>   /**
>>    * ttm_prot_from_caching - Modify the page protection according to the
>>    * ttm cacing mode
>> @@ -63,7 +69,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching
>caching, pgprot_t tmp)
>>   #endif
>>   #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
>>      defined(__powerpc__) || defined(__mips__)
>> -    if (caching == ttm_write_combined)
>> +    if (caching == ttm_write_combined && enable_use_wc != 0)
>>              tmp = pgprot_writecombine(tmp);
>>      else
>>              tmp = pgprot_noncached(tmp);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
  2021-12-22  8:18   ` Deng, Emily
@ 2021-12-22 14:11     ` Alex Deucher
  2021-12-23  7:50       ` Christian König
  0 siblings, 1 reply; 5+ messages in thread
From: Alex Deucher @ 2021-12-22 14:11 UTC (permalink / raw)
  To: Deng, Emily; +Cc: Christian König, Zhao, Victor, amd-gfx

On Wed, Dec 22, 2021 at 3:18 AM Deng, Emily <Emily.Deng@amd.com> wrote:
>
> [AMD Official Use Only]
>
> Currently, only ampere found this issue, but it is hard to detect ampere board, especially on arm passthrough environment.

Isn't this already handled in drm_arch_can_wc_memory()?

Alex

>
> Best wishes
> Emily Deng
>
>
>
> >-----Original Message-----
> >From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
> >Christian König
> >Sent: Wednesday, December 22, 2021 4:11 PM
> >To: Zhao, Victor <Victor.Zhao@amd.com>; amd-gfx@lists.freedesktop.org
> >Subject: Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
> >
> >Am 22.12.21 um 06:51 schrieb Victor Zhao:
> >> Some Arm based platform has hardware issue which may generate
> >> incorrect addresses when receiving writes from the CPU with a
> >> discontiguous set of byte enables. This affects the writes with write
> >> combine property.
> >
> >Can you point out which arm platforms are that exactly?
> >
> >> Workaround by change PROT_NORMAL_NC to PROT_DEVICE_nGnRE on arm.
> >> As this is an issue with some specific arm based cpu, adding a ttm
> >> parameter to control.
> >
> >Something as fundamental as this should not be made controllable by an
> >module parameter.
> >
> >Write combining is very important for good performance and so we should
> >only disable it on boards where we know that this won't work correctly.
> >
> >Regards,
> >Christian.
> >
> >>
> >> Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
> >> ---
> >>   drivers/gpu/drm/ttm/ttm_module.c | 8 +++++++-
> >>   1 file changed, 7 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/gpu/drm/ttm/ttm_module.c
> >> b/drivers/gpu/drm/ttm/ttm_module.c
> >> index e87f40674a4d..b27473cbbd52 100644
> >> --- a/drivers/gpu/drm/ttm/ttm_module.c
> >> +++ b/drivers/gpu/drm/ttm/ttm_module.c
> >> @@ -41,6 +41,12 @@
> >>
> >>   #include "ttm_module.h"
> >>
> >> +static int enable_use_wc = 1;
> >> +
> >> +MODULE_PARM_DESC(enable_use_wc,
> >> +    "control write combine usage on arm platform due to hardware issue
> >> +with write combine found on some specific arm cpu (1 =
> >> +enable(default), 0 = disable)"); module_param(enable_use_wc, int,
> >> +0644);
> >> +
> >>   /**
> >>    * ttm_prot_from_caching - Modify the page protection according to the
> >>    * ttm cacing mode
> >> @@ -63,7 +69,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching
> >caching, pgprot_t tmp)
> >>   #endif
> >>   #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
> >>      defined(__powerpc__) || defined(__mips__)
> >> -    if (caching == ttm_write_combined)
> >> +    if (caching == ttm_write_combined && enable_use_wc != 0)
> >>              tmp = pgprot_writecombine(tmp);
> >>      else
> >>              tmp = pgprot_noncached(tmp);
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
  2021-12-22 14:11     ` Alex Deucher
@ 2021-12-23  7:50       ` Christian König
  0 siblings, 0 replies; 5+ messages in thread
From: Christian König @ 2021-12-23  7:50 UTC (permalink / raw)
  To: Alex Deucher, Deng, Emily; +Cc: Zhao, Victor, amd-gfx

Am 22.12.21 um 15:11 schrieb Alex Deucher:
> On Wed, Dec 22, 2021 at 3:18 AM Deng, Emily <Emily.Deng@amd.com> wrote:
>> [AMD Official Use Only]
>>
>> Currently, only ampere found this issue, but it is hard to detect ampere board, especially on arm passthrough environment.
> Isn't this already handled in drm_arch_can_wc_memory()?

Could be, that function controls if we are trying to setup USWC in the 
first place.

Christian

>
> Alex
>
>> Best wishes
>> Emily Deng
>>
>>
>>
>>> -----Original Message-----
>>> From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of
>>> Christian König
>>> Sent: Wednesday, December 22, 2021 4:11 PM
>>> To: Zhao, Victor <Victor.Zhao@amd.com>; amd-gfx@lists.freedesktop.org
>>> Subject: Re: [PATCH] drm/ttm: add workaround for some arm hardware issue
>>>
>>> Am 22.12.21 um 06:51 schrieb Victor Zhao:
>>>> Some Arm based platform has hardware issue which may generate
>>>> incorrect addresses when receiving writes from the CPU with a
>>>> discontiguous set of byte enables. This affects the writes with write
>>>> combine property.
>>> Can you point out which arm platforms are that exactly?
>>>
>>>> Workaround by change PROT_NORMAL_NC to PROT_DEVICE_nGnRE on arm.
>>>> As this is an issue with some specific arm based cpu, adding a ttm
>>>> parameter to control.
>>> Something as fundamental as this should not be made controllable by an
>>> module parameter.
>>>
>>> Write combining is very important for good performance and so we should
>>> only disable it on boards where we know that this won't work correctly.
>>>
>>> Regards,
>>> Christian.
>>>
>>>> Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
>>>> ---
>>>>    drivers/gpu/drm/ttm/ttm_module.c | 8 +++++++-
>>>>    1 file changed, 7 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/gpu/drm/ttm/ttm_module.c
>>>> b/drivers/gpu/drm/ttm/ttm_module.c
>>>> index e87f40674a4d..b27473cbbd52 100644
>>>> --- a/drivers/gpu/drm/ttm/ttm_module.c
>>>> +++ b/drivers/gpu/drm/ttm/ttm_module.c
>>>> @@ -41,6 +41,12 @@
>>>>
>>>>    #include "ttm_module.h"
>>>>
>>>> +static int enable_use_wc = 1;
>>>> +
>>>> +MODULE_PARM_DESC(enable_use_wc,
>>>> +    "control write combine usage on arm platform due to hardware issue
>>>> +with write combine found on some specific arm cpu (1 =
>>>> +enable(default), 0 = disable)"); module_param(enable_use_wc, int,
>>>> +0644);
>>>> +
>>>>    /**
>>>>     * ttm_prot_from_caching - Modify the page protection according to the
>>>>     * ttm cacing mode
>>>> @@ -63,7 +69,7 @@ pgprot_t ttm_prot_from_caching(enum ttm_caching
>>> caching, pgprot_t tmp)
>>>>    #endif
>>>>    #if defined(__ia64__) || defined(__arm__) || defined(__aarch64__) || \
>>>>       defined(__powerpc__) || defined(__mips__)
>>>> -    if (caching == ttm_write_combined)
>>>> +    if (caching == ttm_write_combined && enable_use_wc != 0)
>>>>               tmp = pgprot_writecombine(tmp);
>>>>       else
>>>>               tmp = pgprot_noncached(tmp);


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-12-23  7:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  5:51 [PATCH] drm/ttm: add workaround for some arm hardware issue Victor Zhao
2021-12-22  8:11 ` Christian König
2021-12-22  8:18   ` Deng, Emily
2021-12-22 14:11     ` Alex Deucher
2021-12-23  7:50       ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.