Re: [PATCH v2] drm/ttm: add generic drvparam[] alias for ttm_place::fpfn/lpfn

From: Arunpravin Paneer Selvam

Date: Tue Jun 30 2026 - 08:55:51 EST




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@xxxxxxx>
Assisted-by: Claude:claude-opus-4-8
Cc: Christian König <christian.koenig@xxxxxxx>
Cc: Thomas Hellström <thomas.hellstrom@xxxxxxxxxxxxxxx>
Cc: Matthew Auld <matthew.auld@xxxxxxxxx>
Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
Signed-off-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
---
  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@xxxxxxxxxx>
Looks good to me as well, Reviewed-by: Christian König <christian.koenig@xxxxxxx>.

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