From: Andres Rodriguez <andresx7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: "Liu, Shaoyun" <Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org>,
"amd-gfx list
(amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org)"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>,
"Deucher,
Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>
Cc: brahma_sw_dev <brahma_sw_dev-5C7GfCeVMHo@public.gmane.org>
Subject: Re: Move kiq ring lock out of virt strucure
Date: Fri, 28 Apr 2017 17:41:09 -0400 [thread overview]
Message-ID: <eacb1673-75ab-2cc8-87f2-ce2beef861eb@gmail.com> (raw)
In-Reply-To: <DM5PR12MB1179284CC4DD50F4D0DDF85DF4130-2J9CzHegvk8p/eksZXEfgQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
I actually have a similar patch in my tree at the moment.
Only a minor nitpick (the original base also has the same problem). Can
you rename 'lock_ring' to 'ring_mutex'? Usually the _lock suffix is
used for spinlock_t and _mutex is used for mutexes.
With that fixed you can add:
Reviewed-by: Andres Rodriguez <andresx7@gmail.com>
Regards,
Andres
On 2017-04-28 05:26 PM, Liu, Shaoyun wrote:
> From c520110807459bdd3fa4d6c86b2f2ab291051ebc Mon Sep 17 00:00:00 2001
> From: Shaoyun Liu <Shaoyun.Liu@amd.com>
> Date: Fri, 28 Apr 2017 17:18:26 -0400
> Subject: [PATCH] drm/amdgpu: Move kiq ring lock out of virt structure
>
> The usage of kiq should not depend on the virtualization.
>
> Change-Id: I39a439383b0c48d8f410cd362325b8404382cd53
> Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 +
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 9 ++++-----
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 1 -
> drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 2 ++
> drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 2 ++
> 5 files changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index e330009..dbd0cb2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -909,6 +909,7 @@ struct amdgpu_mec {
> struct amdgpu_kiq {
> u64 eop_gpu_addr;
> struct amdgpu_bo *eop_obj;
> + struct mutex lock_ring;
> struct amdgpu_ring ring;
> struct amdgpu_irq_src irq;
> };
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 1363239..4da15e8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -108,7 +108,6 @@ void amdgpu_virt_init_setting(struct amdgpu_device *adev)
> adev->cg_flags = 0;
> adev->pg_flags = 0;
>
> - mutex_init(&adev->virt.lock_kiq);
> mutex_init(&adev->virt.lock_reset);
> }
>
> @@ -122,12 +121,12 @@ uint32_t amdgpu_virt_kiq_rreg(struct amdgpu_device *adev, uint32_t reg)
>
> BUG_ON(!ring->funcs->emit_rreg);
>
> - mutex_lock(&adev->virt.lock_kiq);
> + mutex_lock(&kiq->lock_ring);
> amdgpu_ring_alloc(ring, 32);
> amdgpu_ring_emit_rreg(ring, reg);
> amdgpu_fence_emit(ring, &f);
> amdgpu_ring_commit(ring);
> - mutex_unlock(&adev->virt.lock_kiq);
> + mutex_unlock(&kiq->lock_ring);
>
> r = fence_wait(f, false);
> if (r)
> @@ -148,12 +147,12 @@ void amdgpu_virt_kiq_wreg(struct amdgpu_device *adev, uint32_t reg, uint32_t v)
>
> BUG_ON(!ring->funcs->emit_wreg);
>
> - mutex_lock(&adev->virt.lock_kiq);
> + mutex_lock(&kiq->lock_ring);
> amdgpu_ring_alloc(ring, 32);
> amdgpu_ring_emit_wreg(ring, reg, v);
> amdgpu_fence_emit(ring, &f);
> amdgpu_ring_commit(ring);
> - mutex_unlock(&adev->virt.lock_kiq);
> + mutex_unlock(&kiq->lock_ring);
>
> r = fence_wait(f, false);
> if (r)
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> index a8ed162..6f2b7df 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h
> @@ -52,7 +52,6 @@ struct amdgpu_virt {
> uint64_t csa_vmid0_addr;
> bool chained_ib_support;
> uint32_t reg_val_offs;
> - struct mutex lock_kiq;
> struct mutex lock_reset;
> struct amdgpu_irq_src ack_irq;
> struct amdgpu_irq_src rcv_irq;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> index ac64e01..d649479 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
> @@ -1385,6 +1385,8 @@ static int gfx_v8_0_kiq_init_ring(struct amdgpu_device *adev,
> struct amdgpu_kiq *kiq = &adev->gfx.kiq;
> int r = 0;
>
> + mutex_init(&kiq->lock_ring);
> +
> r = amdgpu_wb_get(adev, &adev->virt.reg_val_offs);
> if (r)
> return r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> index 08daa3f..9b68d33 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
> @@ -615,6 +615,8 @@ static int gfx_v9_0_kiq_init_ring(struct amdgpu_device *adev,
> struct amdgpu_kiq *kiq = &adev->gfx.kiq;
> int r = 0;
>
> + mutex_init(&kiq->lock_ring);
> +
> r = amdgpu_wb_get(adev, &adev->virt.reg_val_offs);
> if (r)
> return r;
> -- 1.9.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-04-28 21:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-28 21:26 Move kiq ring lock out of virt strucure Liu, Shaoyun
[not found] ` <DM5PR12MB1179284CC4DD50F4D0DDF85DF4130-2J9CzHegvk8p/eksZXEfgQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-04-28 21:41 ` Andres Rodriguez [this message]
[not found] ` <eacb1673-75ab-2cc8-87f2-ce2beef861eb-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-04-28 21:54 ` Liu, Shaoyun
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=eacb1673-75ab-2cc8-87f2-ce2beef861eb@gmail.com \
--to=andresx7-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
--cc=Shaoyun.Liu-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=brahma_sw_dev-5C7GfCeVMHo@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.