mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn
@ 2026-06-26  6:36 Arunpravin Paneer Selvam
  2026-06-26 10:57 ` Tvrtko Ursulin
  0 siblings, 1 reply; 4+ messages in thread
From: Arunpravin Paneer Selvam @ 2026-06-26  6:36 UTC (permalink / raw)
  To: christian.koenig, tursulin, dri-devel, intel-gfx, intel-xe,
	amd-gfx, nouveau, linux-kernel
  Cc: alexander.deucher, Arunpravin Paneer Selvam,
	Thomas Hellström, Matthew Auld, Matthew Brost

The fpfn/lpfn fields in struct ttm_place are named after page frame
numbers, but they are really just placement parameters interpreted by
the backend resource manager. Wrap them in a union with a generic
drvparam[2] array so backends can access the same storage without the
PFN-specific naming.

drvparam[0]/drvparam[1] alias fpfn/lpfn, so existing users and the
VRAM range manager are unchanged. This decouples the API from
PFN/range-specific semantics so that these fields can be used more
flexibly in the future (e.g. mask-based or segment-aware placement
constraints). No functional change.

v2: Use a union exposing a generic drvparam[2] array instead of
    renaming fpfn/lpfn to param1/param2, keeping existing users
    unchanged (Tvrtko Ursulin)

Suggested-by: Christian König <christian.koenig@amd.com>
Assisted-by: Claude:claude-opus-4-8
Cc: Christian König <christian.koenig@amd.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
---
 include/drm/ttm/ttm_placement.h | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
index ab2639e42c54..7db2073f3236 100644
--- a/include/drm/ttm/ttm_placement.h
+++ b/include/drm/ttm/ttm_placement.h
@@ -75,14 +75,22 @@
  *
  * @fpfn:	first valid page frame number to put the object
  * @lpfn:	last valid page frame number to put the object
+ * @drvparam:	generic driver/backend placement parameters; the
+ *		interpretation is defined by the backend resource manager.
+ *		drvparam[0] and drvparam[1] alias @fpfn and @lpfn.
  * @mem_type:	One of TTM_PL_* where the resource should be allocated from.
  * @flags:	memory domain and caching flags for the object
  *
  * Structure indicating a possible place to put an object.
  */
 struct ttm_place {
-	uint64_t	fpfn;
-	uint64_t	lpfn;
+	union {
+		struct {
+			uint64_t	fpfn;
+			uint64_t	lpfn;
+		};
+		uint64_t	drvparam[2];
+	};
 	uint32_t	mem_type;
 	uint32_t	flags;
 };

base-commit: cdeb2ccd993ed8647adbbda2c3b103aa717fd6f7
-- 
2.34.1


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

* Re: [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn
  2026-06-26  6:36 [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn Arunpravin Paneer Selvam
@ 2026-06-26 10:57 ` Tvrtko Ursulin
  2026-06-29 12:06   ` Christian König
  0 siblings, 1 reply; 4+ messages in thread
From: Tvrtko Ursulin @ 2026-06-26 10:57 UTC (permalink / raw)
  To: Arunpravin Paneer Selvam, christian.koenig, dri-devel, intel-gfx,
	intel-xe, amd-gfx, nouveau, linux-kernel
  Cc: alexander.deucher, Thomas Hellström, Matthew Auld, Matthew Brost


On 26/06/2026 07:36, Arunpravin Paneer Selvam wrote:
> The fpfn/lpfn fields in struct ttm_place are named after page frame
> numbers, but they are really just placement parameters interpreted by
> the backend resource manager. Wrap them in a union with a generic
> drvparam[2] array so backends can access the same storage without the
> PFN-specific naming.
> 
> drvparam[0]/drvparam[1] alias fpfn/lpfn, so existing users and the
> VRAM range manager are unchanged. This decouples the API from
> PFN/range-specific semantics so that these fields can be used more
> flexibly in the future (e.g. mask-based or segment-aware placement
> constraints). No functional change.
> 
> v2: Use a union exposing a generic drvparam[2] array instead of
>      renaming fpfn/lpfn to param1/param2, keeping existing users
>      unchanged (Tvrtko Ursulin)
> 
> Suggested-by: Christian König <christian.koenig@amd.com>
> Assisted-by: Claude:claude-opus-4-8
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
> ---
>   include/drm/ttm/ttm_placement.h | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
> index ab2639e42c54..7db2073f3236 100644
> --- a/include/drm/ttm/ttm_placement.h
> +++ b/include/drm/ttm/ttm_placement.h
> @@ -75,14 +75,22 @@
>    *
>    * @fpfn:	first valid page frame number to put the object
>    * @lpfn:	last valid page frame number to put the object
> + * @drvparam:	generic driver/backend placement parameters; the
> + *		interpretation is defined by the backend resource manager.
> + *		drvparam[0] and drvparam[1] alias @fpfn and @lpfn.
>    * @mem_type:	One of TTM_PL_* where the resource should be allocated from.
>    * @flags:	memory domain and caching flags for the object
>    *
>    * Structure indicating a possible place to put an object.
>    */
>   struct ttm_place {
> -	uint64_t	fpfn;
> -	uint64_t	lpfn;
> +	union {
> +		struct {
> +			uint64_t	fpfn;
> +			uint64_t	lpfn;
> +		};
> +		uint64_t	drvparam[2];
> +	};
>   	uint32_t	mem_type;
>   	uint32_t	flags;
>   };
> 
> base-commit: cdeb2ccd993ed8647adbbda2c3b103aa717fd6f7

LGTM but then again I suggested it (hint hint) so I may be biased :)

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

Regards,

Tvrtko


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

* Re: [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn
  2026-06-26 10:57 ` Tvrtko Ursulin
@ 2026-06-29 12:06   ` Christian König
  2026-06-30 12:47     ` Arunpravin Paneer Selvam
  0 siblings, 1 reply; 4+ messages in thread
From: Christian König @ 2026-06-29 12:06 UTC (permalink / raw)
  To: Tvrtko Ursulin, Arunpravin Paneer Selvam, dri-devel, intel-gfx,
	intel-xe, amd-gfx, nouveau, linux-kernel
  Cc: alexander.deucher, Thomas Hellström, Matthew Auld, Matthew Brost

On 6/26/26 12:57, Tvrtko Ursulin wrote:
> 
> On 26/06/2026 07:36, Arunpravin Paneer Selvam wrote:
>> The fpfn/lpfn fields in struct ttm_place are named after page frame
>> numbers, but they are really just placement parameters interpreted by
>> the backend resource manager. Wrap them in a union with a generic
>> drvparam[2] array so backends can access the same storage without the
>> PFN-specific naming.
>>
>> drvparam[0]/drvparam[1] alias fpfn/lpfn, so existing users and the
>> VRAM range manager are unchanged. This decouples the API from
>> PFN/range-specific semantics so that these fields can be used more
>> flexibly in the future (e.g. mask-based or segment-aware placement
>> constraints). No functional change.
>>
>> v2: Use a union exposing a generic drvparam[2] array instead of
>>      renaming fpfn/lpfn to param1/param2, keeping existing users
>>      unchanged (Tvrtko Ursulin)
>>
>> Suggested-by: Christian König <christian.koenig@amd.com>
>> Assisted-by: Claude:claude-opus-4-8
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> Cc: Matthew Auld <matthew.auld@intel.com>
>> Cc: Matthew Brost <matthew.brost@intel.com>
>> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>> ---
>>   include/drm/ttm/ttm_placement.h | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
>> index ab2639e42c54..7db2073f3236 100644
>> --- a/include/drm/ttm/ttm_placement.h
>> +++ b/include/drm/ttm/ttm_placement.h
>> @@ -75,14 +75,22 @@
>>    *
>>    * @fpfn:    first valid page frame number to put the object
>>    * @lpfn:    last valid page frame number to put the object
>> + * @drvparam:    generic driver/backend placement parameters; the
>> + *        interpretation is defined by the backend resource manager.
>> + *        drvparam[0] and drvparam[1] alias @fpfn and @lpfn.
>>    * @mem_type:    One of TTM_PL_* where the resource should be allocated from.
>>    * @flags:    memory domain and caching flags for the object
>>    *
>>    * Structure indicating a possible place to put an object.
>>    */
>>   struct ttm_place {
>> -    uint64_t    fpfn;
>> -    uint64_t    lpfn;
>> +    union {
>> +        struct {
>> +            uint64_t    fpfn;
>> +            uint64_t    lpfn;
>> +        };
>> +        uint64_t    drvparam[2];
>> +    };
>>       uint32_t    mem_type;
>>       uint32_t    flags;
>>   };
>>
>> base-commit: cdeb2ccd993ed8647adbbda2c3b103aa717fd6f7
> 
> LGTM but then again I suggested it (hint hint) so I may be biased :)
> 
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>

Looks good to me as well, Reviewed-by: Christian König <christian.koenig@amd.com>.

I think this way we can also merge it with the AMDGPU patches who needs this through amd-staging-drm-next.

Let's sync up with Alex on the next weekly call, I think we should start creating an internal branch for the new feature if that hasn't be done yet.

Thanks,
Christian.

> 
> Regards,
> 
> Tvrtko
> 


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

* Re: [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn
  2026-06-29 12:06   ` Christian König
@ 2026-06-30 12:47     ` Arunpravin Paneer Selvam
  0 siblings, 0 replies; 4+ messages in thread
From: Arunpravin Paneer Selvam @ 2026-06-30 12:47 UTC (permalink / raw)
  To: Christian König, Tvrtko Ursulin, dri-devel, intel-gfx,
	intel-xe, amd-gfx, nouveau, linux-kernel
  Cc: alexander.deucher, Thomas Hellström, Matthew Auld, Matthew Brost



On 6/29/2026 5:36 PM, Christian König wrote:
> On 6/26/26 12:57, Tvrtko Ursulin wrote:
>> On 26/06/2026 07:36, Arunpravin Paneer Selvam wrote:
>>> The fpfn/lpfn fields in struct ttm_place are named after page frame
>>> numbers, but they are really just placement parameters interpreted by
>>> the backend resource manager. Wrap them in a union with a generic
>>> drvparam[2] array so backends can access the same storage without the
>>> PFN-specific naming.
>>>
>>> drvparam[0]/drvparam[1] alias fpfn/lpfn, so existing users and the
>>> VRAM range manager are unchanged. This decouples the API from
>>> PFN/range-specific semantics so that these fields can be used more
>>> flexibly in the future (e.g. mask-based or segment-aware placement
>>> constraints). No functional change.
>>>
>>> v2: Use a union exposing a generic drvparam[2] array instead of
>>>       renaming fpfn/lpfn to param1/param2, keeping existing users
>>>       unchanged (Tvrtko Ursulin)
>>>
>>> Suggested-by: Christian König <christian.koenig@amd.com>
>>> Assisted-by: Claude:claude-opus-4-8
>>> Cc: Christian König <christian.koenig@amd.com>
>>> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>>> Cc: Matthew Auld <matthew.auld@intel.com>
>>> Cc: Matthew Brost <matthew.brost@intel.com>
>>> Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@amd.com>
>>> ---
>>>    include/drm/ttm/ttm_placement.h | 12 ++++++++++--
>>>    1 file changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h
>>> index ab2639e42c54..7db2073f3236 100644
>>> --- a/include/drm/ttm/ttm_placement.h
>>> +++ b/include/drm/ttm/ttm_placement.h
>>> @@ -75,14 +75,22 @@
>>>     *
>>>     * @fpfn:    first valid page frame number to put the object
>>>     * @lpfn:    last valid page frame number to put the object
>>> + * @drvparam:    generic driver/backend placement parameters; the
>>> + *        interpretation is defined by the backend resource manager.
>>> + *        drvparam[0] and drvparam[1] alias @fpfn and @lpfn.
>>>     * @mem_type:    One of TTM_PL_* where the resource should be allocated from.
>>>     * @flags:    memory domain and caching flags for the object
>>>     *
>>>     * Structure indicating a possible place to put an object.
>>>     */
>>>    struct ttm_place {
>>> -    uint64_t    fpfn;
>>> -    uint64_t    lpfn;
>>> +    union {
>>> +        struct {
>>> +            uint64_t    fpfn;
>>> +            uint64_t    lpfn;
>>> +        };
>>> +        uint64_t    drvparam[2];
>>> +    };
>>>        uint32_t    mem_type;
>>>        uint32_t    flags;
>>>    };
>>>
>>> base-commit: cdeb2ccd993ed8647adbbda2c3b103aa717fd6f7
>> LGTM but then again I suggested it (hint hint) so I may be biased :)
>>
>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
> Looks good to me as well, Reviewed-by: Christian König <christian.koenig@amd.com>.
>
> I think this way we can also merge it with the AMDGPU patches who needs this through amd-staging-drm-next.
>
> Let's sync up with Alex on the next weekly call, I think we should start creating an internal branch for the new feature if that hasn't be done yet.
Sure Christian.

Thanks,
Arun.
>
> Thanks,
> Christian.
>
>> Regards,
>>
>> Tvrtko
>>


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

end of thread, other threads:[~2026-06-30 12:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-26  6:36 [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn Arunpravin Paneer Selvam
2026-06-26 10:57 ` Tvrtko Ursulin
2026-06-29 12:06   ` Christian König
2026-06-30 12:47     ` Arunpravin Paneer Selvam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox