Skip to contentSkip to conversation

drm/ttm: Support 52-bit PAs in ttm_place

PATCH In review Felix Kuehling 4 participants 6 messages May 13

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/ttm: Support 52-bit PAs in ttm_place

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

---
 include/drm/ttm/ttm_placement.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +2 -2
index b510a4812609..ab2639e42c54 100644
@@ -81,8 +81,8 @@
  * Structure indicating a possible place to put an object.
  */
 struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
+	uint64_t	fpfn;
+	uint64_t	lpfn;
 	uint32_t	mem_type;
 	uint32_t	flags;
 };
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Felix Kuehling

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

@Arun can you pick that one up and push it to drm-misc-next?

Thanks,
Christian.

Quoted 19 lines
---
 include/drm/ttm/ttm_placement.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +2 -2
index b510a4812609..ab2639e42c54 100644
@@ -81,8 +81,8 @@
  * Structure indicating a possible place to put an object.
  */
 struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
+	uint64_t	fpfn;
+	uint64_t	lpfn;
 	uint32_t	mem_type;
 	uint32_t	flags;
 };
#2 lore raw
Quoted 4 lines · Christian König
Quoted 3 lines · Felix Kuehling

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

I forgot to update the commit message. It still says unsigned long. @Arun, can you update that before you push it to drm-misc-next?

Thanks,
  Felix

Quoted 28 lines
Quoted 2 lines

@Arun can you pick that one up and push it to drm-misc-next?

Thanks,
Christian.

Quoted 19 lines
---
  include/drm/ttm/ttm_placement.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +2 -2
index b510a4812609..ab2639e42c54 100644
@@ -81,8 +81,8 @@
   * Structure indicating a possible place to put an object.
   */
  struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
+	uint64_t	fpfn;
+	uint64_t	lpfn;
  	uint32_t	mem_type;
  	uint32_t	flags;
  };
#3 lore raw

I modified the commit message and pushed into drm-misc-next.

Regards,
Arun.

Quoted 41 lines · Felix
Quoted 4 lines · Christian König
Quoted 3 lines · Felix Kuehling

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

I forgot to update the commit message. It still says unsigned long. @Arun, can you update that before you push it to drm-misc-next?

Thanks,
  Felix

Quoted 28 lines
Quoted 2 lines

@Arun can you pick that one up and push it to drm-misc-next?

Thanks,
Christian.

Quoted 19 lines

---
  include/drm/ttm/ttm_placement.h | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +2 -2
index b510a4812609..ab2639e42c54 100644
@@ -81,8 +81,8 @@
    * Structure indicating a possible place to put an object.
    */
   struct ttm_place {
-    unsigned    fpfn;
-    unsigned    lpfn;
+    uint64_t    fpfn;
+    uint64_t    lpfn;
       uint32_t    mem_type;
       uint32_t    flags;
   };
#4 lore raw
In reply to Felix Kuehling
Quoted 14 lines · Felix Kuehling

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

---
  include/drm/ttm/ttm_placement.h | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +0 -0
index b510a4812609..ab2639e42c54 100644

include/drm/ttm/ttm_placement.h line 88

Quoted 10 lines
include/drm/ttm/ttm_placement.h +2 -2
@@ -81,8 +81,8 @@
   * Structure indicating a possible place to put an object.
   */
  struct ttm_place {
-	unsigned	fpfn;
-	unsigned	lpfn;
+	uint64_t	fpfn;
+	uint64_t	lpfn;
  	uint32_t	mem_type;
  	uint32_t	flags;
  };

Maybe audit of usage sites is required to make sure no compiler warnings on 32-bit builds if nothing else. Things like:

amdgpu_vram_mgr_intersects()
...

		if (place->fpfn < lpfn &&
		    (!place->lpfn || place->lpfn > fpfn))
			return true;

Etc. Probably are all best adjusted to match the new type.

There is also:

struct ttm_resource {
	unsigned long start;

Which also may need aligning. I know no one cares about 32-bit builds but some automated systems will probably test it and send reports.

Regards,

Tvrtko

#5 lore raw
Quoted 34 lines · Tvrtko Ursulin
Quoted 14 lines · Felix Kuehling

fpfn and lpfn in struct ttm_place are 32-bit page numbers. With 4KB page size this can support up to 44-bit physical addressing. Grow these to unsigned long to support larger physical addresses.

---
  include/drm/ttm/ttm_placement.h | 4 ++--

  1 file changed, 2 insertions(+), 2 deletions(-)
include/drm/ttm/ttm_placement.h +0 -0
index b510a4812609..ab2639e42c54 100644

include/drm/ttm/ttm_placement.h line 88

Quoted 10 lines
include/drm/ttm/ttm_placement.h +2 -2
@@ -81,8 +81,8 @@
    * Structure indicating a possible place to put an object.
    */
   struct ttm_place {
-    unsigned    fpfn;
-    unsigned    lpfn;
+    uint64_t    fpfn;
+    uint64_t    lpfn;
       uint32_t    mem_type;
       uint32_t    flags;
   };

Maybe audit of usage sites is required to make sure no compiler warnings on 32-bit builds if nothing else. Things like:

amdgpu_vram_mgr_intersects()
...
        if (place->fpfn < lpfn &&
            (!place->lpfn || place->lpfn > fpfn))
            return true;

Quoted 8 lines

Etc. Probably are all best adjusted to match the new type.

There is also:

struct ttm_resource {
    unsigned long start;

Which also may need aligning. I know no one cares about 32-bit builds but some automated systems will probably test it and send reports.

Yeah I have been trying to remove ttm_resource.start exactly for that reason for a very very long time now.

Drivers shouldn't use that and instead rely on their own backends to give the actual placement.

Regards,
Christian.

Quoted 5 lines

Regards,

Tvrtko