drm/amdgpu: Remove the sriov checking and add firmware checking
Subsystems (2)
PATCH v2 1/2 drm/amdgpu: Remove the sriov checking and add firmware checking
Refine the patch 1, and the lock about invalidate_lock.
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 | 59 ++++++++++++++++++++++++++++++++- 2 files changed, 60 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 +58 -1
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
PATCH v2 2/2 drm/amdgpu: use kiq to do invalidate tlb
In reply to a message not in the archiveTo avoid the tlb flush not interrupted by world switch, use kiq and one command to do tlb invalidate.
v2:
Refine the invalidate lock position.
--- 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 | 74 +++++++++++++++++++++++++++++--- 3 files changed, 71 insertions(+), 10 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 +67 -7
107 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
Am 17.08.2018 um 07:40 schrieb Emily Deng:
Quoted 6 lines
Refine the patch 1, and the lock about
invalidate_lock.Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
Signed-off-by Emily Deng <[email protected]>
I can give the two patches a testing on bare metal Vega10 and Raven later today if nobody beats me on this.
Thanks for the patience, that looks *much* better now that we have an unified code path, Christian.
Quoted 93 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59 ++++++++++++++++++++++++++++++++- 2 files changed, 60 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 +54
-0@@ -482,6 +482,59 @@ 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); } +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; + +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 +769,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",@@ -4353,8 +4407,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 4417
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
Quoted 18 lines
-----Original Message-----
From: Christian König <[email protected]>
Sent: Friday, August 17, 2018 3:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amdgpu: Remove the sriov checking and add firmware checkingAm 17.08.2018 um 07:40 schrieb Emily Deng:
Quoted 6 lines
Refine the patch 1, and the lock about
invalidate_lock.Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
Signed-off-by Emily Deng <[email protected]>can't verify the firmware numbers.
Quoted 7 lines
I can give the two patches a testing on bare metal Vega10 and Raven later today if nobody beats me on this.
Thanks for the patience, that looks *much* better now that we have an unified code path, Christian.
Also thanks your help to review these, I am waiting the test result on bare metal from you or someone else, and then push the patches.
Quoted 106 lines
Quoted 3 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59++++++++++++++++++++++++++++++++-
Quoted 8 lines
2 files changed, 60 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,59 @@ static void gfx_v9_0_init_rlc_ext_microcode(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_init_microcode(struct
Quoted 61 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +53
-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 ) && + (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 >=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;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -716,6 +769,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", @@ -4353,8+4407,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 4417
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
I have tested the patches on Rv/Vega10/Vega12.
Series is:
Best Regards
Rex
Quoted 136 lines
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Friday, August 17, 2018 3:23 PM
To: Deng, Emily <[email protected]>; [email protected]
Subject: Re: [PATCH v2 1/2] drm/amdgpu: Remove the sriov checking and add firmware checkingAm 17.08.2018 um 07:40 schrieb Emily Deng:
Quoted 6 lines
Refine the patch 1, and the lock about
invalidate_lock.Unify bare metal and sriov, and add firmware checking for reg write and reg wait unify command.
Signed-off-by Emily Deng <[email protected]>can't verify the firmware numbers.
I can give the two patches a testing on bare metal Vega10 and Raven later today if nobody beats me on this.
Thanks for the patience, that looks *much* better now that we have an unified code path, Christian.
Quoted 3 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h | 2 ++ drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 59++++++++++++++++++++++++++++++++-
Quoted 8 lines
2 files changed, 60 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h struct amdgpu_gfx { · line 279
Quoted 6 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];drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h struct amdgpu_gfx { · line 281
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.h +0
-0unsigned 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,59 @@ static void gfx_v9_0_init_rlc_ext_microcode(struct
amdgpu_device*adev)drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c static int gfx_v9_0_init_microcode(struct
Quoted 61 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +53
-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 ) && + (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 >=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;drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +0
-0@@ -716,6 +769,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", @@ -4353,8+4407,11 @@
Quoted 1 line
static void gfx_v9_0_ring_emit_reg_write_reg_wait(struct
amdgpu_ring*ring,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
Quoted 5 lines
uint32_t ref, uint32_t mask) { int usepfp = (ring->funcs->type == AMDGPU_RING_TYPE_GFX);drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +2
-0+struct amdgpu_device *adev = ring->adev; + bool fw_version_ok = (ring->funcs->type ==
AMDGPU_RING_TYPE_GFX) ?Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +1
-0+ adev->gfx.me_fw_write_wait : adev->gfx.mec_fw_write_wait;
Quoted 10 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 4417
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
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx