diff mbox

drm/radeon: fix active_cu mask on SI and CIK after re-init (v2)

Message ID 1408396344-21766-1-git-send-email-alexander.deucher@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Aug. 18, 2014, 9:12 p.m. UTC
Need to initialize the mask to 0 on init, otherwise it
keeps increasing.

bug:
https://bugzilla.kernel.org/show_bug.cgi?id=82581

v2: also fix cu count

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/cik.c | 9 ++++-----
 drivers/gpu/drm/radeon/si.c  | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

Comments

Michel Dänzer Aug. 19, 2014, 2:25 a.m. UTC | #1
On 19.08.2014 06:12, Alex Deucher wrote:
> Need to initialize the mask to 0 on init, otherwise it
> keeps increasing.
> 
> bug:
> https://bugzilla.kernel.org/show_bug.cgi?id=82581
> 
> v2: also fix cu count

Might be even nicer to keep the two fixes separate, but either way:

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Alex Deucher Aug. 19, 2014, 4:02 p.m. UTC | #2
On Mon, Aug 18, 2014 at 10:25 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On 19.08.2014 06:12, Alex Deucher wrote:
>> Need to initialize the mask to 0 on init, otherwise it
>> keeps increasing.
>>
>> bug:
>> https://bugzilla.kernel.org/show_bug.cgi?id=82581
>>
>> v2: also fix cu count
>
> Might be even nicer to keep the two fixes separate, but either way:
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>

I've split it into two patches.

Thanks.

Alex
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index af2cbc6..f4e1470 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -3483,7 +3483,7 @@  static void cik_gpu_init(struct radeon_device *rdev)
 	u32 mc_shared_chmap, mc_arb_ramcfg;
 	u32 hdp_host_path_cntl;
 	u32 tmp;
-	int i, j, k;
+	int i, j;
 
 	switch (rdev->family) {
 	case CHIP_BONAIRE:
@@ -3672,12 +3672,11 @@  static void cik_gpu_init(struct radeon_device *rdev)
 		     rdev->config.cik.max_sh_per_se,
 		     rdev->config.cik.max_backends_per_se);
 
+	rdev->config.cik.active_cus = 0;
 	for (i = 0; i < rdev->config.cik.max_shader_engines; i++) {
 		for (j = 0; j < rdev->config.cik.max_sh_per_se; j++) {
-			for (k = 0; k < rdev->config.cik.max_cu_per_sh; k++) {
-				rdev->config.cik.active_cus +=
-					hweight32(cik_get_cu_active_bitmap(rdev, i, j));
-			}
+			rdev->config.cik.active_cus +=
+				hweight32(cik_get_cu_active_bitmap(rdev, i, j));
 		}
 	}
 
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 7e58423..a1274a3 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -3057,7 +3057,7 @@  static void si_gpu_init(struct radeon_device *rdev)
 	u32 sx_debug_1;
 	u32 hdp_host_path_cntl;
 	u32 tmp;
-	int i, j, k;
+	int i, j;
 
 	switch (rdev->family) {
 	case CHIP_TAHITI:
@@ -3255,12 +3255,11 @@  static void si_gpu_init(struct radeon_device *rdev)
 		     rdev->config.si.max_sh_per_se,
 		     rdev->config.si.max_cu_per_sh);
 
+	rdev->config.si.active_cus = 0;
 	for (i = 0; i < rdev->config.si.max_shader_engines; i++) {
 		for (j = 0; j < rdev->config.si.max_sh_per_se; j++) {
-			for (k = 0; k < rdev->config.si.max_cu_per_sh; k++) {
-				rdev->config.si.active_cus +=
-					hweight32(si_get_cu_active_bitmap(rdev, i, j));
-			}
+			rdev->config.si.active_cus +=
+				hweight32(si_get_cu_active_bitmap(rdev, i, j));
 		}
 	}