提交 aac1e3ca 编写于 作者: A Alex Deucher

drm/amdgpu/gfx: fix off by one in rb rework (v2)

When I reworked this code, I messed up num rb count.

v2: use hweight32
Reviewed-by: NKen Wang <Qingquing.Wang@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 d2eaa590
...@@ -1635,7 +1635,7 @@ static u32 gfx_v7_0_get_rb_active_bitmap(struct amdgpu_device *adev) ...@@ -1635,7 +1635,7 @@ static u32 gfx_v7_0_get_rb_active_bitmap(struct amdgpu_device *adev)
static void gfx_v7_0_setup_rb(struct amdgpu_device *adev) static void gfx_v7_0_setup_rb(struct amdgpu_device *adev)
{ {
int i, j; int i, j;
u32 data, tmp, num_rbs = 0; u32 data;
u32 active_rbs = 0; u32 active_rbs = 0;
mutex_lock(&adev->grbm_idx_mutex); mutex_lock(&adev->grbm_idx_mutex);
...@@ -1655,10 +1655,7 @@ static void gfx_v7_0_setup_rb(struct amdgpu_device *adev) ...@@ -1655,10 +1655,7 @@ static void gfx_v7_0_setup_rb(struct amdgpu_device *adev)
mutex_unlock(&adev->grbm_idx_mutex); mutex_unlock(&adev->grbm_idx_mutex);
adev->gfx.config.backend_enable_mask = active_rbs; adev->gfx.config.backend_enable_mask = active_rbs;
tmp = active_rbs; adev->gfx.config.num_rbs = hweight32(active_rbs);
while (tmp >>= 1)
num_rbs++;
adev->gfx.config.num_rbs = num_rbs;
} }
/** /**
......
...@@ -2613,7 +2613,7 @@ static u32 gfx_v8_0_get_rb_active_bitmap(struct amdgpu_device *adev) ...@@ -2613,7 +2613,7 @@ static u32 gfx_v8_0_get_rb_active_bitmap(struct amdgpu_device *adev)
static void gfx_v8_0_setup_rb(struct amdgpu_device *adev) static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
{ {
int i, j; int i, j;
u32 data, tmp, num_rbs = 0; u32 data;
u32 active_rbs = 0; u32 active_rbs = 0;
mutex_lock(&adev->grbm_idx_mutex); mutex_lock(&adev->grbm_idx_mutex);
...@@ -2629,10 +2629,7 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev) ...@@ -2629,10 +2629,7 @@ static void gfx_v8_0_setup_rb(struct amdgpu_device *adev)
mutex_unlock(&adev->grbm_idx_mutex); mutex_unlock(&adev->grbm_idx_mutex);
adev->gfx.config.backend_enable_mask = active_rbs; adev->gfx.config.backend_enable_mask = active_rbs;
tmp = active_rbs; adev->gfx.config.num_rbs = hweight32(active_rbs);
while (tmp >>= 1)
num_rbs++;
adev->gfx.config.num_rbs = num_rbs;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册