introduce the smu_v13_0_6 and gfx_v9_4_3 ip block
Subsystems (2)
v2 cover introduce the smu_v13_0_6 and gfx_v9_4_3 ip block
Besides that, this series also covers fixes for multi-xcc
Lijo Lazar (1):
drm/amdgpu: Use single copy per SDMA instance type (v2)
Shiwu Zhang (5):
drm/amdgpu: add the smu_v13_0_6 and gfx_v9_4_3 ip block drm/amdgpu: bypass bios dependent operations drm/amdgpu: skip pcie bar resizing for gfx_v9_4_3 drm/amdgpu: fix the memory override in kiq ring struct drm/amdgpu: complement the 4, 6 and 8 XCC cases
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 66 ++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 +- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 + drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 61 ++++++++++------- 7 files changed, 99 insertions(+), 54 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/6 drm/amdgpu: add the smu_v13_0_6 and gfx_v9_4_3 ip block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -0
@@ -30,6 +30,7 @@#include "soc15.h" #include "gfx_v9_0.h" +#include "gfx_v9_4_3.h" #include "gmc_v9_0.h" #include "df_v1_7.h" #include "df_v3_6.h"
@@ -1795,6 +1796,7 @@ static int amdgpu_discovery_set_smu_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (13 ,0 ,3 ):case IP_VERSION (13 ,0 ,4 ):case IP_VERSION (13 ,0 ,5 ): +case IP_VERSION (13 ,0 ,6 ):case IP_VERSION (13 ,0 ,7 ):case IP_VERSION (13 ,0 ,8 ):case IP_VERSION (13 ,0 ,10 ):
@@ -1893,6 +1895,9 @@ static int amdgpu_discovery_set_gc_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (9 ,4 ,2 ):amdgpu_device_ip_block_add (adev, &gfx_v9_0_ip_block);break ; +case IP_VERSION (9 ,4 ,3 ): +amdgpu_device_ip_block_add (adev, &gfx_v9_4_3_ip_block); +break ;case IP_VERSION (10 ,1 ,10 ):case IP_VERSION (10 ,1 ,2 ):case IP_VERSION (10 ,1 ,1 ):
Signature · 1 line
2.17.1
RE: [PATCH v2 1/6] drm/amdgpu: add the smu_v13_0_6 and gfx_v9_4_3 ip block
[AMD Official Use Only - General]
The patch is
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Shiwu Zhang
Sent: Thursday, May 18, 2023 20:21
To: [email protected]
Subject: [PATCH v2 1/6] drm/amdgpu: add the smu_v13_0_6 and gfx_v9_4_3 ip block
--- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +5 -0
@@ -30,6 +30,7 @@#include "soc15.h" #include "gfx_v9_0.h" +#include "gfx_v9_4_3.h" #include "gmc_v9_0.h" #include "df_v1_7.h" #include "df_v3_6.h"
@@ -1795,6 +1796,7 @@ static int amdgpu_discovery_set_smu_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (13 ,0 ,3 ):case IP_VERSION (13 ,0 ,4 ):case IP_VERSION (13 ,0 ,5 ): +case IP_VERSION (13 ,0 ,6 ):case IP_VERSION (13 ,0 ,7 ):case IP_VERSION (13 ,0 ,8 ):case IP_VERSION (13 ,0 ,10 ):
@@ -1893,6 +1895,9 @@ static int amdgpu_discovery_set_gc_ip_blocks(struct amdgpu_device *adev)case IP_VERSION (9 ,4 ,2 ):amdgpu_device_ip_block_add (adev, &gfx_v9_0_ip_block);break ; +case IP_VERSION (9 ,4 ,3 ): +amdgpu_device_ip_block_add (adev, &gfx_v9_4_3_ip_block); +break ;case IP_VERSION (10 ,1 ,10 ):case IP_VERSION (10 ,1 ,2 ):case IP_VERSION (10 ,1 ,1 ):
Signature · 1 line
2.17.1
PATCH v2 2/6 drm/amdgpu: bypass bios dependent operations
In reply to Shiwu ZhangSince bios reading does not work currently so just bypass all operations related to bios
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 66 ++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 58 +++++++++++-------- 3 files changed, 80 insertions(+), 51 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +41 -25
@@ -1388,6 +1388,15 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)return 0 ; } +static bool amdgpu_device_read_bios (struct amdgpu_device *adev) +{ +if (hweight32 (adev->aid_mask)) { +return false; + } + +return true; +} +/* * GPU helpers function. */
@@ -1404,6 +1413,9 @@ bool amdgpu_device_need_post(struct amdgpu_device *adev) {uint32_t reg; +if (!amdgpu_device_read_bios (adev)) +return false; +if (amdgpu_sriov_vf (adev))return false;
@@ -2317,14 +2329,16 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)return r;/* Read BIOS */ -if (!amdgpu_get_bios (adev)) -return -EINVAL ; +if (amdgpu_device_read_bios (adev)) { +if (!amdgpu_get_bios (adev)) +return -EINVAL ; - r =amdgpu_atombios_init (adev); -if (r) { -dev_err (adev->dev,"amdgpu_atombios_init failed\n" ); -amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL ,0 ,0 ); -return r; + r =amdgpu_atombios_init (adev); +if (r) { +dev_err (adev->dev,"amdgpu_atombios_init failed\n" ); +amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_INIT_FAIL ,0 ,0 ); +return r; + } }/*get pf2vf msg info at it's earliest time*/
@@ -3944,25 +3958,27 @@ int amdgpu_device_init(struct amdgpu_device *adev, } } -if (adev->is_atom_fw) { -/* Initialize clocks */ - r =amdgpu_atomfirmware_get_clock_info (adev); -if (r) { -dev_err (adev->dev,"amdgpu_atomfirmware_get_clock_info failed\n" ); -amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL ,0 ,0 ); - goto failed; - } - }else { -/* Initialize clocks */ - r =amdgpu_atombios_get_clock_info (adev); -if (r) { -dev_err (adev->dev,"amdgpu_atombios_get_clock_info failed\n" ); -amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL ,0 ,0 ); - goto failed; +if (adev->bios) { +if (adev->is_atom_fw) { +/* Initialize clocks */ + r =amdgpu_atomfirmware_get_clock_info (adev); +if (r) { +dev_err (adev->dev,"amdgpu_atomfirmware_get_clock_info failed\n" ); +amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL ,0 ,0 ); + goto failed; + } + }else { +/* Initialize clocks */ + r =amdgpu_atombios_get_clock_info (adev); +if (r) { +dev_err (adev->dev,"amdgpu_atombios_get_clock_info failed\n" ); +amdgpu_vf_error_put (adev,AMDGIM_ERROR_VF_ATOMBIOS_GET_CLOCK_FAIL ,0 ,0 ); + goto failed; + } +/* init i2c buses */ +if (!amdgpu_device_has_dc_support (adev)) +amdgpu_atombios_i2c_init (adev); } -/* init i2c buses */ -if (!amdgpu_device_has_dc_support (adev)) -amdgpu_atombios_i2c_init (adev); } fence_driver_init:
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +5 -2
@@ -1700,7 +1700,7 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev)uint32_t reserve_size =0 ;int ret; -if (!amdgpu_sriov_vf (adev)) { +if (adev->bios && !amdgpu_sriov_vf (adev)) {if (amdgpu_atomfirmware_mem_training_supported (adev)) mem_train_support = true;else
@@ -1717,7 +1717,10 @@ static int amdgpu_ttm_reserve_tmr(struct amdgpu_device *adev)if (adev->bios) reserve_size =amdgpu_atomfirmware_get_fw_reserved_fb_size (adev); -if (!reserve_size) +/* reserve 256MB protected region for aqua_vanjaram boot time TMR */ +if (!adev->bios && adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,3 )) + reserve_size =max (reserve_size, (uint32_t )280 <<20 ); +else if (!reserve_size) reserve_size =DISCOVERY_TMR_OFFSET ;if (mem_train_support) {
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +34 -24
68 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 3/6 drm/amdgpu: skip pcie bar resizing for gfx_v9_4_3
In reply to Shiwu ZhangThis feature has not been verified yet so it is better to skip it for current phase.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
@@ -1710,7 +1710,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev) adev->gmc.real_vram_size = adev->gmc.mc_vram_size;if (!(adev->flags &AMD_IS_APU ) && - !adev->gmc.xgmi.connected_to_cpu) { + !adev->gmc.xgmi.connected_to_cpu && + !(adev->ip_versions[GC_HWIP ][0 ] ==IP_VERSION (9 ,4 ,3 ))) { r =amdgpu_device_resize_fb_bar (adev);if (r)return r;
Signature · 1 line
2.17.1
PATCH v2 4/6 drm/amdgpu: Use single copy per SDMA instance type (v2)
In reply to Shiwu ZhangFrom: Lijo Lazar <[email protected]>
v1: Only single copy per instance type is required for PSP. All instance types use the same firmware copy. (Lijo)
v2: Apply the change into amdgpu_sdma_init_microcode() due to rebase. (Morris)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +7 -0
@@ -252,6 +252,13 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,if (!duplicate && (instance != i))continue ;else { +/* Use a single copy per SDMA firmware type. PSP uses the same instance for all +* groups of SDMAs */ +if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 ) && + adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP && + adev->sdma.num_inst_per_aid == i) { +break ; + } info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; info->ucode_id =AMDGPU_UCODE_ID_SDMA0 + i; info->fw = adev->sdma.instance[i].fw;
Signature · 1 line
2.17.1
RE: [PATCH v2 4/6] drm/amdgpu: Use single copy per SDMA instance type (v2)
[AMD Official Use Only - General]
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Shiwu Zhang
Sent: Thursday, May 18, 2023 20:21
To: [email protected]
Subject: [PATCH v2 4/6] drm/amdgpu: Use single copy per SDMA instance type (v2)
From: Lijo Lazar <[email protected]>
v1: Only single copy per instance type is required for PSP. All instance types use the same firmware copy. (Lijo)
v2: Apply the change into amdgpu_sdma_init_microcode() due to rebase. (Morris)
--- drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c +7 -0
@@ -252,6 +252,13 @@ int amdgpu_sdma_init_microcode(struct amdgpu_device *adev,if (!duplicate && (instance != i))continue ;else { +/* Use a single copy per SDMA firmware type. PSP uses the same instance for all +* groups of SDMAs */ +if (adev->ip_versions[SDMA0_HWIP ][0 ] ==IP_VERSION (4 ,4 ,2 ) && + adev->firmware.load_type ==AMDGPU_FW_LOAD_PSP && + adev->sdma.num_inst_per_aid == i) { +break ; + } info = &adev->firmware.ucode[AMDGPU_UCODE_ID_SDMA0 + i]; info->ucode_id =AMDGPU_UCODE_ID_SDMA0 + i; info->fw = adev->sdma.instance[i].fw;
--
2.17.1
PATCH v2 5/6 drm/amdgpu: fix the memory override in kiq ring struct
In reply to Shiwu ZhangThis is introduced by the code merge and will let the adev->gfx.kiq[0].ring struct being overrided
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -2
@@ -448,8 +448,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring->mqd_size = mqd_size;/* prepare MQD backup */ - adev->gfx.mec.mqd_backup[j + xcc_id * adev->gfx.num_compute_rings] =kmalloc (mqd_size,GFP_KERNEL ); -if (!adev->gfx.mec.mqd_backup[j + xcc_id * adev->gfx.num_compute_rings]) + adev->gfx.mec.mqd_backup[j] =kmalloc (mqd_size,GFP_KERNEL ); +if (!adev->gfx.mec.mqd_backup[j])dev_warn (adev->dev,"no memory to create MQD backup for ring %s\n" , ring->name); } }
Signature · 1 line
2.17.1
RE: [PATCH v2 5/6] drm/amdgpu: fix the memory override in kiq ring struct
[AMD Official Use Only - General]
The patch is
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Shiwu Zhang
Sent: Thursday, May 18, 2023 20:21
To: [email protected]
Subject: [PATCH v2 5/6] drm/amdgpu: fix the memory override in kiq ring struct
This is introduced by the code merge and will let the adev->gfx.kiq[0].ring struct being overrided
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +2 -2
@@ -448,8 +448,8 @@ int amdgpu_gfx_mqd_sw_init(struct amdgpu_device *adev, ring->mqd_size = mqd_size;/* prepare MQD backup */ - adev->gfx.mec.mqd_backup[j + xcc_id * adev->gfx.num_compute_rings] =kmalloc (mqd_size,GFP_KERNEL ); -if (!adev->gfx.mec.mqd_backup[j + xcc_id * adev->gfx.num_compute_rings]) + adev->gfx.mec.mqd_backup[j] =kmalloc (mqd_size,GFP_KERNEL ); +if (!adev->gfx.mec.mqd_backup[j])dev_warn (adev->dev,"no memory to create MQD backup for ring %s\n" , ring->name); } }
Signature · 1 line
2.17.1
PATCH v2 6/6 drm/amdgpu: complement the 4, 6 and 8 XCC cases
In reply to Shiwu Zhang--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -0
@@ -1031,6 +1031,9 @@ static void gfx_v9_4_3_xcc_program_xcc_id(struct amdgpu_device *adev,WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL,0x8 );break ;case 2 : +case 4 : +case 6 : +case 8 : tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID ); tmp = tmp | (adev->gfx.num_xcc_per_xcp <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP ));WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL, tmp);
Signature · 1 line
2.17.1
RE: [PATCH v2 6/6] drm/amdgpu: complement the 4, 6 and 8 XCC cases
[AMD Official Use Only - General]
Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Shiwu Zhang
Sent: Thursday, May 18, 2023 20:21
To: [email protected]
Subject: [PATCH v2 6/6] drm/amdgpu: complement the 4, 6 and 8 XCC cases
--- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +3 -0
@@ -1031,6 +1031,9 @@ static void gfx_v9_4_3_xcc_program_xcc_id(struct amdgpu_device *adev,WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL,0x8 );break ;case 2 : +case 4 : +case 6 : +case 8 : tmp = (xcc_id % adev->gfx.num_xcc_per_xcp) <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID ); tmp = tmp | (adev->gfx.num_xcc_per_xcp <<REG_FIELD_SHIFT (CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP ));WREG32_SOC15 (GC ,GET_INST (GC , xcc_id), regCP_HYP_XCP_CTL, tmp);
Signature · 1 line
2.17.1