Skip to contentSkip to conversation

drm/amdgpu:fix get wrong gfx always on cu masks.

PATCH In review Rex Zhu 2 participants 3 messages Apr 26, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu:fix get wrong gfx always on cu masks.

Change-Id I46d7f2531eaec8135ccaf64b5ce8abc433c54e1a
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |  4 ++--
 4 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +8 -2
index f7579de..25c3703 100644
@@ -3719,6 +3719,12 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
@@ -3737,9 +3743,9 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 			bitmap = gfx_v6_0_get_cu_enabled(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++) {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +8 -2
index fa5a0d2..75cca54 100644
@@ -5339,6 +5339,12 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
@@ -5357,9 +5363,9 @@ static void gfx_v7_0_get_cu_info(struct amdgpu_device *adev)
 			bitmap = gfx_v7_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +8 -2
index 2ff5f19..0025ef6 100644
@@ -7098,9 +7098,15 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
+
 	amdgpu_gfx_parse_disable_cu(disable_masks, 4, 2);
 
 	mutex_lock(&adev->grbm_idx_mutex);
@@ -7116,9 +7122,9 @@ static void gfx_v8_0_get_cu_info(struct amdgpu_device *adev)
 			bitmap = gfx_v8_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 42cfd3b..13da795 100644
@@ -3667,9 +3667,9 @@ static int gfx_v9_0_get_cu_info(struct amdgpu_device *adev,
 			bitmap = gfx_v9_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++) {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < adev->gfx.config.max_cu_per_sh)
 						ao_bitmap |= mask;
 					counter ++;
 				}
Signature · 6 lines
1.9.1

_______________________________________________
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): 1493195758-5904-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Acked-by Alex Deucher
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, April 26, 2017 4:36 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu:fix get wrong gfx always on cu masks.

Change-Id I46d7f2531eaec8135ccaf64b5ce8abc433c54e1a
Quoted 132 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |  4 ++--
 4 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +8 -2
index f7579de..25c3703 100644
@@ -3719,6 +3719,12 @@ static void gfx_v6_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
@@ -3737,9 +3743,9 @@ static void gfx_v6_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v6_0_get_cu_enabled(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +8 -2
index fa5a0d2..75cca54 100644
@@ -5339,6 +5339,12 @@ static void gfx_v7_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
@@ -5357,9 +5363,9 @@ static void gfx_v7_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v7_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
index 2ff5f19..0025ef6 100644
@@ -7098,9 +7098,15 @@ static void gfx_v8_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
+
 	amdgpu_gfx_parse_disable_cu(disable_masks, 4, 2);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
 	mutex_lock(&adev->grbm_idx_mutex);
@@ -7116,9 +7122,9 @@ static void gfx_v8_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v8_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 42cfd3b..13da795 100644
@@ -3667,9 +3667,9 @@ static int gfx_v9_0_get_cu_info(struct
 amdgpu_device *adev,
 			bitmap = gfx_v9_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < adev-
 >gfx.config.max_cu_per_sh)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
 						ao_bitmap |= mask;
 					counter ++;
 				}
--

1.9.1

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

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB16524B65A8CA3698231BA4C7F7110-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#4 lore raw
Quoted 15 lines

-----Original Message-----
From: Deucher, Alexander
Sent: Wednesday, April 26, 2017 12:11 PM
To: Zhu, Rex; [email protected]
Cc: Zhu, Rex
Subject: RE: [PATCH] drm/amdgpu:fix get wrong gfx always on cu masks.

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Wednesday, April 26, 2017 4:36 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu:fix get wrong gfx always on cu masks.

Quoted 4 lines
Quoted 2 lines
Change-Id I46d7f2531eaec8135ccaf64b5ce8abc433c54e1a

Might also want to mention the JIRA ticket id in the commit message.

Alex

Quoted 133 lines
Quoted 133 lines
---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 ++++++++--
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c |  4 ++--
 4 files changed, 26 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +8 -2
index f7579de..25c3703 100644
@@ -3719,6 +3719,12 @@ static void gfx_v6_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
@@ -3737,9 +3743,9 @@ static void gfx_v6_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v6_0_get_cu_enabled(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +8 -2
index fa5a0d2..75cca54 100644
@@ -5339,6 +5339,12 @@ static void gfx_v7_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
+
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
 
 	memset(cu_info, 0, sizeof(*cu_info));
@@ -5357,9 +5363,9 @@ static void gfx_v7_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v7_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +6 -0
index 2ff5f19..0025ef6 100644
@@ -7098,9 +7098,15 @@ static void gfx_v8_0_get_cu_info(struct
 amdgpu_device *adev)
 	u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
 	struct amdgpu_cu_info *cu_info = &adev->gfx.cu_info;
 	unsigned disable_masks[4 * 2];
+	u32 ao_cu_num;
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
+	if (adev->flags & AMD_IS_APU)
+		ao_cu_num = 2;
+	else
+		ao_cu_num = adev->gfx.config.max_cu_per_sh;
+
 	amdgpu_gfx_parse_disable_cu(disable_masks, 4, 2);
 
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
 	mutex_lock(&adev->grbm_idx_mutex);
@@ -7116,9 +7122,9 @@ static void gfx_v8_0_get_cu_info(struct
 amdgpu_device *adev)
 			bitmap = gfx_v8_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < ao_cu_num)
 						ao_bitmap |= mask;
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +0 -0
 					counter ++;
 				}
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2 -2
index 42cfd3b..13da795 100644
@@ -3667,9 +3667,9 @@ static int gfx_v9_0_get_cu_info(struct
 amdgpu_device *adev,
 			bitmap = gfx_v9_0_get_cu_active_bitmap(adev);
 			cu_info->bitmap[i][j] = bitmap;
 
-			for (k = 0; k < 16; k ++) {
+			for (k = 0; k < adev->gfx.config.max_cu_per_sh; k ++)
 {
 				if (bitmap & mask) {
-					if (counter < 2)
+					if (counter < adev-
 >gfx.config.max_cu_per_sh)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0 -1
 						ao_bitmap |= mask;
 					counter ++;
 				}
--

1.9.1

Quoted 4 lines
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