drm/amdgpu: Remove the sriov checking and add firmware checking
Subsystems (2)
PATCH 1/2 drm/amdgpu: Remove the sriov checking and add firmware checking
Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 47 ++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2 -0
@@ -274,6 +274,8 @@ struct amdgpu_gfx {uint32_t rlc_srls_feature_version;uint32_t mec_feature_version;uint32_t mec2_feature_version; +bool mec_fw_write_wait; +bool me_fw_write_wait;struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS ];unsigned num_gfx_rings;struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS ];
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +46 -1
66 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): 1534424701-6723-1-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org
PATCH 2/2 drm/amdgpu: use kiq to do invalidate tlb
To avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 -- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 60 ++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4 -0
@@ -212,6 +212,10 @@ enum amdgpu_kiq_irq { AMDGPU_CP_KIQ_IRQ_LAST }; +#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ +#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ +#define MAX_KIQ_REG_TRY 20 +int amdgpu_device_ip_set_clockgating_state (void *dev,enum amd_ip_block_type block_type,enum amd_clockgating_state state);
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0 -3
@@ -22,9 +22,6 @@*/ #include "amdgpu.h" -#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ -#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ -#define MAX_KIQ_REG_TRY 20uint64_t amdgpu_csa_vaddr (struct amdgpu_device *adev) {
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +60 -0
78 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): 1534424701-6723-2-git-send-email-Emily.Deng-5C7GfCeVMHo@public.gmane.org
Re: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlb
Am 16.08.2018 um 15:05 schrieb Emily Deng:
Quoted 111 lines
To avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 -- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 60 ++++++++++++++++++++++++++++++++ 3 files changed, 64 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +4
-0@@ -212,6 +212,10 @@ enum amdgpu_kiq_irq { AMDGPU_CP_KIQ_IRQ_LAST }; +#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ +#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ +#define MAX_KIQ_REG_TRY 20 +int amdgpu_device_ip_set_clockgating_state (void *dev,enum amd_ip_block_type block_type,enum amd_clockgating_state state);drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0
-3@@ -22,9 +22,6 @@*/ #include "amdgpu.h" -#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ -#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ -#define MAX_KIQ_REG_TRY 20uint64_t amdgpu_csa_vaddr (struct amdgpu_device *adev) {drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +53
-0@@ -311,6 +311,58 @@ static uint32_t gmc_v9_0_get_invalidate_req(unsigned int vmid)return req; } +signed long amdgpu_kiq_reg_write_reg_wait (struct amdgpu_device *adev, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +signed long r, cnt =0 ; +unsigned long flags; +uint32_t seq; +struct amdgpu_kiq *kiq = &adev->gfx.kiq; +struct amdgpu_ring *ring = &kiq->ring; + +if (!ring->ready) +return -EINVAL ; + +spin_lock_irqsave (&kiq->ring_lock, flags); + +amdgpu_ring_alloc (ring,32 ); +amdgpu_ring_emit_reg_write_reg_wait (ring, reg0, reg1, + ref, mask); +amdgpu_fence_emit_polling (ring, &seq); +amdgpu_ring_commit (ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags); + + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + +/* don't wait anymore for gpu reset case because this way may +* block gpu_recover() routine forever, e.g. this virt_kiq_rreg +* is triggered in TTM and ttm_bo_lock_delayed_workqueue() will +* never return if we keep waiting in virt_kiq_rreg, which cause +* gpu_recover() hang there. +* +* also don't wait anymore for IRQ context +* */ +if (r <1 && (adev->in_gpu_reset ||in_interrupt ())) + goto failed_kiq; + +might_sleep (); + +while (r <1 && cnt++ <MAX_KIQ_REG_TRY ) { +msleep (MAX_KIQ_REG_BAILOUT_INTERVAL ); + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + } + +if (cnt >MAX_KIQ_REG_TRY ) + goto failed_kiq; + +return 0 ; + +failed_kiq: +pr_err ("failed to invalidate tlb with kiq\n" ); +return r; +} +/* * GART * VMID 0 is the physical GPU addresses as used by the kernel. @@ -332,6 +384,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev,/* Use register 17 for GART */ const unsigned eng =17 ;unsigned i, j; +int r;spin_lock (&adev->gmc.invalidate_lock);
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 395
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0@@ -339,6 +392,13 @@ static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev,struct amdgpu_vmhub *hub = &adev->vmhub[i];u32 tmp =gmc_v9_0_get_invalidate_req (vmid); +spin_unlock (&adev->gmc.invalidate_lock);
Well just remove the lock altogether. Taking it and dropping it again immediately doesn't do anything useful.
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 404
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6
-0+ r =amdgpu_kiq_reg_write_reg_wait (adev, hub->vm_inv_eng0_req + eng, + hub->vm_inv_eng0_ack + eng, tmp,1 << vmid); +spin_lock (&adev->gmc.invalidate_lock); +if (!r) +continue ; +WREG32_NO_KIQ (hub->vm_inv_eng0_req + eng, tmp);/* Busy wait for ACK.*/
Since you now use the KIQ to wait for the TLB flush I think we can now remove the MMIO implementation.
Regards,
Christian.
_______________________________________________
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): 1a97e548-09d3-ec4b-d2d4-c9d5e753f749-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
RE: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlb
Quoted 144 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, August 16, 2018 9:24 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlbAm 16.08.2018 um 15:05 schrieb Emily Deng:
Quoted 8 lines
To avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 -- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 60++++++++++++++++++++++++++++++++
Quoted 8 lines
3 files changed, 64 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu.h enum amdgpu_kiq_irq { · line 221
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4
-0@@ -212,6 +212,10 @@ enum amdgpu_kiq_irq { AMDGPU_CP_KIQ_IRQ_LAST }; +#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ +#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ +#define MAX_KIQ_REG_TRY 20 +int amdgpu_device_ip_set_clockgating_state (void *dev,enum amd_ip_block_type block_type,enum amd_clockgating_state state);diff --git
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint32_t
Quoted 21 lines
a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 21adb1b6..3885636 100644drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0
-3@@ -22,9 +22,6 @@*/ #include "amdgpu.h" -#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ -#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ -#define MAX_KIQ_REG_TRY 20uint64_t amdgpu_csa_vaddr (struct amdgpu_device *adev) {drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0@@ -311,6 +311,58 @@ static uint32_t
gmc_v9_0_get_invalidate_req(unsigned int vmid)Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +30
-0return req; } +signed long amdgpu_kiq_reg_write_reg_wait (struct amdgpu_device *adev, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) +{ +signed long r, cnt =0 ; +unsigned long flags; +uint32_t seq; +struct amdgpu_kiq *kiq = &adev->gfx.kiq; +struct amdgpu_ring *ring = &kiq->ring; + +if (!ring->ready) +return -EINVAL ; + +spin_lock_irqsave (&kiq->ring_lock, flags); + +amdgpu_ring_alloc (ring,32 ); +amdgpu_ring_emit_reg_write_reg_wait (ring, reg0, reg1, + ref, mask); +amdgpu_fence_emit_polling (ring, &seq); +amdgpu_ring_commit (ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags); + + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + +/* don't wait anymore for gpu reset case because this way may +* block gpu_recover() routine forever, e.g. this virt_kiq_rreg +* is triggered in TTM and ttm_bo_lock_delayed_workqueue() will +* never return if we keep waiting in virt_kiq_rreg, which cause +* gpu_recover() hang there. +* drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint32_t gmc_v9_0_get_invalidate_req(unsigned int vmid)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10
-0+* also don't wait anymore for IRQ context +* */ +if (r <1 && (adev->in_gpu_reset ||in_interrupt ())) + goto failed_kiq; + +might_sleep (); + +while (r <1 && cnt++ <MAX_KIQ_REG_TRY ) { +msleep (MAX_KIQ_REG_BAILOUT_INTERVAL ); + r = amdgpu_fence_wait_polling(ring, seq,
MAX_KIQ_REG_WAIT);drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +12
-0+ } + +if (cnt >MAX_KIQ_REG_TRY ) + goto failed_kiq; + +return 0 ; + +failed_kiq: +pr_err ("failed to invalidate tlb with kiq\n" ); +return r; +} +/* * GART * VMID 0 is the physical GPU addresses as used by the kernel. @@ -332,6 +384,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0/* Use register 17 for GART */ const unsigned eng =17 ;unsigned i, j; +int r;spin_lock (&adev->gmc.invalidate_lock);@@ -339,6 +392,13 @@ static void gmc_v9_0_flush_gpu_tlb(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 395
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0struct amdgpu_vmhub *hub = &adev->vmhub[i];u32 tmp =gmc_v9_0_get_invalidate_req (vmid); +spin_unlock (&adev->gmc.invalidate_lock);Well just remove the lock altogether. Taking it and dropping it again immediately doesn't do anything useful.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6
-0+ r =amdgpu_kiq_reg_write_reg_wait (adev, hub- vm_inv_eng0_req + eng, + hub->vm_inv_eng0_ack + eng, tmp,1 << vmid); +spin_lock (&adev->gmc.invalidate_lock); +if (!r) +continue ; +WREG32_NO_KIQ (hub->vm_inv_eng0_req + eng, tmp);
Quoted 3 lines
Quoted 1 line
/* Busy wait for ACK.*/
Since you now use the KIQ to wait for the TLB flush I think we can now remove the MMIO implementation.
Ok. If remove the MMIO implementation, then we don't need adev->gmc.invalidate_lock.
Quoted 3 lines
Regards,
Christian.
_______________________________________________
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): DM6PR12MB2652D87439F7592F04CA8D138F3D0-lmeGfMZKVrHiBFXSrFbU1AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlb
Quoted 151 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Deng, Emily
Sent: Friday, August 17, 2018 10:19 AM
To: Koenig, Christian <[email protected]>; amd- [email protected]
Subject: RE: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlbQuoted 143 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, August 16, 2018 9:24 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH 2/2] drm/amdgpu: use kiq to do invalidate tlbAm 16.08.2018 um 15:05 schrieb Emily Deng:
Quoted 8 lines
To avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 -- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 60++++++++++++++++++++++++++++++++
Quoted 8 lines
3 files changed, 64 insertions(+), 3 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu.h enum amdgpu_kiq_irq { · line 221
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu.h +4
-0@@ -212,6 +212,10 @@ enum amdgpu_kiq_irq { AMDGPU_CP_KIQ_IRQ_LAST }; +#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ +#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ +#define MAX_KIQ_REG_TRY 20 +int amdgpu_device_ip_set_clockgating_state (void *dev,enum amd_ip_block_type block_type,enum amd_clockgating_state state);diff --git
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint32_t
Quoted 21 lines
a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.cb/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
index 21adb1b6..3885636 100644drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +0
-3@@ -22,9 +22,6 @@*/ #include "amdgpu.h" -#define MAX_KIQ_REG_WAIT 5000/* in usecs, 5ms */ -#define MAX_KIQ_REG_BAILOUT_INTERVAL 5/* in msecs, 5ms */ -#define MAX_KIQ_REG_TRY 20uint64_t amdgpu_csa_vaddr (struct amdgpu_device *adev) {drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0@@ -311,6 +311,58 @@ static uint32_t
gmc_v9_0_get_invalidate_req(unsigned int vmid)Quoted 32 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +29
-0return req; } +signed long amdgpu_kiq_reg_write_reg_wait (struct amdgpu_device *adev, +uint32_t reg0,uint32_t reg1, +uint32_t ref,uint32_t mask) { +signed long r, cnt =0 ; +unsigned long flags; +uint32_t seq; +struct amdgpu_kiq *kiq = &adev->gfx.kiq; +struct amdgpu_ring *ring = &kiq->ring; + +if (!ring->ready) +return -EINVAL ; + +spin_lock_irqsave (&kiq->ring_lock, flags); + +amdgpu_ring_alloc (ring,32 ); +amdgpu_ring_emit_reg_write_reg_wait (ring, reg0, reg1, + ref, mask); +amdgpu_fence_emit_polling (ring, &seq); +amdgpu_ring_commit (ring); +spin_unlock_irqrestore (&kiq->ring_lock, flags); + + r =amdgpu_fence_wait_polling (ring, seq,MAX_KIQ_REG_WAIT ); + +/* don't wait anymore for gpu reset case because this way may +* block gpu_recover() routine forever, e.g. this virt_kiq_rreg +* is triggered in TTM and ttm_bo_lock_delayed_workqueue() will +* never return if we keep waiting in virt_kiq_rreg, which cause +* gpu_recover() hang there. +* drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static uint32_t gmc_v9_0_get_invalidate_req(unsigned int vmid)
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +10
-0+* also don't wait anymore for IRQ context +* */ +if (r <1 && (adev->in_gpu_reset ||in_interrupt ())) + goto failed_kiq; + +might_sleep (); + +while (r <1 && cnt++ <MAX_KIQ_REG_TRY ) { +msleep (MAX_KIQ_REG_BAILOUT_INTERVAL ); + r = amdgpu_fence_wait_polling(ring, seq,
MAX_KIQ_REG_WAIT);drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +12
-0+ } + +if (cnt >MAX_KIQ_REG_TRY ) + goto failed_kiq; + +return 0 ; + +failed_kiq: +pr_err ("failed to invalidate tlb with kiq\n" ); +return r; +} +/* * GART * VMID 0 is the physical GPU addresses as used by the kernel. @@ -332,6 +384,7 @@ static void gmc_v9_0_flush_gpu_tlb(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0/* Use register 17 for GART */ const unsigned eng =17 ;unsigned i, j; +int r;spin_lock (&adev->gmc.invalidate_lock);@@ -339,6 +392,13 @@ static void gmc_v9_0_flush_gpu_tlb(struct
amdgpu_device*adev,drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static void gmc_v9_0_flush_gpu_tlb(struct amdgpu_device *adev, · line 395
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1
-0struct amdgpu_vmhub *hub = &adev->vmhub[i];u32 tmp =gmc_v9_0_get_invalidate_req (vmid); +spin_unlock (&adev->gmc.invalidate_lock);Well just remove the lock altogether. Taking it and dropping it again immediately doesn't do anything useful.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +6
-0+ r =amdgpu_kiq_reg_write_reg_wait (adev, hub- vm_inv_eng0_req + eng, + hub->vm_inv_eng0_ack + eng, tmp,1 << vmid); +spin_lock (&adev->gmc.invalidate_lock); +if (!r) +continue ; +WREG32_NO_KIQ (hub->vm_inv_eng0_req + eng, tmp);
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
/* Busy wait for ACK.*/
Since you now use the KIQ to wait for the TLB flush I think we can now remove the MMIO implementation.
Ok. If remove the MMIO implementation, then we don't need adev-
Quoted 1 line
gmc.invalidate_lock.
Sorry, just forget one thing, the MMIO path couldn't be removed, as the kiq only could be used when the kiq ring is ready for using, so when the kiq is not ready,
need fallback to the MMIO path.
Quoted 7 lines
Quoted 3 lines
Regards,
Christian._______________________________________________
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
Am 16.08.2018 um 15:05 schrieb Emily Deng:
Quoted 30 lines
Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 47 ++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2
-0@@ -274,6 +274,8 @@ struct amdgpu_gfx {uint32_t rlc_srls_feature_version;uint32_t mec_feature_version;uint32_t mec2_feature_version; +bool mec_fw_write_wait; +bool me_fw_write_wait;struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS ];unsigned num_gfx_rings;struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS ];drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -482,6 +482,47 @@ static void gfx_v9_0_init_rlc_ext_microcode(struct amdgpu_device *adev)le32_to_cpu (rlc_hdr->reg_list_format_direct_reg_list_length); }
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_rlc_ext_microcode(struct amdgpu_device *adev) · line 494
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +10
-0+static void gfx_v9_0_check_fw_write_wait (struct amdgpu_device *adev) +{ + adev->gfx.me_fw_write_wait = false; + adev->gfx.mec_fw_write_wait = false; + +switch (adev->asic_type) { +case CHIP_VEGA10 : +if ((adev->gfx.me_fw_version >=0x0000009c ) && (adev->gfx.me_feature_version >=42 ) && + (adev->gfx.pfp_fw_version >=0x000000b1 ) && (adev->gfx.pfp_feature_version >=42 )) + adev->gfx.me_fw_write_wait = true;
Well that looks like the correct solution to me. Only a nit pick left to fix, the coding style looks a bit off.
For example the "if" should be indented so that "(adev.." in both lines is on the same column:
if ((adev.... ) &&
(adev....
And the "adev->gfx.me_fw_write_wait = true;" is to far to the right.
With that fixed the patch is Acked-by: Christian König <[email protected]>.
Regards,
Christian.
Quoted 45 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +32
-0+ +if ((adev->gfx.mec_fw_version >=0x00000193 ) && (adev->gfx.mec_feature_version >=42 )) + adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_VEGA12 : +if ((adev->gfx.me_fw_version >=0x0000009c ) && (adev->gfx.me_feature_version >=44 ) && + (adev->gfx.pfp_fw_version >=0x000000b2 ) && (adev->gfx.pfp_feature_version >=44 )) + adev->gfx.me_fw_write_wait = true; + +if ((adev->gfx.mec_fw_version >=0x00000196 ) && (adev->gfx.mec_feature_version >=44 )) + adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_VEGA20 : +if ((adev->gfx.me_fw_version >=0x0000009c ) && (adev->gfx.me_feature_version >=44 ) && + (adev->gfx.pfp_fw_version >=0x000000b2 ) && (adev->gfx.pfp_feature_version >=44 )) + adev->gfx.me_fw_write_wait = true; + +if ((adev->gfx.mec_fw_version >=0x00000197 ) && (adev->gfx.mec_feature_version >=44 )) + adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_RAVEN : +if ((adev->gfx.me_fw_version >=0x0000009c ) && (adev->gfx.me_feature_version >=42 ) && + (adev->gfx.pfp_fw_version >=0x000000b1 ) && (adev->gfx.pfp_feature_version >=42 )) + adev->gfx.me_fw_write_wait = true; + +if ((adev->gfx.mec_fw_version >=0x00000192 ) && (adev->gfx.mec_feature_version >=42 )) + adev->gfx.mec_fw_write_wait = true; +break ; + } +} +static int gfx_v9_0_init_microcode (struct amdgpu_device *adev) {const char *chip_name;@@ -716,6 +757,7 @@ static int gfx_v9_0_init_microcode(struct amdgpu_device *adev) } out: +gfx_v9_0_check_fw_write_wait (adev);if (err) { dev_err(adev->dev, "gfx9: Failed to load firmware \"%s\"\n",@@ -4348,8 +4390,11 @@ static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring, uint32_t ref, uint32_t mask) {
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring, · line 4400
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-1int usepfp = (ring->funcs->type ==AMDGPU_RING_TYPE_GFX ); +struct amdgpu_device *adev = ring->adev; +bool fw_version_ok = (ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) ? + adev->gfx.me_fw_write_wait : adev->gfx.mec_fw_write_wait; -if (amdgpu_sriov_vf (ring->adev)) +if (fw_version_ok)gfx_v9_0_wait_reg_mem (ring, usepfp,0 ,1 , reg0, reg1, ref, mask,0x20 );else
_______________________________________________
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): f768308d-e7b3-1bd2-24cb-5dd56e4d8c92-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 60 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Thursday, August 16, 2018 9:17 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH 1/2] drm/amdgpu: Remove the sriov checking and add firmware checkingAm 16.08.2018 um 15:05 schrieb Emily Deng:
Quoted 7 lines
Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
Signed-off-by Emily Deng <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 47++++++++++++++++++++++++++++++++-
Quoted 8 lines
2 files changed, 48 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h struct amdgpu_gfx { · line 281
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +2
-0@@ -274,6 +274,8 @@ struct amdgpu_gfx {uint32_t rlc_srls_feature_version;uint32_t mec_feature_version;uint32_t mec2_feature_version; +bool mec_fw_write_wait; +bool me_fw_write_wait;struct amdgpu_ring gfx_ring[AMDGPU_MAX_GFX_RINGS ];unsigned num_gfx_rings;struct amdgpu_ring compute_ring[AMDGPU_MAX_COMPUTE_RINGS];drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_init_rlc_ext_microcode(struct
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -482,6 +482,47 @@ static void gfx_v9_0_init_rlc_ext_microcode(struct
amdgpu_device*adev)Quoted 15 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +8
-0le32_to_cpu (rlc_hdr- reg_list_format_direct_reg_list_length); } +static void gfx_v9_0_check_fw_write_wait (struct amdgpu_device *adev) +{ + adev->gfx.me_fw_write_wait = false; + adev->gfx.mec_fw_write_wait = false; + +switch (adev->asic_type) { +case CHIP_VEGA10 : + if ((adev->gfx.me_fw_version >= 0x0000009c) && (adev-gfx.me_feature_version >= 42) &&
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ (adev->gfx.pfp_fw_version >= 0x000000b1) && (adev-gfx.pfp_feature_version >= 42))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ adev->gfx.me_fw_write_wait = true;Well that looks like the correct solution to me. Only a nit pick left to fix, the coding style looks a bit off.
Quoted 8 lines
For example the "if" should be indented so that "(adev.." in both lines is on the same column:
if ((adev.... ) &&
(adev....And the "
adev->gfx.me_fw_write_wait= true;" is to far to the right.
Thanks, will modify as your suggestion.
Quoted 68 lines
With that fixed the patch is Acked-by: Christian König <[email protected]>.
Regards,
Christian.drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_init_microcode(struct
Quoted 45 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-0+ + if ((adev->gfx.mec_fw_version >= 0x00000193) && (adev-gfx.mec_feature_version >= 42))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0+ adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_VEGA12 : + if ((adev->gfx.me_fw_version >= 0x0000009c) && (adev-gfx.me_feature_version >= 44) &&
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ (adev->gfx.pfp_fw_version >= 0x000000b2) && (adev-gfx.pfp_feature_version >= 44))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+ adev->gfx.me_fw_write_wait = true; + + if ((adev->gfx.mec_fw_version >= 0x00000196) && (adev-gfx.mec_feature_version >= 44))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0+ adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_VEGA20 : + if ((adev->gfx.me_fw_version >= 0x0000009c) && (adev-gfx.me_feature_version >= 44) &&
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ (adev->gfx.pfp_fw_version >= 0x000000b2) && (adev-gfx.pfp_feature_version >= 44))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+ adev->gfx.me_fw_write_wait = true; + + if ((adev->gfx.mec_fw_version >= 0x00000197) && (adev-gfx.mec_feature_version >= 44))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +4
-0+ adev->gfx.mec_fw_write_wait = true; +break ; +case CHIP_RAVEN : + if ((adev->gfx.me_fw_version >= 0x0000009c) && (adev-gfx.me_feature_version >= 42) &&
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ (adev->gfx.pfp_fw_version >= 0x000000b1) && (adev-gfx.pfp_feature_version >= 42))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+ adev->gfx.me_fw_write_wait = true; + + if ((adev->gfx.mec_fw_version >= 0x00000192) && (adev-gfx.mec_feature_version >= 42))
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5
-0+ adev->gfx.mec_fw_write_wait = true; +break ; + } +} +static int gfx_v9_0_init_microcode (struct amdgpu_device *adev) {const char *chip_name;@@ -716,6 +757,7 @@ static int gfx_v9_0_init_microcode(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_init_microcode(struct amdgpu_device *adev)
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0} out: +gfx_v9_0_check_fw_write_wait (adev);if (err) {dev_err (adev->dev, "gfx9: Failed to load firmware \"%s\"\n", @@ -4348,8+4390,11 @@
Quoted 8 lines
static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct
amdgpu_ring*ring,
uint32_tref,uint32_tmask)
{
int usepfp = (ring->funcs->type==AMDGPU_RING_TYPE_GFX);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3
-0+struct amdgpu_device *adev = ring->adev; +bool fw_version_ok = (ring->funcs->type ==AMDGPU_RING_TYPE_GFX ) ? + adev->gfx.me_fw_write_wait : adev->gfx.mec_fw_write_wait;
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct amdgpu_ring *ring, · line 4400
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-1-if (amdgpu_sriov_vf (ring->adev)) +if (fw_version_ok)gfx_v9_0_wait_reg_mem (ring, usepfp,0 ,1 , reg0, reg1, ref, mask,0x20 );else
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx