Skip to contentSkip to conversation

drm/amdgpu: new ids flag for tmz

PATCH In review Pierre-Eric Pelloux-Prayer 2 participants 4 messages Jul 30, 2020

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

PATCH 1/1 drm/amdgpu: new ids flag for tmz

Allows UMD to know if TMZ is supported and enabled.
This commit also bumps KMS_DRIVER_MINOR so UMD knows if it can rely on AMDGPU_IDS_FLAGS_TMZ.
---
Patch for using it in Mesa is at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049
(ac/gpu_info: add detection of TMZ support).

Pierre-Eric

 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
 include/uapi/drm/amdgpu_drm.h           | 1 +
 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 6291f5f0d223..6dcab25914cf 100644
@@ -88,9 +88,10 @@
  * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
  * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
  * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
+ * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	39
+#define KMS_DRIVER_MINOR	40
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index eebbe2103e32..d92ee30bc06c 100644
@@ -736,6 +736,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
 		if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
 			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
+		if (adev->gmc.tmz_enabled)
+			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
 
 		vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
 		vm_size -= AMDGPU_VA_RESERVED_SIZE;
include/uapi/drm/amdgpu_drm.h +1 -0
index 765a94ec4420..b826f2d6efe1 100644
@@ -676,6 +676,7 @@ struct drm_amdgpu_cs_chunk_data {
  */
 #define AMDGPU_IDS_FLAGS_FUSION         0x1
 #define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
+#define AMDGPU_IDS_FLAGS_TMZ            0x4
 
 /* indicate if acceleration can be working */
 #define AMDGPU_INFO_ACCEL_WORKING		0x00
Signature · 6 lines
2.26.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

Am 30.07.20 um 12:25 schrieb Pierre-Eric Pelloux-Prayer:

Quoted 19 lines

Allows UMD to know if TMZ is supported and enabled.
This commit also bumps KMS_DRIVER_MINOR so UMD knows if it can rely on AMDGPU_IDS_FLAGS_TMZ.
---
Patch for using it in Mesa is at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049
(ac/gpu_info: add detection of TMZ support).

Pierre-Eric

  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
  include/uapi/drm/amdgpu_drm.h           | 1 +
  3 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
index 6291f5f0d223..6dcab25914cf 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 94

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -88,9 +88,10 @@
   * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
   * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
   * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
+ * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
   */
  #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	39
+#define KMS_DRIVER_MINOR	40

I don't think we need this. Unused ids_flags should be zero on older kernels.

That's why we have this in the first place.

Christian.

Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
  #define KMS_DRIVER_PATCHLEVEL	0
 
  int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index eebbe2103e32..d92ee30bc06c 100644
@@ -736,6 +736,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
  			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
  		if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
  			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
+		if (adev->gmc.tmz_enabled)
+			dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
 
  		vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
  		vm_size -= AMDGPU_VA_RESERVED_SIZE;
include/uapi/drm/amdgpu_drm.h +0 -0
index 765a94ec4420..b826f2d6efe1 100644

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_cs_chunk_data { · line 682

Quoted 7 lines
include/uapi/drm/amdgpu_drm.h +1 -0
@@ -676,6 +676,7 @@ struct drm_amdgpu_cs_chunk_data {
   */
  #define AMDGPU_IDS_FLAGS_FUSION         0x1
  #define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
+#define AMDGPU_IDS_FLAGS_TMZ            0x4
 
  /* indicate if acceleration can be working */
  #define AMDGPU_INFO_ACCEL_WORKING		0x00

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw

Hi Christian,

Quoted 15 lines · Christian König

Am 30.07.20 um 12:25 schrieb Pierre-Eric Pelloux-Prayer:

Quoted 14 lines

Allows UMD to know if TMZ is supported and enabled.
This commit also bumps KMS_DRIVER_MINOR so UMD knows if it can rely on AMDGPU_IDS_FLAGS_TMZ.
---
Patch for using it in Mesa is at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049
(ac/gpu_info: add detection of TMZ support).

Pierre-Eric

  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
  include/uapi/drm/amdgpu_drm.h           | 1 +

  3 files changed, 5 insertions(+), 1 deletion(-)
Quoted 15 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 94

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 6291f5f0d223..6dcab25914cf 100644
@@ -88,9 +88,10 @@
    * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
    * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
    * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
+ * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
    */
   #define KMS_DRIVER_MAJOR    3
-#define KMS_DRIVER_MINOR    39
+#define KMS_DRIVER_MINOR    40

I don't think we need this. Unused ids_flags should be zero on older kernels.

If we don't increase KMS_DRIVER_MINOR then:

ids_flags & AMDGPU_IDS_FLAGS_TMZ == 0

has 2 meanings:
- TMZ is not enabled
- or TMZ might be enabled but it's not reported by the kernel

If you prefer not bumping KMS_DRIVER_MINOR that's fine though. Mesa can check if TMZ is really disabled by trying to allocate a TMZ buffer.

Thanks,
Pierre-Eric

Quoted 27 lines

That's why we have this in the first place.

Christian.

Quoted 22 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
   #define KMS_DRIVER_PATCHLEVEL    0
     int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index eebbe2103e32..d92ee30bc06c 100644
@@ -736,6 +736,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
               dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
           if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
               dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
+        if (adev->gmc.tmz_enabled)
+            dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
             vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
           vm_size -= AMDGPU_VA_RESERVED_SIZE;
include/uapi/drm/amdgpu_drm.h +0 -0
index 765a94ec4420..b826f2d6efe1 100644
@@ -676,6 +676,7 @@ struct drm_amdgpu_cs_chunk_data {
    */
   #define AMDGPU_IDS_FLAGS_FUSION         0x1
   #define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
Quoted 8 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_cs_chunk_data { · line 682

Quoted 3 lines
include/uapi/drm/amdgpu_drm.h +1 -0
+#define AMDGPU_IDS_FLAGS_TMZ            0x4
     /* indicate if acceleration can be working */
   #define AMDGPU_INFO_ACCEL_WORKING        0x00

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw

Am 30.07.20 um 12:59 schrieb Pierre-Eric Pelloux-Prayer:

Quoted 32 lines

Hi Christian,

Quoted 15 lines · Christian König

Am 30.07.20 um 12:25 schrieb Pierre-Eric Pelloux-Prayer:

Quoted 14 lines

Allows UMD to know if TMZ is supported and enabled.
This commit also bumps KMS_DRIVER_MINOR so UMD knows if it can rely on AMDGPU_IDS_FLAGS_TMZ.
---
Patch for using it in Mesa is at https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6049
(ac/gpu_info: add detection of TMZ support).

Pierre-Eric

   drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
   drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 ++
   include/uapi/drm/amdgpu_drm.h           | 1 +
   3 files changed, 5 insertions(+), 1 deletion(-)
Quoted 14 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c line 94

Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 6291f5f0d223..6dcab25914cf 100644
@@ -88,9 +88,10 @@
    * - 3.37.0 - L2 is invalidated before SDMA IBs, needed for correctness
    * - 3.38.0 - Add AMDGPU_IB_FLAG_EMIT_MEM_SYNC
    * - 3.39.0 - DMABUF implicit sync does a full pipeline sync
+ * - 3.40.0 - Add AMDGPU_IDS_FLAGS_TMZ
    */
   #define KMS_DRIVER_MAJOR    3
-#define KMS_DRIVER_MINOR    39
+#define KMS_DRIVER_MINOR    40

I don't think we need this. Unused ids_flags should be zero on older kernels.

Quoted 7 lines

If we don't increase KMS_DRIVER_MINOR then:

    ids_flags & AMDGPU_IDS_FLAGS_TMZ == 0

has 2 meanings:
- TMZ is not enabled
- or TMZ might be enabled but it's not reported by the kernel

Ah! Yeah that's a good argument.

We need to note that in the commit message.

And maybe call the flag TMZ_ENABLED to make clear what this is good for.

Thanks,
Christian.

Quoted 40 lines

If you prefer not bumping KMS_DRIVER_MINOR that's fine though. Mesa can check if TMZ is really disabled by trying to allocate a TMZ buffer.

Thanks,
Pierre-Eric

Quoted 25 lines

That's why we have this in the first place.

Christian.

Quoted 21 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
   #define KMS_DRIVER_PATCHLEVEL    0
     int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -0
index eebbe2103e32..d92ee30bc06c 100644
@@ -736,6 +736,8 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
               dev_info.ids_flags |= AMDGPU_IDS_FLAGS_FUSION;
           if (amdgpu_mcbp || amdgpu_sriov_vf(adev))
               dev_info.ids_flags |= AMDGPU_IDS_FLAGS_PREEMPTION;
+        if (adev->gmc.tmz_enabled)
+            dev_info.ids_flags |= AMDGPU_IDS_FLAGS_TMZ;
             vm_size = adev->vm_manager.max_pfn * AMDGPU_GPU_PAGE_SIZE;
           vm_size -= AMDGPU_VA_RESERVED_SIZE;
include/uapi/drm/amdgpu_drm.h +0 -0
index 765a94ec4420..b826f2d6efe1 100644
@@ -676,6 +676,7 @@ struct drm_amdgpu_cs_chunk_data {
    */
   #define AMDGPU_IDS_FLAGS_FUSION         0x1
Quoted 8 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_cs_chunk_data { · line 682

Quoted 4 lines
include/uapi/drm/amdgpu_drm.h +1 -0
   #define AMDGPU_IDS_FLAGS_PREEMPTION     0x2
+#define AMDGPU_IDS_FLAGS_TMZ            0x4
     /* indicate if acceleration can be working */
   #define AMDGPU_INFO_ACCEL_WORKING        0x00

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx