diff mbox series

[1/6] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3

Message ID 20210622162339.761651-1-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/6] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3 | expand

Commit Message

Andrey Grodzovsky June 22, 2021, 4:23 p.m. UTC
From: Lang Yu <Lang.Yu@amd.com>

Sometimes drivers need to use bounce buffers to evict BOs. While those reside
in some domain they are not necessarily suitable for CS.

Add a flag so that drivers can note that a bounce buffers needs to be
reallocated during validation.

v2: add detailed comments
v3 (chk): merge commits and rework commit message

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo.c    | 3 +++
 include/drm/ttm/ttm_placement.h | 7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Das, Nirmoy June 23, 2021, 6:18 p.m. UTC | #1
Tried on vmwgfx and amdgpu, everything looks fine. I would have love to 
do a kfdtest as

I think kfdtest does bo movement tests but it seems kfdtest regressing 
even before this series. Trying to debug that.


The series is Acked-by: Nirmoy Das <nirmoy.das@amd.com>


On 6/22/2021 6:23 PM, Andrey Grodzovsky wrote:
> From: Lang Yu <Lang.Yu@amd.com>
>
> Sometimes drivers need to use bounce buffers to evict BOs. While those reside
> in some domain they are not necessarily suitable for CS.
>
> Add a flag so that drivers can note that a bounce buffers needs to be
> reallocated during validation.
>
> v2: add detailed comments
> v3 (chk): merge commits and rework commit message
>
> Suggested-by: Christian König <christian.koenig@amd.com>
> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c    | 3 +++
>   include/drm/ttm/ttm_placement.h | 7 +++++--
>   2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index db53fecca696..45145d02aed2 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -913,6 +913,9 @@ static bool ttm_bo_places_compat(const struct ttm_place *places,
>   {
>   	unsigned i;
>   
> +	if (mem->placement & TTM_PL_FLAG_TEMPORARY)
> +		return false;
> +
>   	for (i = 0; i < num_placement; i++) {
>   		const struct ttm_place *heap = &places[i];
>   
> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index aa6ba4d0cf78..8995c9e4ec1b 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -47,8 +47,11 @@
>    * top of the memory area, instead of the bottom.
>    */
>   
> -#define TTM_PL_FLAG_CONTIGUOUS  (1 << 19)
> -#define TTM_PL_FLAG_TOPDOWN     (1 << 22)
> +#define TTM_PL_FLAG_CONTIGUOUS  (1 << 0)
> +#define TTM_PL_FLAG_TOPDOWN     (1 << 1)
> +
> +/* For multihop handling */
> +#define TTM_PL_FLAG_TEMPORARY   (1 << 2)
>   
>   /**
>    * struct ttm_place
Andrey Grodzovsky June 23, 2021, 7:10 p.m. UTC | #2
Thanks Nirmoy.

Pushed to drm-misc-next.

Andrey

On 2021-06-23 2:18 p.m., Das, Nirmoy wrote:
> Tried on vmwgfx and amdgpu, everything looks fine. I would have love 
> to do a kfdtest as
>
> I think kfdtest does bo movement tests but it seems kfdtest regressing 
> even before this series. Trying to debug that.
>
>
> The series is Acked-by: Nirmoy Das <nirmoy.das@amd.com>
>
>
> On 6/22/2021 6:23 PM, Andrey Grodzovsky wrote:
>> From: Lang Yu <Lang.Yu@amd.com>
>>
>> Sometimes drivers need to use bounce buffers to evict BOs. While 
>> those reside
>> in some domain they are not necessarily suitable for CS.
>>
>> Add a flag so that drivers can note that a bounce buffers needs to be
>> reallocated during validation.
>>
>> v2: add detailed comments
>> v3 (chk): merge commits and rework commit message
>>
>> Suggested-by: Christian König <christian.koenig@amd.com>
>> Signed-off-by: Lang Yu <Lang.Yu@amd.com>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_bo.c    | 3 +++
>>   include/drm/ttm/ttm_placement.h | 7 +++++--
>>   2 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
>> index db53fecca696..45145d02aed2 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -913,6 +913,9 @@ static bool ttm_bo_places_compat(const struct 
>> ttm_place *places,
>>   {
>>       unsigned i;
>>   +    if (mem->placement & TTM_PL_FLAG_TEMPORARY)
>> +        return false;
>> +
>>       for (i = 0; i < num_placement; i++) {
>>           const struct ttm_place *heap = &places[i];
>>   diff --git a/include/drm/ttm/ttm_placement.h 
>> b/include/drm/ttm/ttm_placement.h
>> index aa6ba4d0cf78..8995c9e4ec1b 100644
>> --- a/include/drm/ttm/ttm_placement.h
>> +++ b/include/drm/ttm/ttm_placement.h
>> @@ -47,8 +47,11 @@
>>    * top of the memory area, instead of the bottom.
>>    */
>>   -#define TTM_PL_FLAG_CONTIGUOUS  (1 << 19)
>> -#define TTM_PL_FLAG_TOPDOWN     (1 << 22)
>> +#define TTM_PL_FLAG_CONTIGUOUS  (1 << 0)
>> +#define TTM_PL_FLAG_TOPDOWN     (1 << 1)
>> +
>> +/* For multihop handling */
>> +#define TTM_PL_FLAG_TEMPORARY   (1 << 2)
>>     /**
>>    * struct ttm_place
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index db53fecca696..45145d02aed2 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -913,6 +913,9 @@  static bool ttm_bo_places_compat(const struct ttm_place *places,
 {
 	unsigned i;
 
+	if (mem->placement & TTM_PL_FLAG_TEMPORARY)
+		return false;
+
 	for (i = 0; i < num_placement; i++) {
 		const struct ttm_place *heap = &places[i];
 
diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
index aa6ba4d0cf78..8995c9e4ec1b 100644
--- a/include/drm/ttm/ttm_placement.h
+++ b/include/drm/ttm/ttm_placement.h
@@ -47,8 +47,11 @@ 
  * top of the memory area, instead of the bottom.
  */
 
-#define TTM_PL_FLAG_CONTIGUOUS  (1 << 19)
-#define TTM_PL_FLAG_TOPDOWN     (1 << 22)
+#define TTM_PL_FLAG_CONTIGUOUS  (1 << 0)
+#define TTM_PL_FLAG_TOPDOWN     (1 << 1)
+
+/* For multihop handling */
+#define TTM_PL_FLAG_TEMPORARY   (1 << 2)
 
 /**
  * struct ttm_place