KGD bringup for aqua_vanjaram on drm-next branch
Subsystems (2)
cover KGD bringup for aqua_vanjaram on drm-next branch
This series aims to enable the basic KGD functions during modprobe
Le Ma (1):
drm/amdgpu: add asic type for aqua_vanjaram
Lijo Lazar (1):
drm/amdgpu: Use single copy per SDMA instance type (v2)
Shiwu Zhang (6):
drm/amdgpu: add the pciid for aqua_vanjaram drm/amdgpu: add the smu and gfx ip block for aqua_vanjaram drm/amdgpu: bypass bios dependent operations for aqua_vanjaram drm/amdgpu: skip bar resizing for aqua_vanjaram drm/amdgpu: fix the memory override in kiq ring struct drm/amdgpu: complement the 4, 6 and 8 XCD cases
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 68 ++++++++++++------- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 5 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++ 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 ++++++++++------- include/drm/amd_asic_type.h | 23 ++++--- 9 files changed, 117 insertions(+), 65 deletions(-)
Signature · 1 line
2.17.1
PATCH 1/8 drm/amdgpu: add the pciid for aqua_vanjaram
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +4 -0
@@ -2032,6 +2032,10 @@ static const struct pci_device_id pciidlist[] = { {0x1002, 0x7424, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY}, {0x1002, 0x743F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_BEIGE_GOBY}, +/* Aqua_Vanjaram */ + {0x1002, 0x74a0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_AQUA_VANJARAM | AMD_IS_APU}, + {0x1002, 0x74a1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_AQUA_VANJARAM}, + { PCI_DEVICE(0x1002, PCI_ANY_ID), .class = PCI_CLASS_DISPLAY_VGA << 8, .class_mask = 0xffffff,
Signature · 1 line
2.17.1
PATCH 2/8 drm/amdgpu: add asic type for aqua_vanjaram
In reply to Shiwu ZhangFrom: Le Ma <[email protected]>
Add aqua_vanjaram in amdgpu_asic_name array and amdgpu_asic_type enum
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 1 + include/drm/amd_asic_type.h | 23 +++++++++++----------- 2 files changed, 13 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -125,6 +125,7 @@ const char *amdgpu_asic_name[] = {"ARCTURUS" ,"RENOIR" ,"ALDEBARAN" , +"AQUA_VANJARAM" ,"NAVI10" ,"CYAN_SKILLFISH" , "NAVI14",
include/drm/amd_asic_type.h +12 -11
@@ -52,17 +52,18 @@ enum amd_asic_type {CHIP_ARCTURUS ,/* 23 */ CHIP_RENOIR ,/* 24 */ CHIP_ALDEBARAN ,/* 25 */ -CHIP_NAVI10 ,/* 26 */ -CHIP_CYAN_SKILLFISH ,/* 27 */ -CHIP_NAVI14 ,/* 28 */ -CHIP_NAVI12 ,/* 29 */ -CHIP_SIENNA_CICHLID ,/* 30 */ -CHIP_NAVY_FLOUNDER ,/* 31 */ -CHIP_VANGOGH ,/* 32 */ -CHIP_DIMGREY_CAVEFISH ,/* 33 */ -CHIP_BEIGE_GOBY ,/* 34 */ -CHIP_YELLOW_CARP ,/* 35 */ -CHIP_IP_DISCOVERY ,/* 36 */ +CHIP_AQUA_VANJARAM ,/* 26 */ +CHIP_NAVI10 ,/* 27 */ +CHIP_CYAN_SKILLFISH ,/* 28 */ +CHIP_NAVI14 ,/* 29 */ +CHIP_NAVI12 ,/* 30 */ +CHIP_SIENNA_CICHLID ,/* 31 */ +CHIP_NAVY_FLOUNDER ,/* 32 */ +CHIP_VANGOGH ,/* 33 */ +CHIP_DIMGREY_CAVEFISH ,/* 34 */ +CHIP_BEIGE_GOBY ,/* 35 */ +CHIP_YELLOW_CARP ,/* 36 */ +CHIP_IP_DISCOVERY ,/* 37 */ CHIP_LAST, };
Signature · 1 line
2.17.1
PATCH 3/8 drm/amdgpu: add the smu and gfx ip block for aqua_vanjaram
In reply to Shiwu Zhang--- 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 4/8 drm/amdgpu: bypass bios dependent operations for aqua_vanjaram
In reply to Shiwu ZhangDO NOT UPSTREAM. need to revert it when bios reading is ready
Since bios reading does not work currently so just bypass all operations related to bios
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 67 ++++++++++++++-------- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 ++- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 58 +++++++++++-------- 3 files changed, 81 insertions(+), 51 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +42 -25
@@ -1389,6 +1389,16 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)return 0 ; } +static bool amdgpu_device_read_bios (struct amdgpu_device *adev) +{ +/* only AQUA_VANJARAM has the aid_mask initialized */ +if (hweight32 (adev->aid_mask)) { +return false; + } + +return true; +} +/* * GPU helpers function. */
@@ -1405,6 +1415,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;
@@ -2318,14 +2331,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*/
@@ -3945,25 +3960,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 5/8 drm/amdgpu: skip bar resizing for aqua_vanjaram
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 6/8 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
PATCH 7/8 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
PATCH 8/8 drm/amdgpu: complement the 4, 6 and 8 XCD 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