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 <[email protected]>
Assisted-by: Claude:claude-opus-4-8
Cc: Christian König <[email protected]>
Cc: Thomas Hellström <[email protected]>
Cc: Matthew Auld <[email protected]>
Cc: Matthew Brost <[email protected]>
Signed-off-by: Arunpravin Paneer Selvam <[email protected]>
---
 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

Reply via email to