diff mbox

[1/2] drm/amdgpu: fix bug when amdkfd destroys hqd

Message ID 1438155863-9187-1-git-send-email-oded.gabbay@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Oded Gabbay July 29, 2015, 7:44 a.m. UTC
The wrong define was used to check if the hqd is still active

Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ilia Mirkin July 29, 2015, 8:49 a.m. UTC | #1
On Wed, Jul 29, 2015 at 3:44 AM, Oded Gabbay <oded.gabbay@gmail.com> wrote:
> The wrong define was used to check if the hqd is still active
>
> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
> index 2daad33..6a45330 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
> @@ -450,7 +450,8 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,
>
>         while (true) {
>                 temp = RREG32(mmCP_HQD_ACTIVE);
> -               if (temp & CP_HQD_ACTIVE__ACTIVE__SHIFT)
> +               if (temp & (CP_HQD_ACTIVE__ACTIVE_MASK <<
> +                               CP_HQD_ACTIVE__ACTIVE__SHIFT))

It's a bit moot here since the shift is 0, but I thought the mask
normally included the shift already...

#define CP_MQD_BASE_ADDR__BASE_ADDR_MASK 0xfffffffc
#define CP_MQD_BASE_ADDR__BASE_ADDR__SHIFT 0x2

#define CP_HPD_EOP_CONTROL__PEND_SIG_SEM_MASK 0x80000000
#define CP_HPD_EOP_CONTROL__PEND_SIG_SEM__SHIFT 0x1f

etc.

>                         break;
>                 if (timeout == 0) {
>                         pr_err("kfd: cp queue preemption time out (%dms)\n",
> --
> 2.4.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Oded Gabbay July 29, 2015, 8:54 a.m. UTC | #2
On Wed, Jul 29, 2015 at 11:49 AM, Ilia Mirkin <imirkin@alum.mit.edu> wrote:
> On Wed, Jul 29, 2015 at 3:44 AM, Oded Gabbay <oded.gabbay@gmail.com> wrote:
>> The wrong define was used to check if the hqd is still active
>>
>> Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
>> index 2daad33..6a45330 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
>> @@ -450,7 +450,8 @@ static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,
>>
>>         while (true) {
>>                 temp = RREG32(mmCP_HQD_ACTIVE);
>> -               if (temp & CP_HQD_ACTIVE__ACTIVE__SHIFT)
>> +               if (temp & (CP_HQD_ACTIVE__ACTIVE_MASK <<
>> +                               CP_HQD_ACTIVE__ACTIVE__SHIFT))
>
> It's a bit moot here since the shift is 0, but I thought the mask
> normally included the shift already...
>
> #define CP_MQD_BASE_ADDR__BASE_ADDR_MASK 0xfffffffc
> #define CP_MQD_BASE_ADDR__BASE_ADDR__SHIFT 0x2
>
> #define CP_HPD_EOP_CONTROL__PEND_SIG_SEM_MASK 0x80000000
> #define CP_HPD_EOP_CONTROL__PEND_SIG_SEM__SHIFT 0x1f
>
> etc.
>
Absolutely correct and although it is muted here, still best practice
is to fix that.
Thanks!

   Oded
>>                         break;
>>                 if (timeout == 0) {
>>                         pr_err("kfd: cp queue preemption time out (%dms)\n",
>> --
>> 2.4.3
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
index 2daad33..6a45330 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v7.c
@@ -450,7 +450,8 @@  static int kgd_hqd_destroy(struct kgd_dev *kgd, uint32_t reset_type,
 
 	while (true) {
 		temp = RREG32(mmCP_HQD_ACTIVE);
-		if (temp & CP_HQD_ACTIVE__ACTIVE__SHIFT)
+		if (temp & (CP_HQD_ACTIVE__ACTIVE_MASK <<
+				CP_HQD_ACTIVE__ACTIVE__SHIFT))
 			break;
 		if (timeout == 0) {
 			pr_err("kfd: cp queue preemption time out (%dms)\n",