From: Huang Rui <ray.huang-5C7GfCeVMHo@public.gmane.org>
To: "Koenig, Christian" <Christian.Koenig-5C7GfCeVMHo@public.gmane.org>
Cc: "Deucher,
Alexander" <Alexander.Deucher-5C7GfCeVMHo@public.gmane.org>,
"Huan, Alvin" <Alvin.Huan-5C7GfCeVMHo@public.gmane.org>,
"Wang, Ken" <Ken.Wang-5C7GfCeVMHo@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH 01/18] drm/amdgpu: abstract gart table initialization for gfxhub/mmhub
Date: Thu, 1 Jun 2017 09:59:46 +0800 [thread overview]
Message-ID: <20170601015945.GC2951@hr-amur2> (raw)
In-Reply-To: <1bda3f76-870e-02a0-b51e-f37f02e4ef52-5C7GfCeVMHo@public.gmane.org>
On Thu, Jun 01, 2017 at 01:02:18AM +0800, Koenig, Christian wrote:
> Am 31.05.2017 um 18:14 schrieb Huang Rui:
> > Signed-off-by: Huang Rui <ray.huang@amd.com>
> > ---
> > drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 33
> +++++++++++++++++++-------------
> > drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c | 33
> +++++++++++++++++++-------------
> > 2 files changed, 40 insertions(+), 26 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c b/drivers/gpu/drm/amd/
> amdgpu/gfxhub_v1_0.c
> > index 7c430c4..8cf30b7 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c
> > @@ -31,6 +31,24 @@
> >
> > #include "soc15_common.h"
> >
> > +static void gfxhub_v1_0_init_pt_regs(struct amdgpu_device *adev)
> > +{
> > + uint64_t value;
> > +
> > + BUG_ON(adev->gart.table_addr & (~0x0000FFFFFFFFF000ULL));
> > + value = adev->gart.table_addr - adev->mc.vram_start
> > + + adev->vm_manager.vram_base_offset;
> > + value &= 0x0000FFFFFFFFF000ULL;
> > + value |= 0x1; /*valid bit*/
> > +
> > + WREG32(SOC15_REG_OFFSET(GC, 0,
> > + mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32),
> > + (u32)value);
> > + WREG32(SOC15_REG_OFFSET(GC, 0,
> > + mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32),
> > + (u32)(value >> 32));
> > +}
> > +
> > int gfxhub_v1_0_gart_enable(struct amdgpu_device *adev)
> > {
> > u32 tmp;
> > @@ -38,6 +56,8 @@ int gfxhub_v1_0_gart_enable(struct amdgpu_device *adev)
> > u32 i;
> >
> > /* Program MC. */
> > + gfxhub_v1_0_init_pt_regs(adev);
> > +
> > /* Update configuration */
> > WREG32(SOC15_REG_OFFSET(GC, 0, mmMC_VM_SYSTEM_APERTURE_LOW_ADDR),
> > adev->mc.vram_start >> 18);
> > @@ -154,19 +174,6 @@ int gfxhub_v1_0_gart_enable(struct amdgpu_device *adev)
> > mmVM_CONTEXT0_PAGE_TABLE_END_ADDR_HI32),
> > (u32)(adev->mc.gtt_end >> 44));
> >
> > - BUG_ON(adev->gart.table_addr & (~0x0000FFFFFFFFF000ULL));
> > - value = adev->gart.table_addr - adev->mc.vram_start
> > - + adev->vm_manager.vram_base_offset;
> > - value &= 0x0000FFFFFFFFF000ULL;
> > - value |= 0x1; /*valid bit*/
> > -
> > - WREG32(SOC15_REG_OFFSET(GC, 0,
> > - mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32),
> > - (u32)value);
> > - WREG32(SOC15_REG_OFFSET(GC, 0,
> > - mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32),
> > - (u32)(value >> 32));
> > -
> > WREG32(SOC15_REG_OFFSET(GC, 0,
> > mmVM_L2_PROTECTION_FAULT_DEFAULT_ADDR_LO32),
> > (u32)(adev->dummy_page.addr >> 12));
> > diff --git a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c b/drivers/gpu/drm/amd/
> amdgpu/mmhub_v1_0.c
> > index afd9d85..84eb3a3 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/mmhub_v1_0.c
> > @@ -44,6 +44,24 @@ u64 mmhub_v1_0_get_fb_location(struct amdgpu_device *adev)
> > return base;
> > }
> >
> > +static void mmhub_v1_0_init_pt_regs(struct amdgpu_device *adev)
> > +{
> > + uint64_t value;
> > +
> > + BUG_ON(adev->gart.table_addr & (~0x0000FFFFFFFFF000ULL));
> > + value = adev->gart.table_addr - adev->mc.vram_start +
> > + adev->vm_manager.vram_base_offset;
> > + value &= 0x0000FFFFFFFFF000ULL;
> > + value |= 0x1; /* valid bit */
> > +
> > + WREG32(SOC15_REG_OFFSET(MMHUB, 0,
> > + mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_LO32),
> > + (u32)value);
> > + WREG32(SOC15_REG_OFFSET(MMHUB, 0,
> > + mmVM_CONTEXT0_PAGE_TABLE_BASE_ADDR_HI32),
> > + (u32)(value >> 32));
>
> While at it please use the upper_32_bits() and lower_32_bits() macros
> for this.
>
> Additional to that since you cleanup the code anyway (which is very
> appreciated!) please use the WREG32_SOC15() macro instead.
>
My pleasure. I found original mmhub/gfxhub programming sequence was really
hard to read when I was debugging S3 issue. So I have to break it down to
make it clearly.
Could I add one more patches at top of patch set to use
WREG32_SOC15/REG32_SOC15 instead for the whole GMC, GFXHUB, and MMHUB
blocks.
Thanks,
Ray
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-06-01 1:59 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-31 16:14 [PATCH 00/18] Vega10 S3 following up Huang Rui
[not found] ` <1496247293-16429-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 16:14 ` [PATCH 01/18] drm/amdgpu: abstract gart table initialization for gfxhub/mmhub Huang Rui
[not found] ` <1496247293-16429-2-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 16:32 ` Deucher, Alexander
2017-05-31 17:02 ` Christian König
[not found] ` <1bda3f76-870e-02a0-b51e-f37f02e4ef52-5C7GfCeVMHo@public.gmane.org>
2017-06-01 1:59 ` Huang Rui [this message]
2017-06-01 4:19 ` zhoucm1
[not found] ` <592F95C7.4080406-5C7GfCeVMHo@public.gmane.org>
2017-06-01 5:29 ` Huang Rui
2017-06-01 5:30 ` zhoucm1
2017-05-31 16:14 ` [PATCH 02/18] drm/amdgpu: abstract gart aperture " Huang Rui
[not found] ` <1496247293-16429-3-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 16:38 ` Deucher, Alexander
2017-05-31 16:14 ` [PATCH 03/18] drm/amdgpu: abstract system " Huang Rui
2017-05-31 16:14 ` [PATCH 04/18] drm/amdgpu: abstract TLB " Huang Rui
2017-05-31 16:14 ` [PATCH 05/18] drm/amdgpu: abstract cache " Huang Rui
2017-05-31 16:14 ` [PATCH 06/18] drm/amdgpu: abstract system domain enablement " Huang Rui
2017-05-31 16:14 ` [PATCH 07/18] drm/amdgpu: abstract disable identity aperture " Huang Rui
[not found] ` <1496247293-16429-8-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 16:21 ` Deucher, Alexander
2017-05-31 16:14 ` [PATCH 08/18] drm/amdgpu: abstract setup vmid config " Huang Rui
2017-05-31 16:14 ` [PATCH 09/18] drm/amdgpu: fix to miss program invalidation at resume Huang Rui
2017-05-31 16:14 ` [PATCH 10/18] drm/amdgpu: export gfxhub sw_init into gmc Huang Rui
2017-05-31 16:14 ` [PATCH 11/18] drm/amdgpu: export mmhub " Huang Rui
[not found] ` <1496247293-16429-12-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 17:04 ` Christian König
[not found] ` <fd87586c-8609-bd81-b7e3-46f2a72a90e2-5C7GfCeVMHo@public.gmane.org>
2017-06-01 1:42 ` Huang Rui
2017-05-31 16:14 ` [PATCH 12/18] drm/amdgpu: export mmhub set clockgating " Huang Rui
2017-05-31 16:14 ` [PATCH 13/18] drm/amdgpu: export mmhub get " Huang Rui
2017-05-31 16:14 ` [PATCH 14/18] drm/amdgpu: remove gfxhub ip Huang Rui
2017-05-31 16:14 ` [PATCH 15/18] drm/amdgpu: remove mmhub ip Huang Rui
2017-05-31 16:14 ` [PATCH 16/18] drm/amdgpu: add ip name print for selecting ips with ip_block_mask Huang Rui
2017-05-31 16:14 ` [PATCH 17/18] drm/amdgpu: add ip block number prints Huang Rui
2017-05-31 16:14 ` [PATCH 18/18] drm/amdgpu: fix the gart table cleared issue for S3 Huang Rui
[not found] ` <1496247293-16429-19-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org>
2017-05-31 16:29 ` Deucher, Alexander
[not found] ` <BN6PR12MB16529494252B5889988E00BBF7F10-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-05-31 16:58 ` Christian König
[not found] ` <e2d9fdd5-7544-8b2c-031d-3894e2a7ec07-5C7GfCeVMHo@public.gmane.org>
2017-06-01 1:49 ` Huang Rui
2017-05-31 16:43 ` [PATCH 00/18] Vega10 S3 following up Deucher, Alexander
2017-05-31 17:00 ` Zhang, Hawking
[not found] ` <CY1PR12MB053461B71BE32E7234ECF668FCF10-1s8aH8ViOEf7axfsnaG19wdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-06-01 2:01 ` Huang Rui
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=20170601015945.GC2951@hr-amur2 \
--to=ray.huang-5c7gfcevmho@public.gmane.org \
--cc=Alexander.Deucher-5C7GfCeVMHo@public.gmane.org \
--cc=Alvin.Huan-5C7GfCeVMHo@public.gmane.org \
--cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
--cc=Ken.Wang-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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.