drm/amdgpu: Add PSP supporting PSP 13.0.6 SRIOV ucode init.
Subsystems (2)
Alex Deucher
maintainerPATCH 1/4 drm/amdgpu: Add PSP supporting PSP 13.0.6 SRIOV ucode init.
From: Gavin Wan <[email protected]>
Add PSP supporting PSP 13.0.6 SRIOV ucode init.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
@@ -146,6 +146,9 @@ static int psp_init_sriov_microcode(struct psp_context *psp)case IP_VERSION (13 ,0 ,0 ): adev->virt.autoload_ucode_id =0 ;break ; +case IP_VERSION (13 ,0 ,6 ): + ret =psp_init_cap_microcode (psp, ucode_prefix); +break ;case IP_VERSION (13 ,0 ,10 ): adev->virt.autoload_ucode_id =AMDGPU_UCODE_ID_CP_MES1_DATA ; ret =psp_init_cap_microcode (psp, ucode_prefix);
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 2/4 drm/amdgpu: Skip using MC FB Offset when APU flag is set for SRIOV.
From: Gavin Wan <[email protected]>
The MC_VM_FB_OFFSET is PF only register. It cannot be read on VF. So, the driver should not use MC_VM_FB_OFFSET address to set the address of dev->gmc.aper_base.
--- 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
@@ -1644,7 +1644,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)*/ /* check whether both host-gpu and gpu-gpu xgmi links exist */ -if (((adev->flags &AMD_IS_APU ) && !amdgpu_passthrough (adev)) || +if ((!amdgpu_sriov_vf (adev) && + (adev->flags &AMD_IS_APU ) && !amdgpu_passthrough (adev)) || (adev->gmc.xgmi.supported && adev->gmc.xgmi.connected_to_cpu)) { adev->gmc.aper_base =
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 3/4 drm/amdgpu: Set memory partitions to 1 for SRIOV.
In reply to Alex DeucherFrom: Gavin Wan <[email protected]>
For SRIOV, the memory partitions are set on host drover. Each VF only has one memory partition. We need set the memory partitions to 1 on guest driver for SRIOV.
V2: sqaush in fix ("drm/amdgpu: Fix memory range info of GC 9.4.3 VFs")
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +7 -1
@@ -1346,6 +1346,9 @@ gmc_v9_0_get_memory_partition(struct amdgpu_device *adev, u32 *supp_modes)static enum amdgpu_memory_partition gmc_v9_0_query_memory_partition (struct amdgpu_device *adev) { +if (amdgpu_sriov_vf (adev)) +return AMDGPU_NPS1_PARTITION_MODE ; +return gmc_v9_0_get_memory_partition (adev,NULL ); }
@@ -1897,7 +1900,10 @@ static int gmc_v9_0_init_mem_ranges(struct amdgpu_device *adev)else gmc_v9_0_init_sw_mem_ranges (adev, adev->gmc.mem_partitions); - valid =gmc_v9_0_validate_partition_info (adev); +if (amdgpu_sriov_vf (adev)) + valid = true; +else + valid =gmc_v9_0_validate_partition_info (adev);if (!valid) {/* TODO: handle invalid case */ dev_WARN(adev->dev,
Signature · 1 line
2.40.1
Alex Deucher
maintainerPATCH 4/4 drm/amdgpu: Checked if the pointer NULL before use it.
In reply to Alex DeucherFrom: Gavin Wan <[email protected]>
For SRIOV on some parts, the host driver does not post VBIOS. So the guest cannot get bios information. Therefore, adev->virt.fw_reserve.p_pf2vf and adev->mode_info.atom_context are NULL.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +12 -8
@@ -3854,21 +3854,24 @@ int amdgpu_device_init(struct amdgpu_device *adev, }/* enable PCIE atomic ops */ -if (amdgpu_sriov_vf (adev)) - adev->have_atomics_support = ((struct amd_sriov_msg_pf2vf_info *) - adev->virt.fw_reserve.p_pf2vf)->pcie_atomic_ops_support_flags == - (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |PCI_EXP_DEVCAP2_ATOMIC_COMP64 ); +if (amdgpu_sriov_vf (adev)) { +if (adev->virt.fw_reserve.p_pf2vf) + adev->have_atomics_support = ((struct amd_sriov_msg_pf2vf_info *) + adev->virt.fw_reserve.p_pf2vf)->pcie_atomic_ops_support_flags == + (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |PCI_EXP_DEVCAP2_ATOMIC_COMP64 );/* APUs w/ gfx9 onwards doesn't reply on PCIe atomics, rather it is a * internal path natively support atomics, set have_atomics_support to true. */ -else if ((adev->flags &AMD_IS_APU ) && - (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 ))) + }else if ((adev->flags &AMD_IS_APU ) && + (adev->ip_versions[GC_HWIP ][0 ] >IP_VERSION (9 ,0 ,0 ))) { adev->have_atomics_support = true; -else + }else { adev->have_atomics_support = !pci_enable_atomic_ops_to_root (adev->pdev,PCI_EXP_DEVCAP2_ATOMIC_COMP32 |PCI_EXP_DEVCAP2_ATOMIC_COMP64 ); + } +if (!adev->have_atomics_support)dev_info (adev->dev,"PCIE atomic ops is not supported\n" );
@@ -3884,7 +3887,8 @@ int amdgpu_device_init(struct amdgpu_device *adev,amdgpu_reset_init (adev);/* detect if we are with an SRIOV vbios */ -amdgpu_device_detect_sriov_bios (adev); +if (adev->bios) +amdgpu_device_detect_sriov_bios (adev);/* check if we need to reset the asic * E.g., driver was not cleanly unloaded previously, etc.
Signature · 1 line
2.40.1