enable xgmi node migration support for hibernate on SRIOV
Subsystems (3)
v8 cover enable xgmi node migration support for hibernate on SRIOV
On SRIOV and VM environment, customer may need to switch to new vGPU indexes after hibernate and then resume the VM. For GPUs with XGMI, vram_start will change in this case, the FB aperture gpu address of VRAM BOs will also change. These gpu addresses need to be updated when resume. But these addresses are all over the KMD codebase, updating each of them is error-prone and not acceptable.
The solution is to use pdb0 page table to cover both vram and gart memory and use pdb0 virtual gpu address instead. When gpu indexes change, the virtual gpu address won't change.
For psp and smu, pdb0's gpu address does not work, so the original FB aperture gpu address is used instead. They need to be updated when resume with changed vGPUs.
v2:
- remove physical_node_id_changed
- set vram_start to 0 to switch cached gpu addr to gart aperture
- cleanup pdb0 patch
v3:
- remove gmc_v9_0_init_sw_mem_ranges() call
- remove vram_offset memeber
- add 4 refactoring patch to remove cached gpu addr
- cleanup pdb0 patch
v4:
- remove gmc_v9_0_mc_init() call and refresh update.
- do not set fb_start in mmhub_v1_8_get_fb_location() when pdb0 enabled. v5:
- add amdgpu_virt_xgmi_migrate_enabled() check
- move vram_base_offset update to pdb0 patch
- remove 4 refactoring patches to remove cached gpu addr
- add patch to fix IH not working issue when resume with new VF
v6: per Lijo feedback
- rename amdgpu_device_update_xgmi_info() to amdgpu_virt_resume()
- merge xgmi node and vram_base_offset update, IH fix into amdgpu_virt_resume()
- remove 2 unnecessary gpu addr update changes
v7: per Christian feedback
- remove pdb0_enabled and add gmc_v9_0_is_pdb0_enabled()
- remove amdgpu_gmc_vram_location() call in amdgpu_gmc_sysvm_location()
- remove check in mmhub_v1_8_get_fb_location() and update fb_start/fb_end on resume v8:
- use cached fb_start in amdgpu_bo_fb_aper_addr()
- remove fb_start/fb_end update in amdgpu_virt_resume() and amdgpu_gmc_sysvm_location()
- use vram_start to set regVM_CONTEXT0_PAGE_TABLE_START_ADDR_*
- move check to the callsite of amdgpu_virt_resume()
- add gmc.xgmi.node_segment_size check in amdgpu_virt_xgmi_migrate_enabled()
- rename gmc_v9_0_is_pdb0_enabled() to amdgpu_gmc_is_pdb0_enabled()
Samuel Zhang (4):
drm/amdgpu: update xgmi info and vram_base_offset on resume drm/amdgpu: update GPU addresses for SMU and PSP drm/amdgpu: enable pdb0 for hibernation on SRIOV drm/amdgpu: fix fence fallback timer expired error
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 38 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 28 ++++++++++++---- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 ++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 23 +++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 ++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 7 ++++ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 8 +++-- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 +++++--- drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 6 ++-- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 ++++++++++ 13 files changed, 151 insertions(+), 17 deletions(-)
Signature · 1 line
2.43.5
PATCH v8 1/4 drm/amdgpu: update xgmi info and vram_base_offset on resume
For SRIOV VM env with XGMI enabled systems, XGMI physical node id may change when hibernate and resume with different VF.
Update XGMI info and vram_base_offset on resume for gfx444 SRIOV env. Add amdgpu_virt_xgmi_migrate_enabled() as the feature flag.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 7 +++++ 2 files changed, 38 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +31 -0
@@ -2732,6 +2732,12 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (!amdgpu_device_pcie_dynamic_switching_supported (adev)) adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK ; + adev->virt.is_xgmi_node_migrate_enabled = false; +if (amdgpu_sriov_vf (adev)) { + adev->virt.is_xgmi_node_migrate_enabled = +amdgpu_ip_version ((adev),GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,4 ); + } + total = true;for (i =0 ; i < adev->num_ip_blocks; i++) { ip_block = &adev->ip_blocks[i];
@@ -5040,6 +5046,25 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)return 0 ; } +static inline int amdgpu_virt_resume (struct amdgpu_device *adev) +{ +int r; +unsigned int prev_physical_node_id = adev->gmc.xgmi.physical_node_id; + + r = adev->gfxhub.funcs->get_xgmi_info (adev); +if (r) +return r; + +dev_info (adev->dev,"xgmi node, old id %d, new id %d\n" , + prev_physical_node_id, adev->gmc.xgmi.physical_node_id); + + adev->vm_manager.vram_base_offset = adev->gfxhub.funcs->get_mc_fb_offset (adev); + adev->vm_manager.vram_base_offset += + adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + +return 0 ; +} +/** * amdgpu_device_resume - initiate device resume *
@@ -5061,6 +5086,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)return r; } +if (amdgpu_virt_xgmi_migrate_enabled (adev)) { + r =amdgpu_virt_resume (adev); +if (r) + goto exit; + } +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +7 -0
@@ -295,6 +295,9 @@ struct amdgpu_virt {union amd_sriov_ras_caps ras_telemetry_en_caps;struct amdgpu_virt_ras ras;struct amd_sriov_ras_telemetry_error_count count_cache; + +/* hibernate and resume with different VF feature for xgmi enabled system */ +bool is_xgmi_node_migrate_enabled; };struct amdgpu_video_codec_info ;
@@ -376,6 +379,10 @@ static inline bool is_virtual_machine(void) ((adev)->virt.gim_feature & AMDGIM_FEATURE_VCN_RB_DECOUPLE)#define amdgpu_sriov_is_mes_info_enable (adev) \ ((adev)->virt.gim_feature & AMDGIM_FEATURE_MES_INFO_ENABLE) + +#define amdgpu_virt_xgmi_migrate_enabled (adev) \ + ((adev)->virt.is_xgmi_node_migrate_enabled && adev->gmc.xgmi.node_segment_size != 0) +bool amdgpu_virt_mmio_blocked (struct amdgpu_device *adev);void amdgpu_virt_init_setting (struct amdgpu_device *adev);int amdgpu_virt_request_full_gpu (struct amdgpu_device *adev,bool init);
Signature · 1 line
2.43.5
Re: [PATCH v8 1/4] drm/amdgpu: update xgmi info and vram_base_offset on resume
Quoted 9 lines · Samuel Zhang
For SRIOV VM env with XGMI enabled systems, XGMI physical node id may change when hibernate and resume with different VF.
Update XGMI info and
vram_base_offseton resume for gfx444 SRIOV env. Addamdgpu_virt_xgmi_migrate_enabled()as the feature flag.Signed-off-by Jiang Liu <[email protected]>Signed-off-by Samuel Zhang <[email protected]>Reviewed-by Christian König <[email protected]>
Thanks,
Lijo
Quoted 86 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 31 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h | 7 +++++ 2 files changed, 38 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +31
-0@@ -2732,6 +2732,12 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)if (!amdgpu_device_pcie_dynamic_switching_supported (adev)) adev->pm.pp_feature &= ~PP_PCIE_DPM_MASK ; + adev->virt.is_xgmi_node_migrate_enabled = false; +if (amdgpu_sriov_vf (adev)) { + adev->virt.is_xgmi_node_migrate_enabled = +amdgpu_ip_version ((adev),GC_HWIP ,0 ) ==IP_VERSION (9 ,4 ,4 ); + } + total = true;for (i =0 ; i < adev->num_ip_blocks; i++) { ip_block = &adev->ip_blocks[i];@@ -5040,6 +5046,25 @@ int amdgpu_device_suspend(struct drm_device *dev, bool notify_clients)return 0 ; } +static inline int amdgpu_virt_resume (struct amdgpu_device *adev) +{ +int r; +unsigned int prev_physical_node_id = adev->gmc.xgmi.physical_node_id; + + r = adev->gfxhub.funcs->get_xgmi_info (adev); +if (r) +return r; + +dev_info (adev->dev,"xgmi node, old id %d, new id %d\n" , + prev_physical_node_id, adev->gmc.xgmi.physical_node_id); + + adev->vm_manager.vram_base_offset = adev->gfxhub.funcs->get_mc_fb_offset (adev); + adev->vm_manager.vram_base_offset += + adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + +return 0 ; +} +/** * amdgpu_device_resume - initiate device resume * @@ -5061,6 +5086,12 @@ int amdgpu_device_resume(struct drm_device *dev, bool notify_clients)return r; } +if (amdgpu_virt_xgmi_migrate_enabled (adev)) { + r =amdgpu_virt_resume (adev); +if (r) + goto exit; + } +if (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ;drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h +7
-0@@ -295,6 +295,9 @@ struct amdgpu_virt {union amd_sriov_ras_caps ras_telemetry_en_caps;struct amdgpu_virt_ras ras;struct amd_sriov_ras_telemetry_error_count count_cache; + +/* hibernate and resume with different VF feature for xgmi enabled system */ +bool is_xgmi_node_migrate_enabled; };struct amdgpu_video_codec_info ;@@ -376,6 +379,10 @@ static inline bool is_virtual_machine(void) ((adev)->virt.gim_feature & AMDGIM_FEATURE_VCN_RB_DECOUPLE)#define amdgpu_sriov_is_mes_info_enable (adev) \ ((adev)->virt.gim_feature & AMDGIM_FEATURE_MES_INFO_ENABLE) + +#define amdgpu_virt_xgmi_migrate_enabled (adev) \ + ((adev)->virt.is_xgmi_node_migrate_enabled && adev->gmc.xgmi.node_segment_size != 0) +bool amdgpu_virt_mmio_blocked (struct amdgpu_device *adev);void amdgpu_virt_init_setting (struct amdgpu_device *adev);int amdgpu_virt_request_full_gpu (struct amdgpu_device *adev,bool init);
PATCH v8 2/4 drm/amdgpu: update GPU addresses for SMU and PSP
In reply to Samuel Zhangadd amdgpu_bo_fb_aper_addr() and update the cached GPU addresses to use the FB aperture address for SMU and PSP.
2 reasons for this change:
1. when pdb0 is enabled, gpu addr from amdgpu_bo_create_kernel() is GART aperture address, it is not compatible with SMU and PSP, it need to be updated to use FB aperture address.
2. Since FB aperture address will change after switching to new GPU index after hibernation, it need to be updated on resume.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 23 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 +++++++++++++++++ 5 files changed, 65 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +20 -0
@@ -1513,6 +1513,26 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)return amdgpu_bo_gpu_offset_no_check (bo); } +/** +* amdgpu_bo_fb_aper_addr - return FB aperture GPU offset of the VRAM bo +* @bo: amdgpu VRAM buffer object for which we query the offset +* +* Returns: +* current FB aperture GPU offset of the object. +*/ +u64 amdgpu_bo_fb_aper_addr (struct amdgpu_bo *bo) +{ +struct amdgpu_device *adev =amdgpu_ttm_adev (bo->tbo.bdev); +uint64_t offset, fb_base; + +WARN_ON_ONCE (bo->tbo.resource->mem_type !=TTM_PL_VRAM ); + + fb_base = adev->gmc.fb_start; + fb_base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + offset = (bo->tbo.resource->start <<PAGE_SHIFT ) + fb_base; +return amdgpu_gmc_sign_extend (offset); +} +/** * amdgpu_bo_gpu_offset_no_check - return GPU offset of bo * @bo: amdgpu object for which we query the offset
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1 -0
@@ -320,6 +320,7 @@ int amdgpu_bo_sync_wait_resv(struct amdgpu_device *adev, struct dma_resv *resv, bool intr);int amdgpu_bo_sync_wait (struct amdgpu_bo *bo,void *owner,bool intr);u64 amdgpu_bo_gpu_offset (struct amdgpu_bo *bo); +u64 amdgpu_bo_fb_aper_addr (struct amdgpu_bo *bo);u64 amdgpu_bo_gpu_offset_no_check (struct amdgpu_bo *bo);uint32_t amdgpu_bo_mem_stats_placement (struct amdgpu_bo *bo); uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +23 -0
@@ -871,6 +871,8 @@ static int psp_tmr_init(struct psp_context *psp) &psp->tmr_bo, &psp->tmr_mc_addr, pptr); } +if (amdgpu_virt_xgmi_migrate_enabled (psp->adev) && psp->tmr_bo) + psp->tmr_mc_addr =amdgpu_bo_fb_aper_addr (psp->tmr_bo);return ret; }
@@ -1270,6 +1272,11 @@ int psp_ta_load(struct psp_context *psp, struct ta_context *context)psp_copy_fw (psp, context->bin_desc.start_addr, context->bin_desc.size_bytes); +if (amdgpu_virt_xgmi_migrate_enabled (psp->adev) && + context->mem_context.shared_bo) + context->mem_context.shared_mc_addr = +amdgpu_bo_fb_aper_addr (context->mem_context.shared_bo); +psp_prep_ta_load_cmd_buf (cmd, psp->fw_pri_mc_addr, context); ret = psp_cmd_submit_buf(psp, NULL, cmd,
@@ -2336,11 +2343,27 @@ bool amdgpu_psp_tos_reload_needed(struct amdgpu_device *adev)return false; } +static void psp_update_gpu_addresses (struct amdgpu_device *adev) +{ +struct psp_context *psp = &adev->psp; + +if (psp->cmd_buf_bo && psp->cmd_buf_mem) { + psp->fw_pri_mc_addr =amdgpu_bo_fb_aper_addr (psp->fw_pri_bo); + psp->fence_buf_mc_addr =amdgpu_bo_fb_aper_addr (psp->fence_buf_bo); + psp->cmd_buf_mc_addr =amdgpu_bo_fb_aper_addr (psp->cmd_buf_bo); + } +if (adev->firmware.rbuf && psp->km_ring.ring_mem) + psp->km_ring.ring_mem_mc_addr =amdgpu_bo_fb_aper_addr (adev->firmware.rbuf); +} +static int psp_hw_start (struct psp_context *psp) {struct amdgpu_device *adev = psp->adev;int ret; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) +psp_update_gpu_addresses (adev); +if (!amdgpu_sriov_vf (adev)) {if ((is_psp_fw_valid (psp->kdb)) && (psp->funcs->bootloader_load_kdb !=NULL )) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +3 -0
@@ -1152,6 +1152,9 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev) adev->firmware.max_ucodes =AMDGPU_UCODE_ID_MAXIMUM ; } +if (amdgpu_virt_xgmi_migrate_enabled (adev) && adev->firmware.fw_buf) + adev->firmware.fw_buf_mc =amdgpu_bo_fb_aper_addr (adev->firmware.fw_buf); +for (i =0 ; i < adev->firmware.max_ucodes; i++) { ucode = &adev->firmware.ucode[i];if (ucode->fw) {
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +18 -0
@@ -1000,6 +1000,21 @@ static int smu_fini_fb_allocations(struct smu_context *smu)return 0 ; } +static void smu_update_gpu_addresses (struct smu_context *smu) +{ +struct smu_table_context *smu_table = &smu->smu_table; +struct smu_table *pm_status_table = smu_table->tables +SMU_TABLE_PMSTATUSLOG ; +struct smu_table *driver_table = &(smu_table->driver_table); +struct smu_table *dummy_read_1_table = &smu_table->dummy_read_1_table; + +if (pm_status_table->bo) + pm_status_table->mc_address =amdgpu_bo_fb_aper_addr (pm_status_table->bo); +if (driver_table->bo) + driver_table->mc_address =amdgpu_bo_fb_aper_addr (driver_table->bo); +if (dummy_read_1_table->bo) + dummy_read_1_table->mc_address =amdgpu_bo_fb_aper_addr (dummy_read_1_table->bo); +} +/** * smu_alloc_memory_pool - allocate memory pool in the system memory *
@@ -1789,6 +1804,9 @@ static int smu_start_smc_engine(struct smu_context *smu)struct amdgpu_device *adev = smu->adev;int ret =0 ; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) +smu_update_gpu_addresses (smu); + smu->smc_fw_state =SMU_FW_INIT ;if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) {
Signature · 1 line
2.43.5
Re: [PATCH v8 2/4] drm/amdgpu: update GPU addresses for SMU and PSP
Quoted 10 lines · Samuel Zhang
add
amdgpu_bo_fb_aper_addr()and update the cached GPU addresses to use the FB aperture address for SMU and PSP.2 reasons for this change:
1. when pdb0 is enabled, gpu addr fromamdgpu_bo_create_kernel()is GART aperture address, it is not compatible with SMU and PSP, it need to be updated to use FB aperture address.
2. Since FB aperture address will change after switching to new GPU index after hibernation, it need to be updated on resume.
Quoted 3 lines
Signed-off-by Jiang Liu <[email protected]>Signed-off-by Samuel Zhang <[email protected]>Acked-by Christian König <[email protected]>
Thanks,
Lijo
Quoted 154 lines
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 20 +++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_object.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 23 ++++++++++++++++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 18 +++++++++++++++++ 5 files changed, 65 insertions(+)drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +20
-0@@ -1513,6 +1513,26 @@ u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo)return amdgpu_bo_gpu_offset_no_check (bo); } +/** +* amdgpu_bo_fb_aper_addr - return FB aperture GPU offset of the VRAM bo +* @bo: amdgpu VRAM buffer object for which we query the offset +* +* Returns: +* current FB aperture GPU offset of the object. +*/ +u64 amdgpu_bo_fb_aper_addr (struct amdgpu_bo *bo) +{ +struct amdgpu_device *adev =amdgpu_ttm_adev (bo->tbo.bdev); +uint64_t offset, fb_base; + +WARN_ON_ONCE (bo->tbo.resource->mem_type !=TTM_PL_VRAM ); + + fb_base = adev->gmc.fb_start; + fb_base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + offset = (bo->tbo.resource->start <<PAGE_SHIFT ) + fb_base; +return amdgpu_gmc_sign_extend (offset); +} +/** * amdgpu_bo_gpu_offset_no_check - return GPU offset of bo * @bo: amdgpu object for which we query the offset drivers/gpu/drm/amd/amdgpu/amdgpu_object.h +1
-0@@ -320,6 +320,7 @@ int amdgpu_bo_sync_wait_resv(struct amdgpu_device *adev, struct dma_resv *resv, bool intr);int amdgpu_bo_sync_wait (struct amdgpu_bo *bo,void *owner,bool intr);u64 amdgpu_bo_gpu_offset (struct amdgpu_bo *bo); +u64 amdgpu_bo_fb_aper_addr (struct amdgpu_bo *bo);u64 amdgpu_bo_gpu_offset_no_check (struct amdgpu_bo *bo);uint32_t amdgpu_bo_mem_stats_placement (struct amdgpu_bo *bo); uint32_t amdgpu_bo_get_preferred_domain(struct amdgpu_device *adev,drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +23
-0@@ -871,6 +871,8 @@ static int psp_tmr_init(struct psp_context *psp) &psp->tmr_bo, &psp->tmr_mc_addr, pptr); } +if (amdgpu_virt_xgmi_migrate_enabled (psp->adev) && psp->tmr_bo) + psp->tmr_mc_addr =amdgpu_bo_fb_aper_addr (psp->tmr_bo);return ret; }@@ -1270,6 +1272,11 @@ int psp_ta_load(struct psp_context *psp, struct ta_context *context)psp_copy_fw (psp, context->bin_desc.start_addr, context->bin_desc.size_bytes); +if (amdgpu_virt_xgmi_migrate_enabled (psp->adev) && + context->mem_context.shared_bo) + context->mem_context.shared_mc_addr = +amdgpu_bo_fb_aper_addr (context->mem_context.shared_bo); +psp_prep_ta_load_cmd_buf (cmd, psp->fw_pri_mc_addr, context); ret = psp_cmd_submit_buf(psp, NULL, cmd,@@ -2336,11 +2343,27 @@ bool amdgpu_psp_tos_reload_needed(struct amdgpu_device *adev)return false; } +static void psp_update_gpu_addresses (struct amdgpu_device *adev) +{ +struct psp_context *psp = &adev->psp; + +if (psp->cmd_buf_bo && psp->cmd_buf_mem) { + psp->fw_pri_mc_addr =amdgpu_bo_fb_aper_addr (psp->fw_pri_bo); + psp->fence_buf_mc_addr =amdgpu_bo_fb_aper_addr (psp->fence_buf_bo); + psp->cmd_buf_mc_addr =amdgpu_bo_fb_aper_addr (psp->cmd_buf_bo); + } +if (adev->firmware.rbuf && psp->km_ring.ring_mem) + psp->km_ring.ring_mem_mc_addr =amdgpu_bo_fb_aper_addr (adev->firmware.rbuf); +} +static int psp_hw_start (struct psp_context *psp) {struct amdgpu_device *adev = psp->adev;int ret; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) +psp_update_gpu_addresses (adev); +if (!amdgpu_sriov_vf (adev)) {if ((is_psp_fw_valid (psp->kdb)) && (psp->funcs->bootloader_load_kdb !=NULL )) {drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +3
-0@@ -1152,6 +1152,9 @@ int amdgpu_ucode_init_bo(struct amdgpu_device *adev) adev->firmware.max_ucodes =AMDGPU_UCODE_ID_MAXIMUM ; } +if (amdgpu_virt_xgmi_migrate_enabled (adev) && adev->firmware.fw_buf) + adev->firmware.fw_buf_mc =amdgpu_bo_fb_aper_addr (adev->firmware.fw_buf); +for (i =0 ; i < adev->firmware.max_ucodes; i++) { ucode = &adev->firmware.ucode[i];if (ucode->fw) {drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +18
-0@@ -1000,6 +1000,21 @@ static int smu_fini_fb_allocations(struct smu_context *smu)return 0 ; } +static void smu_update_gpu_addresses (struct smu_context *smu) +{ +struct smu_table_context *smu_table = &smu->smu_table; +struct smu_table *pm_status_table = smu_table->tables +SMU_TABLE_PMSTATUSLOG ; +struct smu_table *driver_table = &(smu_table->driver_table); +struct smu_table *dummy_read_1_table = &smu_table->dummy_read_1_table; + +if (pm_status_table->bo) + pm_status_table->mc_address =amdgpu_bo_fb_aper_addr (pm_status_table->bo); +if (driver_table->bo) + driver_table->mc_address =amdgpu_bo_fb_aper_addr (driver_table->bo); +if (dummy_read_1_table->bo) + dummy_read_1_table->mc_address =amdgpu_bo_fb_aper_addr (dummy_read_1_table->bo); +} +/** * smu_alloc_memory_pool - allocate memory pool in the system memory * @@ -1789,6 +1804,9 @@ static int smu_start_smc_engine(struct smu_context *smu)struct amdgpu_device *adev = smu->adev;int ret =0 ; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) +smu_update_gpu_addresses (smu); + smu->smc_fw_state =SMU_FW_INIT ;if (adev->firmware.load_type !=AMDGPU_FW_LOAD_PSP ) {
PATCH v8 3/4 drm/amdgpu: enable pdb0 for hibernation on SRIOV
In reply to Samuel ZhangWhen switching to new GPU index after hibernation and then resume, VRAM offset of each VRAM BO will be changed, and the cached gpu addresses needed to updated.
This is to enable pdb0 and switch to use pdb0-based virtual gpu address by default in amdgpu_bo_create_reserved(). since the virtual addresses do not change, this can avoid the need to update all cached gpu addresses all over the codebase.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 28 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 8 ++++--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 +++++++---- drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 6 +++-- 4 files changed, 39 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +21 -7
@@ -38,6 +38,8 @@#include <drm/drm_drv.h> #include <drm/ttm/ttm_tt.h> +static const u64 four_gb =0x100000000ULL ; +/** * amdgpu_gmc_pdb0_alloc - allocate vram for pdb0 *
@@ -251,10 +253,20 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcu64 hive_vram_end = mc->xgmi.node_segment_size * mc->xgmi.num_physical_nodes -1 ; mc->vram_start = mc->xgmi.node_segment_size * mc->xgmi.physical_node_id; mc->vram_end = mc->vram_start + mc->xgmi.node_segment_size -1 ; - mc->gart_start = hive_vram_end +1 ; +/* node_segment_size may not 4GB aligned on SRIOV, align up is needed. */ + mc->gart_start =ALIGN (hive_vram_end +1 , four_gb); mc->gart_end = mc->gart_start + mc->gart_size -1 ; - mc->fb_start = hive_vram_start; - mc->fb_end = hive_vram_end; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) { +/* set mc->vram_start to 0 to switch the returned GPU address of +* amdgpu_bo_create_reserved() from FB aperture to GART aperture. +*/ + mc->vram_start =0 ; + mc->vram_end = mc->vram_start + mc->mc_vram_size -1 ; + mc->visible_vram_size =min (mc->visible_vram_size, mc->real_vram_size); + }else { + mc->fb_start = hive_vram_start; + mc->fb_end = hive_vram_end; + }dev_info (adev->dev,"VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n" , mc->mc_vram_size >>20 , mc->vram_start, mc->vram_end, mc->real_vram_size >>20 );
@@ -276,7 +288,6 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcvoid amdgpu_gmc_gart_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc,enum amdgpu_gart_placement gart_placement) { -const uint64_t four_gb =0x100000000ULL ;u64 size_af, size_bf;/*To avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START*/ u64 max_mc_address =min (adev->gmc.mc_mask,AMDGPU_GMC_HOLE_START -1 );
@@ -1053,9 +1064,7 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev)*/ u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes;u64 pde0_page_size = (1ULL <<adev->gmc.vmid0_page_table_block_size)<<21 ; -u64 vram_addr = adev->vm_manager.vram_base_offset - - adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -u64 vram_end = vram_addr + vram_size; +u64 vram_addr, vram_end;u64 gart_ptb_gpu_pa =amdgpu_gmc_vram_pa (adev, adev->gart.bo);int idx;
@@ -1068,6 +1077,11 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev) flags |=AMDGPU_PTE_FRAG ((adev->gmc.vmid0_page_table_block_size +9 *1 )); flags |=AMDGPU_PDE_PTE_FLAG (adev); + vram_addr = adev->vm_manager.vram_base_offset; +if (!amdgpu_virt_xgmi_migrate_enabled (adev)) + vram_addr -= adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + vram_end = vram_addr + vram_size; +/* The first n PDE0 entries are used as PTE, * pointing to vram */
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +5 -3
@@ -76,6 +76,8 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev, {uint64_t pt_base;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);
@@ -91,10 +93,10 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev,if (adev->gmc.pdb0_bo) {WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(GC, GET_INST(GC, i), regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
@@ -180,7 +182,7 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,/* In the case squeezing vram into GART aperture, we don't use * FB aperture and AGP aperture. Disable them. */ -if (adev->gmc.pdb0_bo) { +if (adev->gmc.pdb0_bo && adev->gmc.xgmi.connected_to_cpu) {WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_TOP,0 );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_BASE,0x00FFFFFF );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_AGP_TOP,0 );
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +9 -4
@@ -413,6 +413,11 @@ static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = { (0x001d43e0 + 0x00001800), }; +static inline bool amdgpu_gmc_is_pdb0_enabled (struct amdgpu_device *adev) +{ +return adev->gmc.xgmi.connected_to_cpu ||amdgpu_virt_xgmi_migrate_enabled (adev); +} +static inline bool gmc_v9_0_is_multi_chiplet (struct amdgpu_device *adev) {return !!adev->aid_mask;
@@ -1726,7 +1731,7 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,/* add the xgmi offset of the physical node */ base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) {amdgpu_gmc_sysvm_location (adev, mc); }else {amdgpu_gmc_vram_location (adev, mc, base);
@@ -1841,7 +1846,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)return 0 ; } -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) { adev->gmc.vmid0_page_table_depth =1 ; adev->gmc.vmid0_page_table_block_size =12 ; }else {
@@ -1867,7 +1872,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)if (r)return r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev)) r =amdgpu_gmc_pdb0_alloc (adev); }
@@ -2372,7 +2377,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) {int r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev))amdgpu_gmc_init_pdb0 (adev);if (adev->gart.bo ==NULL ) {
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +4 -2
@@ -78,6 +78,8 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)uint64_t pt_base;u32 inst_mask;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);
@@ -94,10 +96,10 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)if (adev->gmc.pdb0_bo) {WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(MMHUB, i, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
Signature · 1 line
2.43.5
Re: [PATCH v8 3/4] drm/amdgpu: enable pdb0 for hibernation on SRIOV
Quoted 126 lines · Samuel Zhang
When switching to new GPU index after hibernation and then resume, VRAM offset of each VRAM BO will be changed, and the cached gpu addresses needed to updated.
This is to enable pdb0 and switch to use pdb0-based virtual gpu address by default in
amdgpu_bo_create_reserved(). since the virtual addresses do not change, this can avoid the need to update all cached gpu addresses all over the codebase.Signed-off-by Emily Deng <[email protected]>Signed-off-by Samuel Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 28 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 8 ++++--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 +++++++---- drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 6 +++-- 4 files changed, 39 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +21
-7@@ -38,6 +38,8 @@#include <drm/drm_drv.h> #include <drm/ttm/ttm_tt.h> +static const u64 four_gb =0x100000000ULL ; +/** * amdgpu_gmc_pdb0_alloc - allocate vram for pdb0 * @@ -251,10 +253,20 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcu64 hive_vram_end = mc->xgmi.node_segment_size * mc->xgmi.num_physical_nodes -1 ; mc->vram_start = mc->xgmi.node_segment_size * mc->xgmi.physical_node_id; mc->vram_end = mc->vram_start + mc->xgmi.node_segment_size -1 ; - mc->gart_start = hive_vram_end +1 ; +/* node_segment_size may not 4GB aligned on SRIOV, align up is needed. */ + mc->gart_start =ALIGN (hive_vram_end +1 , four_gb); mc->gart_end = mc->gart_start + mc->gart_size -1 ; - mc->fb_start = hive_vram_start; - mc->fb_end = hive_vram_end; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) { +/* set mc->vram_start to 0 to switch the returned GPU address of +* amdgpu_bo_create_reserved() from FB aperture to GART aperture. +*/ + mc->vram_start =0 ; + mc->vram_end = mc->vram_start + mc->mc_vram_size -1 ; + mc->visible_vram_size =min (mc->visible_vram_size, mc->real_vram_size); + }else { + mc->fb_start = hive_vram_start; + mc->fb_end = hive_vram_end; + }dev_info (adev->dev,"VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n" , mc->mc_vram_size >>20 , mc->vram_start, mc->vram_end, mc->real_vram_size >>20 );@@ -276,7 +288,6 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcvoid amdgpu_gmc_gart_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc,enum amdgpu_gart_placement gart_placement) { -const uint64_t four_gb =0x100000000ULL ;u64 size_af, size_bf;/*To avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START*/ u64 max_mc_address =min (adev->gmc.mc_mask,AMDGPU_GMC_HOLE_START -1 );@@ -1053,9 +1064,7 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev)*/ u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes;u64 pde0_page_size = (1ULL <<adev->gmc.vmid0_page_table_block_size)<<21 ; -u64 vram_addr = adev->vm_manager.vram_base_offset - - adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -u64 vram_end = vram_addr + vram_size; +u64 vram_addr, vram_end;u64 gart_ptb_gpu_pa =amdgpu_gmc_vram_pa (adev, adev->gart.bo);int idx;@@ -1068,6 +1077,11 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev) flags |=AMDGPU_PTE_FRAG ((adev->gmc.vmid0_page_table_block_size +9 *1 )); flags |=AMDGPU_PDE_PTE_FLAG (adev); + vram_addr = adev->vm_manager.vram_base_offset; +if (!amdgpu_virt_xgmi_migrate_enabled (adev)) + vram_addr -= adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + vram_end = vram_addr + vram_size; +/* The first n PDE0 entries are used as PTE, * pointing to vram */ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +5
-3@@ -76,6 +76,8 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev, {uint64_t pt_base;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);@@ -91,10 +93,10 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev,if (adev->gmc.pdb0_bo) {WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(GC, GET_INST(GC, i), regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,@@ -180,7 +182,7 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,/* In the case squeezing vram into GART aperture, we don't use * FB aperture and AGP aperture. Disable them. */ -if (adev->gmc.pdb0_bo) { +if (adev->gmc.pdb0_bo && adev->gmc.xgmi.connected_to_cpu) {WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_TOP,0 );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_BASE,0x00FFFFFF );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_AGP_TOP,0 );drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = { · line 420
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +5
-0@@ -413,6 +413,11 @@ static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = { (0x001d43e0 + 0x00001800), }; +static inline bool amdgpu_gmc_is_pdb0_enabled (struct amdgpu_device *adev) +{ +return adev->gmc.xgmi.connected_to_cpu ||amdgpu_virt_xgmi_migrate_enabled (adev); +} +
What I meant is - since this is generic logic you could keep it as amdgpu_gmc_* function and maintain as inline in amdgpu_gmc.h
Thanks,
Lijo
Quoted 65 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4
-4static inline bool gmc_v9_0_is_multi_chiplet (struct amdgpu_device *adev) {return !!adev->aid_mask;@@ -1726,7 +1731,7 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,/* add the xgmi offset of the physical node */ base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) {amdgpu_gmc_sysvm_location (adev, mc); }else {amdgpu_gmc_vram_location (adev, mc, base);@@ -1841,7 +1846,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)return 0 ; } -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) { adev->gmc.vmid0_page_table_depth =1 ; adev->gmc.vmid0_page_table_block_size =12 ; }else {@@ -1867,7 +1872,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)if (r)return r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev)) r =amdgpu_gmc_pdb0_alloc (adev); }@@ -2372,7 +2377,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) {int r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev))amdgpu_gmc_init_pdb0 (adev);if (adev->gart.bo ==NULL ) {drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +4
-2@@ -78,6 +78,8 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)uint64_t pt_base;u32 inst_mask;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);@@ -94,10 +96,10 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)if (adev->gmc.pdb0_bo) {WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(MMHUB, i, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
Christian König
maintainerRe: [PATCH v8 3/4] drm/amdgpu: enable pdb0 for hibernation on SRIOV
Quoted 130 lines · Lijo
Quoted 129 lines · Samuel Zhang
When switching to new GPU index after hibernation and then resume, VRAM offset of each VRAM BO will be changed, and the cached gpu addresses needed to updated.
This is to enable pdb0 and switch to use pdb0-based virtual gpu address by default in
amdgpu_bo_create_reserved(). since the virtual addresses do not change, this can avoid the need to update all cached gpu addresses all over the codebase.Signed-off-by Emily Deng <[email protected]>Signed-off-by Samuel Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 28 ++++++++++++++++++------ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c | 8 ++++--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 13 +++++++---- drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c | 6 +++-- 4 files changed, 39 insertions(+), 16 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c +21
-7@@ -38,6 +38,8 @@#include <drm/drm_drv.h> #include <drm/ttm/ttm_tt.h> +static const u64 four_gb =0x100000000ULL ; +/** * amdgpu_gmc_pdb0_alloc - allocate vram for pdb0 * @@ -251,10 +253,20 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcu64 hive_vram_end = mc->xgmi.node_segment_size * mc->xgmi.num_physical_nodes -1 ; mc->vram_start = mc->xgmi.node_segment_size * mc->xgmi.physical_node_id; mc->vram_end = mc->vram_start + mc->xgmi.node_segment_size -1 ; - mc->gart_start = hive_vram_end +1 ; +/* node_segment_size may not 4GB aligned on SRIOV, align up is needed. */ + mc->gart_start =ALIGN (hive_vram_end +1 , four_gb); mc->gart_end = mc->gart_start + mc->gart_size -1 ; - mc->fb_start = hive_vram_start; - mc->fb_end = hive_vram_end; +if (amdgpu_virt_xgmi_migrate_enabled (adev)) { +/* set mc->vram_start to 0 to switch the returned GPU address of +* amdgpu_bo_create_reserved() from FB aperture to GART aperture. +*/ + mc->vram_start =0 ; + mc->vram_end = mc->vram_start + mc->mc_vram_size -1 ; + mc->visible_vram_size =min (mc->visible_vram_size, mc->real_vram_size); + }else { + mc->fb_start = hive_vram_start; + mc->fb_end = hive_vram_end; + }dev_info (adev->dev,"VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n" , mc->mc_vram_size >>20 , mc->vram_start, mc->vram_end, mc->real_vram_size >>20 );@@ -276,7 +288,6 @@ void amdgpu_gmc_sysvm_location(struct amdgpu_device *adev, struct amdgpu_gmc *mcvoid amdgpu_gmc_gart_location (struct amdgpu_device *adev,struct amdgpu_gmc *mc,enum amdgpu_gart_placement gart_placement) { -const uint64_t four_gb =0x100000000ULL ;u64 size_af, size_bf;/*To avoid the hole, limit the max mc address to AMDGPU_GMC_HOLE_START*/ u64 max_mc_address =min (adev->gmc.mc_mask,AMDGPU_GMC_HOLE_START -1 );@@ -1053,9 +1064,7 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev)*/ u64 vram_size = adev->gmc.xgmi.node_segment_size * adev->gmc.xgmi.num_physical_nodes;u64 pde0_page_size = (1ULL <<adev->gmc.vmid0_page_table_block_size)<<21 ; -u64 vram_addr = adev->vm_manager.vram_base_offset - - adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -u64 vram_end = vram_addr + vram_size; +u64 vram_addr, vram_end;u64 gart_ptb_gpu_pa =amdgpu_gmc_vram_pa (adev, adev->gart.bo);int idx;@@ -1068,6 +1077,11 @@ void amdgpu_gmc_init_pdb0(struct amdgpu_device *adev) flags |=AMDGPU_PTE_FRAG ((adev->gmc.vmid0_page_table_block_size +9 *1 )); flags |=AMDGPU_PDE_PTE_FLAG (adev); + vram_addr = adev->vm_manager.vram_base_offset; +if (!amdgpu_virt_xgmi_migrate_enabled (adev)) + vram_addr -= adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; + vram_end = vram_addr + vram_size; +/* The first n PDE0 entries are used as PTE, * pointing to vram */ drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c +5
-3@@ -76,6 +76,8 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev, {uint64_t pt_base;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);@@ -91,10 +93,10 @@ static void gfxhub_v1_2_xcc_init_gart_aperture_regs(struct amdgpu_device *adev,if (adev->gmc.pdb0_bo) {WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (GC ,GET_INST (GC , i), regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(GC, GET_INST(GC, i), regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,@@ -180,7 +182,7 @@ gfxhub_v1_2_xcc_init_system_aperture_regs(struct amdgpu_device *adev,/* In the case squeezing vram into GART aperture, we don't use * FB aperture and AGP aperture. Disable them. */ -if (adev->gmc.pdb0_bo) { +if (adev->gmc.pdb0_bo && adev->gmc.xgmi.connected_to_cpu) {WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_TOP,0 );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_FB_LOCATION_BASE,0x00FFFFFF );WREG32_SOC15 (GC ,GET_INST (GC , i), regMC_VM_AGP_TOP,0 );drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0@@ -413,6 +413,11 @@ static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = { (0x001d43e0 + 0x00001800), };
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c static const uint32_t ecc_umc_mcumc_ctrl_mask_addrs[] = { · line 420
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +5
-0+static inline bool amdgpu_gmc_is_pdb0_enabled (struct amdgpu_device *adev) +{ +return adev->gmc.xgmi.connected_to_cpu ||amdgpu_virt_xgmi_migrate_enabled (adev); +} +What I meant is - since this is generic logic you could keep it as amdgpu_gmc_* function and maintain as inline in
amdgpu_gmc.h
Yeah agrre.
One more little style nit pick below.
Quoted 42 lines
Thanks,
LijoQuoted 38 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +4
-4static inline bool gmc_v9_0_is_multi_chiplet (struct amdgpu_device *adev) {return !!adev->aid_mask;@@ -1726,7 +1731,7 @@ static void gmc_v9_0_vram_gtt_location(struct amdgpu_device *adev,/* add the xgmi offset of the physical node */ base += adev->gmc.xgmi.physical_node_id * adev->gmc.xgmi.node_segment_size; -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) {amdgpu_gmc_sysvm_location (adev, mc); }else {amdgpu_gmc_vram_location (adev, mc, base);@@ -1841,7 +1846,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)return 0 ; } -if (adev->gmc.xgmi.connected_to_cpu) { +if (amdgpu_gmc_is_pdb0_enabled (adev)) { adev->gmc.vmid0_page_table_depth =1 ; adev->gmc.vmid0_page_table_block_size =12 ; }else {@@ -1867,7 +1872,7 @@ static int gmc_v9_0_gart_init(struct amdgpu_device *adev)if (r)return r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev)) r =amdgpu_gmc_pdb0_alloc (adev); }@@ -2372,7 +2377,7 @@ static int gmc_v9_0_gart_enable(struct amdgpu_device *adev) {int r; -if (adev->gmc.xgmi.connected_to_cpu) +if (amdgpu_gmc_is_pdb0_enabled (adev))amdgpu_gmc_init_pdb0 (adev);
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev) · line 82
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +0
-0if (adev->gart.bo ==NULL ) {drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +2
-0@@ -78,6 +78,8 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)uint64_t pt_base;u32 inst_mask;int i; +uint64_t gart_start =amdgpu_virt_xgmi_migrate_enabled (adev) ? + adev->gmc.vram_start : adev->gmc.fb_start;
Please keep long lines early in the decleration and especially thing like "i", "r" or "ret" last.
Apart from that looks good to me.
Regards,
Christian.
Quoted 17 lines
Quoted 16 lines
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c +2
-2if (adev->gmc.pdb0_bo) pt_base =amdgpu_gmc_pd_addr (adev->gmc.pdb0_bo);@@ -94,10 +96,10 @@ static void mmhub_v1_8_init_gart_aperture_regs(struct amdgpu_device *adev)if (adev->gmc.pdb0_bo) {WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_LO32, - (u32)(adev->gmc.fb_start >>12 )); + (u32)(gart_start >>12 ));WREG32_SOC15 (MMHUB , i, regVM_CONTEXT0_PAGE_TABLE_START_ADDR_HI32, - (u32)(adev->gmc.fb_start >>44 )); + (u32)(gart_start >>44 )); WREG32_SOC15(MMHUB, i, regVM_CONTEXT0_PAGE_TABLE_END_ADDR_LO32,
PATCH v8 4/4 drm/amdgpu: fix fence fallback timer expired error
In reply to Samuel ZhangIH is not working after switching a new gpu index for the first time.
The msix table in virtual machine is faked. The real msix table will be programmed by QEMU when guest enable/disable msix interrupt. But QEMU accessing VF msix table (register GFXMSIX_VECT0_ADDR_LO) is blocked by nBIF protection if the VF isn't in exclusive access at that time.
call amdgpu_restore_msix on resume to restore msix table.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +7 -0
@@ -5051,6 +5051,13 @@ static inline int amdgpu_virt_resume(struct amdgpu_device *adev)int r;unsigned int prev_physical_node_id = adev->gmc.xgmi.physical_node_id; +/* The msix table in VM is faked. The real msix table will be +* programmed by QEMU when guest enable/disable msix interrupt. But QEMU +* accessing VF msix table (register GFXMSIX_VECT0_ADDR_LO) is blocked +* by nBIF protection if the VF isn't in exclusive access at that time. +*/ +amdgpu_restore_msix (adev); + r = adev->gfxhub.funcs->get_xgmi_info (adev);if (r)return r;
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1 -1
@@ -245,7 +245,7 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } -static void amdgpu_restore_msix (struct amdgpu_device *adev) +void amdgpu_restore_msix (struct amdgpu_device *adev) {u16 ctrl;
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1 -0
@@ -149,5 +149,6 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev);int amdgpu_irq_add_domain (struct amdgpu_device *adev);void amdgpu_irq_remove_domain (struct amdgpu_device *adev);unsigned amdgpu_irq_create_mapping (struct amdgpu_device *adev,unsigned src_id); +void amdgpu_restore_msix (struct amdgpu_device *adev);#endif
Signature · 1 line
2.43.5
Re: [PATCH v8 4/4] drm/amdgpu: fix fence fallback timer expired error
Quoted 21 lines · Samuel Zhang
IH is not working after switching a new gpu index for the first time.
The msix table in virtual machine is faked. The real msix table will be programmed by QEMU when guest enable/disable msix interrupt. But QEMU accessing VF msix table (register
GFXMSIX_VECT0_ADDR_LO) is blocked by nBIF protection if the VF isn't in exclusive access at that time.call
amdgpu_restore_msixon resume to restore msix table.Signed-off-by Samuel Zhang <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 7 +++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-)drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0
-0
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static inline int amdgpu_virt_resume(struct amdgpu_device *adev) · line 5059
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6
-0@@ -5051,6 +5051,13 @@ static inline int amdgpu_virt_resume(struct amdgpu_device *adev)int r;unsigned int prev_physical_node_id = adev->gmc.xgmi.physical_node_id; +/* The msix table in VM is faked. The real msix table will be +* programmed by QEMU when guest enable/disable msix interrupt. But QEMU +* accessing VF msix table (register GFXMSIX_VECT0_ADDR_LO) is blocked +* by nBIF protection if the VF isn't in exclusive access at that time. +*/ +amdgpu_restore_msix (adev);
To clarify - enabling/disabling msix here triggers QEMU to program VF msix table again?
Thanks,
Lijo
Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1
-0+ r = adev->gfxhub.funcs->get_xgmi_info (adev);if (r)return r;drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +1
-1@@ -245,7 +245,7 @@ static bool amdgpu_msi_ok(struct amdgpu_device *adev)return true; } -static void amdgpu_restore_msix (struct amdgpu_device *adev) +void amdgpu_restore_msix (struct amdgpu_device *adev) {u16 ctrl;drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h +1
-0@@ -149,5 +149,6 @@ void amdgpu_irq_gpu_reset_resume_helper(struct amdgpu_device *adev);int amdgpu_irq_add_domain (struct amdgpu_device *adev);void amdgpu_irq_remove_domain (struct amdgpu_device *adev);unsigned amdgpu_irq_create_mapping (struct amdgpu_device *adev,unsigned src_id); +void amdgpu_restore_msix (struct amdgpu_device *adev);#endif
[AMD Official Use Only - AMD Internal Distribution Only]
@Koenig, Christian<mailto:[email protected]> and @Lazar, Lijo<mailto:[email protected]>
Could you help review these changes again?
Best whishes
Emily Deng
Quoted 167 lines
-----Original Message-----
From: Samuel Zhang <[email protected]>
Sent: Thursday, May 22, 2025 6:41 PM
Cc Zhao, Victor <[email protected]>; Chang, HaiJun<[email protected]>; Zhang, GuoQing (Sam) <[email protected]>;
Koenig, Christian <[email protected]>; Deucher, Alexander
<[email protected]>; Zhang, Owen(SRDC) <[email protected]>;
Ma, Qing (Mark) <[email protected]>; Lazar, Lijo <[email protected]>; Deng,
Emily <[email protected]>
Subject: [PATCH v8 0/4] enable xgmi node migration support for hibernate on SRIOV
On SRIOV and VM environment, customer may need to switch to new vGPU indexes
after hibernate and then resume the VM. For GPUs with XGMI,
vram_startwillchange in this case, the FB aperture gpu address of VRAM BOs will also change.
These gpu addresses need to be updated when resume. But these addresses are all
over the KMD codebase, updating each of them is error-prone and not acceptable.
The solution is to use pdb0 page table to cover both vram and gart memory and use
pdb0 virtual gpu address instead. When gpu indexes change, the virtual gpu address
won't change.
For psp and smu, pdb0's gpu address does not work, so the original FB aperture gpu
address is used instead. They need to be updated when resume with changed
vGPUs.
v2:
- remove
physical_node_id_changed- set
vram_startto 0 to switch cached gpu addr to gart aperture- cleanup pdb0 patch
v3:
- remove
gmc_v9_0_init_sw_mem_ranges()call- remove
vram_offsetmemeber- add 4 refactoring patch to remove cached gpu addr
- cleanup pdb0 patch
v4:
- remove
gmc_v9_0_mc_init()call andrefreshupdate.- do not set
fb_startinmmhub_v1_8_get_fb_location()when pdb0 enabled.v5:
- add
amdgpu_virt_xgmi_migrate_enabled()check- move
vram_base_offsetupdate to pdb0 patch- remove 4 refactoring patches to remove cached gpu addr
- add patch to fix IH not working issue when resume with new VF
v6: per Lijo feedback
- rename
amdgpu_device_update_xgmi_info()toamdgpu_virt_resume()- merge xgmi node and
vram_base_offsetupdate, IH fix intoamdgpu_virt_resume()- remove 2 unnecessary gpu addr update changes
v7: per Christian feedback
- remove
pdb0_enabledand addgmc_v9_0_is_pdb0_enabled()- remove
amdgpu_gmc_vram_location()call inamdgpu_gmc_sysvm_location()- remove check in
mmhub_v1_8_get_fb_location()and update fb_start/fb_end onresume
v8:
- use cached
fb_startinamdgpu_bo_fb_aper_addr()- remove fb_start/fb_end update in
amdgpu_virt_resume()and
amdgpu_gmc_sysvm_location()- use
vram_startto set regVM_CONTEXT0_PAGE_TABLE_START_ADDR_*- move check to the callsite of
amdgpu_virt_resume()- add gmc.xgmi.node_segment_size check in
amdgpu_virt_xgmi_migrate_enabled()- rename
gmc_v9_0_is_pdb0_enabled()toamdgpu_gmc_is_pdb0_enabled()Samuel Zhang (4):
drm/amdgpu: update xgmi info and
vram_base_offseton resumedrm/amdgpu: update GPU addresses for SMU and PSP
drm/amdgpu: enable pdb0 for hibernation on SRIOV
drm/amdgpu: fix fence fallback timer expired error
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 38 ++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c| 28 ++++++++++++----
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h| 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c| 20 ++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h| 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c| 23 +++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c| 3 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h| 7 ++++
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c| 8 +++--
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c| 13 +++++---
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c| 6 ++--
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c| 18 ++++++++++13 files changed, 151 insertions(+), 17 deletions(-)--
2.43.5
[AMD Official Use Only - AMD Internal Distribution Only]
Ping @Lazar, Lijo<mailto:[email protected]>, @Koenig, Christian<mailto:[email protected]>…
Kindly pls review the updated patch in advance and we can discuss your suggestions in tomorrow's meeting. Thanks for your great support.
Rgds/Owen
From: Deng, Emily <[email protected]>
Sent: Monday, May 26, 2025 9:56 AM
To: Zhang, GuoQing (Sam) <[email protected]>; Koenig, Christian <[email protected]>; Lazar, Lijo <[email protected]>; Deucher, Alexander <[email protected]>
Cc: Zhao, Victor <[email protected]>; Chang, HaiJun <[email protected]>; Zhang, GuoQing (Sam) <[email protected]>; Zhang, Owen(SRDC) <[email protected]>; Ma, Qing (Mark) <[email protected]>; [email protected]
Subject: RE: [PATCH v8 0/4] enable xgmi node migration support for hibernate on SRIOV
[AMD Official Use Only - AMD Internal Distribution Only]
@Koenig, Christian<mailto:[email protected]> and @Lazar, Lijo<mailto:[email protected]>
Could you help review these changes again?
Best whishes
Emily Deng
Quoted 167 lines
-----Original Message-----
From: Samuel Zhang <[email protected]<mailto:[email protected]>>
Sent: Thursday, May 22, 2025 6:41 PM
To: [email protected]<mailto:[email protected]>
Cc Zhao, Victor <[email protected]<mailto:[email protected]>>; Chang, HaiJun<[email protected]<mailto:[email protected]>>; Zhang, GuoQing (Sam) <[email protected]<mailto:[email protected]>>;
Koenig, Christian <[email protected]<mailto:[email protected]>>; Deucher, Alexander
<[email protected]<mailto:[email protected]>>; Zhang, Owen(SRDC) <[email protected]<mailto:[email protected]>>;
Ma, Qing (Mark) <[email protected]<mailto:[email protected]>>; Lazar, Lijo <[email protected]<mailto:[email protected]>>; Deng,
Emily <[email protected]<mailto:[email protected]>>
Subject: [PATCH v8 0/4] enable xgmi node migration support for hibernate on SRIOV
On SRIOV and VM environment, customer may need to switch to new vGPU indexes
after hibernate and then resume the VM. For GPUs with XGMI,
vram_startwillchange in this case, the FB aperture gpu address of VRAM BOs will also change.
These gpu addresses need to be updated when resume. But these addresses are all
over the KMD codebase, updating each of them is error-prone and not acceptable.
The solution is to use pdb0 page table to cover both vram and gart memory and use
pdb0 virtual gpu address instead. When gpu indexes change, the virtual gpu address
won't change.
For psp and smu, pdb0's gpu address does not work, so the original FB aperture gpu
address is used instead. They need to be updated when resume with changed
vGPUs.
v2:
- remove
physical_node_id_changed- set
vram_startto 0 to switch cached gpu addr to gart aperture- cleanup pdb0 patch
v3:
- remove
gmc_v9_0_init_sw_mem_ranges()call- remove
vram_offsetmemeber- add 4 refactoring patch to remove cached gpu addr
- cleanup pdb0 patch
v4:
- remove
gmc_v9_0_mc_init()call andrefreshupdate.- do not set
fb_startinmmhub_v1_8_get_fb_location()when pdb0 enabled.v5:
- add
amdgpu_virt_xgmi_migrate_enabled()check- move
vram_base_offsetupdate to pdb0 patch- remove 4 refactoring patches to remove cached gpu addr
- add patch to fix IH not working issue when resume with new VF
v6: per Lijo feedback
- rename
amdgpu_device_update_xgmi_info()toamdgpu_virt_resume()- merge xgmi node and
vram_base_offsetupdate, IH fix intoamdgpu_virt_resume()- remove 2 unnecessary gpu addr update changes
v7: per Christian feedback
- remove
pdb0_enabledand addgmc_v9_0_is_pdb0_enabled()- remove
amdgpu_gmc_vram_location()call inamdgpu_gmc_sysvm_location()- remove check in
mmhub_v1_8_get_fb_location()and update fb_start/fb_end onresume
v8:
- use cached
fb_startinamdgpu_bo_fb_aper_addr()- remove fb_start/fb_end update in
amdgpu_virt_resume()and
amdgpu_gmc_sysvm_location()- use
vram_startto set regVM_CONTEXT0_PAGE_TABLE_START_ADDR_*- move check to the callsite of
amdgpu_virt_resume()- add gmc.xgmi.node_segment_size check in
amdgpu_virt_xgmi_migrate_enabled()- rename
gmc_v9_0_is_pdb0_enabled()toamdgpu_gmc_is_pdb0_enabled()Samuel Zhang (4):
drm/amdgpu: update xgmi info and
vram_base_offseton resumedrm/amdgpu: update GPU addresses for SMU and PSP
drm/amdgpu: enable pdb0 for hibernation on SRIOV
drm/amdgpu: fix fence fallback timer expired error
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c| 38 ++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c| 28 ++++++++++++----
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c| 2 +-
drivers/gpu/drm/amd/amdgpu/amdgpu_irq.h| 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c| 20 ++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h| 1 +
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c| 23 +++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c| 3 ++
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.h| 7 ++++
drivers/gpu/drm/amd/amdgpu/gfxhub_v1_2.c| 8 +++--
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c| 13 +++++---
drivers/gpu/drm/amd/amdgpu/mmhub_v1_8.c| 6 ++--
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c| 18 ++++++++++13 files changed, 151 insertions(+), 17 deletions(-)--
2.43.5