diff mbox series

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

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

Commit Message

Christian König June 1, 2021, 12:25 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

Christian König June 7, 2021, 12:36 p.m. UTC | #1
Thomas any comments on this?

Is the purpose of this now clear enough?

Thanks,
Christian.

Am 01.06.21 um 14:25 schrieb Christian König:
> 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 51a94fd63bd7..6b393502198e 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -929,6 +929,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
Thomas Hellström (Intel) June 7, 2021, 12:38 p.m. UTC | #2
Sure. LGTM,

Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>


On 6/7/21 2:36 PM, Christian König wrote:
> Thomas any comments on this?
>
> Is the purpose of this now clear enough?
>
> Thanks,
> Christian.
>
> Am 01.06.21 um 14:25 schrieb Christian König:
>> 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 51a94fd63bd7..6b393502198e 100644
>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> @@ -929,6 +929,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
Christian König June 7, 2021, 12:41 p.m. UTC | #3
Thanks!

Lang can anybody from your team give as an reviewed-by/test-by on the 
amdgpu patches? I just want another pair of eyes looking over it.

If nobody else has time I will ask Nirmoy for a quick testing round.

Thanks,
Christian.

Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
> Sure. LGTM,
>
> Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>
>
> On 6/7/21 2:36 PM, Christian König wrote:
>> Thomas any comments on this?
>>
>> Is the purpose of this now clear enough?
>>
>> Thanks,
>> Christian.
>>
>> Am 01.06.21 um 14:25 schrieb Christian König:
>>> 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 51a94fd63bd7..6b393502198e 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>> @@ -929,6 +929,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
Lang Yu June 7, 2021, 12:58 p.m. UTC | #4
[AMD Official Use Only]

Thanks,please let Nirmoy do it.

Regards,
Lang

获取 Outlook for iOS<https://aka.ms/o0ukef>
Christian König June 7, 2021, 1:01 p.m. UTC | #5
Hi Nirmoy,

can you give that patch set a testing round and an review?

The memory stress test with low VRAM on APUs should be sufficient and 
you should have that setup still around.

Thanks in advance,
Christian.

Am 07.06.21 um 14:58 schrieb Yu, Lang:
>
> [AMD Official Use Only]
>
>
> Thanks,please let Nirmoy do it.
>
> Regards,
> Lang
>
> 获取 Outlook for iOS <https://aka.ms/o0ukef>
> ------------------------------------------------------------------------
> *发件人:* Christian König <ckoenig.leichtzumerken@gmail.com>
> *发送时间:* Monday, June 7, 2021 8:41:49 PM
> *收件人:* Thomas Hellström (Intel) <thomas_os@shipmail.org>; Yu, Lang 
> <Lang.Yu@amd.com>
> *抄送:* dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>
> *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3
> Thanks!
>
> Lang can anybody from your team give as an reviewed-by/test-by on the
> amdgpu patches? I just want another pair of eyes looking over it.
>
> If nobody else has time I will ask Nirmoy for a quick testing round.
>
> Thanks,
> Christian.
>
> Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
> > Sure. LGTM,
> >
> > Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> >
> >
> > On 6/7/21 2:36 PM, Christian König wrote:
> >> Thomas any comments on this?
> >>
> >> Is the purpose of this now clear enough?
> >>
> >> Thanks,
> >> Christian.
> >>
> >> Am 01.06.21 um 14:25 schrieb Christian König:
> >>> 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 51a94fd63bd7..6b393502198e 100644
> >>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> >>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> >>> @@ -929,6 +929,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
>
Das, Nirmoy June 7, 2021, 2:42 p.m. UTC | #6
On 6/7/2021 3:01 PM, Christian König wrote:
> Hi Nirmoy,
>
> can you give that patch set a testing round and an review?


Sure! I will get back asap.

>
> The memory stress test with low VRAM on APUs should be sufficient and 
> you should have that setup still around.
>
> Thanks in advance,
> Christian.
>
> Am 07.06.21 um 14:58 schrieb Yu, Lang:
>>
>> [AMD Official Use Only]
>>
>>
>> Thanks,please let Nirmoy do it.
>>
>> Regards,
>> Lang
>>
>> 获取 Outlook for iOS 
>> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fo0ukef&data=04%7C01%7Cnirmoy.das%40amd.com%7Ca1e4256424cb46841b6b08d929b45120%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637586676695741160%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=m6t3vxIQ%2BgRQJvI27G9gHtR2XN7Hoyg6WXkG6uDRTbc%3D&reserved=0>
>> ------------------------------------------------------------------------
>> *发件人:* Christian König <ckoenig.leichtzumerken@gmail.com>
>> *发送时间:* Monday, June 7, 2021 8:41:49 PM
>> *收件人:* Thomas Hellström (Intel) <thomas_os@shipmail.org>; Yu, Lang 
>> <Lang.Yu@amd.com>
>> *抄送:* dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>
>> *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3
>> Thanks!
>>
>> Lang can anybody from your team give as an reviewed-by/test-by on the
>> amdgpu patches? I just want another pair of eyes looking over it.
>>
>> If nobody else has time I will ask Nirmoy for a quick testing round.
>>
>> Thanks,
>> Christian.
>>
>> Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
>> > Sure. LGTM,
>> >
>> > Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> >
>> >
>> > On 6/7/21 2:36 PM, Christian König wrote:
>> >> Thomas any comments on this?
>> >>
>> >> Is the purpose of this now clear enough?
>> >>
>> >> Thanks,
>> >> Christian.
>> >>
>> >> Am 01.06.21 um 14:25 schrieb Christian König:
>> >>> 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 51a94fd63bd7..6b393502198e 100644
>> >>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>> >>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>> >>> @@ -929,6 +929,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
>>
>
Das, Nirmoy June 7, 2021, 3:27 p.m. UTC | #7
Hi Christian and Lang,


I can't apply it cleanly because of 
https://patchwork.freedesktop.org/patch/436305/. This series needs a rebase.


Regards,

Nirmoy

On 6/7/2021 4:42 PM, Das, Nirmoy wrote:
>
>
> On 6/7/2021 3:01 PM, Christian König wrote:
>> Hi Nirmoy,
>>
>> can you give that patch set a testing round and an review?
>
>
> Sure! I will get back asap.
>
>>
>> The memory stress test with low VRAM on APUs should be sufficient and 
>> you should have that setup still around.
>>
>> Thanks in advance,
>> Christian.
>>
>> Am 07.06.21 um 14:58 schrieb Yu, Lang:
>>>
>>> [AMD Official Use Only]
>>>
>>>
>>> Thanks,please let Nirmoy do it.
>>>
>>> Regards,
>>> Lang
>>>
>>> 获取 Outlook for iOS 
>>> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Faka.ms%2Fo0ukef&data=04%7C01%7Cnirmoy.das%40amd.com%7Cd789a01a337743638ed308d929c28fa0%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637586737878220366%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TkIx1d6hvZtrP6iQihfUlrB6oBP9QZGfNa08anYm4X4%3D&reserved=0>
>>> ------------------------------------------------------------------------
>>> *发件人:* Christian König <ckoenig.leichtzumerken@gmail.com>
>>> *发送时间:* Monday, June 7, 2021 8:41:49 PM
>>> *收件人:* Thomas Hellström (Intel) <thomas_os@shipmail.org>; Yu, Lang 
>>> <Lang.Yu@amd.com>
>>> *抄送:* dri-devel@lists.freedesktop.org 
>>> <dri-devel@lists.freedesktop.org>
>>> *主题:* Re: [PATCH 1/4] drm/ttm: add TTM_PL_FLAG_TEMPORARY flag v3
>>> Thanks!
>>>
>>> Lang can anybody from your team give as an reviewed-by/test-by on the
>>> amdgpu patches? I just want another pair of eyes looking over it.
>>>
>>> If nobody else has time I will ask Nirmoy for a quick testing round.
>>>
>>> Thanks,
>>> Christian.
>>>
>>> Am 07.06.21 um 14:38 schrieb Thomas Hellström (Intel):
>>> > Sure. LGTM,
>>> >
>>> > Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>>> >
>>> >
>>> > On 6/7/21 2:36 PM, Christian König wrote:
>>> >> Thomas any comments on this?
>>> >>
>>> >> Is the purpose of this now clear enough?
>>> >>
>>> >> Thanks,
>>> >> Christian.
>>> >>
>>> >> Am 01.06.21 um 14:25 schrieb Christian König:
>>> >>> 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 51a94fd63bd7..6b393502198e 100644
>>> >>> --- a/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
>>> >>> @@ -929,6 +929,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 51a94fd63bd7..6b393502198e 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -929,6 +929,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