drm/amdgpu: Disable vcn decode ring for sriov navi12
Subsystems (2)
PATCH 1/6 drm/amdgpu: Disable vcn decode ring for sriov navi12
Since vcn decoding ring is not required, so just disable it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 4 +++- drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c | 29 ++++++++++++------------- 2 files changed, 17 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +3 -1
@@ -427,7 +427,9 @@ static int amdgpu_hw_ip_info(struct amdgpu_device *adev,if (adev->uvd.harvest_config & (1 << i))continue ; -if (adev->vcn.inst[i].ring_dec.sched.ready) +if (adev->vcn.inst[i].ring_dec.sched.ready || + (adev->asic_type ==CHIP_NAVI12 && +amdgpu_sriov_vf (adev))) ++num_rings; } ib_start_alignment =16 ;
drivers/gpu/drm/amd/amdgpu/vcn_v2_0.c +14 -15
@@ -220,21 +220,20 @@ static int vcn_v2_0_hw_init(void *handle) {struct amdgpu_device *adev = (struct amdgpu_device *)handle;struct amdgpu_ring *ring = &adev->vcn.inst->ring_dec; -int i, r; +int i, r =-1 ; adev->nbio.funcs->vcn_doorbell_range (adev, ring->use_doorbell, ring->doorbell_index,0 ); -if (amdgpu_sriov_vf (adev)) +if (amdgpu_sriov_vf (adev)) {vcn_v2_0_start_sriov (adev); - - r =amdgpu_ring_test_helper (ring); -if (r) - goto done; - -//Disable vcn decode for sriov -if (amdgpu_sriov_vf (adev)) - ring->sched.ready = false; +if (adev->asic_type ==CHIP_NAVI12 ) + ring->sched.ready = false; + }else { + r =amdgpu_ring_test_helper (ring); +if (r) + goto done; + }for (i =0 ; i < adev->vcn.num_enc_rings; ++i) { ring = &adev->vcn.inst->ring_enc[i];
@@ -245,8 +244,11 @@ static int vcn_v2_0_hw_init(void *handle) done:if (!r) -DRM_INFO ("VCN decode and encode initialized successfully(under %s).\n" , - (adev->pg_flags &AMD_PG_SUPPORT_VCN_DPG )?"DPG Mode" :"SPG Mode" ); +DRM_INFO ("VCN %s encode initialized successfully(under %s).\n" , + (adev->asic_type ==CHIP_NAVI12 && +amdgpu_sriov_vf (adev))?"" :"decode and" , + (adev->pg_flags & +AMD_PG_SUPPORT_VCN_DPG )?"DPG Mode" :"SPG Mode" );return r; }
@@ -1719,9 +1721,6 @@ int vcn_v2_0_dec_ring_test_ring(struct amdgpu_ring *ring)unsigned i;int r; -if (amdgpu_sriov_vf (adev)) -return 0 ; -WREG32 (adev->vcn.inst[ring->me].external.scratch9,0xCAFEDEAD ); r =amdgpu_ring_alloc (ring,4 );if (r)
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/6 drm/amdgpu: Correct the irq numbers for virtual ctrc
Set the num_types equal to the enabled num_crtc.
--- drivers/gpu/drm/amd/amdgpu/dce_virtual.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/dce_virtual.c +1 -1
@@ -768,7 +768,7 @@ static const struct amdgpu_irq_src_funcs dce_virtual_crtc_irq_funcs = {static void dce_virtual_set_irq_funcs (struct amdgpu_device *adev) { - adev->crtc_irq.num_types =AMDGPU_CRTC_IRQ_VBLANK6 +1 ; + adev->crtc_irq.num_types = adev->mode_info.num_crtc; adev->crtc_irq.funcs = &dce_virtual_crtc_irq_funcs; }
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/6 drm/amdgpu: Restore msix after FLR
In reply to Emily DengFrom: "Emily.Deng" <[email protected]>
After FLR, the msix will be cleared, so need to re-enable it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +13 -0
@@ -277,6 +277,18 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +void amdgpu_restore_msix (struct amdgpu_device *adev) +{ +#ifdef PCI_IRQ_MSIX +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); +#endif +}/** * amdgpu_irq_init - initialize interrupt handling *
@@ -558,6 +570,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +amdgpu_restore_msix (adev);for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/6 drm/amdgpu: Disable fetch discovery data from vram for navi12 sriov
In reply to Emily DengTo fix the board disappear issue.
--- drivers/gpu/drm/amd/amdgpu/nv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/nv.c +4 -1
@@ -692,7 +692,10 @@ int nv_set_ip_blocks(struct amdgpu_device *adev) }else { adev->nbio.funcs = &nbio_v2_3_funcs; adev->nbio.hdp_flush_reg = &nbio_v2_3_hdp_flush_reg; - } + +if (amdgpu_sriov_vf (adev) && adev->asic_type ==CHIP_NAVI12 ) + amdgpu_discovery =0 ; + adev->hdp.funcs = &hdp_v5_0_funcs;if (adev->asic_type >=CHIP_SIENNA_CICHLID )
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 5/6 drm/amdgpu: Disable RPTR write back for navi12
In reply to Emily DengIt will hit ramdomly sdma hang, and pending on utcl2 address translation when access the RPTR polling address.
According sdma firmware team mentioned, the RPTR writeback is done by hardware automatically, and will hit issue when clock gating occurs. So stop using the rptr write back for sdma5.0.
--- drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v5_0.c +12 -6
@@ -298,13 +298,19 @@ static void sdma_v5_0_ring_patch_cond_exec(struct amdgpu_ring *ring,*/ static uint64_t sdma_v5_0_ring_get_rptr (struct amdgpu_ring *ring) { -u64 *rptr; +struct amdgpu_device *adev = ring->adev; +u64 rptr; +u32 lowbit, highbit; + + lowbit =RREG32_RLC (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_RPTR)); + highbit =RREG32_RLC (sdma_v5_0_get_reg_offset (adev, ring->me, mmSDMA0_GFX_RB_RPTR_HI)); -/* XXX check if swapping is necessary on BE */ - rptr = ((u64 *)&ring->adev->wb.wb[ring->rptr_offs]); + rptr = highbit; + rptr = rptr <<32 ; + rptr |= lowbit; -DRM_DEBUG ("rptr before shift == 0x%016llx\n" , *rptr); -return ((*rptr) >>2 ); +DRM_DEBUG ("rptr before shift == 0x%016llx\n" , rptr); +return (rptr >>2 ); }/**
@@ -702,7 +708,7 @@ static int sdma_v5_0_gfx_resume(struct amdgpu_device *adev)WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_RPTR_ADDR_LO),lower_32_bits (adev->wb.gpu_addr + wb_offset) &0xFFFFFFFC ); - rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,1 ); + rb_cntl =REG_SET_FIELD (rb_cntl,SDMA0_GFX_RB_CNTL ,RPTR_WRITEBACK_ENABLE ,0 );WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_BASE), ring->gpu_addr >>8 );WREG32 (sdma_v5_0_get_reg_offset (adev, i, mmSDMA0_GFX_RB_BASE_HI), ring->gpu_addr >>40 );
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 6/6 drm/amdgpu: Fix driver unload issue
In reply to Emily DengDuring driver unloading, don't need to copy mem, or it will introduce some call trace, such as when sa_manager is freed, it will introduce warn call trace in amdgpu_sa_bo_new.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -0
@@ -317,6 +317,9 @@ int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev,struct dma_fence *fence =NULL ;int r =0 ; +if (adev->shutdown) +return 0 ; +if (!adev->mman.buffer_funcs_enabled) {DRM_ERROR ("Trying to move memory with ring turned off.\n" );return -EINVAL ;
Signature · 6 lines
2.25.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/6] drm/amdgpu: Restore msix after FLR
In reply to Emily Deng[AMD Public Use]
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Emily Deng
Sent: Monday, March 29, 2021 1:20 PM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu: Restore msix after FLR
From: "Emily.Deng" <[email protected]>
After FLR, the msix will be cleared, so need to re-enable it.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +10 -0
@@ -277,6 +277,18 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +void amdgpu_restore_msix (struct amdgpu_device *adev) {#ifdef +PCI_IRQ_MSIX +u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl);#endif }
< > pci_restore_msi_state() is the API to do this.
/**
* amdgpu_irq_init - initialize interrupt handling
*
@@ -558,6 +570,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {
int i, j, k;
+ amdgpu_restore_msix(adev);
< > This is not needed for all cases. For ex: this is called in other cases like mode1 reset where entire config space (including MSIX) is restored already.
Thanks,
Lijo
for (i = 0; i < AMDGPU_IRQ_CLIENTID_MAX; ++i) {
if (!adev->irq.client[i].sources)
continue;
--
2.25.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7Cb583583b1aae4a93c03508d8f2873f50%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637526009994752107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=E6prbMAEwqsWBIFGqrgtd4i4ucg0OBrpG07G3xTuTqU%3D&reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
maintainerRE: [PATCH 3/6] drm/amdgpu: Restore msix after FLR
In reply to Emily Deng[AMD Public Use]
Quoted 23 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Emily Deng
Sent: Monday, March 29, 2021 3:50 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu: Restore msix after FLRFrom: "Emily.Deng" <[email protected]>
After FLR, the msix will be cleared, so need to re-enable it.
Signed-off-by Emily.Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c static bool amdgpu_msi_ok(struct amdgpu_device · line 282
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +2
-0@@ -277,6 +277,18 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } +void amdgpu_restore_msix (struct amdgpu_device *adev) {#ifdef +PCI_IRQ_MSIX
This should be static. Also please use the amdgpu_irq_ prefix for consistency. Additionally, the #ifdef should be on it's own line. Moreover, can we just drop the #ifdef?
Alex
Quoted 24 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +9
-1+u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl);#endif }/** * amdgpu_irq_init - initialize interrupt handling * @@ -558,6 +570,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +amdgpu_restore_msix (adev);for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ; --2.25.1
Quoted 11 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C422d42ec3 d004b207e5908d8f2873f6c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7 C0%7C637526009994486807%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&am p;sdata=0gZJU2qgZ1H%2F08YNVNN4RVAcgzXDbMZOw%2FuGvrimYtg%3D&a mp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 3/6] drm/amdgpu: Restore msix after FLR
Quoted 38 lines
-----Original Message-----
From: Deucher, Alexander <[email protected]>
Sent: Monday, March 29, 2021 10:41 PM
To: Deng, Emily <[email protected]>; [email protected]
Cc: Deng, Emily <[email protected]>
Subject: RE: [PATCH 3/6] drm/amdgpu: Restore msix after FLR[AMD Public Use]
Quoted 27 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Emily Deng
Sent: Monday, March 29, 2021 3:50 AM
To: [email protected]
Cc: Deng, Emily <[email protected]>
Subject: [PATCH 3/6] drm/amdgpu: Restore msix after FLRFrom: "Emily.Deng" <[email protected]>
After FLR, the msix will be cleared, so need to re-enable it.
Signed-off-by Emily.Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +0
-0@@ -277,6 +277,18 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; }
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c static bool amdgpu_msi_ok(struct amdgpu_device · line 282
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +2
-0+void amdgpu_restore_msix (struct amdgpu_device *adev) {#ifdef +PCI_IRQ_MSIX This should be static. Also please use the
amdgpu_irq_prefix for consistency. Additionally, the #ifdef should be on it's own line. Moreover, can we just drop the #ifdef?Alex
Hi Alex,
Thanks for your suggestion, will modify and send out v2 patch to review again.
Quoted 34 lines
Quoted 25 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +9
-1+u16 ctrl; + +pci_read_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , &ctrl); + ctrl &= ~PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap +PCI_MSIX_FLAGS , ctrl); + ctrl |=PCI_MSIX_FLAGS_ENABLE ; +pci_write_config_word (adev->pdev, adev->pdev->msix_cap + +PCI_MSIX_FLAGS , ctrl);#endif }/** * amdgpu_irq_init - initialize interrupt handling * @@ -558,6 +570,7 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev) {int i, j, k; +amdgpu_restore_msix (adev);for (i =0 ; i <AMDGPU_IRQ_CLIENTID_MAX ; ++i) {if (!adev->irq.client[i].sources)continue ; --2.25.1
Quoted 7 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
freedesktop.org%2Fmailman%2Flistinfo%2Famd- gfx&data=04%7C01%7Calexander.deucher%40amd.com%7C422d42ec3d004b207e5908d8f2873f6c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7
Quoted 1 line
Quoted 5 lines
C0%7C637526009994486807%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4w
Quoted 1 line
LjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&am
Quoted 2 lines
p;sdata=0gZJU2qgZ1H%2F08YNVNN4RVAcgzXDbMZOw%2FuGvrimYtg%3D&a mp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx