drm/amdgpu: Add field in amdgpu_dev to hold reserved doorbell index
Subsystems (3)
PATCH 1/8 drm/amdgpu: Add field in amdgpu_dev to hold reserved doorbell index
This is a preparation work to make reserved doorbell index per device, instead of using a global macro definition. By doing this, we can easily change doorbell layout for future ASICs while not affecting ASICs in production.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +50 -0
@@ -813,6 +813,55 @@ struct amd_powerplay {uint32_t pp_feature; }; +/* Reserved doorbells for amdgpu (including multimedia). +* KFD can use all the rest in the 2M doorbell bar. +* For asic before vega10, doorbell is 32-bit, so the +* index/offset is in dword. For vega10 and after, doorbell +* can be 64-bit, so the index defined is in qword. +*/ +struct amdgpu_doorbell_index { +uint32_t kiq; +uint32_t mec_ring0; +uint32_t mec_ring1; +uint32_t mec_ring2; +uint32_t mec_ring3; +uint32_t mec_ring4; +uint32_t mec_ring5; +uint32_t mec_ring6; +uint32_t mec_ring7; +uint32_t userqueue_start; +uint32_t userqueue_end; +uint32_t gfx_ring0; +uint32_t sdma_engine0; +uint32_t sdma_engine1; +uint32_t sdma_engine2; +uint32_t sdma_engine3; +uint32_t sdma_engine4; +uint32_t sdma_engine5; +uint32_t sdma_engine6; +uint32_t sdma_engine7; +uint32_t ih; +union { +struct { +uint32_t vcn_ring0_1; +uint32_t vcn_ring2_3; +uint32_t vcn_ring4_5; +uint32_t vcn_ring6_7; + } vcn; +struct { +uint32_t uvd_ring0_1; +uint32_t uvd_ring2_3; +uint32_t uvd_ring4_5; +uint32_t uvd_ring6_7; +uint32_t vce_ring0_1; +uint32_t vce_ring2_3; +uint32_t vce_ring4_5; +uint32_t vce_ring6_7; + } uvd_vce; + }; +uint32_t max_assignment; +}; +#define AMDGPU_RESET_MAGIC_NUM 64struct amdgpu_device {struct device *dev;
@@ -1026,6 +1075,7 @@ struct amdgpu_device {unsigned long last_mm_index;bool in_gpu_reset;struct mutex lock_reset; +struct amdgpu_doorbell_index doorbell_index; };static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-1-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
PATCH 2/8 drm/amdgpu: Add asic func interface to init doorbell index
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +3 -0
@@ -654,6 +654,8 @@ struct amdgpu_asic_funcs { struct amdgpu_ring *ring);/* check if the asic needs a full reset of if soft reset will work */ bool (*need_full_reset)(struct amdgpu_device *adev); +/* initialize doorbell layout for specific asic*/ +void (*init_doorbell_index)(struct amdgpu_device *adev); };/*
@@ -1212,6 +1214,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_asic_flush_hdp (adev, r) (adev)->asic_funcs->flush_hdp((adev), (r))#define amdgpu_asic_invalidate_hdp (adev, r) (adev)->asic_funcs->invalidate_hdp((adev), (r))#define amdgpu_asic_need_full_reset (adev) (adev)->asic_funcs->need_full_reset((adev)) +#define amdgpu_asic_init_doorbell_index (adev) (adev)->asic_funcs->init_doorbell_index((adev))/* Common functions */ bool amdgpu_device_should_recover_gpu (struct amdgpu_device *adev);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-2-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 2/8] drm/amdgpu: Add asic func interface to init doorbell index
Quoted 3 lines · Oak Zeng
Change-Id I7e8a9c9dfd4f3bd0902679a1771c1a043ece2674Signed-off-by Oak Zeng <[email protected]>
With a patch description added,
Quoted 28 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +3
-1@@ -654,6 +654,8 @@ struct amdgpu_asic_funcs { struct amdgpu_ring *ring);/* check if the asic needs a full reset of if soft reset will work */ bool (*need_full_reset)(struct amdgpu_device *adev); +/* initialize doorbell layout for specific asic*/ +void (*init_doorbell_index)(struct amdgpu_device *adev); };/* @@ -1212,6 +1214,7 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define amdgpu_asic_flush_hdp (adev, r) (adev)->asic_funcs->flush_hdp((adev), (r))#define amdgpu_asic_invalidate_hdp (adev, r) (adev)->asic_funcs->invalidate_hdp((adev), (r))#define amdgpu_asic_need_full_reset (adev) (adev)->asic_funcs->need_full_reset((adev)) +#define amdgpu_asic_init_doorbell_index (adev) (adev)->asic_funcs->init_doorbell_index((adev))/* Common functions */ bool amdgpu_device_should_recover_gpu (struct amdgpu_device *adev); --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/8 drm/amdgpu: Vega10 doorbell index initialization
In reply to a message not in the archivev2: Use enum definition instead of hardcoded value
--- drivers/gpu/drm/amd/amdgpu/soc15.c | 1 + drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 30 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +1 -0
@@ -613,6 +613,7 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = .flush_hdp = &soc15_flush_hdp, .invalidate_hdp = &soc15_invalidate_hdp, .need_full_reset = &soc15_need_full_reset, + .init_doorbell_index = &vega10_doorbell_index_init, };static int soc15_common_early_init (void *handle)
drivers/gpu/drm/amd/amdgpu/soc15.h +1 -0
@@ -58,4 +58,5 @@ void soc15_program_register_sequence(struct amdgpu_device *adev,int vega10_reg_base_init (struct amdgpu_device *adev);int vega20_reg_base_init (struct amdgpu_device *adev); +void vega10_doorbell_index_init (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/amdgpu/vega10_reg_init.c +28 -0
@@ -56,4 +56,32 @@ int vega10_reg_base_init(struct amdgpu_device *adev)return 0 ; } +void vega10_doorbell_index_init (struct amdgpu_device *adev) +{ + adev->doorbell_index.kiq =AMDGPU_DOORBELL64_KIQ ; + adev->doorbell_index.mec_ring0 =AMDGPU_DOORBELL64_MEC_RING0 ; + adev->doorbell_index.mec_ring1 =AMDGPU_DOORBELL64_MEC_RING1 ; + adev->doorbell_index.mec_ring2 =AMDGPU_DOORBELL64_MEC_RING2 ; + adev->doorbell_index.mec_ring3 =AMDGPU_DOORBELL64_MEC_RING3 ; + adev->doorbell_index.mec_ring4 =AMDGPU_DOORBELL64_MEC_RING4 ; + adev->doorbell_index.mec_ring5 =AMDGPU_DOORBELL64_MEC_RING5 ; + adev->doorbell_index.mec_ring6 =AMDGPU_DOORBELL64_MEC_RING6 ; + adev->doorbell_index.mec_ring7 =AMDGPU_DOORBELL64_MEC_RING7 ; + adev->doorbell_index.userqueue_start =AMDGPU_DOORBELL64_USERQUEUE_START ; + adev->doorbell_index.userqueue_end =AMDGPU_DOORBELL64_USERQUEUE_END ; + adev->doorbell_index.gfx_ring0 =AMDGPU_DOORBELL64_GFX_RING0 ; + adev->doorbell_index.sdma_engine0 = AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0; + adev->doorbell_index.sdma_engine1 = AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1; + adev->doorbell_index.ih =AMDGPU_DOORBELL64_IH ; + adev->doorbell_index.uvd_vce.uvd_ring0_1 =AMDGPU_DOORBELL64_UVD_RING0_1 ; + adev->doorbell_index.uvd_vce.uvd_ring2_3 =AMDGPU_DOORBELL64_UVD_RING2_3 ; + adev->doorbell_index.uvd_vce.uvd_ring4_5 =AMDGPU_DOORBELL64_UVD_RING4_5 ; + adev->doorbell_index.uvd_vce.uvd_ring6_7 =AMDGPU_DOORBELL64_UVD_RING6_7 ; + adev->doorbell_index.uvd_vce.vce_ring0_1 =AMDGPU_DOORBELL64_VCE_RING0_1 ; + adev->doorbell_index.uvd_vce.vce_ring2_3 =AMDGPU_DOORBELL64_VCE_RING2_3 ; + adev->doorbell_index.uvd_vce.vce_ring4_5 =AMDGPU_DOORBELL64_VCE_RING4_5 ; + adev->doorbell_index.uvd_vce.vce_ring6_7 =AMDGPU_DOORBELL64_VCE_RING6_7 ; +/* In unit of dword doorbell */ + adev->doorbell_index.max_assignment =AMDGPU_DOORBELL64_MAX_ASSIGNMENT <<1 ; +}
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/8 drm/amdgpu: Doorbell index initialization for ASICs before vega10
In reply to a message not in the archivev2: Use enum definition instead of hardcoded number
--- drivers/gpu/drm/amd/amdgpu/cik.c | 1 + drivers/gpu/drm/amd/amdgpu/cik.h | 1 + drivers/gpu/drm/amd/amdgpu/vi.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vi.h | 1 + 4 files changed, 22 insertions(+)
drivers/gpu/drm/amd/amdgpu/cik.c +1 -0
@@ -1755,6 +1755,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = .flush_hdp = &cik_flush_hdp, .invalidate_hdp = &cik_invalidate_hdp, .need_full_reset = &cik_need_full_reset, + .init_doorbell_index = &legacy_doorbell_index_init, };static int cik_common_early_init (void *handle)
drivers/gpu/drm/amd/amdgpu/cik.h +1 -0
@@ -30,4 +30,5 @@ void cik_srbm_select(struct amdgpu_device *adev, u32 me, u32 pipe, u32 queue, u32 vmid);int cik_set_ip_blocks (struct amdgpu_device *adev); +void legacy_doorbell_index_init (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/amdgpu/vi.c +19 -0
@@ -955,6 +955,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = .flush_hdp = &vi_flush_hdp, .invalidate_hdp = &vi_invalidate_hdp, .need_full_reset = &vi_need_full_reset, + .init_doorbell_index = &legacy_doorbell_index_init, };#define CZ_REV_BRISTOL (rev) \
@@ -1712,3 +1713,21 @@ int vi_set_ip_blocks(struct amdgpu_device *adev)return 0 ; } + +void legacy_doorbell_index_init (struct amdgpu_device *adev) +{ + adev->doorbell_index.kiq =AMDGPU_DOORBELL_KIQ ; + adev->doorbell_index.mec_ring0 =AMDGPU_DOORBELL_MEC_RING0 ; + adev->doorbell_index.mec_ring1 =AMDGPU_DOORBELL_MEC_RING1 ; + adev->doorbell_index.mec_ring2 =AMDGPU_DOORBELL_MEC_RING2 ; + adev->doorbell_index.mec_ring3 =AMDGPU_DOORBELL_MEC_RING3 ; + adev->doorbell_index.mec_ring4 =AMDGPU_DOORBELL_MEC_RING4 ; + adev->doorbell_index.mec_ring5 =AMDGPU_DOORBELL_MEC_RING5 ; + adev->doorbell_index.mec_ring6 =AMDGPU_DOORBELL_MEC_RING6 ; + adev->doorbell_index.mec_ring7 =AMDGPU_DOORBELL_MEC_RING7 ; + adev->doorbell_index.gfx_ring0 =AMDGPU_DOORBELL_GFX_RING0 ; + adev->doorbell_index.sdma_engine0 = AMDGPU_DOORBELL_sDMA_ENGINE0; + adev->doorbell_index.sdma_engine1 = AMDGPU_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.ih =AMDGPU_DOORBELL_IH ; + adev->doorbell_index.max_assignment =AMDGPU_DOORBELL_MAX_ASSIGNMENT ; +}
drivers/gpu/drm/amd/amdgpu/vi.h +1 -0
@@ -30,4 +30,5 @@ void vi_srbm_select(struct amdgpu_device *adev, u32 me, u32 pipe, u32 queue, u32 vmid);int vi_set_ip_blocks (struct amdgpu_device *adev); +void legacy_doorbell_index_init (struct amdgpu_device *adev);#endif
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-4-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 4/8] drm/amdgpu: Doorbell index initialization for ASICs before vega10
Quoted 7 lines · Oak Zeng
v2: Use enum definition instead of hardcoded number
Change-Id Id64eb98f5b1c24b51eb2fd5a083086fc3515813dSigned-off-by Oak Zeng <[email protected]>Suggested-by Felix Kuehling <[email protected]>Suggested-by Alex Deucher <[email protected]>
With a patch description added:
Quoted 76 lines
--- drivers/gpu/drm/amd/amdgpu/cik.c | 1 + drivers/gpu/drm/amd/amdgpu/cik.h | 1 + drivers/gpu/drm/amd/amdgpu/vi.c | 19 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/vi.h | 1 + 4 files changed, 22 insertions(+)drivers/gpu/drm/amd/amdgpu/cik.c +1
-0@@ -1755,6 +1755,7 @@ static const struct amdgpu_asic_funcs cik_asic_funcs = .flush_hdp = &cik_flush_hdp, .invalidate_hdp = &cik_invalidate_hdp, .need_full_reset = &cik_need_full_reset, + .init_doorbell_index = &legacy_doorbell_index_init, };static int cik_common_early_init (void *handle)drivers/gpu/drm/amd/amdgpu/cik.h +1
-0@@ -30,4 +30,5 @@ void cik_srbm_select(struct amdgpu_device *adev, u32 me, u32 pipe, u32 queue, u32 vmid);int cik_set_ip_blocks (struct amdgpu_device *adev); +void legacy_doorbell_index_init (struct amdgpu_device *adev);#endif drivers/gpu/drm/amd/amdgpu/vi.c +19
-0@@ -955,6 +955,7 @@ static const struct amdgpu_asic_funcs vi_asic_funcs = .flush_hdp = &vi_flush_hdp, .invalidate_hdp = &vi_invalidate_hdp, .need_full_reset = &vi_need_full_reset, + .init_doorbell_index = &legacy_doorbell_index_init, };#define CZ_REV_BRISTOL (rev) \@@ -1712,3 +1713,21 @@ int vi_set_ip_blocks(struct amdgpu_device *adev)return 0 ; } + +void legacy_doorbell_index_init (struct amdgpu_device *adev) +{ + adev->doorbell_index.kiq =AMDGPU_DOORBELL_KIQ ; + adev->doorbell_index.mec_ring0 =AMDGPU_DOORBELL_MEC_RING0 ; + adev->doorbell_index.mec_ring1 =AMDGPU_DOORBELL_MEC_RING1 ; + adev->doorbell_index.mec_ring2 =AMDGPU_DOORBELL_MEC_RING2 ; + adev->doorbell_index.mec_ring3 =AMDGPU_DOORBELL_MEC_RING3 ; + adev->doorbell_index.mec_ring4 =AMDGPU_DOORBELL_MEC_RING4 ; + adev->doorbell_index.mec_ring5 =AMDGPU_DOORBELL_MEC_RING5 ; + adev->doorbell_index.mec_ring6 =AMDGPU_DOORBELL_MEC_RING6 ; + adev->doorbell_index.mec_ring7 =AMDGPU_DOORBELL_MEC_RING7 ; + adev->doorbell_index.gfx_ring0 =AMDGPU_DOORBELL_GFX_RING0 ; + adev->doorbell_index.sdma_engine0 = AMDGPU_DOORBELL_sDMA_ENGINE0; + adev->doorbell_index.sdma_engine1 = AMDGPU_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.ih =AMDGPU_DOORBELL_IH ; + adev->doorbell_index.max_assignment =AMDGPU_DOORBELL_MAX_ASSIGNMENT ; +}drivers/gpu/drm/amd/amdgpu/vi.h +1
-1@@ -30,4 +30,5 @@ void vi_srbm_select(struct amdgpu_device *adev, u32 me, u32 pipe, u32 queue, u32 vmid);int vi_set_ip_blocks (struct amdgpu_device *adev); +void legacy_doorbell_index_init (struct amdgpu_device *adev);#endif --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/8 drm/amdgpu: Doorbell layout for vega20 and future asic
In reply to a message not in the archivev2: Use enum definition instead of hardcoded value
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 ++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 22 +++++++++++- drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 33 ++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +50 -0
@@ -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 =0xFFFF +}AMDGPU_VEGA20_DOORBELL_ASSIGNMENT ; +/* * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space */
drivers/gpu/drm/amd/amdgpu/soc15.c +21 -1
@@ -616,6 +616,23 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = .init_doorbell_index = &vega10_doorbell_index_init, }; +static const struct amdgpu_asic_funcs vega20_asic_funcs = +{ + .read_disabled_bios = &soc15_read_disabled_bios, + .read_bios_from_rom = &soc15_read_bios_from_rom, + .read_register = &soc15_read_register, + .reset = &soc15_asic_reset, + .set_vga_state = &soc15_vga_set_state, + .get_xclk = &soc15_get_xclk, + .set_uvd_clocks = &soc15_set_uvd_clocks, + .set_vce_clocks = &soc15_set_vce_clocks, + .get_config_memsize = &soc15_get_config_memsize, + .flush_hdp = &soc15_flush_hdp, + .invalidate_hdp = &soc15_invalidate_hdp, + .need_full_reset = &soc15_need_full_reset, + .init_doorbell_index = &vega20_doorbell_index_init, +}; +static int soc15_common_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -633,11 +650,11 @@ static int soc15_common_early_init(void *handle) adev->se_cac_rreg = &soc15_se_cac_rreg; adev->se_cac_wreg = &soc15_se_cac_wreg; - adev->asic_funcs = &soc15_asic_funcs; adev->external_rev_id =0xFF ;switch (adev->asic_type) {case CHIP_VEGA10 : + adev->asic_funcs = &soc15_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_RLC_LS |
@@ -661,6 +678,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id =0x1 ;break ;case CHIP_VEGA12 : + adev->asic_funcs = &soc15_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_CGCG |
@@ -683,6 +701,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x14 ;break ;case CHIP_VEGA20 : + adev->asic_funcs = &vega20_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_CGCG |
@@ -705,6 +724,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x28 ;break ;case CHIP_RAVEN : + adev->asic_funcs = &soc15_asic_funcs;if (adev->rev_id >=0x8 ) adev->external_rev_id = adev->rev_id +0x81 ;else if (adev->pdev->device ==0x15d8 )
drivers/gpu/drm/amd/amdgpu/soc15.h +1 -0
@@ -59,4 +59,5 @@ int vega10_reg_base_init(struct amdgpu_device *adev);int vega20_reg_base_init (struct amdgpu_device *adev);void vega10_doorbell_index_init (struct amdgpu_device *adev); +void vega20_doorbell_index_init (struct amdgpu_device *adev);#endif
drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c +33 -0
@@ -54,4 +54,37 @@ int vega20_reg_base_init(struct amdgpu_device *adev)return 0 ; } +void vega20_doorbell_index_init (struct amdgpu_device *adev) +{ + adev->doorbell_index.kiq =AMDGPU_VEGA20_DOORBELL_KIQ ; + adev->doorbell_index.mec_ring0 =AMDGPU_VEGA20_DOORBELL_MEC_RING0 ; + adev->doorbell_index.mec_ring1 =AMDGPU_VEGA20_DOORBELL_MEC_RING1 ; + adev->doorbell_index.mec_ring2 =AMDGPU_VEGA20_DOORBELL_MEC_RING2 ; + adev->doorbell_index.mec_ring3 =AMDGPU_VEGA20_DOORBELL_MEC_RING3 ; + adev->doorbell_index.mec_ring4 =AMDGPU_VEGA20_DOORBELL_MEC_RING4 ; + adev->doorbell_index.mec_ring5 =AMDGPU_VEGA20_DOORBELL_MEC_RING5 ; + adev->doorbell_index.mec_ring6 =AMDGPU_VEGA20_DOORBELL_MEC_RING6 ; + adev->doorbell_index.mec_ring7 =AMDGPU_VEGA20_DOORBELL_MEC_RING7 ; + adev->doorbell_index.userqueue_start =AMDGPU_VEGA20_DOORBELL_USERQUEUE_START ; + adev->doorbell_index.userqueue_end =AMDGPU_VEGA20_DOORBELL_USERQUEUE_END ; + adev->doorbell_index.gfx_ring0 =AMDGPU_VEGA20_DOORBELL_GFX_RING0 ; + adev->doorbell_index.sdma_engine0 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0; + adev->doorbell_index.sdma_engine1 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.sdma_engine2 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2; + adev->doorbell_index.sdma_engine3 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3; + adev->doorbell_index.sdma_engine4 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4; + adev->doorbell_index.sdma_engine5 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5; + adev->doorbell_index.sdma_engine6 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6; + adev->doorbell_index.sdma_engine7 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7; + adev->doorbell_index.ih =AMDGPU_VEGA20_DOORBELL_IH ; + adev->doorbell_index.uvd_vce.uvd_ring0_1 =AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1 ; + adev->doorbell_index.uvd_vce.uvd_ring2_3 =AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3 ; + adev->doorbell_index.uvd_vce.uvd_ring4_5 =AMDGPU_VEGA20_DOORBELL64_UVD_RING4_5 ; + adev->doorbell_index.uvd_vce.uvd_ring6_7 =AMDGPU_VEGA20_DOORBELL64_UVD_RING6_7 ; + adev->doorbell_index.uvd_vce.vce_ring0_1 =AMDGPU_VEGA20_DOORBELL64_VCE_RING0_1 ; + adev->doorbell_index.uvd_vce.vce_ring2_3 =AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3 ; + adev->doorbell_index.uvd_vce.vce_ring4_5 =AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5 ; + adev->doorbell_index.uvd_vce.vce_ring6_7 =AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7 ; + adev->doorbell_index.max_assignment =AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT <<1 ; +}
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-5-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 5/8] drm/amdgpu: Doorbell layout for vega20 and future asic
Quoted 7 lines · Oak Zeng
v2: Use enum definition instead of hardcoded value
Change-Id I04d22fb717ac50483c0835f160a2e860e344f358Signed-off-by Oak Zeng <[email protected]>Suggested-by Felix Kuehling <[email protected]>Suggested-by Alex Deucher <[email protected]>
With a patch description added:
Quoted 188 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 ++++++++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/soc15.c | 22 +++++++++++- drivers/gpu/drm/amd/amdgpu/soc15.h | 1 + drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c | 33 ++++++++++++++++++ 4 files changed, 105 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +50
-0@@ -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 =0xFFFF +}AMDGPU_VEGA20_DOORBELL_ASSIGNMENT ; +/* * 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space */ drivers/gpu/drm/amd/amdgpu/soc15.c +21
-1@@ -616,6 +616,23 @@ static const struct amdgpu_asic_funcs soc15_asic_funcs = .init_doorbell_index = &vega10_doorbell_index_init, }; +static const struct amdgpu_asic_funcs vega20_asic_funcs = +{ + .read_disabled_bios = &soc15_read_disabled_bios, + .read_bios_from_rom = &soc15_read_bios_from_rom, + .read_register = &soc15_read_register, + .reset = &soc15_asic_reset, + .set_vga_state = &soc15_vga_set_state, + .get_xclk = &soc15_get_xclk, + .set_uvd_clocks = &soc15_set_uvd_clocks, + .set_vce_clocks = &soc15_set_vce_clocks, + .get_config_memsize = &soc15_get_config_memsize, + .flush_hdp = &soc15_flush_hdp, + .invalidate_hdp = &soc15_invalidate_hdp, + .need_full_reset = &soc15_need_full_reset, + .init_doorbell_index = &vega20_doorbell_index_init, +}; +static int soc15_common_early_init (void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;@@ -633,11 +650,11 @@ static int soc15_common_early_init(void *handle) adev->se_cac_rreg = &soc15_se_cac_rreg; adev->se_cac_wreg = &soc15_se_cac_wreg; - adev->asic_funcs = &soc15_asic_funcs; adev->external_rev_id =0xFF ;switch (adev->asic_type) {case CHIP_VEGA10 : + adev->asic_funcs = &soc15_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_RLC_LS |@@ -661,6 +678,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id =0x1 ;break ;case CHIP_VEGA12 : + adev->asic_funcs = &soc15_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_CGCG |@@ -683,6 +701,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x14 ;break ;case CHIP_VEGA20 : + adev->asic_funcs = &vega20_asic_funcs; adev->cg_flags =AMD_CG_SUPPORT_GFX_MGCG |AMD_CG_SUPPORT_GFX_MGLS | AMD_CG_SUPPORT_GFX_CGCG |@@ -705,6 +724,7 @@ static int soc15_common_early_init(void *handle) adev->external_rev_id = adev->rev_id +0x28 ;break ;case CHIP_RAVEN : + adev->asic_funcs = &soc15_asic_funcs;if (adev->rev_id >=0x8 ) adev->external_rev_id = adev->rev_id +0x81 ;else if (adev->pdev->device ==0x15d8 )drivers/gpu/drm/amd/amdgpu/soc15.h +1
-0@@ -59,4 +59,5 @@ int vega10_reg_base_init(struct amdgpu_device *adev);int vega20_reg_base_init (struct amdgpu_device *adev);void vega10_doorbell_index_init (struct amdgpu_device *adev); +void vega20_doorbell_index_init (struct amdgpu_device *adev);#endif drivers/gpu/drm/amd/amdgpu/vega20_reg_init.c +33
-1@@ -54,4 +54,37 @@ int vega20_reg_base_init(struct amdgpu_device *adev)return 0 ; } +void vega20_doorbell_index_init (struct amdgpu_device *adev) +{ + adev->doorbell_index.kiq =AMDGPU_VEGA20_DOORBELL_KIQ ; + adev->doorbell_index.mec_ring0 =AMDGPU_VEGA20_DOORBELL_MEC_RING0 ; + adev->doorbell_index.mec_ring1 =AMDGPU_VEGA20_DOORBELL_MEC_RING1 ; + adev->doorbell_index.mec_ring2 =AMDGPU_VEGA20_DOORBELL_MEC_RING2 ; + adev->doorbell_index.mec_ring3 =AMDGPU_VEGA20_DOORBELL_MEC_RING3 ; + adev->doorbell_index.mec_ring4 =AMDGPU_VEGA20_DOORBELL_MEC_RING4 ; + adev->doorbell_index.mec_ring5 =AMDGPU_VEGA20_DOORBELL_MEC_RING5 ; + adev->doorbell_index.mec_ring6 =AMDGPU_VEGA20_DOORBELL_MEC_RING6 ; + adev->doorbell_index.mec_ring7 =AMDGPU_VEGA20_DOORBELL_MEC_RING7 ; + adev->doorbell_index.userqueue_start =AMDGPU_VEGA20_DOORBELL_USERQUEUE_START ; + adev->doorbell_index.userqueue_end =AMDGPU_VEGA20_DOORBELL_USERQUEUE_END ; + adev->doorbell_index.gfx_ring0 =AMDGPU_VEGA20_DOORBELL_GFX_RING0 ; + adev->doorbell_index.sdma_engine0 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE0; + adev->doorbell_index.sdma_engine1 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.sdma_engine2 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE2; + adev->doorbell_index.sdma_engine3 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE3; + adev->doorbell_index.sdma_engine4 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE4; + adev->doorbell_index.sdma_engine5 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE5; + adev->doorbell_index.sdma_engine6 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE6; + adev->doorbell_index.sdma_engine7 = AMDGPU_VEGA20_DOORBELL_sDMA_ENGINE7; + adev->doorbell_index.ih =AMDGPU_VEGA20_DOORBELL_IH ; + adev->doorbell_index.uvd_vce.uvd_ring0_1 =AMDGPU_VEGA20_DOORBELL64_UVD_RING0_1 ; + adev->doorbell_index.uvd_vce.uvd_ring2_3 =AMDGPU_VEGA20_DOORBELL64_UVD_RING2_3 ; + adev->doorbell_index.uvd_vce.uvd_ring4_5 =AMDGPU_VEGA20_DOORBELL64_UVD_RING4_5 ; + adev->doorbell_index.uvd_vce.uvd_ring6_7 =AMDGPU_VEGA20_DOORBELL64_UVD_RING6_7 ; + adev->doorbell_index.uvd_vce.vce_ring0_1 =AMDGPU_VEGA20_DOORBELL64_VCE_RING0_1 ; + adev->doorbell_index.uvd_vce.vce_ring2_3 =AMDGPU_VEGA20_DOORBELL64_VCE_RING2_3 ; + adev->doorbell_index.uvd_vce.vce_ring4_5 =AMDGPU_VEGA20_DOORBELL64_VCE_RING4_5 ; + adev->doorbell_index.uvd_vce.vce_ring6_7 =AMDGPU_VEGA20_DOORBELL64_VCE_RING6_7 ; + adev->doorbell_index.max_assignment =AMDGPU_VEGA20_DOORBELL_MAX_ASSIGNMENT <<1 ; +} --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/8 drm/amdgpu: Call doorbell index init on device initialization
In reply to a message not in the archiveAlso call functioin amdgpu_device_doorbell_init after amdgpu_device_ip_early_init because the former depends on the later to set up asic-specific init_doorbell_index function
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5 -3
@@ -513,6 +513,8 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev)*/ static int amdgpu_device_doorbell_init (struct amdgpu_device *adev) { +amdgpu_asic_init_doorbell_index (adev); +/* No doorbell on SI hardware generation */ if (adev->asic_type <CHIP_BONAIRE ) { adev->doorbell.base =0 ;
@@ -2464,9 +2466,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,DRM_INFO ("register mmio base: 0x%08X\n" , (uint32_t )adev->rmmio_base);DRM_INFO ("register mmio size: %u\n" , (unsigned )adev->rmmio_size); -/* doorbell bar mapping */ -amdgpu_device_doorbell_init (adev); -/* io port mapping */ for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) {if (pci_resource_flags (adev->pdev, i) &IORESOURCE_IO ) {
@@ -2485,6 +2484,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)return r; +/* doorbell bar mapping and doorbell index init*/ +amdgpu_device_doorbell_init (adev); +/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */ /* this will fail for cards that aren't VGA class devices, just * ignore it */
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-6-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 6/8] drm/amdgpu: Call doorbell index init on device initialization
Quoted 10 lines · Oak Zeng
Also call functioin
amdgpu_device_doorbell_initafteramdgpu_device_ip_early_initbecause the former depends on the later to set up asic-specificinit_doorbell_indexfunctionChange-Id I2f004bbbe2565035460686f4fc16e86b77a2a9b5Signed-off-by Oak Zeng <[email protected]>Suggested-by Felix Kuehling <[email protected]>Suggested-by Alex Deucher <[email protected]>
Quoted 40 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +5
-4@@ -513,6 +513,8 @@ void amdgpu_device_pci_config_reset(struct amdgpu_device *adev)*/ static int amdgpu_device_doorbell_init (struct amdgpu_device *adev) { +amdgpu_asic_init_doorbell_index (adev); +/* No doorbell on SI hardware generation */ if (adev->asic_type <CHIP_BONAIRE ) { adev->doorbell.base =0 ;@@ -2464,9 +2466,6 @@ int amdgpu_device_init(struct amdgpu_device *adev,DRM_INFO ("register mmio base: 0x%08X\n" , (uint32_t )adev->rmmio_base);DRM_INFO ("register mmio size: %u\n" , (unsigned )adev->rmmio_size); -/* doorbell bar mapping */ -amdgpu_device_doorbell_init (adev); -/* io port mapping */ for (i =0 ; i <DEVICE_COUNT_RESOURCE ; i++) {if (pci_resource_flags (adev->pdev, i) &IORESOURCE_IO ) {@@ -2485,6 +2484,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,if (r)return r; +/* doorbell bar mapping and doorbell index init*/ +amdgpu_device_doorbell_init (adev); +/* if we have > 1 VGA cards, then disable the amdgpu VGA resources */ /* this will fail for cards that aren't VGA class devices, just * ignore it */ --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 7/8 drm/amdgpu: Use asic specific doorbell index instead of macro definition
In reply to a message not in the archive--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 27 ++++++++------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 +++++----- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 25 +++++++++---------------- drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 2 +- 12 files changed, 36 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +8 -19
@@ -181,25 +181,14 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)* process in case of 64-bit doorbells so we * can use each doorbell assignment twice. */ -if (adev->asic_type ==CHIP_VEGA10 ) { - gpu_resources.sdma_doorbell[0 ][i] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + (i >>1 ); - gpu_resources.sdma_doorbell[0 ][i+1 ] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 +0x200 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i+1 ] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 +0x200 + (i >>1 ); - }else { - gpu_resources.sdma_doorbell[0 ][i] = - AMDGPU_DOORBELL64_sDMA_ENGINE0 + (i >>1 ); - gpu_resources.sdma_doorbell[0 ][i+1 ] = - AMDGPU_DOORBELL64_sDMA_ENGINE0 +0x200 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i] = - AMDGPU_DOORBELL64_sDMA_ENGINE1 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i+1 ] = - AMDGPU_DOORBELL64_sDMA_ENGINE1 +0x200 + (i >>1 ); - } + gpu_resources.sdma_doorbell[0 ][i] = + adev->doorbell_index.sdma_engine0 + (i >>1 ); + gpu_resources.sdma_doorbell[0 ][i+1 ] = + adev->doorbell_index.sdma_engine0 +0x200 + (i >>1 ); + gpu_resources.sdma_doorbell[1 ][i] = + adev->doorbell_index.sdma_engine1 + (i >>1 ); + gpu_resources.sdma_doorbell[1 ][i+1 ] = + adev->doorbell_index.sdma_engine1 +0x200 + (i >>1 ); }/* Doorbells 0x0e0-0ff and 0x2e0-2ff are reserved for * SDMA, IH and VCN. So don't use them for the CP.
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -1
@@ -532,7 +532,7 @@ static int amdgpu_device_doorbell_init(struct amdgpu_device *adev) adev->doorbell.size =pci_resource_len (adev->pdev,2 ); adev->doorbell.num_doorbells =min_t (u32, adev->doorbell.size /sizeof (u32), -AMDGPU_DOORBELL_MAX_ASSIGNMENT +1 ); + adev->doorbell_index.max_assignment+1 );if (adev->doorbell.num_doorbells ==0 )return -EINVAL ;
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1 -1
@@ -250,7 +250,7 @@ int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, ring->adev =NULL ; ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_KIQ ; + ring->doorbell_index = adev->doorbell_index.kiq; r =amdgpu_gfx_kiq_acquire (adev, ring);if (r)
drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1 -1
@@ -4363,7 +4363,7 @@ static int gfx_v7_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_MEC_RING0 + ring_id; + ring->doorbell_index = adev->doorbell_index.mec_ring0 + ring_id;sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue); irq_type =AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -5
@@ -1890,7 +1890,7 @@ static int gfx_v8_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_MEC_RING0 + ring_id; + ring->doorbell_index = adev->doorbell_index.mec_ring0 + ring_id; ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (ring_id *GFX8_MEC_HPD_SIZE );sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue);
@@ -2001,7 +2001,7 @@ static int gfx_v8_0_sw_init(void *handle)/* no gfx doorbells on iceland */ if (adev->asic_type !=CHIP_TOPAZ ) { ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_GFX_RING0 ; + ring->doorbell_index = adev->doorbell_index.gfx_ring0; } r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,
@@ -4215,7 +4215,7 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu tmp =REG_SET_FIELD (0 ,CP_RB_DOORBELL_RANGE_LOWER ,DOORBELL_RANGE_LOWER , -AMDGPU_DOORBELL_GFX_RING0 ); + adev->doorbell_index.gfx_ring0);WREG32 (mmCP_RB_DOORBELL_RANGE_LOWER, tmp); WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,
@@ -4644,8 +4644,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)static void gfx_v8_0_set_mec_doorbell_range (struct amdgpu_device *adev) {if (adev->asic_type >CHIP_TONGA ) { -WREG32 (mmCP_MEC_DOORBELL_RANGE_LOWER,AMDGPU_DOORBELL_KIQ <<2 ); -WREG32 (mmCP_MEC_DOORBELL_RANGE_UPPER,AMDGPU_DOORBELL_MEC_RING7 <<2 ); +WREG32 (mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq <<2 ); +WREG32 (mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 <<2 ); }/* enable doorbells */ WREG32_FIELD (CP_PQ_STATUS ,DOORBELL_ENABLE ,1 );
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4 -4
@@ -1566,7 +1566,7 @@ static int gfx_v9_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index = (AMDGPU_DOORBELL64_MEC_RING0 + ring_id) <<1 ; + ring->doorbell_index = (adev->doorbell_index.mec_ring0 + ring_id) <<1 ; ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (ring_id *GFX9_MEC_HPD_SIZE );sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue);
@@ -1655,7 +1655,7 @@ static int gfx_v9_0_sw_init(void *handle)else sprintf (ring->name,"gfx_%d" , i); ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL64_GFX_RING0 <<1 ; + ring->doorbell_index = adev->doorbell_index.gfx_ring0 <<1 ; r =amdgpu_ring_init (adev, ring,1024 , &adev->gfx.eop_irq,AMDGPU_CP_IRQ_GFX_EOP );if (r)
@@ -2981,9 +2981,9 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)/* enable the doorbell if requested */ if (ring->use_doorbell) {WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_LOWER, - (AMDGPU_DOORBELL64_KIQ *2 ) <<2 ); + (adev->doorbell_index.kiq *2 ) <<2 );WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, - (AMDGPU_DOORBELL64_USERQUEUE_END *2 ) <<2 ); + (adev->doorbell_index.userqueue_end *2 ) <<2 ); } WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,
drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1 -1
@@ -1146,7 +1146,7 @@ static int sdma_v3_0_sw_init(void *handle)if (!amdgpu_sriov_vf (adev)) { ring->use_doorbell = true; ring->doorbell_index = (i ==0 ) ? - AMDGPU_DOORBELL_sDMA_ENGINE0 : AMDGPU_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.sdma_engine0 : adev->doorbell_index.sdma_engine1; }else { ring->use_pollmem = true; }
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +9 -16
@@ -1518,15 +1518,13 @@ static int sdma_v4_0_sw_init(void *handle) ring->ring_obj =NULL ; ring->use_doorbell = true; +DRM_INFO ("use_doorbell being set to: [%s]\n" , + ring->use_doorbell?"true" :"false" ); +/* doorbell size is 2 dwords, get DWORD offset */ -if (adev->asic_type ==CHIP_VEGA10 ) - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 <<1 ); -else - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_DOORBELL64_sDMA_ENGINE1 <<1 ); + ring->doorbell_index = (i ==0 ) ? + (adev->doorbell_index.sdma_engine0 <<1 ) + : (adev->doorbell_index.sdma_engine1 <<1 );sprintf (ring->name,"sdma%d" , i); r = amdgpu_ring_init(adev, ring, 1024,
@@ -1545,14 +1543,9 @@ static int sdma_v4_0_sw_init(void *handle)/* paging queue use same doorbell index/routing as gfx queue * with 0x400 (4096 dwords) offset on second doorbell page */ -if (adev->asic_type ==CHIP_VEGA10 ) - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 <<1 ); -else - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_DOORBELL64_sDMA_ENGINE1 <<1 ); + ring->doorbell_index = (i ==0 ) ? + (adev->doorbell_index.sdma_engine0 <<1 ) + : (adev->doorbell_index.sdma_engine1 <<1 ); ring->doorbell_index +=0x400 ;sprintf (ring->name,"page%d" , i);
drivers/gpu/drm/amd/amdgpu/tonga_ih.c +1 -1
@@ -322,7 +322,7 @@ static int tonga_ih_sw_init(void *handle)return r; adev->irq.ih.use_doorbell = true; - adev->irq.ih.doorbell_index =AMDGPU_DOORBELL_IH ; + adev->irq.ih.doorbell_index = adev->doorbell_index.ih; r =amdgpu_irq_init (adev);
drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +2 -2
@@ -455,9 +455,9 @@ static int uvd_v7_0_sw_init(void *handle)* sriov, so set unused location for other unused rings. */ if (i ==0 ) - ring->doorbell_index =AMDGPU_DOORBELL64_UVD_RING0_1 *2 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.uvd_ring0_1 *2 ;else - ring->doorbell_index =AMDGPU_DOORBELL64_UVD_RING2_3 *2 +1 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.uvd_ring2_3 *2 +1 ; } r =amdgpu_ring_init (adev, ring,512 , &adev->uvd.inst[j].irq,0 );if (r)
drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +2 -2
@@ -466,9 +466,9 @@ static int vce_v4_0_sw_init(void *handle)* so set unused location for other unused rings. */ if (i ==0 ) - ring->doorbell_index =AMDGPU_DOORBELL64_VCE_RING0_1 *2 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring0_1 *2 ;else - ring->doorbell_index =AMDGPU_DOORBELL64_VCE_RING2_3 *2 +1 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring2_3 *2 +1 ; } r =amdgpu_ring_init (adev, ring,512 , &adev->vce.irq,0 );if (r)
drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1 -1
@@ -385,7 +385,7 @@ static int vega10_ih_sw_init(void *handle)return r; adev->irq.ih.use_doorbell = true; - adev->irq.ih.doorbell_index =AMDGPU_DOORBELL64_IH <<1 ; + adev->irq.ih.doorbell_index = adev->doorbell_index.ih <<1 ; r =amdgpu_irq_init (adev);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-7-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 7/8] drm/amdgpu: Use asic specific doorbell index instead of macro definition
Quoted 5 lines · Oak Zeng
Change-Id Iffff84475efcfb482c474fccb133010abb5df5f4Signed-off-by Oak Zeng <[email protected]>Suggested-by Felix Kuehling <[email protected]>Suggested-by Alex Deucher <[email protected]>
With a patch description added:
Quoted 286 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 27 ++++++++------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 10 +++++----- drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 8 ++++---- drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c | 2 +- drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 25 +++++++++---------------- drivers/gpu/drm/amd/amdgpu/tonga_ih.c | 2 +- drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vce_v4_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 2 +- 12 files changed, 36 insertions(+), 54 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c +8
-19@@ -181,25 +181,14 @@ void amdgpu_amdkfd_device_init(struct amdgpu_device *adev)* process in case of 64-bit doorbells so we * can use each doorbell assignment twice. */ -if (adev->asic_type ==CHIP_VEGA10 ) { - gpu_resources.sdma_doorbell[0 ][i] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 + (i >>1 ); - gpu_resources.sdma_doorbell[0 ][i+1 ] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 +0x200 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i+1 ] = - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 +0x200 + (i >>1 ); - }else { - gpu_resources.sdma_doorbell[0 ][i] = - AMDGPU_DOORBELL64_sDMA_ENGINE0 + (i >>1 ); - gpu_resources.sdma_doorbell[0 ][i+1 ] = - AMDGPU_DOORBELL64_sDMA_ENGINE0 +0x200 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i] = - AMDGPU_DOORBELL64_sDMA_ENGINE1 + (i >>1 ); - gpu_resources.sdma_doorbell[1 ][i+1 ] = - AMDGPU_DOORBELL64_sDMA_ENGINE1 +0x200 + (i >>1 ); - } + gpu_resources.sdma_doorbell[0 ][i] = + adev->doorbell_index.sdma_engine0 + (i >>1 ); + gpu_resources.sdma_doorbell[0 ][i+1 ] = + adev->doorbell_index.sdma_engine0 +0x200 + (i >>1 ); + gpu_resources.sdma_doorbell[1 ][i] = + adev->doorbell_index.sdma_engine1 + (i >>1 ); + gpu_resources.sdma_doorbell[1 ][i+1 ] = + adev->doorbell_index.sdma_engine1 +0x200 + (i >>1 ); }/* Doorbells 0x0e0-0ff and 0x2e0-2ff are reserved for * SDMA, IH and VCN. So don't use them for the CP. drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-1@@ -532,7 +532,7 @@ static int amdgpu_device_doorbell_init(struct amdgpu_device *adev) adev->doorbell.size =pci_resource_len (adev->pdev,2 ); adev->doorbell.num_doorbells =min_t (u32, adev->doorbell.size /sizeof (u32), -AMDGPU_DOORBELL_MAX_ASSIGNMENT +1 ); + adev->doorbell_index.max_assignment+1 );if (adev->doorbell.num_doorbells ==0 )return -EINVAL ;drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +1
-1@@ -250,7 +250,7 @@ int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev, ring->adev =NULL ; ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_KIQ ; + ring->doorbell_index = adev->doorbell_index.kiq; r =amdgpu_gfx_kiq_acquire (adev, ring);if (r)drivers/gpu/drm/amd/amdgpu/gfx_v7_0.c +1
-1@@ -4363,7 +4363,7 @@ static int gfx_v7_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_MEC_RING0 + ring_id; + ring->doorbell_index = adev->doorbell_index.mec_ring0 + ring_id;sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue); irq_type =AMDGPU_CP_IRQ_COMPUTE_MEC1_PIPE0_EOP drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5
-5@@ -1890,7 +1890,7 @@ static int gfx_v8_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_MEC_RING0 + ring_id; + ring->doorbell_index = adev->doorbell_index.mec_ring0 + ring_id; ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (ring_id *GFX8_MEC_HPD_SIZE );sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue);@@ -2001,7 +2001,7 @@ static int gfx_v8_0_sw_init(void *handle)/* no gfx doorbells on iceland */ if (adev->asic_type !=CHIP_TOPAZ ) { ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL_GFX_RING0 ; + ring->doorbell_index = adev->doorbell_index.gfx_ring0; } r = amdgpu_ring_init(adev, ring, 1024, &adev->gfx.eop_irq,@@ -4215,7 +4215,7 @@ static void gfx_v8_0_set_cpg_door_bell(struct amdgpu_device *adev, struct amdgpu tmp =REG_SET_FIELD (0 ,CP_RB_DOORBELL_RANGE_LOWER ,DOORBELL_RANGE_LOWER , -AMDGPU_DOORBELL_GFX_RING0 ); + adev->doorbell_index.gfx_ring0);WREG32 (mmCP_RB_DOORBELL_RANGE_LOWER, tmp); WREG32(mmCP_RB_DOORBELL_RANGE_UPPER,@@ -4644,8 +4644,8 @@ static int gfx_v8_0_kcq_init_queue(struct amdgpu_ring *ring)static void gfx_v8_0_set_mec_doorbell_range (struct amdgpu_device *adev) {if (adev->asic_type >CHIP_TONGA ) { -WREG32 (mmCP_MEC_DOORBELL_RANGE_LOWER,AMDGPU_DOORBELL_KIQ <<2 ); -WREG32 (mmCP_MEC_DOORBELL_RANGE_UPPER,AMDGPU_DOORBELL_MEC_RING7 <<2 ); +WREG32 (mmCP_MEC_DOORBELL_RANGE_LOWER, adev->doorbell_index.kiq <<2 ); +WREG32 (mmCP_MEC_DOORBELL_RANGE_UPPER, adev->doorbell_index.mec_ring7 <<2 ); }/* enable doorbells */ WREG32_FIELD (CP_PQ_STATUS ,DOORBELL_ENABLE ,1 );drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-4@@ -1566,7 +1566,7 @@ static int gfx_v9_0_compute_ring_init(struct amdgpu_device *adev, int ring_id, ring->ring_obj =NULL ; ring->use_doorbell = true; - ring->doorbell_index = (AMDGPU_DOORBELL64_MEC_RING0 + ring_id) <<1 ; + ring->doorbell_index = (adev->doorbell_index.mec_ring0 + ring_id) <<1 ; ring->eop_gpu_addr = adev->gfx.mec.hpd_eop_gpu_addr + (ring_id *GFX9_MEC_HPD_SIZE );sprintf (ring->name,"comp_%d.%d.%d" , ring->me, ring->pipe, ring->queue);@@ -1655,7 +1655,7 @@ static int gfx_v9_0_sw_init(void *handle)else sprintf (ring->name,"gfx_%d" , i); ring->use_doorbell = true; - ring->doorbell_index =AMDGPU_DOORBELL64_GFX_RING0 <<1 ; + ring->doorbell_index = adev->doorbell_index.gfx_ring0 <<1 ; r =amdgpu_ring_init (adev, ring,1024 , &adev->gfx.eop_irq,AMDGPU_CP_IRQ_GFX_EOP );if (r)@@ -2981,9 +2981,9 @@ static int gfx_v9_0_kiq_init_register(struct amdgpu_ring *ring)/* enable the doorbell if requested */ if (ring->use_doorbell) {WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_LOWER, - (AMDGPU_DOORBELL64_KIQ *2 ) <<2 ); + (adev->doorbell_index.kiq *2 ) <<2 );WREG32_SOC15 (GC ,0 , mmCP_MEC_DOORBELL_RANGE_UPPER, - (AMDGPU_DOORBELL64_USERQUEUE_END *2 ) <<2 ); + (adev->doorbell_index.userqueue_end *2 ) <<2 ); } WREG32_SOC15(GC, 0, mmCP_HQD_PQ_DOORBELL_CONTROL,drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c +1
-1@@ -1146,7 +1146,7 @@ static int sdma_v3_0_sw_init(void *handle)if (!amdgpu_sriov_vf (adev)) { ring->use_doorbell = true; ring->doorbell_index = (i ==0 ) ? - AMDGPU_DOORBELL_sDMA_ENGINE0 : AMDGPU_DOORBELL_sDMA_ENGINE1; + adev->doorbell_index.sdma_engine0 : adev->doorbell_index.sdma_engine1; }else { ring->use_pollmem = true; }drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +9
-16@@ -1518,15 +1518,13 @@ static int sdma_v4_0_sw_init(void *handle) ring->ring_obj =NULL ; ring->use_doorbell = true; +DRM_INFO ("use_doorbell being set to: [%s]\n" , + ring->use_doorbell?"true" :"false" ); +/* doorbell size is 2 dwords, get DWORD offset */ -if (adev->asic_type ==CHIP_VEGA10 ) - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 <<1 ); -else - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_DOORBELL64_sDMA_ENGINE1 <<1 ); + ring->doorbell_index = (i ==0 ) ? + (adev->doorbell_index.sdma_engine0 <<1 ) + : (adev->doorbell_index.sdma_engine1 <<1 );sprintf (ring->name,"sdma%d" , i); r = amdgpu_ring_init(adev, ring, 1024,@@ -1545,14 +1543,9 @@ static int sdma_v4_0_sw_init(void *handle)/* paging queue use same doorbell index/routing as gfx queue * with 0x400 (4096 dwords) offset on second doorbell page */ -if (adev->asic_type ==CHIP_VEGA10 ) - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 <<1 ); -else - ring->doorbell_index = (i ==0 ) ? - (AMDGPU_DOORBELL64_sDMA_ENGINE0 <<1 ) - : (AMDGPU_DOORBELL64_sDMA_ENGINE1 <<1 ); + ring->doorbell_index = (i ==0 ) ? + (adev->doorbell_index.sdma_engine0 <<1 ) + : (adev->doorbell_index.sdma_engine1 <<1 ); ring->doorbell_index +=0x400 ;sprintf (ring->name,"page%d" , i);drivers/gpu/drm/amd/amdgpu/tonga_ih.c +1
-1@@ -322,7 +322,7 @@ static int tonga_ih_sw_init(void *handle)return r; adev->irq.ih.use_doorbell = true; - adev->irq.ih.doorbell_index =AMDGPU_DOORBELL_IH ; + adev->irq.ih.doorbell_index = adev->doorbell_index.ih; r =amdgpu_irq_init (adev);drivers/gpu/drm/amd/amdgpu/uvd_v7_0.c +2
-2@@ -455,9 +455,9 @@ static int uvd_v7_0_sw_init(void *handle)* sriov, so set unused location for other unused rings. */ if (i ==0 ) - ring->doorbell_index =AMDGPU_DOORBELL64_UVD_RING0_1 *2 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.uvd_ring0_1 *2 ;else - ring->doorbell_index =AMDGPU_DOORBELL64_UVD_RING2_3 *2 +1 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.uvd_ring2_3 *2 +1 ; } r =amdgpu_ring_init (adev, ring,512 , &adev->uvd.inst[j].irq,0 );if (r)drivers/gpu/drm/amd/amdgpu/vce_v4_0.c +2
-2@@ -466,9 +466,9 @@ static int vce_v4_0_sw_init(void *handle)* so set unused location for other unused rings. */ if (i ==0 ) - ring->doorbell_index =AMDGPU_DOORBELL64_VCE_RING0_1 *2 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring0_1 *2 ;else - ring->doorbell_index =AMDGPU_DOORBELL64_VCE_RING2_3 *2 +1 ; + ring->doorbell_index = adev->doorbell_index.uvd_vce.vce_ring2_3 *2 +1 ; } r =amdgpu_ring_init (adev, ring,512 , &adev->vce.irq,0 );if (r)drivers/gpu/drm/amd/amdgpu/vega10_ih.c +1
-2@@ -385,7 +385,7 @@ static int vega10_ih_sw_init(void *handle)return r; adev->irq.ih.use_doorbell = true; - adev->irq.ih.doorbell_index =AMDGPU_DOORBELL64_IH <<1 ; + adev->irq.ih.doorbell_index = adev->doorbell_index.ih <<1 ; r =amdgpu_irq_init (adev); --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 8/8 drm/amdgpu: Moved doorbell structures to seperate file
In reply to a message not in the archiveMove doorbell structures, enum definitions and helper functions from amdgpu.h to amdgpu_doorbell.h. No functional change
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 227 +----------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h | 249 +++++++++++++++++++++++++++ 2 files changed, 250 insertions(+), 226 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -226
@@ -81,6 +81,7 @@#include "amdgpu_job.h" #include "amdgpu_bo_list.h" #include "amdgpu_gem.h" +#include "amdgpu_doorbell.h" #define MAX_GPU_INSTANCE 16
@@ -361,173 +362,6 @@ int amdgpu_fence_slab_init(void);void amdgpu_fence_slab_fini (void );/* -* GPU doorbell structures, functions & helpers -*/ -typedef enum _AMDGPU_DOORBELL_ASSIGNMENT -{ -AMDGPU_DOORBELL_KIQ =0x000 , -AMDGPU_DOORBELL_HIQ =0x001 , -AMDGPU_DOORBELL_DIQ =0x002 , -AMDGPU_DOORBELL_MEC_RING0 =0x010 , -AMDGPU_DOORBELL_MEC_RING1 =0x011 , -AMDGPU_DOORBELL_MEC_RING2 =0x012 , -AMDGPU_DOORBELL_MEC_RING3 =0x013 , -AMDGPU_DOORBELL_MEC_RING4 =0x014 , -AMDGPU_DOORBELL_MEC_RING5 =0x015 , -AMDGPU_DOORBELL_MEC_RING6 =0x016 , -AMDGPU_DOORBELL_MEC_RING7 =0x017 , -AMDGPU_DOORBELL_GFX_RING0 =0x020 , - AMDGPU_DOORBELL_sDMA_ENGINE0 =0x1E0 , - AMDGPU_DOORBELL_sDMA_ENGINE1 =0x1E1 , -AMDGPU_DOORBELL_IH =0x1E8 , -AMDGPU_DOORBELL_MAX_ASSIGNMENT =0x3FF , -AMDGPU_DOORBELL_INVALID =0xFFFF -}AMDGPU_DOORBELL_ASSIGNMENT ; - -struct amdgpu_doorbell { -/* doorbell mmio */ -resource_size_t base; -resource_size_t size; -u32 __iomem *ptr; -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 =0xFFFF -}AMDGPU_VEGA20_DOORBELL_ASSIGNMENT ; - -/* -* 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space -*/ -typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT -{ -/* -* All compute related doorbells: kiq, hiq, diq, traditional compute queue, user queue, should locate in -* a continues range so that programming CP_MEC_DOORBELL_RANGE_LOWER/UPPER can cover this range. -* Compute related doorbells are allocated from 0x00 to 0x8a -*/ - - -/* kernel scheduling */ -AMDGPU_DOORBELL64_KIQ =0x00 , - -/* HSA interface queue and debug queue */ -AMDGPU_DOORBELL64_HIQ =0x01 , -AMDGPU_DOORBELL64_DIQ =0x02 , - -/* Compute engines */ -AMDGPU_DOORBELL64_MEC_RING0 =0x03 , -AMDGPU_DOORBELL64_MEC_RING1 =0x04 , -AMDGPU_DOORBELL64_MEC_RING2 =0x05 , -AMDGPU_DOORBELL64_MEC_RING3 =0x06 , -AMDGPU_DOORBELL64_MEC_RING4 =0x07 , -AMDGPU_DOORBELL64_MEC_RING5 =0x08 , -AMDGPU_DOORBELL64_MEC_RING6 =0x09 , -AMDGPU_DOORBELL64_MEC_RING7 =0x0a , - -/* User queue doorbell range (128 doorbells) */ -AMDGPU_DOORBELL64_USERQUEUE_START =0x0b , -AMDGPU_DOORBELL64_USERQUEUE_END =0x8a , - -/* Graphics engine */ -AMDGPU_DOORBELL64_GFX_RING0 =0x8b , - -/* -* Other graphics doorbells can be allocated here: from 0x8c to 0xdf -* Graphics voltage island aperture 1 -* default non-graphics QWORD index is 0xe0 - 0xFF inclusive -*/ - -/* sDMA engines reserved from 0xe0 -0xef */ - AMDGPU_DOORBELL64_sDMA_ENGINE0 =0xE0 , - AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xE1 , - AMDGPU_DOORBELL64_sDMA_ENGINE1 =0xE8 , - AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xE9 , - -/* For vega10 sriov, the sdma doorbell must be fixed as follow -* to keep the same setting with host driver, or it will -* happen conflicts -*/ - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 =0xF0 , - AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xF1 , - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 =0xF2 , - AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xF3 , - -/* Interrupt handler */ -AMDGPU_DOORBELL64_IH =0xF4 ,/* For legacy interrupt ring buffer */ -AMDGPU_DOORBELL64_IH_RING1 =0xF5 ,/* For page migration request log */ -AMDGPU_DOORBELL64_IH_RING2 =0xF6 ,/* For page migration translation/invalidation log */ - -/* VCN engine use 32 bits doorbell */ -AMDGPU_DOORBELL64_VCN0_1 =0xF8 ,/* lower 32 bits for VNC0 and upper 32 bits for VNC1 */ -AMDGPU_DOORBELL64_VCN2_3 =0xF9 , -AMDGPU_DOORBELL64_VCN4_5 =0xFA , -AMDGPU_DOORBELL64_VCN6_7 =0xFB , - -/* 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_DOORBELL64_UVD_RING0_1 =0xF8 , -AMDGPU_DOORBELL64_UVD_RING2_3 =0xF9 , -AMDGPU_DOORBELL64_UVD_RING4_5 =0xFA , -AMDGPU_DOORBELL64_UVD_RING6_7 =0xFB , - -AMDGPU_DOORBELL64_VCE_RING0_1 =0xFC , -AMDGPU_DOORBELL64_VCE_RING2_3 =0xFD , -AMDGPU_DOORBELL64_VCE_RING4_5 =0xFE , -AMDGPU_DOORBELL64_VCE_RING6_7 =0xFF , - -AMDGPU_DOORBELL64_MAX_ASSIGNMENT =0xFF , -AMDGPU_DOORBELL64_INVALID =0xFFFF -}AMDGPU_DOORBELL64_ASSIGNMENT ; - -/* * IRQS. */
@@ -865,55 +699,6 @@ struct amd_powerplay {uint32_t pp_feature; }; -/* Reserved doorbells for amdgpu (including multimedia). -* KFD can use all the rest in the 2M doorbell bar. -* For asic before vega10, doorbell is 32-bit, so the -* index/offset is in dword. For vega10 and after, doorbell -* can be 64-bit, so the index defined is in qword. -*/ -struct amdgpu_doorbell_index { -uint32_t kiq; -uint32_t mec_ring0; -uint32_t mec_ring1; -uint32_t mec_ring2; -uint32_t mec_ring3; -uint32_t mec_ring4; -uint32_t mec_ring5; -uint32_t mec_ring6; -uint32_t mec_ring7; -uint32_t userqueue_start; -uint32_t userqueue_end; -uint32_t gfx_ring0; -uint32_t sdma_engine0; -uint32_t sdma_engine1; -uint32_t sdma_engine2; -uint32_t sdma_engine3; -uint32_t sdma_engine4; -uint32_t sdma_engine5; -uint32_t sdma_engine6; -uint32_t sdma_engine7; -uint32_t ih; -union { -struct { -uint32_t vcn_ring0_1; -uint32_t vcn_ring2_3; -uint32_t vcn_ring4_5; -uint32_t vcn_ring6_7; - } vcn; -struct { -uint32_t uvd_ring0_1; -uint32_t uvd_ring2_3; -uint32_t uvd_ring4_5; -uint32_t uvd_ring6_7; -uint32_t vce_ring0_1; -uint32_t vce_ring2_3; -uint32_t vce_ring4_5; -uint32_t vce_ring6_7; - } uvd_vce; - }; -uint32_t max_assignment; -}; -#define AMDGPU_RESET_MAGIC_NUM 64struct amdgpu_device {struct device *dev;
@@ -1152,11 +937,6 @@ uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset);u32 amdgpu_io_rreg (struct amdgpu_device *adev,u32 reg);void amdgpu_io_wreg (struct amdgpu_device *adev,u32 reg,u32 v); -u32 amdgpu_mm_rdoorbell (struct amdgpu_device *adev,u32 index); -void amdgpu_mm_wdoorbell (struct amdgpu_device *adev,u32 index,u32 v); -u64 amdgpu_mm_rdoorbell64 (struct amdgpu_device *adev,u32 index); -void amdgpu_mm_wdoorbell64 (struct amdgpu_device *adev,u32 index,u64 v); -bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);bool amdgpu_device_has_dc_support (struct amdgpu_device *adev);
@@ -1218,11 +998,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define RREG32_IO (reg) amdgpu_io_rreg(adev, (reg))#define WREG32_IO (reg, v) amdgpu_io_wreg(adev, (reg), (v)) -#define RDOORBELL32 (index) amdgpu_mm_rdoorbell(adev, (index)) -#define WDOORBELL32 (index, v) amdgpu_mm_wdoorbell(adev, (index), (v)) -#define RDOORBELL64 (index) amdgpu_mm_rdoorbell64(adev, (index)) -#define WDOORBELL64 (index, v) amdgpu_mm_wdoorbell64(adev, (index), (v)) -#define REG_FIELD_SHIFT (reg, field) reg##__##field##__SHIFT#define REG_FIELD_MASK (reg, field) reg##__##field##_MASK
drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h new file +249 -0
249 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1543253365-11942-8-git-send-email-ozeng-5C7GfCeVMHo@public.gmane.org
Alex Deucher
Reviewed-byRe: [PATCH 8/8] drm/amdgpu: Moved doorbell structures to seperate file
Quoted 6 lines · Oak Zeng
Move doorbell structures, enum definitions and helper functions from
amdgpu.htoamdgpu_doorbell.h. No functional changeChange-Id I09f7b84869b6d3c688b7a2506ff78d62b3de23f5Signed-off-by Oak Zeng <[email protected]>
Quoted 530 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 227 +----------------------- drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h | 249 +++++++++++++++++++++++++++ 2 files changed, 250 insertions(+), 226 deletions(-) create mode 100644 drivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.hdrivers/gpu/drm/amd/amdgpu/amdgpu.h +1
-226@@ -81,6 +81,7 @@#include "amdgpu_job.h" #include "amdgpu_bo_list.h" #include "amdgpu_gem.h" +#include "amdgpu_doorbell.h" #define MAX_GPU_INSTANCE 16@@ -361,173 +362,6 @@ int amdgpu_fence_slab_init(void);void amdgpu_fence_slab_fini (void );/* -* GPU doorbell structures, functions & helpers -*/ -typedef enum _AMDGPU_DOORBELL_ASSIGNMENT -{ -AMDGPU_DOORBELL_KIQ =0x000 , -AMDGPU_DOORBELL_HIQ =0x001 , -AMDGPU_DOORBELL_DIQ =0x002 , -AMDGPU_DOORBELL_MEC_RING0 =0x010 , -AMDGPU_DOORBELL_MEC_RING1 =0x011 , -AMDGPU_DOORBELL_MEC_RING2 =0x012 , -AMDGPU_DOORBELL_MEC_RING3 =0x013 , -AMDGPU_DOORBELL_MEC_RING4 =0x014 , -AMDGPU_DOORBELL_MEC_RING5 =0x015 , -AMDGPU_DOORBELL_MEC_RING6 =0x016 , -AMDGPU_DOORBELL_MEC_RING7 =0x017 , -AMDGPU_DOORBELL_GFX_RING0 =0x020 , - AMDGPU_DOORBELL_sDMA_ENGINE0 =0x1E0 , - AMDGPU_DOORBELL_sDMA_ENGINE1 =0x1E1 , -AMDGPU_DOORBELL_IH =0x1E8 , -AMDGPU_DOORBELL_MAX_ASSIGNMENT =0x3FF , -AMDGPU_DOORBELL_INVALID =0xFFFF -}AMDGPU_DOORBELL_ASSIGNMENT ; - -struct amdgpu_doorbell { -/* doorbell mmio */ -resource_size_t base; -resource_size_t size; -u32 __iomem *ptr; -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 =0xFFFF -}AMDGPU_VEGA20_DOORBELL_ASSIGNMENT ; - -/* -* 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space -*/ -typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT -{ -/* -* All compute related doorbells: kiq, hiq, diq, traditional compute queue, user queue, should locate in -* a continues range so that programming CP_MEC_DOORBELL_RANGE_LOWER/UPPER can cover this range. -* Compute related doorbells are allocated from 0x00 to 0x8a -*/ - - -/* kernel scheduling */ -AMDGPU_DOORBELL64_KIQ =0x00 , - -/* HSA interface queue and debug queue */ -AMDGPU_DOORBELL64_HIQ =0x01 , -AMDGPU_DOORBELL64_DIQ =0x02 , - -/* Compute engines */ -AMDGPU_DOORBELL64_MEC_RING0 =0x03 , -AMDGPU_DOORBELL64_MEC_RING1 =0x04 , -AMDGPU_DOORBELL64_MEC_RING2 =0x05 , -AMDGPU_DOORBELL64_MEC_RING3 =0x06 , -AMDGPU_DOORBELL64_MEC_RING4 =0x07 , -AMDGPU_DOORBELL64_MEC_RING5 =0x08 , -AMDGPU_DOORBELL64_MEC_RING6 =0x09 , -AMDGPU_DOORBELL64_MEC_RING7 =0x0a , - -/* User queue doorbell range (128 doorbells) */ -AMDGPU_DOORBELL64_USERQUEUE_START =0x0b , -AMDGPU_DOORBELL64_USERQUEUE_END =0x8a , - -/* Graphics engine */ -AMDGPU_DOORBELL64_GFX_RING0 =0x8b , - -/* -* Other graphics doorbells can be allocated here: from 0x8c to 0xdf -* Graphics voltage island aperture 1 -* default non-graphics QWORD index is 0xe0 - 0xFF inclusive -*/ - -/* sDMA engines reserved from 0xe0 -0xef */ - AMDGPU_DOORBELL64_sDMA_ENGINE0 =0xE0 , - AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xE1 , - AMDGPU_DOORBELL64_sDMA_ENGINE1 =0xE8 , - AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xE9 , - -/* For vega10 sriov, the sdma doorbell must be fixed as follow -* to keep the same setting with host driver, or it will -* happen conflicts -*/ - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 =0xF0 , - AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xF1 , - AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 =0xF2 , - AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xF3 , - -/* Interrupt handler */ -AMDGPU_DOORBELL64_IH =0xF4 ,/* For legacy interrupt ring buffer */ -AMDGPU_DOORBELL64_IH_RING1 =0xF5 ,/* For page migration request log */ -AMDGPU_DOORBELL64_IH_RING2 =0xF6 ,/* For page migration translation/invalidation log */ - -/* VCN engine use 32 bits doorbell */ -AMDGPU_DOORBELL64_VCN0_1 =0xF8 ,/* lower 32 bits for VNC0 and upper 32 bits for VNC1 */ -AMDGPU_DOORBELL64_VCN2_3 =0xF9 , -AMDGPU_DOORBELL64_VCN4_5 =0xFA , -AMDGPU_DOORBELL64_VCN6_7 =0xFB , - -/* 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_DOORBELL64_UVD_RING0_1 =0xF8 , -AMDGPU_DOORBELL64_UVD_RING2_3 =0xF9 , -AMDGPU_DOORBELL64_UVD_RING4_5 =0xFA , -AMDGPU_DOORBELL64_UVD_RING6_7 =0xFB , - -AMDGPU_DOORBELL64_VCE_RING0_1 =0xFC , -AMDGPU_DOORBELL64_VCE_RING2_3 =0xFD , -AMDGPU_DOORBELL64_VCE_RING4_5 =0xFE , -AMDGPU_DOORBELL64_VCE_RING6_7 =0xFF , - -AMDGPU_DOORBELL64_MAX_ASSIGNMENT =0xFF , -AMDGPU_DOORBELL64_INVALID =0xFFFF -}AMDGPU_DOORBELL64_ASSIGNMENT ; - -/* * IRQS. */ @@ -865,55 +699,6 @@ struct amd_powerplay {uint32_t pp_feature; }; -/* Reserved doorbells for amdgpu (including multimedia). -* KFD can use all the rest in the 2M doorbell bar. -* For asic before vega10, doorbell is 32-bit, so the -* index/offset is in dword. For vega10 and after, doorbell -* can be 64-bit, so the index defined is in qword. -*/ -struct amdgpu_doorbell_index { -uint32_t kiq; -uint32_t mec_ring0; -uint32_t mec_ring1; -uint32_t mec_ring2; -uint32_t mec_ring3; -uint32_t mec_ring4; -uint32_t mec_ring5; -uint32_t mec_ring6; -uint32_t mec_ring7; -uint32_t userqueue_start; -uint32_t userqueue_end; -uint32_t gfx_ring0; -uint32_t sdma_engine0; -uint32_t sdma_engine1; -uint32_t sdma_engine2; -uint32_t sdma_engine3; -uint32_t sdma_engine4; -uint32_t sdma_engine5; -uint32_t sdma_engine6; -uint32_t sdma_engine7; -uint32_t ih; -union { -struct { -uint32_t vcn_ring0_1; -uint32_t vcn_ring2_3; -uint32_t vcn_ring4_5; -uint32_t vcn_ring6_7; - } vcn; -struct { -uint32_t uvd_ring0_1; -uint32_t uvd_ring2_3; -uint32_t uvd_ring4_5; -uint32_t uvd_ring6_7; -uint32_t vce_ring0_1; -uint32_t vce_ring2_3; -uint32_t vce_ring4_5; -uint32_t vce_ring6_7; - } uvd_vce; - }; -uint32_t max_assignment; -}; -#define AMDGPU_RESET_MAGIC_NUM 64struct amdgpu_device {struct device *dev;@@ -1152,11 +937,6 @@ uint8_t amdgpu_mm_rreg8(struct amdgpu_device *adev, uint32_t offset);u32 amdgpu_io_rreg (struct amdgpu_device *adev,u32 reg);void amdgpu_io_wreg (struct amdgpu_device *adev,u32 reg,u32 v); -u32 amdgpu_mm_rdoorbell (struct amdgpu_device *adev,u32 index); -void amdgpu_mm_wdoorbell (struct amdgpu_device *adev,u32 index,u32 v); -u64 amdgpu_mm_rdoorbell64 (struct amdgpu_device *adev,u32 index); -void amdgpu_mm_wdoorbell64 (struct amdgpu_device *adev,u32 index,u64 v); -bool amdgpu_device_asic_has_dc_support (enum amd_asic_type asic_type);bool amdgpu_device_has_dc_support (struct amdgpu_device *adev);@@ -1218,11 +998,6 @@ int emu_soc_asic_init(struct amdgpu_device *adev);#define RREG32_IO (reg) amdgpu_io_rreg(adev, (reg))#define WREG32_IO (reg, v) amdgpu_io_wreg(adev, (reg), (v)) -#define RDOORBELL32 (index) amdgpu_mm_rdoorbell(adev, (index)) -#define WDOORBELL32 (index, v) amdgpu_mm_wdoorbell(adev, (index), (v)) -#define RDOORBELL64 (index) amdgpu_mm_rdoorbell64(adev, (index)) -#define WDOORBELL64 (index, v) amdgpu_mm_wdoorbell64(adev, (index), (v)) -#define REG_FIELD_SHIFT (reg, field) reg##__##field##__SHIFT#define REG_FIELD_MASK (reg, field) reg##__##field##_MASKdrivers/gpu/drm/amd/amdgpu/amdgpu_doorbell.h new file +249
-1@@ -0,0 +1,249 @@ +/* +* 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. +* +*/ + +/* +* GPU doorbell structures, functions & helpers +*/ +struct amdgpu_doorbell { +/* doorbell mmio */ +resource_size_t base; +resource_size_t size; +u32 __iomem *ptr; +u32 num_doorbells;/* Number of doorbells actually reserved for amdgpu. */ +}; + +/* Reserved doorbells for amdgpu (including multimedia). +* KFD can use all the rest in the 2M doorbell bar. +* For asic before vega10, doorbell is 32-bit, so the +* index/offset is in dword. For vega10 and after, doorbell +* can be 64-bit, so the index defined is in qword. +*/ +struct amdgpu_doorbell_index { +uint32_t kiq; +uint32_t mec_ring0; +uint32_t mec_ring1; +uint32_t mec_ring2; +uint32_t mec_ring3; +uint32_t mec_ring4; +uint32_t mec_ring5; +uint32_t mec_ring6; +uint32_t mec_ring7; +uint32_t userqueue_start; +uint32_t userqueue_end; +uint32_t gfx_ring0; +uint32_t sdma_engine0; +uint32_t sdma_engine1; +uint32_t sdma_engine2; +uint32_t sdma_engine3; +uint32_t sdma_engine4; +uint32_t sdma_engine5; +uint32_t sdma_engine6; +uint32_t sdma_engine7; +uint32_t ih; +union { +struct { +uint32_t vcn_ring0_1; +uint32_t vcn_ring2_3; +uint32_t vcn_ring4_5; +uint32_t vcn_ring6_7; + } vcn; +struct { +uint32_t uvd_ring0_1; +uint32_t uvd_ring2_3; +uint32_t uvd_ring4_5; +uint32_t uvd_ring6_7; +uint32_t vce_ring0_1; +uint32_t vce_ring2_3; +uint32_t vce_ring4_5; +uint32_t vce_ring6_7; + } uvd_vce; + }; +uint32_t max_assignment; +}; + +typedef enum _AMDGPU_DOORBELL_ASSIGNMENT +{ +AMDGPU_DOORBELL_KIQ =0x000 , +AMDGPU_DOORBELL_HIQ =0x001 , +AMDGPU_DOORBELL_DIQ =0x002 , +AMDGPU_DOORBELL_MEC_RING0 =0x010 , +AMDGPU_DOORBELL_MEC_RING1 =0x011 , +AMDGPU_DOORBELL_MEC_RING2 =0x012 , +AMDGPU_DOORBELL_MEC_RING3 =0x013 , +AMDGPU_DOORBELL_MEC_RING4 =0x014 , +AMDGPU_DOORBELL_MEC_RING5 =0x015 , +AMDGPU_DOORBELL_MEC_RING6 =0x016 , +AMDGPU_DOORBELL_MEC_RING7 =0x017 , +AMDGPU_DOORBELL_GFX_RING0 =0x020 , + AMDGPU_DOORBELL_sDMA_ENGINE0 =0x1E0 , + AMDGPU_DOORBELL_sDMA_ENGINE1 =0x1E1 , +AMDGPU_DOORBELL_IH =0x1E8 , +AMDGPU_DOORBELL_MAX_ASSIGNMENT =0x3FF , +AMDGPU_DOORBELL_INVALID =0xFFFF +}AMDGPU_DOORBELL_ASSIGNMENT ; + +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 =0xFFFF +}AMDGPU_VEGA20_DOORBELL_ASSIGNMENT ; + +/* +* 64bit doorbell, offset are in QWORD, occupy 2KB doorbell space +*/ +typedef enum _AMDGPU_DOORBELL64_ASSIGNMENT +{ +/* +* All compute related doorbells: kiq, hiq, diq, traditional compute queue, user queue, should locate in +* a continues range so that programming CP_MEC_DOORBELL_RANGE_LOWER/UPPER can cover this range. +* Compute related doorbells are allocated from 0x00 to 0x8a +*/ + + +/* kernel scheduling */ +AMDGPU_DOORBELL64_KIQ =0x00 , + +/* HSA interface queue and debug queue */ +AMDGPU_DOORBELL64_HIQ =0x01 , +AMDGPU_DOORBELL64_DIQ =0x02 , + +/* Compute engines */ +AMDGPU_DOORBELL64_MEC_RING0 =0x03 , +AMDGPU_DOORBELL64_MEC_RING1 =0x04 , +AMDGPU_DOORBELL64_MEC_RING2 =0x05 , +AMDGPU_DOORBELL64_MEC_RING3 =0x06 , +AMDGPU_DOORBELL64_MEC_RING4 =0x07 , +AMDGPU_DOORBELL64_MEC_RING5 =0x08 , +AMDGPU_DOORBELL64_MEC_RING6 =0x09 , +AMDGPU_DOORBELL64_MEC_RING7 =0x0a , + +/* User queue doorbell range (128 doorbells) */ +AMDGPU_DOORBELL64_USERQUEUE_START =0x0b , +AMDGPU_DOORBELL64_USERQUEUE_END =0x8a , + +/* Graphics engine */ +AMDGPU_DOORBELL64_GFX_RING0 =0x8b , + +/* +* Other graphics doorbells can be allocated here: from 0x8c to 0xdf +* Graphics voltage island aperture 1 +* default non-graphics QWORD index is 0xe0 - 0xFF inclusive +*/ + +/* sDMA engines reserved from 0xe0 -0xef */ + AMDGPU_DOORBELL64_sDMA_ENGINE0 =0xE0 , + AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xE1 , + AMDGPU_DOORBELL64_sDMA_ENGINE1 =0xE8 , + AMDGPU_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xE9 , + +/* For vega10 sriov, the sdma doorbell must be fixed as follow +* to keep the same setting with host driver, or it will +* happen conflicts +*/ + AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE0 =0xF0 , + AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE0 =0xF1 , + AMDGPU_VEGA10_DOORBELL64_sDMA_ENGINE1 =0xF2 , + AMDGPU_VEGA10_DOORBELL64_sDMA_HI_PRI_ENGINE1 =0xF3 , + +/* Interrupt handler */ +AMDGPU_DOORBELL64_IH =0xF4 ,/* For legacy interrupt ring buffer */ +AMDGPU_DOORBELL64_IH_RING1 =0xF5 ,/* For page migration request log */ +AMDGPU_DOORBELL64_IH_RING2 =0xF6 ,/* For page migration translation/invalidation log */ + +/* VCN engine use 32 bits doorbell */ +AMDGPU_DOORBELL64_VCN0_1 =0xF8 ,/* lower 32 bits for VNC0 and upper 32 bits for VNC1 */ +AMDGPU_DOORBELL64_VCN2_3 =0xF9 , +AMDGPU_DOORBELL64_VCN4_5 =0xFA , +AMDGPU_DOORBELL64_VCN6_7 =0xFB , + +/* 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_DOORBELL64_UVD_RING0_1 =0xF8 , +AMDGPU_DOORBELL64_UVD_RING2_3 =0xF9 , +AMDGPU_DOORBELL64_UVD_RING4_5 =0xFA , +AMDGPU_DOORBELL64_UVD_RING6_7 =0xFB , + +AMDGPU_DOORBELL64_VCE_RING0_1 =0xFC , +AMDGPU_DOORBELL64_VCE_RING2_3 =0xFD , +AMDGPU_DOORBELL64_VCE_RING4_5 =0xFE , +AMDGPU_DOORBELL64_VCE_RING6_7 =0xFF , + +AMDGPU_DOORBELL64_MAX_ASSIGNMENT =0xFF , +AMDGPU_DOORBELL64_INVALID =0xFFFF +}AMDGPU_DOORBELL64_ASSIGNMENT ; + +u32 amdgpu_mm_rdoorbell (struct amdgpu_device *adev,u32 index); +void amdgpu_mm_wdoorbell (struct amdgpu_device *adev,u32 index,u32 v); +u64 amdgpu_mm_rdoorbell64 (struct amdgpu_device *adev,u32 index); +void amdgpu_mm_wdoorbell64 (struct amdgpu_device *adev,u32 index,u64 v); + +#define RDOORBELL32 (index) amdgpu_mm_rdoorbell(adev, (index)) +#define WDOORBELL32 (index, v) amdgpu_mm_wdoorbell(adev, (index), (v)) +#define RDOORBELL64 (index) amdgpu_mm_rdoorbell64(adev, (index)) +#define WDOORBELL64 (index, v) amdgpu_mm_wdoorbell64(adev, (index), (v)) + --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Alex Deucher
Reviewed-byQuoted 10 lines · Oak Zeng
This is a preparation work to make reserved doorbell index per device, instead of using a global macro definition. By doing this, we can easily change doorbell layout for future ASICs while not affecting ASICs in production.
Change-Id If08e2bc9d0749748ed4083ba4eb32a4698763085Signed-off-by Oak Zeng <[email protected]>Suggested-by Felix Kuehling <[email protected]>Suggested-by Alex Deucher <[email protected]>
Quoted 75 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu.h +50
-1@@ -813,6 +813,55 @@ struct amd_powerplay {uint32_t pp_feature; }; +/* Reserved doorbells for amdgpu (including multimedia). +* KFD can use all the rest in the 2M doorbell bar. +* For asic before vega10, doorbell is 32-bit, so the +* index/offset is in dword. For vega10 and after, doorbell +* can be 64-bit, so the index defined is in qword. +*/ +struct amdgpu_doorbell_index { +uint32_t kiq; +uint32_t mec_ring0; +uint32_t mec_ring1; +uint32_t mec_ring2; +uint32_t mec_ring3; +uint32_t mec_ring4; +uint32_t mec_ring5; +uint32_t mec_ring6; +uint32_t mec_ring7; +uint32_t userqueue_start; +uint32_t userqueue_end; +uint32_t gfx_ring0; +uint32_t sdma_engine0; +uint32_t sdma_engine1; +uint32_t sdma_engine2; +uint32_t sdma_engine3; +uint32_t sdma_engine4; +uint32_t sdma_engine5; +uint32_t sdma_engine6; +uint32_t sdma_engine7; +uint32_t ih; +union { +struct { +uint32_t vcn_ring0_1; +uint32_t vcn_ring2_3; +uint32_t vcn_ring4_5; +uint32_t vcn_ring6_7; + } vcn; +struct { +uint32_t uvd_ring0_1; +uint32_t uvd_ring2_3; +uint32_t uvd_ring4_5; +uint32_t uvd_ring6_7; +uint32_t vce_ring0_1; +uint32_t vce_ring2_3; +uint32_t vce_ring4_5; +uint32_t vce_ring6_7; + } uvd_vce; + }; +uint32_t max_assignment; +}; +#define AMDGPU_RESET_MAGIC_NUM 64struct amdgpu_device {struct device *dev;@@ -1026,6 +1075,7 @@ struct amdgpu_device {unsigned long last_mm_index;bool in_gpu_reset;struct mutex lock_reset; +struct amdgpu_doorbell_index doorbell_index; };static inline struct amdgpu_device *amdgpu_ttm_adev (struct ttm_bo_device *bdev) --2.7.4
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx