Skip to contentSkip to conversation

drm/amdgpu: export gpu always on cu bitmap

PATCH Superseded Flora Cui 6 participants 16 messages Jun 20, 2017 – Jun 26, 2017 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Flora Cui

author
#0 lore raw

PATCH 1/1 drm/amdgpu: export gpu always on cu bitmap

Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 2 +-
 8 files changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-	uint32_t number; /* total active CU number */
-	uint32_t ao_cu_mask;
 	uint32_t max_waves_per_simd;
 	uint32_t wave_front_size;
 	uint32_t max_scratch_slots_per_cu;
 	uint32_t lds_size;
+
+	/* total active CU number */
+	uint32_t number;
+	uint32_t ao_cu_mask;
+	uint32_t ao_cu_bitmap[4][4];
 	uint32_t bitmap[4][4];
 };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	17
+#define KMS_DRIVER_MINOR	18
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -1
index f68ced6..6ba8204 100644
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
 		dev_info.cu_active_number = adev->gfx.cu_info.number;
-		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
 		dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+		memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+		       sizeof(adev->gfx.cu_info.ao_cu_bitmap));
 		memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
 		       sizeof(adev->gfx.cu_info.bitmap));
 		dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +1 -1
index 4f34394..4304422 100644
@@ -760,7 +760,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1497946521-21500-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 1/1 amdgpu: update always on cu bitmap

Change-Id Ie2a812716a6802f7a5a0bc09b1a8db824c5bf2ed
---
 amdgpu/amdgpu.h          | 2 +-
 amdgpu/amdgpu_gpu_info.c | 2 +-
 include/drm/amdgpu_drm.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu.h +1 -1
index b6779f9..34ca5f1 100644
@@ -486,7 +486,7 @@ struct amdgpu_gpu_info {
 	uint32_t pa_sc_raster_cfg1[4];
 	/* CU info */
 	uint32_t cu_active_number;
-	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
 	uint32_t cu_bitmap[4][4];
 	/* video memory type info*/
 	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -1
index 34f77be..acfd700 100644
@@ -229,7 +229,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 	}
 
 	dev->info.cu_active_number = dev->dev_info.cu_active_number;
-	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
 	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 
 	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +1 -1
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1497949479-22146-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Re: [PATCH libdrm] amdgpu: update always on cu bitmap

I'm not 100% sure what this is all about, but it clearly won't work like this.

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 13 lines
include/drm/amdgpu_drm.h +1 -1
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */
  	__u32 enabled_rb_pipes_mask;

That is a non-backward compatible change to the kernel interface and as such forbidden.

Regards,
Christian.

Am 20.06.2017 um 11:04 schrieb Flora Cui:

Quoted 39 lines
Change-Id Ie2a812716a6802f7a5a0bc09b1a8db824c5bf2ed
---
  amdgpu/amdgpu.h          | 2 +-
  amdgpu/amdgpu_gpu_info.c | 2 +-
  include/drm/amdgpu_drm.h | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu.h +1 -1
index b6779f9..34ca5f1 100644
@@ -486,7 +486,7 @@ struct amdgpu_gpu_info {
  	uint32_t pa_sc_raster_cfg1[4];
  	/* CU info */
  	uint32_t cu_active_number;
-	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
  	uint32_t cu_bitmap[4][4];
  	/* video memory type info*/
  	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -1
index 34f77be..acfd700 100644
@@ -229,7 +229,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
  	}
 
  	dev->info.cu_active_number = dev->dev_info.cu_active_number;
-	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
  	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 
  	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +0 -0
index df250de..dcbe22c 100644

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 8 lines
include/drm/amdgpu_drm.h +1 -1
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */
  	__u32 enabled_rb_pipes_mask;

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

A message that is not in the archive (sent off-list or not yet received): 75494a7b-0ee1-b8e4-9b5e-a82bfeb0d1bb-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

#6 lore raw

Re: [PATCH libdrm] amdgpu: update always on cu bitmap

Quoted 18 lines · Christian König

I'm not 100% sure what this is all about, but it clearly won't work like this.

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 13 lines
include/drm/amdgpu_drm.h +1 -1
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */
  	__u32 enabled_rb_pipes_mask;

That is a non-backward compatible change to the kernel interface and as such forbidden.

The uabi changes should also flow from the kernel first, only then land in libdrm. See libdrm/include/drm/README.
-Daniel

Quoted 56 lines

Regards,
Christian.

Am 20.06.2017 um 11:04 schrieb Flora Cui:

Quoted 37 lines
Change-Id Ie2a812716a6802f7a5a0bc09b1a8db824c5bf2ed
---
  amdgpu/amdgpu.h          | 2 +-
  amdgpu/amdgpu_gpu_info.c | 2 +-
  include/drm/amdgpu_drm.h | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu.h +1 -1
index b6779f9..34ca5f1 100644
@@ -486,7 +486,7 @@ struct amdgpu_gpu_info {
  	uint32_t pa_sc_raster_cfg1[4];
  	/* CU info */
  	uint32_t cu_active_number;
-	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
  	uint32_t cu_bitmap[4][4];
  	/* video memory type info*/
  	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -1
index 34f77be..acfd700 100644
@@ -229,7 +229,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
  	}
  	dev->info.cu_active_number = dev->dev_info.cu_active_number;
-	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
  	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
  	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +0 -0
index df250de..dcbe22c 100644

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 8 lines
include/drm/amdgpu_drm.h +1 -1
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */
  	__u32 enabled_rb_pipes_mask;

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#7 lore raw

Re: [PATCH libdrm] amdgpu: update always on cu bitmap

In reply to a message not in the archive

each SE take 16 bit in cu_ao_mask. For ASICs with 4 SE, cu_ao_mask has invalid value. so I change cu_ao_mask to cu_ao_bitmap[4][4] and increase kmd driver version.

Quoted 60 lines · Christian König

I'm not 100% sure what this is all about, but it clearly won't work like this.

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 13 lines
include/drm/amdgpu_drm.h +1 -1
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;

That is a non-backward compatible change to the kernel interface and as such forbidden.

Regards,
Christian.

Am 20.06.2017 um 11:04 schrieb Flora Cui:

Quoted 37 lines
Change-Id Ie2a812716a6802f7a5a0bc09b1a8db824c5bf2ed
---
 amdgpu/amdgpu.h          | 2 +-
 amdgpu/amdgpu_gpu_info.c | 2 +-
 include/drm/amdgpu_drm.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu.h +1 -1
index b6779f9..34ca5f1 100644
@@ -486,7 +486,7 @@ struct amdgpu_gpu_info {
 	uint32_t pa_sc_raster_cfg1[4];
 	/* CU info */
 	uint32_t cu_active_number;
-	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
 	uint32_t cu_bitmap[4][4];
 	/* video memory type info*/
 	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -1
index 34f77be..acfd700 100644
@@ -229,7 +229,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 	}
 	dev->info.cu_active_number = dev->dev_info.cu_active_number;
-	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
 	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +0 -0
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
Quoted 10 lines

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 8 lines
include/drm/amdgpu_drm.h +1 -1
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;

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

#8 lore raw

Re: [PATCH libdrm] amdgpu: update always on cu bitmap

Quoted 3 lines · Flora Cui

each SE take 16 bit in cu_ao_mask. For ASICs with 4 SE, cu_ao_mask has invalid value. so I change cu_ao_mask to cu_ao_bitmap[4][4] and increase kmd driver version.

Please read Documentation/ioctl/botching-up-ioctls.txt

You cannot change ioctl structures like you're proposing here.

Thanks, Daniel

Quoted 76 lines · Christian König
Quoted 60 lines

I'm not 100% sure what this is all about, but it clearly won't work like this.

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 13 lines
include/drm/amdgpu_drm.h +1 -1
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;

That is a non-backward compatible change to the kernel interface and as such forbidden.

Regards,
Christian.

Am 20.06.2017 um 11:04 schrieb Flora Cui:

Quoted 37 lines
Change-Id Ie2a812716a6802f7a5a0bc09b1a8db824c5bf2ed
---
 amdgpu/amdgpu.h          | 2 +-
 amdgpu/amdgpu_gpu_info.c | 2 +-
 include/drm/amdgpu_drm.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
amdgpu/amdgpu.h +1 -1
index b6779f9..34ca5f1 100644
@@ -486,7 +486,7 @@ struct amdgpu_gpu_info {
 	uint32_t pa_sc_raster_cfg1[4];
 	/* CU info */
 	uint32_t cu_active_number;
-	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
 	uint32_t cu_bitmap[4][4];
 	/* video memory type info*/
 	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -1
index 34f77be..acfd700 100644
@@ -229,7 +229,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 	}
 	dev->info.cu_active_number = dev->dev_info.cu_active_number;
-	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
 	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +0 -0
index df250de..dcbe22c 100644
@@ -832,7 +832,7 @@ struct drm_amdgpu_info_device {
Quoted 10 lines

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 838

Quoted 8 lines
include/drm/amdgpu_drm.h +1 -1
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
-	__u32 cu_ao_mask;
+	__u32 cu_ao_bitmap[4][4];
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
 	__u32 enabled_rb_pipes_mask;

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

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#9 lore raw

PATCH 1/1 amdgpu: update the exported always on CU bitmap

In reply to a message not in the archive

keep cu_ao_mask unchanged for backward compatibility.

Change-Id I9f497aadd309977468e246fea333b392c0150276

---
This patch should be landed after the kmd patch upsteam. right?

 amdgpu/amdgpu.h          | 2 ++
 amdgpu/amdgpu_gpu_info.c | 1 +
 include/drm/amdgpu_drm.h | 3 +++
 3 files changed, 6 insertions(+)
amdgpu/amdgpu.h +2 -0
index b6779f9..cc80493 100644
@@ -486,7 +486,9 @@ struct amdgpu_gpu_info {
 	uint32_t pa_sc_raster_cfg1[4];
 	/* CU info */
 	uint32_t cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
 	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
 	uint32_t cu_bitmap[4][4];
 	/* video memory type info*/
 	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -0
index 34f77be..7a5feb9 100644
@@ -230,6 +230,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 
 	dev->info.cu_active_number = dev->dev_info.cu_active_number;
 	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
 	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 
 	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +3 -0
index df250de..05c4e72 100644
@@ -832,6 +832,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
 	__u32 cu_ao_mask;
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
@@ -886,6 +887,8 @@ struct drm_amdgpu_info_device {
 	/* max gs wavefront per vgt*/
 	__u32 max_gs_waves_per_vgt;
 	__u32 _pad1;
+	/* always on cu bitmap */
+	__u32 cu_ao_bitmap[4][4];
 };
 
 struct drm_amdgpu_info_hw_ip {
Signature · 6 lines
2.7.4

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

Re: [PATCH libdrm] amdgpu: update the exported always on CU bitmap

Quoted 6 lines · Flora Cui

keep cu_ao_mask unchanged for backward compatibility.

Change-Id I9f497aadd309977468e246fea333b392c0150276

---
This patch should be landed after the kmd patch upsteam. right?

Right. Also, include/drm/amdgpu_drm.h should be updated in a separate patch, see include/drm/README (in particular the "When and how to update these files").

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1498457550-27605-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

#12 lore raw

Re: [PATCH libdrm] amdgpu: update the exported always on CU bitmap

Am 26.06.2017 um 08:12 schrieb Flora Cui:

Quoted 6 lines

keep cu_ao_mask unchanged for backward compatibility.

Change-Id I9f497aadd309977468e246fea333b392c0150276

---
This patch should be landed after the kmd patch upsteam. right?

In general yes, but this patch is a NAK as well.

Quoted 10 lines
  amdgpu/amdgpu.h          | 2 ++
  amdgpu/amdgpu_gpu_info.c | 1 +
  include/drm/amdgpu_drm.h | 3 +++
  3 files changed, 6 insertions(+)
amdgpu/amdgpu.h +0 -0
index b6779f9..cc80493 100644

amdgpu/amdgpu.h struct amdgpu_gpu_info { · line 492

Quoted 7 lines
amdgpu/amdgpu.h +2 -0
@@ -486,7 +486,9 @@ struct amdgpu_gpu_info {
  	uint32_t pa_sc_raster_cfg1[4];
  	/* CU info */
  	uint32_t cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
  	uint32_t cu_ao_mask;
+	uint32_t cu_ao_bitmap[4][4];
  	uint32_t cu_bitmap[4][4];

You can't change the amdgpu_gpu_info structure here for the same reasons you can't change the kernel interface.

Even worse in oposite to the kernel interface this structure isn't versionized, so you can't change it at all.

I suggest that we deprecate amdgpu_gpu_info and clients just call the appropriate info query directly.

Regards,
Christian.

Quoted 27 lines
amdgpu/amdgpu.h +0 -0
  	/* video memory type info*/
  	uint32_t vram_type;
amdgpu/amdgpu_gpu_info.c +1 -0
index 34f77be..7a5feb9 100644
@@ -230,6 +230,7 @@ drm_private int amdgpu_query_gpu_info_init(amdgpu_device_handle dev)
 
  	dev->info.cu_active_number = dev->dev_info.cu_active_number;
  	dev->info.cu_ao_mask = dev->dev_info.cu_ao_mask;
+	memcpy(&dev->info.cu_ao_bitmap[0][0], &dev->dev_info.cu_ao_bitmap[0][0], sizeof(dev->info.cu_ao_bitmap));
  	memcpy(&dev->info.cu_bitmap[0][0], &dev->dev_info.cu_bitmap[0][0], sizeof(dev->info.cu_bitmap));
 
  	/* TODO: info->max_quad_shader_pipes is not set */
include/drm/amdgpu_drm.h +1 -0
index df250de..05c4e72 100644
@@ -832,6 +832,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
  	__u32 cu_ao_mask;
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */

include/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 894

Quoted 8 lines
include/drm/amdgpu_drm.h +2 -0
@@ -886,6 +887,8 @@ struct drm_amdgpu_info_device {
  	/* max gs wavefront per vgt*/
  	__u32 max_gs_waves_per_vgt;
  	__u32 _pad1;
+	/* always on cu bitmap */
+	__u32 cu_ao_bitmap[4][4];
  };
 
  struct drm_amdgpu_info_hw_ip {

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

#13 lore raw
In reply to a message not in the archive
Quoted 131 lines · Flora Cui
Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 2 +-
 8 files changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-       uint32_t number; /* total active CU number */
-       uint32_t ao_cu_mask;
        uint32_t max_waves_per_simd;
        uint32_t wave_front_size;
        uint32_t max_scratch_slots_per_cu;
        uint32_t lds_size;
+
+       /* total active CU number */
+       uint32_t number;
+       uint32_t ao_cu_mask;
+       uint32_t ao_cu_bitmap[4][4];
        uint32_t bitmap[4][4];
 };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR       3
-#define KMS_DRIVER_MINOR       17
+#define KMS_DRIVER_MINOR       18
 #define KMS_DRIVER_PATCHLEVEL  0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -1
index f68ced6..6ba8204 100644
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
                dev_info.cu_active_number = adev->gfx.cu_info.number;
-               dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
                dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+               memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+                      sizeof(adev->gfx.cu_info.ao_cu_bitmap));
                memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
                       sizeof(adev->gfx.cu_info.bitmap));
                dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +0 -0
index 4f34394..4304422 100644

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 766

Quoted 8 lines
include/uapi/drm/amdgpu_drm.h +1 -1
@@ -760,7 +760,7 @@ struct drm_amdgpu_info_device {
        __u64 max_memory_clock;
        /* cu information */
        __u32 cu_active_number;
-       __u32 cu_ao_mask;
+       __u32 cu_ao_bitmap[4][4];
        __u32 cu_bitmap[4][4];
        /** Render backend pipe mask. One render backend is CB+DB. */
        __u32 enabled_rb_pipes_mask;

You need to add these to the end of the structure for backwards compatibility.

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

A message that is not in the archive (sent off-list or not yet received): CADnq5_PQcrNDSHeJyWr=401vn_EKc6i7+Lk+8jUfWfC1H4_EWA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#15 lore raw
Quoted 134 lines · Alex Deucher
Quoted 133 lines · Flora Cui
Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 2 +-
 8 files changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-       uint32_t number; /* total active CU number */
-       uint32_t ao_cu_mask;
        uint32_t max_waves_per_simd;
        uint32_t wave_front_size;
        uint32_t max_scratch_slots_per_cu;
        uint32_t lds_size;
+
+       /* total active CU number */
+       uint32_t number;
+       uint32_t ao_cu_mask;
+       uint32_t ao_cu_bitmap[4][4];
        uint32_t bitmap[4][4];
 };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR       3
-#define KMS_DRIVER_MINOR       17
+#define KMS_DRIVER_MINOR       18
 #define KMS_DRIVER_PATCHLEVEL  0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -1
index f68ced6..6ba8204 100644
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
                dev_info.cu_active_number = adev->gfx.cu_info.number;
-               dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
                dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+               memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+                      sizeof(adev->gfx.cu_info.ao_cu_bitmap));
                memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
                       sizeof(adev->gfx.cu_info.bitmap));
                dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +0 -0
index 4f34394..4304422 100644
@@ -760,7 +760,7 @@ struct drm_amdgpu_info_device {
        __u64 max_memory_clock;
        /* cu information */
Quoted 9 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 766

Quoted 6 lines
include/uapi/drm/amdgpu_drm.h +1 -1
        __u32 cu_active_number;
-       __u32 cu_ao_mask;
+       __u32 cu_ao_bitmap[4][4];
        __u32 cu_bitmap[4][4];
        /** Render backend pipe mask. One render backend is CB+DB. */
        __u32 enabled_rb_pipes_mask;

You need to add these to the end of the structure for backwards compatibility.

OK. How to handle cu_ao_mask? it's invalid, yet kmd has to keep it for backward compatibility.

Quoted 1 line

Alex

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

#16 lore raw

Am 21.06.2017 um 09:42 schrieb Flora Cui:

Quoted 143 lines · Alex Deucher
Quoted 133 lines · Flora Cui
Quoted 132 lines
Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
  include/uapi/drm/amdgpu_drm.h           | 2 +-
  8 files changed, 22 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
  };
 
  struct amdgpu_cu_info {
-       uint32_t number; /* total active CU number */
-       uint32_t ao_cu_mask;
         uint32_t max_waves_per_simd;
         uint32_t wave_front_size;
         uint32_t max_scratch_slots_per_cu;
         uint32_t lds_size;
+
+       /* total active CU number */
+       uint32_t number;
+       uint32_t ao_cu_mask;
+       uint32_t ao_cu_bitmap[4][4];
         uint32_t bitmap[4][4];
  };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
   * - 3.15.0 - Export more gpu info for gfx9
   * - 3.16.0 - Add reserved vmid support
   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
   */
  #define KMS_DRIVER_MAJOR       3
-#define KMS_DRIVER_MINOR       17
+#define KMS_DRIVER_MINOR       18
  #define KMS_DRIVER_PATCHLEVEL  0
 
  int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +2 -1
index f68ced6..6ba8204 100644
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
                 dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
                 dev_info.cu_active_number = adev->gfx.cu_info.number;
-               dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
                 dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+               memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+                      sizeof(adev->gfx.cu_info.ao_cu_bitmap));
                 memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
                        sizeof(adev->gfx.cu_info.bitmap));
                 dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
                                 mask <<= 1;
                         }
                         active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                 }
         }
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
                                 mask <<= 1;
                         }
                         active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                 }
         }
         gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
                                 mask <<= 1;
                         }
                         active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                 }
         }
         gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
                                 mask <<= 1;
                         }
                         active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                 }
         }
         gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +0 -0
index 4f34394..4304422 100644
@@ -760,7 +760,7 @@ struct drm_amdgpu_info_device {
         __u64 max_memory_clock;
Quoted 9 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 766

Quoted 7 lines
include/uapi/drm/amdgpu_drm.h +1 -1
         /* cu information */
         __u32 cu_active_number;
-       __u32 cu_ao_mask;
+       __u32 cu_ao_bitmap[4][4];
         __u32 cu_bitmap[4][4];
         /** Render backend pipe mask. One render backend is CB+DB. */
         __u32 enabled_rb_pipes_mask;

You need to add these to the end of the structure for backwards compatibility.

Quoted 1 line

OK. How to handle cu_ao_mask? it's invalid, yet kmd has to keep it for backward compatibility.

I can't completely answer that question since I don't know the hardware background well enough.

But the main questions are how it is used today and what can we do to avoid breaking existing userspace?

If the value is completely ignored by user space then we can simply set it to zero and add some deprecated comment on the field.

If the the incorrect value is somehow used then we should still provide it even when it is completely wrong.

Regards,
Christian.

Quoted 5 lines
Quoted 1 line

Alex

_______________________________________________
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

#17 lore raw
In reply to Flora Cui
Quoted 166 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Flora Cui
Sent: Wednesday, June 21, 2017 3:42 AM
To: Alex Deucher
Cc: amd-gfx list
Subject: Re: [PATCH] drm/amdgpu: export gpu always on cu bitmap

Quoted 14 lines · Alex Deucher
Quoted 13 lines · Flora Cui
Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 2 +-
 8 files changed, 22 insertions(+), 9 deletions(-)
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu.h

Quoted 21 lines
Quoted 21 lines

index 6b7d2a1..6b9a91c 100644

drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-       uint32_t number; /* total active CU number */
-       uint32_t ao_cu_mask;
        uint32_t max_waves_per_simd;
        uint32_t wave_front_size;
        uint32_t max_scratch_slots_per_cu;
        uint32_t lds_size;
+
+       /* total active CU number */
+       uint32_t number;
+       uint32_t ao_cu_mask;
+       uint32_t ao_cu_bitmap[4][4];
        uint32_t bitmap[4][4];
 };
 
Quoted 1 line

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Quoted 14 lines
Quoted 14 lines

index 0424711..5a1d794 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR       3
-#define KMS_DRIVER_MINOR       17
+#define KMS_DRIVER_MINOR       18
 #define KMS_DRIVER_PATCHLEVEL  0
 
Quoted 2 lines

Review

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +0 -0
 int amdgpu_vram_limit = 0;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device

Quoted 4 lines

index f68ced6..6ba8204 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
@@ -591,8 +591,9 @@ static int amdgpu_info_ioctl(struct drm_device

*dev, void *data, struct drm_file

Quoted 6 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -1
                dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
                dev_info.cu_active_number = adev->gfx.cu_info.number;
-               dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
                dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+               memcpy(&dev_info.cu_ao_bitmap[0], &adev-
Quoted 7 lines

gfx.cu_info.ao_cu_bitmap[0],

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c static int amdgpu_info_ioctl(struct drm_device · line 597

Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +1 -0
+                      sizeof(adev->gfx.cu_info.ao_cu_bitmap));
                memcpy(&dev_info.cu_bitmap[0], &adev-

gfx.cu_info.bitmap[0],

Review

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
                       sizeof(adev->gfx.cu_info.bitmap));
                dev_info.vram_type = adev->mc.vram_type;
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_get_cu_info(struct

Quoted 4 lines

index 7b0b3cf..5173ca1 100644

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct

amdgpu_device *adev)

Quoted 11 lines

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
 
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c static void gfx_v7_0_get_cu_info(struct

Quoted 4 lines

index fb0a94c..8c4dd7b 100644

drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct

amdgpu_device *adev)

Quoted 11 lines

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c static void gfx_v8_0_get_cu_info(struct

Quoted 4 lines

index 1a75ab1..9edb509 100644

drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct

amdgpu_device *adev)

Quoted 11 lines

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
(quoted diff) +0 -0

b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c

Quoted 4 lines

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_get_cu_info(struct

Quoted 4 lines

index 5d56126..0d6a6d9 100644

drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct

amdgpu_device *adev,

Quoted 11 lines

Review

Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
                                mask <<= 1;
                        }
                        active_cu_number += counter;
-                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       if (i < 2 && j < 2)
+                               ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                       cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
                }
        }
        gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
(quoted diff) +0 -0

b/include/uapi/drm/amdgpu_drm.h

Quoted 6 lines
Quoted 6 lines

index 4f34394..4304422 100644

include/uapi/drm/amdgpu_drm.h +0 -0
@@ -760,7 +760,7 @@ struct drm_amdgpu_info_device {
        __u64 max_memory_clock;
        /* cu information */
Quoted 8 lines

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 766

Quoted 6 lines
include/uapi/drm/amdgpu_drm.h +1 -1
        __u32 cu_active_number;
-       __u32 cu_ao_mask;
+       __u32 cu_ao_bitmap[4][4];
        __u32 cu_bitmap[4][4];
        /** Render backend pipe mask. One render backend is CB+DB. */
        __u32 enabled_rb_pipes_mask;

You need to add these to the end of the structure for backwards

Quoted 4 lines

compatibility.

Quoted 1 line

OK. How to handle cu_ao_mask? it's invalid, yet kmd has to keep it for backward compatibility.

Correct. You'll have to leave it there for compatibility, but the UMDs should use the new data if the kernel is new enough.

Alex

Quoted 5 lines
Quoted 1 line

Alex

_______________________________________________
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

author
#18 lore raw

PATCH v2 1/1 drm/amdgpu: export gpu always on cu bitmap

In reply to a message not in the archive

v2: keep cu_ao_mask for backward compatibility.

Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 3 +++
 8 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-	uint32_t number; /* total active CU number */
-	uint32_t ao_cu_mask;
 	uint32_t max_waves_per_simd;
 	uint32_t wave_front_size;
 	uint32_t max_scratch_slots_per_cu;
 	uint32_t lds_size;
+
+	/* total active CU number */
+	uint32_t number;
+	uint32_t ao_cu_mask;
+	uint32_t ao_cu_bitmap[4][4];
 	uint32_t bitmap[4][4];
 };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	17
+#define KMS_DRIVER_MINOR	18
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -1
index f68ced6..eff2e11 100644
@@ -591,8 +591,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
 		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
 		dev_info.cu_active_number = adev->gfx.cu_info.number;
-		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
+		dev_info.cu_ao_mask = 0;
 		dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+		memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+		       sizeof(adev->gfx.cu_info.ao_cu_bitmap));
 		memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
 		       sizeof(adev->gfx.cu_info.bitmap));
 		dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
 	}
 	gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +3 -0
index 4f34394..d0ee739 100644
@@ -760,6 +760,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
 	__u32 cu_ao_mask;
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
@@ -814,6 +815,8 @@ struct drm_amdgpu_info_device {
 	/* max gs wavefront per vgt*/
 	__u32 max_gs_waves_per_vgt;
 	__u32 _pad1;
+	/* always on cu bitmap */
+	__u32 cu_ao_bitmap[4][4];
 };
 
 struct drm_amdgpu_info_hw_ip {
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1498101191-19634-1-git-send-email-Flora.Cui-5C7GfCeVMHo@public.gmane.org

#20 lore raw

Am 22.06.2017 um 05:13 schrieb Flora Cui:

Quoted 4 lines

v2: keep cu_ao_mask for backward compatibility.

Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab

I can't judge the technical correctness, but at least it looks backward compatible now.

Patch is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Quoted 138 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
  include/uapi/drm/amdgpu_drm.h           | 3 +++
  8 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
  };
 
  struct amdgpu_cu_info {
-	uint32_t number; /* total active CU number */
-	uint32_t ao_cu_mask;
  	uint32_t max_waves_per_simd;
  	uint32_t wave_front_size;
  	uint32_t max_scratch_slots_per_cu;
  	uint32_t lds_size;
+
+	/* total active CU number */
+	uint32_t number;
+	uint32_t ao_cu_mask;
+	uint32_t ao_cu_bitmap[4][4];
  	uint32_t bitmap[4][4];
  };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
   * - 3.15.0 - Export more gpu info for gfx9
   * - 3.16.0 - Add reserved vmid support
   * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
   */
  #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	17
+#define KMS_DRIVER_MINOR	18
  #define KMS_DRIVER_PATCHLEVEL	0
 
  int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -1
index f68ced6..eff2e11 100644
@@ -591,8 +591,10 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
  		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
  		dev_info.cu_active_number = adev->gfx.cu_info.number;
-		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
+		dev_info.cu_ao_mask = 0;
  		dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+		memcpy(&dev_info.cu_ao_bitmap[0], &adev->gfx.cu_info.ao_cu_bitmap[0],
+		       sizeof(adev->gfx.cu_info.ao_cu_bitmap));
  		memcpy(&dev_info.cu_bitmap[0], &adev->gfx.cu_info.bitmap[0],
  		       sizeof(adev->gfx.cu_info.bitmap));
  		dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
  				mask <<= 1;
  			}
  			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
  		}
  	}
 
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
  				mask <<= 1;
  			}
  			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
  		}
  	}
  	gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
  				mask <<= 1;
  			}
  			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
  		}
  	}
  	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
  				mask <<= 1;
  			}
  			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
  		}
  	}
  	gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +1 -0
index 4f34394..d0ee739 100644
@@ -760,6 +760,7 @@ struct drm_amdgpu_info_device {
  	__u64 max_memory_clock;
  	/* cu information */
  	__u32 cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
  	__u32 cu_ao_mask;
  	__u32 cu_bitmap[4][4];
  	/** Render backend pipe mask. One render backend is CB+DB. */

include/uapi/drm/amdgpu_drm.h struct drm_amdgpu_info_device { · line 822

Quoted 8 lines
include/uapi/drm/amdgpu_drm.h +2 -0
@@ -814,6 +815,8 @@ struct drm_amdgpu_info_device {
  	/* max gs wavefront per vgt*/
  	__u32 max_gs_waves_per_vgt;
  	__u32 _pad1;
+	/* always on cu bitmap */
+	__u32 cu_ao_bitmap[4][4];
  };
 
  struct drm_amdgpu_info_hw_ip {

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

Reviewed-by Alex Deucher
#21 lore raw
In reply to a message not in the archive
Quoted 7 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Flora Cui
Sent: Wednesday, June 21, 2017 11:13 PM
To: [email protected]
Cc: Cui, Flora
Subject: [PATCH v2] drm/amdgpu: export gpu always on cu bitmap

Tweak the subject and commit message a bit. Something like:

drm/amdgpu: Fix the exported always on CU bitmap

Newer asics with 4 SEs are not able to fit the entire bitmask in the original field, use an array instead.

With that,

Quoted 173 lines

v2: keep cu_ao_mask for backward compatibility.

Change-Id I056d8af23340d46e5140bd10cc38dfb887cc78ab
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 7 +++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c   | 4 +++-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c   | 4 +++-
 include/uapi/drm/amdgpu_drm.h           | 3 +++
 8 files changed, 25 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +5 -2
index 6b7d2a1..6b9a91c 100644
@@ -1029,12 +1029,15 @@ struct amdgpu_gfx_config {
 };
 
 struct amdgpu_cu_info {
-	uint32_t number; /* total active CU number */
-	uint32_t ao_cu_mask;
 	uint32_t max_waves_per_simd;
 	uint32_t wave_front_size;
 	uint32_t max_scratch_slots_per_cu;
 	uint32_t lds_size;
+
+	/* total active CU number */
+	uint32_t number;
+	uint32_t ao_cu_mask;
+	uint32_t ao_cu_bitmap[4][4];
 	uint32_t bitmap[4][4];
 };
 
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +2 -1
index 0424711..5a1d794 100644
@@ -67,9 +67,10 @@
  * - 3.15.0 - Export more gpu info for gfx9
  * - 3.16.0 - Add reserved vmid support
  * - 3.17.0 - Add AMDGPU_NUM_VRAM_CPU_PAGE_FAULTS.
+ * - 3.18.0 - Export gpu always on cu bitmap
  */
 #define KMS_DRIVER_MAJOR	3
-#define KMS_DRIVER_MINOR	17
+#define KMS_DRIVER_MINOR	18
 #define KMS_DRIVER_PATCHLEVEL	0
 
 int amdgpu_vram_limit = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -1
index f68ced6..eff2e11 100644
@@ -591,8 +591,10 @@ static int amdgpu_info_ioctl(struct drm_device
 *dev, void *data, struct drm_file
 		dev_info.gart_page_size = AMDGPU_GPU_PAGE_SIZE;
 
 		dev_info.cu_active_number = adev->gfx.cu_info.number;
-		dev_info.cu_ao_mask = adev->gfx.cu_info.ao_cu_mask;
+		dev_info.cu_ao_mask = 0;
 		dev_info.ce_ram_size = adev->gfx.ce_ram_size;
+		memcpy(&dev_info.cu_ao_bitmap[0], &adev-
 >gfx.cu_info.ao_cu_bitmap[0],
+		       sizeof(adev->gfx.cu_info.ao_cu_bitmap));
 		memcpy(&dev_info.cu_bitmap[0], &adev-
Quoted 1 line

gfx.cu_info.bitmap[0],

drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +0 -0
 		       sizeof(adev->gfx.cu_info.bitmap));
 		dev_info.vram_type = adev->mc.vram_type;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +3 -1
index 7b0b3cf..5173ca1 100644
@@ -3535,7 +3535,9 @@ static void gfx_v6_0_get_cu_info(struct
 amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j *
 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 	}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +3 -1
index fb0a94c..8c4dd7b 100644
@@ -5427,7 +5427,9 @@ static void gfx_v7_0_get_cu_info(struct
 amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j *
 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 	}
 	gfx_v7_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +3 -1
index 1a75ab1..9edb509 100644
@@ -7080,7 +7080,9 @@ static void gfx_v8_0_get_cu_info(struct
 amdgpu_device *adev)
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j *
 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 	}
 	gfx_v8_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -1
index 5d56126..0d6a6d9 100644
@@ -4459,7 +4459,9 @@ static int gfx_v9_0_get_cu_info(struct
 amdgpu_device *adev,
 				mask <<= 1;
 			}
 			active_cu_number += counter;
-			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+			if (i < 2 && j < 2)
+				ao_cu_mask |= (ao_bitmap << (i * 16 + j *
 8));
+			cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
 		}
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -0
 	}
 	gfx_v9_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
include/uapi/drm/amdgpu_drm.h +3 -1
index 4f34394..d0ee739 100644
@@ -760,6 +760,7 @@ struct drm_amdgpu_info_device {
 	__u64 max_memory_clock;
 	/* cu information */
 	__u32 cu_active_number;
+	/* NOTE: cu_ao_mask is INVALID, DON'T use it */
 	__u32 cu_ao_mask;
 	__u32 cu_bitmap[4][4];
 	/** Render backend pipe mask. One render backend is CB+DB. */
@@ -814,6 +815,8 @@ struct drm_amdgpu_info_device {
 	/* max gs wavefront per vgt*/
 	__u32 max_gs_waves_per_vgt;
 	__u32 _pad1;
+	/* always on cu bitmap */
+	__u32 cu_ao_bitmap[4][4];
 };
 
 struct drm_amdgpu_info_hw_ip {
--

2.7.4

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