All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: Tom St Denis <tstdenis82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>
Subject: Re: [PATCH 1/5] drm/amd/amdgpu: Clean up gfx_v8_0_kiq_set_interrupt_state()
Date: Tue, 4 Apr 2017 16:07:07 +0200	[thread overview]
Message-ID: <257e2fd5-943f-2d83-5706-869a35b988f7@vodafone.de> (raw)
In-Reply-To: <20170404140344.17441-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>

Am 04.04.2017 um 16:03 schrieb Tom St Denis:
> Use new WREG32_FIELD_OFFSET() to clean up code.
>
> Signed-off-by: Tom St Denis <tom.stdenis@amd.com>

Reviewed-by: Christian König <christian.koenig@amd.com> for the whole 
series.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h   |  3 +++
>   drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 40 +++++++++++------------------------
>   2 files changed, 15 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 86fba1af1cdd..0e746db61a72 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -1730,6 +1730,9 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev);
>   #define WREG32_FIELD(reg, field, val)	\
>   	WREG32(mm##reg, (RREG32(mm##reg) & ~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field))
>   
> +#define WREG32_FIELD_OFFSET(reg, offset, field, val)	\
> +	WREG32(mm##reg + offset, (RREG32(mm##reg + offset) & ~REG_FIELD_MASK(reg, field)) | (val) << REG_FIELD_SHIFT(reg, field))
> +
>   /*
>    * BIOS helpers.
>    */
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index 1f35497089a6..595dc14019dd 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -6814,40 +6814,24 @@ static int gfx_v8_0_kiq_set_interrupt_state(struct amdgpu_device *adev,
>   					    unsigned int type,
>   					    enum amdgpu_interrupt_state state)
>   {
> -	uint32_t tmp, target;
>   	struct amdgpu_ring *ring = &(adev->gfx.kiq.ring);
>   
>   	BUG_ON(ring->funcs->type != AMDGPU_RING_TYPE_KIQ);
>   
> -	if (ring->me == 1)
> -		target = mmCP_ME1_PIPE0_INT_CNTL;
> -	else
> -		target = mmCP_ME2_PIPE0_INT_CNTL;
> -	target += ring->pipe;
> -
>   	switch (type) {
>   	case AMDGPU_CP_KIQ_IRQ_DRIVER0:
> -		if (state == AMDGPU_IRQ_STATE_DISABLE) {
> -			tmp = RREG32(mmCPC_INT_CNTL);
> -			tmp = REG_SET_FIELD(tmp, CPC_INT_CNTL,
> -						 GENERIC2_INT_ENABLE, 0);
> -			WREG32(mmCPC_INT_CNTL, tmp);
> -
> -			tmp = RREG32(target);
> -			tmp = REG_SET_FIELD(tmp, CP_ME2_PIPE0_INT_CNTL,
> -						 GENERIC2_INT_ENABLE, 0);
> -			WREG32(target, tmp);
> -		} else {
> -			tmp = RREG32(mmCPC_INT_CNTL);
> -			tmp = REG_SET_FIELD(tmp, CPC_INT_CNTL,
> -						 GENERIC2_INT_ENABLE, 1);
> -			WREG32(mmCPC_INT_CNTL, tmp);
> -
> -			tmp = RREG32(target);
> -			tmp = REG_SET_FIELD(tmp, CP_ME2_PIPE0_INT_CNTL,
> -						 GENERIC2_INT_ENABLE, 1);
> -			WREG32(target, tmp);
> -		}
> +		WREG32_FIELD(CPC_INT_CNTL, GENERIC2_INT_ENABLE,
> +			     state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1);
> +		if (ring->me == 1)
> +			WREG32_FIELD_OFFSET(CP_ME1_PIPE0_INT_CNTL,
> +				     ring->pipe,
> +				     GENERIC2_INT_ENABLE,
> +				     state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1);
> +		else
> +			WREG32_FIELD_OFFSET(CP_ME2_PIPE0_INT_CNTL,
> +				     ring->pipe,
> +				     GENERIC2_INT_ENABLE,
> +				     state == AMDGPU_IRQ_STATE_DISABLE ? 0 : 1);
>   		break;
>   	default:
>   		BUG(); /* kiq only support GENERIC2_INT now */


_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2017-04-04 14:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-04 14:03 [PATCH 1/5] drm/amd/amdgpu: Clean up gfx_v8_0_kiq_set_interrupt_state() Tom St Denis
     [not found] ` <20170404140344.17441-1-tom.stdenis-5C7GfCeVMHo@public.gmane.org>
2017-04-04 14:03   ` [PATCH 2/5] drm/amd/amdgpu: Clean up gfx_v8_0_inactive_hqd() Tom St Denis
2017-04-04 14:03   ` [PATCH 3/5] drm/amd/amdgpu: clean up gfx_v8_0_kiq_init_register() Tom St Denis
2017-04-04 14:03   ` [PATCH 4/5] drm/amd/amdgpu: de-numberify HQD_ACTIVE check Tom St Denis
2017-04-04 14:03   ` [PATCH 5/5] drm/amd/amdgpu: Clean up gfx_v8_0_mqd_init() Tom St Denis
2017-04-04 14:07   ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=257e2fd5-943f-2d83-5706-869a35b988f7@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=tom.stdenis-5C7GfCeVMHo@public.gmane.org \
    --cc=tstdenis82-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.