RE: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
Hi Alex, It is strange I didn't get your email on Wednesday. I will add one patch to move all the doorbell definitions to a separate amdgpu_doorbell.h Regards, Oak From: Deucher, Alexander Sent: Friday, November 23, 2018 1:57 PM To: Alex Deucher ; Zeng, Oak ; Koenig, Christian Cc: amd-gfx list Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic The main idea is to be able to use different layouts on different asics that may share the same IP code. Alex From: amd-gfx mailto:amd-gfx-boun...@lists.freedesktop.org>> on behalf of Christian König mailto:ckoenig.leichtzumer...@gmail.com>> Sent: Thursday, November 22, 2018 4:26:53 AM To: Alex Deucher; Zeng, Oak Cc: amd-gfx list Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic Am 21.11.18 um 17:39 schrieb Alex Deucher: > On Wed, Nov 21, 2018 at 11:37 AM Zeng, Oak > mailto:oak.z...@amd.com>> wrote: >>> No need to add a new file for this. Just add this to vega20_reg_init.c. >> Agreed. >> >>> Also, please use the doorbell enums rather than hardcoding the numbers. >> Ok. Where should I put the doorbell enums for vega20? In amdgpu.h or in >> vega20_reg_init.c? > Maybe add amdgpu_doorbell.h and move all of the enums there? Mhm, isn't part of the goal of this work to get rid of the enums? I mean when we have a structure to hold the indexes to we really need the enums any more? I don't think so. Christian. > > Alex > >> thanks, >> Oak >> >> -Original Message- >> From: amd-gfx >> mailto:amd-gfx-boun...@lists.freedesktop.org>> >> On Behalf Of Alex Deucher >> Sent: Wednesday, November 21, 2018 11:22 AM >> To: Zeng, Oak mailto:oak.z...@amd.com>> >> Cc: Zeng, Oak mailto:oak.z...@amd.com>>; amd-gfx list >> mailto:amd-gfx@lists.freedesktop.org>> >> Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and >> future asic >> >> On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng >> mailto:oz...@amd.com>> wrote: >>> Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 >>> Signed-off-by: Oak Zeng mailto:oz...@amd.com>> >>> Suggested-by: Felix Kuehling >>> mailto:felix.kuehl...@amd.com>> >>> Suggested-by: Alex Deucher >>> mailto:alexander.deuc...@amd.com>> >>> --- >>> drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- >>> drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + >>> .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 >>> ++ >>> 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 >>> drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile >>> b/drivers/gpu/drm/amd/amdgpu/Makefile >>> index 3ab8eba..b3b150b 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/Makefile >>> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile >>> @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o >>> gfx_v6_0.o si_ih.o si_dma.o dce >>> >>> amdgpu-y += \ >>> vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o >>> nbio_v7_0.o vega10_reg_init.o \ >>> - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o >>> vega12_doorbell_index_init.o \ >>> - vi_doorbell_index_init.o >>> + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o >>> vega10_doorbell_index_init.o \ >>> + vega12_doorbell_index_init.o vega20_doorbell_index_init.o >>> >>> # add DF block >>> amdgpu-y += \ >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> index 3ffd8f5..19f2149 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct >>> amdgpu_device *adev) >>> vi_doorbell_index_init(adev); >>> else if (adev->asic_type == CHIP_VEGA10) >>> vega10_doorbell_index_init(adev); >>> - else >>> + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == >>> + CHIP_RAVEN) >>> vega12_doorbell_index_init(adev); >>> + else >>> + vega20_doorbell_index_init(adev); >>> >>> /* No
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
The main idea is to be able to use different layouts on different asics that may share the same IP code. Alex From: amd-gfx on behalf of Christian K?nig Sent: Thursday, November 22, 2018 4:26:53 AM To: Alex Deucher; Zeng, Oak Cc: amd-gfx list Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic Am 21.11.18 um 17:39 schrieb Alex Deucher: > On Wed, Nov 21, 2018 at 11:37 AM Zeng, Oak wrote: >>> No need to add a new file for this. Just add this to vega20_reg_init.c. >> Agreed. >> >>> Also, please use the doorbell enums rather than hardcoding the numbers. >> Ok. Where should I put the doorbell enums for vega20? In amdgpu.h or in >> vega20_reg_init.c? > Maybe add amdgpu_doorbell.h and move all of the enums there? Mhm, isn't part of the goal of this work to get rid of the enums? I mean when we have a structure to hold the indexes to we really need the enums any more? I don't think so. Christian. > > Alex > >> thanks, >> Oak >> >> -Original Message- >> From: amd-gfx On Behalf Of Alex >> Deucher >> Sent: Wednesday, November 21, 2018 11:22 AM >> To: Zeng, Oak >> Cc: Zeng, Oak ; amd-gfx list >> >> Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and >> future asic >> >> On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng wrote: >>> Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 >>> Signed-off-by: Oak Zeng >>> Suggested-by: Felix Kuehling >>> Suggested-by: Alex Deucher >>> --- >>> drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- >>> drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- >>> drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + >>> .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 >>> ++ >>> 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 >>> drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c >>> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile >>> b/drivers/gpu/drm/amd/amdgpu/Makefile >>> index 3ab8eba..b3b150b 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/Makefile >>> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile >>> @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o >>> gfx_v6_0.o si_ih.o si_dma.o dce >>> >>> amdgpu-y += \ >>> vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o >>> nbio_v7_0.o vega10_reg_init.o \ >>> - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o >>> vega12_doorbell_index_init.o \ >>> - vi_doorbell_index_init.o >>> + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o >>> vega10_doorbell_index_init.o \ >>> + vega12_doorbell_index_init.o vega20_doorbell_index_init.o >>> >>> # add DF block >>> amdgpu-y += \ >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> index 3ffd8f5..19f2149 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c >>> @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct >>> amdgpu_device *adev) >>> vi_doorbell_index_init(adev); >>> else if (adev->asic_type == CHIP_VEGA10) >>> vega10_doorbell_index_init(adev); >>> - else >>> + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == >>> + CHIP_RAVEN) >>> vega12_doorbell_index_init(adev); >>> + else >>> + vega20_doorbell_index_init(adev); >>> >>> /* No doorbell on SI hardware generation */ >>> if (adev->asic_type < CHIP_BONAIRE) { diff --git >>> a/drivers/gpu/drm/amd/amdgpu/soc15.h >>> b/drivers/gpu/drm/amd/amdgpu/soc15.h >>> index 939c0e8..6ba0d26 100644 >>> --- a/drivers/gpu/drm/amd/amdgpu/soc15.h >>> +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h >>> @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device >>> *adev); >>> >>> void vega10_doorbell_index_init(struct amdgpu_device *adev); void >>> vega12_doorbell_index_init(struct amdgpu_device *adev); >>> +void vega20_doorbell_index_init(struct amdgpu_device *adev); >>> #endif >>> diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c >>> b/drivers/gpu/drm/amd/amdgpu/vega20_d
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
Am 21.11.18 um 17:39 schrieb Alex Deucher: On Wed, Nov 21, 2018 at 11:37 AM Zeng, Oak wrote: No need to add a new file for this. Just add this to vega20_reg_init.c. Agreed. Also, please use the doorbell enums rather than hardcoding the numbers. Ok. Where should I put the doorbell enums for vega20? In amdgpu.h or in vega20_reg_init.c? Maybe add amdgpu_doorbell.h and move all of the enums there? Mhm, isn't part of the goal of this work to get rid of the enums? I mean when we have a structure to hold the indexes to we really need the enums any more? I don't think so. Christian. Alex thanks, Oak -Original Message- From: amd-gfx On Behalf Of Alex Deucher Sent: Wednesday, November 21, 2018 11:22 AM To: Zeng, Oak Cc: Zeng, Oak ; amd-gfx list Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng wrote: Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 Signed-off-by: Oak Zeng Suggested-by: Felix Kuehling Suggested-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 ++ 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile b/drivers/gpu/drm/amd/amdgpu/Makefile index 3ab8eba..b3b150b 100644 --- a/drivers/gpu/drm/amd/amdgpu/Makefile +++ b/drivers/gpu/drm/amd/amdgpu/Makefile @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o si_ih.o si_dma.o dce amdgpu-y += \ vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o vega10_reg_init.o \ - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o vega12_doorbell_index_init.o \ - vi_doorbell_index_init.o + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o vega10_doorbell_index_init.o \ + vega12_doorbell_index_init.o vega20_doorbell_index_init.o # add DF block amdgpu-y += \ diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index 3ffd8f5..19f2149 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct amdgpu_device *adev) vi_doorbell_index_init(adev); else if (adev->asic_type == CHIP_VEGA10) vega10_doorbell_index_init(adev); - else + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == + CHIP_RAVEN) vega12_doorbell_index_init(adev); + else + vega20_doorbell_index_init(adev); /* No doorbell on SI hardware generation */ if (adev->asic_type < CHIP_BONAIRE) { diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h b/drivers/gpu/drm/amd/amdgpu/soc15.h index 939c0e8..6ba0d26 100644 --- a/drivers/gpu/drm/amd/amdgpu/soc15.h +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device *adev); void vega10_doorbell_index_init(struct amdgpu_device *adev); void vega12_doorbell_index_init(struct amdgpu_device *adev); +void vega20_doorbell_index_init(struct amdgpu_device *adev); #endif diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c new file mode 100644 index 000..dcaef7f --- /dev/null +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c @@ -0,0 +1,64 @@ +/* + * Copyright 2018 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person +obtaining a + * copy of this software and associated documentation files (the +"Software"), + * to deal in the Software without restriction, including without +limitation + * the rights to use, copy, modify, merge, publish, distribute, +sublicense, + * and/or sell copies of the Software, and to permit persons to whom +the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be +included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, +DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +OR + * OTHER DEALINGS IN THE SOFTWARE. + * + */ + +#include "amdgpu.h" + +void vega20_doorbell_index_init(struct amdgpu_de
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
On Wed, Nov 21, 2018 at 5:00 PM Oak Zeng wrote: > > v2: Use enum definition instead of hardcoded value > > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > Signed-off-by: Oak Zeng > Suggested-by: Felix Kuehling > Suggested-by: Alex Deucher This patch should come before patch 5 so we update all of the asics before we switch to using the new interface. Alex > --- > drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 > > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++- > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 33 ++ > 4 files changed, 87 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > index b7ee4ef..e4101b1 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h > @@ -392,6 +392,56 @@ struct amdgpu_doorbell { > u32 num_doorbells; /* Number of doorbells > actually reserved for amdgpu. */ > }; > > +typedef enum _AMDGPU_VEGA20_DOORBELL_ASSIGNMENT > +{ > + /* Compute + GFX: 0~255 */ > + AMDGPU_VEGA20_DOORBELL_KIQ = 0x000, > + AMDGPU_VEGA20_DOORBELL_HIQ = 0x001, > + AMDGPU_VEGA20_DOORBELL_DIQ = 0x002, > + AMDGPU_VEGA20_DOORBELL_MEC_RING0 = 0x003, > + AMDGPU_VEGA20_DOORBELL_MEC_RING1 = 0x004, > + AMDGPU_VEGA20_DOORBELL_MEC_RING2 = 0x005, > + AMDGPU_VEGA20_DOORBELL_MEC_RING3 = 0x006, > + AMDGPU_VEGA20_DOORBELL_MEC_RING4 = 0x007, > + AMDGPU_VEGA20_DOORBELL_MEC_RING5 = 0x008, > + AMDGPU_VEGA20_DOORBELL_MEC_RING6 = 0x009, > + AMDGPU_VEGA20_DOORBELL_MEC_RING7 = 0x00A, > + AMDGPU_VEGA20_DOORBELL_USERQUEUE_START = 0x00B, > + AMDGPU_VEGA20_DOORBELL_USERQUEUE_END = 0x08A, > + AMDGPU_VEGA20_DOORBELL_GFX_RING0 = 0x08B, > + /* SDMA:256~335*/ > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0= 0x100, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1= 0x10A, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2= 0x114, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3= 0x11E, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4= 0x128, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5= 0x132, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6= 0x13C, > + AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7= 0x146, > + /* IH: 376~391 */ > + AMDGPU_VEGA20_DOORBELL_IH = 0x178, > + /* MMSCH: 392~407 > +* overlap the doorbell assignment with VCN as they are mutually > exclusive > +* VCE engine's doorbell is 32 bit and two VCE ring share one QWORD > +*/ > + AMDGPU_VEGA20_DOORBELL64_VCN0_1 = 0x188, /* lower 32 > bits for VNC0 and upper 32 bits for VNC1 */ > + AMDGPU_VEGA20_DOORBELL64_VCN2_3 = 0x189, > + AMDGPU_VEGA20_DOORBELL64_VCN4_5 = 0x18A, > + AMDGPU_VEGA20_DOORBELL64_VCN6_7 = 0x18B, > + > + AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1 = 0x188, > + AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3 = 0x189, > + AMDGPU_VEGA20_DOORBELL64_UVD_RING4_5 = 0x18A, > + AMDGPU_VEGA20_DOORBELL64_UVD_RING6_7 = 0x18B, > + > + AMDGPU_VEGA20_DOORBELL64_VCE_RING0_1 = 0x18C, > + AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3 = 0x18D, > + AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5 = 0x18E, > + AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7 = 0x18F, > + AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT= 0x18F, > + AMDGPU_VEGA20_DOORBELL_INVALID = 0x > +} AMDGPU_VEGA20_DOORBELL_ASSIGNMENT; > + > /* > * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space > */ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 3ffd8f5..19f2149 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > amdgpu_device *adev) > vi_doorbell_index_init(adev); > else if (adev->asic_type == CHIP_VEGA10) > vega10_doorbell_index_init(adev); > - else > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > CHIP_RAVEN) > vega12_doorbell_index_init(adev); > + else > + vega20_doorbell_index_init(adev); > > /* No doorbell on SI hardware generation */ > if (adev->asic_type < CHIP_BONAIRE) { > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h > b/drivers/gpu/drm/amd/amdgpu/soc15.h >
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
On Wed, Nov 21, 2018 at 11:37 AM Zeng, Oak wrote: > > >No need to add a new file for this. Just add this to vega20_reg_init.c. > Agreed. > > >Also, please use the doorbell enums rather than hardcoding the numbers. > Ok. Where should I put the doorbell enums for vega20? In amdgpu.h or in > vega20_reg_init.c? Maybe add amdgpu_doorbell.h and move all of the enums there? Alex > > thanks, > Oak > > -Original Message- > From: amd-gfx On Behalf Of Alex > Deucher > Sent: Wednesday, November 21, 2018 11:22 AM > To: Zeng, Oak > Cc: Zeng, Oak ; amd-gfx list > Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and > future asic > > On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng wrote: > > > > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > > Signed-off-by: Oak Zeng > > Suggested-by: Felix Kuehling > > Suggested-by: Alex Deucher > > --- > > drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- > > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- > > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > > .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 > > ++ > > 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 > > drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > > b/drivers/gpu/drm/amd/amdgpu/Makefile > > index 3ab8eba..b3b150b 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > > @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o > > gfx_v6_0.o si_ih.o si_dma.o dce > > > > amdgpu-y += \ > > vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o > > nbio_v7_0.o vega10_reg_init.o \ > > - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o > > vega12_doorbell_index_init.o \ > > - vi_doorbell_index_init.o > > + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o > > vega10_doorbell_index_init.o \ > > + vega12_doorbell_index_init.o vega20_doorbell_index_init.o > > > > # add DF block > > amdgpu-y += \ > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > index 3ffd8f5..19f2149 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > > amdgpu_device *adev) > > vi_doorbell_index_init(adev); > > else if (adev->asic_type == CHIP_VEGA10) > > vega10_doorbell_index_init(adev); > > - else > > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > > + CHIP_RAVEN) > > vega12_doorbell_index_init(adev); > > + else > > + vega20_doorbell_index_init(adev); > > > > /* No doorbell on SI hardware generation */ > > if (adev->asic_type < CHIP_BONAIRE) { diff --git > > a/drivers/gpu/drm/amd/amdgpu/soc15.h > > b/drivers/gpu/drm/amd/amdgpu/soc15.h > > index 939c0e8..6ba0d26 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/soc15.h > > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h > > @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device > > *adev); > > > > void vega10_doorbell_index_init(struct amdgpu_device *adev); void > > vega12_doorbell_index_init(struct amdgpu_device *adev); > > +void vega20_doorbell_index_init(struct amdgpu_device *adev); > > #endif > > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > new file mode 100644 > > index 000..dcaef7f > > --- /dev/null > > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > @@ -0,0 +1,64 @@ > > +/* > > + * Copyright 2018 Advanced Micro Devices, Inc. > > + * > > + * Permission is hereby granted, free of charge, to any person > > +obtaining a > > + * copy of this software and associated documentation files (the > > +"Software"), > > + * to deal in the Software without restriction, including without > > +limitation > > + * the rights to use, copy, modify, merge, publish, distribute, > > +sublicense, > > + * and/or sell copies of the Software, and to permit persons to whom > > +the > > + * Software is furnished to do so, subject to the following conditions: > > + * > > + * The above copyrigh
RE: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
>No need to add a new file for this. Just add this to vega20_reg_init.c. Agreed. >Also, please use the doorbell enums rather than hardcoding the numbers. Ok. Where should I put the doorbell enums for vega20? In amdgpu.h or in vega20_reg_init.c? thanks, Oak -Original Message- From: amd-gfx On Behalf Of Alex Deucher Sent: Wednesday, November 21, 2018 11:22 AM To: Zeng, Oak Cc: Zeng, Oak ; amd-gfx list Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng wrote: > > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > Signed-off-by: Oak Zeng > Suggested-by: Felix Kuehling > Suggested-by: Alex Deucher > --- > drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 > ++ > 4 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 > drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index 3ab8eba..b3b150b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o > gfx_v6_0.o si_ih.o si_dma.o dce > > amdgpu-y += \ > vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o > vega10_reg_init.o \ > - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o > vega12_doorbell_index_init.o \ > - vi_doorbell_index_init.o > + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o > vega10_doorbell_index_init.o \ > + vega12_doorbell_index_init.o vega20_doorbell_index_init.o > > # add DF block > amdgpu-y += \ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 3ffd8f5..19f2149 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > amdgpu_device *adev) > vi_doorbell_index_init(adev); > else if (adev->asic_type == CHIP_VEGA10) > vega10_doorbell_index_init(adev); > - else > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > + CHIP_RAVEN) > vega12_doorbell_index_init(adev); > + else > + vega20_doorbell_index_init(adev); > > /* No doorbell on SI hardware generation */ > if (adev->asic_type < CHIP_BONAIRE) { diff --git > a/drivers/gpu/drm/amd/amdgpu/soc15.h > b/drivers/gpu/drm/amd/amdgpu/soc15.h > index 939c0e8..6ba0d26 100644 > --- a/drivers/gpu/drm/amd/amdgpu/soc15.h > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h > @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device > *adev); > > void vega10_doorbell_index_init(struct amdgpu_device *adev); void > vega12_doorbell_index_init(struct amdgpu_device *adev); > +void vega20_doorbell_index_init(struct amdgpu_device *adev); > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > new file mode 100644 > index 000..dcaef7f > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > @@ -0,0 +1,64 @@ > +/* > + * Copyright 2018 Advanced Micro Devices, Inc. > + * > + * Permission is hereby granted, free of charge, to any person > +obtaining a > + * copy of this software and associated documentation files (the > +"Software"), > + * to deal in the Software without restriction, including without > +limitation > + * the rights to use, copy, modify, merge, publish, distribute, > +sublicense, > + * and/or sell copies of the Software, and to permit persons to whom > +the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be > +included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, > +EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF > +MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT > +SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, > +DAMAGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR > +OTHERWISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH
RE: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
The new doorbell layout for vega20 was an agreement b/t Felix/Alex and Windows team. Windows team want us to try the new layout first. If it works, they will apply the same layout. Previously we used a MACRO definitions for doorbell layout. There are 32-bit and 64-bit doorbell layout. Pre-vega10 use 32-bit definition and Vega10 and after use 64-bit definition. All the doorbell layout change need to be backward compatible, otherwise we break compatibility with GIM and the Windows driver on SRIOV. If we do it in the old way, we will have to add a new set of layout for vega20 because the agreed layout for vega20 is totally different. Making doorbell layout asic-specific makes things clear and easy to extend in the future if we want to use different layout for new asics. The old MACRO definition is pretty messy. Sometimes people might be confusing when to use the 32-bit layout and when 64-bit. I actually found a typo in gfx_v9_0.c where 64-bit doorbell should be used but 32-bit was programmed. If you guys agree, what I can do is, keep the old MACRO definition but do the asic-specific doorbell initialization at the same time? thanks, Oak -Original Message- From: amd-gfx On Behalf Of Liu, Shaoyun Sent: Wednesday, November 21, 2018 11:10 AM To: Zeng, Oak ; amd-gfx@lists.freedesktop.org Cc: Zeng, Oak Subject: Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic The doorbell index defines should be compatible with what is used in windows driver . I don't see the necessary to introduce the new init file for this instead of use the original MACRO defines. We need to coordinate with windows driver team for a new user queue SDMA doorbell range and used them for vega20 and future asic . Regards shaoyun.liu On 2018-11-21 10:52 a.m., Oak Zeng wrote: > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > Signed-off-by: Oak Zeng > Suggested-by: Felix Kuehling > Suggested-by: Alex Deucher > --- > drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 > ++ > 4 files changed, 70 insertions(+), 3 deletions(-) > create mode 100644 > drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index 3ab8eba..b3b150b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o > gfx_v6_0.o si_ih.o si_dma.o dce > > amdgpu-y += \ > vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o > vega10_reg_init.o \ > - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o > vega12_doorbell_index_init.o \ > - vi_doorbell_index_init.o > + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o > vega10_doorbell_index_init.o \ > + vega12_doorbell_index_init.o vega20_doorbell_index_init.o > > # add DF block > amdgpu-y += \ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 3ffd8f5..19f2149 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > amdgpu_device *adev) > vi_doorbell_index_init(adev); > else if (adev->asic_type == CHIP_VEGA10) > vega10_doorbell_index_init(adev); > - else > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > +CHIP_RAVEN) > vega12_doorbell_index_init(adev); > + else > + vega20_doorbell_index_init(adev); > > /* No doorbell on SI hardware generation */ > if (adev->asic_type < CHIP_BONAIRE) { diff --git > a/drivers/gpu/drm/amd/amdgpu/soc15.h > b/drivers/gpu/drm/amd/amdgpu/soc15.h > index 939c0e8..6ba0d26 100644 > --- a/drivers/gpu/drm/amd/amdgpu/soc15.h > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h > @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device > *adev); > > void vega10_doorbell_index_init(struct amdgpu_device *adev); > void vega12_doorbell_index_init(struct amdgpu_device *adev); > +void vega20_doorbell_index_init(struct amdgpu_device *adev); > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > new file mode 100644 > index 000..dcaef7f > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > @@ -0,0 +1,64 @@ > +/* > + * Copyright
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
On Wed, Nov 21, 2018 at 10:52 AM Oak Zeng wrote: > > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > Signed-off-by: Oak Zeng > Suggested-by: Felix Kuehling > Suggested-by: Alex Deucher > --- > drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 > ++ > 4 files changed, 70 insertions(+), 3 deletions(-) > create mode 100644 drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index 3ab8eba..b3b150b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o > si_ih.o si_dma.o dce > > amdgpu-y += \ > vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o > vega10_reg_init.o \ > - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o > vega12_doorbell_index_init.o \ > - vi_doorbell_index_init.o > + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o > vega10_doorbell_index_init.o \ > + vega12_doorbell_index_init.o vega20_doorbell_index_init.o > > # add DF block > amdgpu-y += \ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 3ffd8f5..19f2149 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > amdgpu_device *adev) > vi_doorbell_index_init(adev); > else if (adev->asic_type == CHIP_VEGA10) > vega10_doorbell_index_init(adev); > - else > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > CHIP_RAVEN) > vega12_doorbell_index_init(adev); > + else > + vega20_doorbell_index_init(adev); > > /* No doorbell on SI hardware generation */ > if (adev->asic_type < CHIP_BONAIRE) { > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h > b/drivers/gpu/drm/amd/amdgpu/soc15.h > index 939c0e8..6ba0d26 100644 > --- a/drivers/gpu/drm/amd/amdgpu/soc15.h > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h > @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device *adev); > > void vega10_doorbell_index_init(struct amdgpu_device *adev); > void vega12_doorbell_index_init(struct amdgpu_device *adev); > +void vega20_doorbell_index_init(struct amdgpu_device *adev); > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > new file mode 100644 > index 000..dcaef7f > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > @@ -0,0 +1,64 @@ > +/* > + * Copyright 2018 Advanced Micro Devices, Inc. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > + * OTHER DEALINGS IN THE SOFTWARE. > + * > + */ > + > +#include "amdgpu.h" > + > +void vega20_doorbell_index_init(struct amdgpu_device *adev) > +{ > + /* Compute + GFX: 0~255 */ > + adev->doorbell_index.kiq = 0x00; > + adev->doorbell_index.mec_ring0 = 0x03; > + adev->doorbell_index.mec_ring1 = 0x04; > + adev->doorbell_index.mec_ring2 = 0x05; > + adev->doorbell_index.mec_ring3 = 0x06; > + adev->doorbell_index.mec_ring4 = 0x07; > + adev->doorbell_index.mec_ring5 = 0x08; > + adev->doorbell_index.mec_ring6 = 0x09; > + adev->doorbell_index.mec_ring7 = 0x0a; > + adev->doorbell_index.userqueue_start = 0x0b; > + adev->doorbell_index.userqueue_end = 0x8a; > + adev->doorbell_index.gfx_ring0 = 0x8b; > + /* SDMA:256~335*/ > + adev->doorbell_index.sdma_engine0 = 0x100; > +
Re: [PATCH 7/7] drm/amdgpu: Use new doorbell layout for vega20 and future asic
The doorbell index defines should be compatible with what is used in windows driver . I don't see the necessary to introduce the new init file for this instead of use the original MACRO defines. We need to coordinate with windows driver team for a new user queue SDMA doorbell range and used them for vega20 and future asic . Regards shaoyun.liu On 2018-11-21 10:52 a.m., Oak Zeng wrote: > Change-Id: I04d22fb717ac50483c0835f160a2e860e344f358 > Signed-off-by: Oak Zeng > Suggested-by: Felix Kuehling > Suggested-by: Alex Deucher > --- > drivers/gpu/drm/amd/amdgpu/Makefile| 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 +- > drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + > .../drm/amd/amdgpu/vega20_doorbell_index_init.c| 64 > ++ > 4 files changed, 70 insertions(+), 3 deletions(-) > create mode 100644 drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > > diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile > b/drivers/gpu/drm/amd/amdgpu/Makefile > index 3ab8eba..b3b150b 100644 > --- a/drivers/gpu/drm/amd/amdgpu/Makefile > +++ b/drivers/gpu/drm/amd/amdgpu/Makefile > @@ -63,8 +63,8 @@ amdgpu-$(CONFIG_DRM_AMDGPU_SI)+= si.o gmc_v6_0.o gfx_v6_0.o > si_ih.o si_dma.o dce > > amdgpu-y += \ > vi.o mxgpu_vi.o nbio_v6_1.o soc15.o emu_soc.o mxgpu_ai.o nbio_v7_0.o > vega10_reg_init.o \ > - vega20_reg_init.o nbio_v7_4.o vega10_doorbell_index_init.o > vega12_doorbell_index_init.o \ > - vi_doorbell_index_init.o > + vega20_reg_init.o nbio_v7_4.o vi_doorbell_index_init.o > vega10_doorbell_index_init.o \ > + vega12_doorbell_index_init.o vega20_doorbell_index_init.o > > # add DF block > amdgpu-y += \ > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 3ffd8f5..19f2149 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -517,8 +517,10 @@ static int amdgpu_device_doorbell_init(struct > amdgpu_device *adev) > vi_doorbell_index_init(adev); > else if (adev->asic_type == CHIP_VEGA10) > vega10_doorbell_index_init(adev); > - else > + else if (adev->asic_type == CHIP_VEGA12 || adev->asic_type == > CHIP_RAVEN) > vega12_doorbell_index_init(adev); > + else > + vega20_doorbell_index_init(adev); > > /* No doorbell on SI hardware generation */ > if (adev->asic_type < CHIP_BONAIRE) { > diff --git a/drivers/gpu/drm/amd/amdgpu/soc15.h > b/drivers/gpu/drm/amd/amdgpu/soc15.h > index 939c0e8..6ba0d26 100644 > --- a/drivers/gpu/drm/amd/amdgpu/soc15.h > +++ b/drivers/gpu/drm/amd/amdgpu/soc15.h > @@ -60,4 +60,5 @@ int vega20_reg_base_init(struct amdgpu_device *adev); > > void vega10_doorbell_index_init(struct amdgpu_device *adev); > void vega12_doorbell_index_init(struct amdgpu_device *adev); > +void vega20_doorbell_index_init(struct amdgpu_device *adev); > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > new file mode 100644 > index 000..dcaef7f > --- /dev/null > +++ b/drivers/gpu/drm/amd/amdgpu/vega20_doorbell_index_init.c > @@ -0,0 +1,64 @@ > +/* > + * Copyright 2018 Advanced Micro Devices, Inc. > + * > + * Permission is hereby granted, free of charge, to any person obtaining a > + * copy of this software and associated documentation files (the "Software"), > + * to deal in the Software without restriction, including without limitation > + * the rights to use, copy, modify, merge, publish, distribute, sublicense, > + * and/or sell copies of the Software, and to permit persons to whom the > + * Software is furnished to do so, subject to the following conditions: > + * > + * The above copyright notice and this permission notice shall be included in > + * all copies or substantial portions of the Software. > + * > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL > + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR > + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, > + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > + * OTHER DEALINGS IN THE SOFTWARE. > + * > + */ > + > +#include "amdgpu.h" > + > +void vega20_doorbell_index_init(struct amdgpu_device *adev) > +{ > + /* Compute + GFX: 0~255 */ > + adev->doorbell_index.kiq = 0x00; > + adev->doorbell_index.mec_ring0 = 0x03; > + adev->doorbell_index.mec_ring1 = 0x04; > + adev->doorbell_index.mec_ring2 = 0x05; > + adev->doorbell_index.mec_ring3 = 0x06; > + adev->doorbell_index.mec_ring4 = 0x07; > + adev->doorbell_index.mec_ring5 = 0x08; > + adev->doorbell_index.mec_ring6