drm/amdgpu: Check for PCIe atomic ops support when reading pf2vf data
Subsystems (2)
PATCH 1/1 drm/amdgpu: Check for PCIe atomic ops support when reading pf2vf data
The critical region v2 patches clear the fw_reserve.p_pf2vf variable after pf2vf data is read the first time. have_atomics_support relies on that variable to check for PCIe atomic ops support.
Move have_atomics_support check for SRIOV VFs to be when pf2vf data is read.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++------------ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 ++ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15 -18
@@ -4012,24 +4012,21 @@ int amdgpu_device_init(struct amdgpu_device *adev, }/* enable PCIE atomic ops */ -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 && -amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 )) || - (adev->gmc.xgmi.connected_to_cpu && -amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (12 ,1 ,0 ))) { - adev->have_atomics_support = true; - }else { - adev->have_atomics_support = - !pci_enable_atomic_ops_to_root (adev->pdev, -PCI_EXP_DEVCAP2_ATOMIC_COMP32 | -PCI_EXP_DEVCAP2_ATOMIC_COMP64 ); +if (!amdgpu_sriov_vf (adev)) { +/* 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. +*/ +if ((adev->flags &AMD_IS_APU && +amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 )) || + (adev->gmc.xgmi.connected_to_cpu && +amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (12 ,1 ,0 ))) { + adev->have_atomics_support = true; + }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)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -0
@@ -652,6 +652,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) adev->virt.ras_en_caps.all = pf2vf->pf2vf_ras_caps.ras_en_caps.all; adev->virt.ras_telemetry_en_caps.all = pf2vf->pf2vf_ras_caps.ras_telemetry_en_caps.all; + + adev->have_atomics_support = pf2vf->pcie_atomic_ops_support_flags == + (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |PCI_EXP_DEVCAP2_ATOMIC_COMP64 );break ;default :dev_err (adev->dev,"invalid pf2vf version: 0x%x\n" , pf2vf_info->version);
Signature · 1 line
2.34.1
AMD General
Looks good to me.
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Victor Lu
Sent: Wednesday, September 16, 2026 10:23 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Pan, Ellen <[email protected]>; Lu, Victor Cheng Chi (Victor) <[email protected]>
Subject: [PATCH] drm/amdgpu: Check for PCIe atomic ops support when reading pf2vf data
The critical region v2 patches clear the fw_reserve.p_pf2vf variable after pf2vf data is read the first time. have_atomics_support relies on that variable to check for PCIe atomic ops support.
Move have_atomics_support check for SRIOV VFs to be when pf2vf data is read.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 33 ++++++++++------------ drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 3 ++ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +15 -18
@@ -4012,24 +4012,21 @@ int amdgpu_device_init(struct amdgpu_device *adev, }/* enable PCIE atomic ops */ -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 && -amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 )) || - (adev->gmc.xgmi.connected_to_cpu && -amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (12 ,1 ,0 ))) { - adev->have_atomics_support = true; - }else { - adev->have_atomics_support = - !pci_enable_atomic_ops_to_root (adev->pdev, -PCI_EXP_DEVCAP2_ATOMIC_COMP32 | -PCI_EXP_DEVCAP2_ATOMIC_COMP64 ); +if (!amdgpu_sriov_vf (adev)) { +/* 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. +*/ +if ((adev->flags &AMD_IS_APU && +amdgpu_ip_version (adev,GC_HWIP ,0 ) >IP_VERSION (9 ,0 ,0 )) || + (adev->gmc.xgmi.connected_to_cpu && +amdgpu_ip_version (adev,GC_HWIP ,0 ) >=IP_VERSION (12 ,1 ,0 ))) { + adev->have_atomics_support = true; + }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)
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c +3 -0
@@ -652,6 +652,9 @@ static int amdgpu_virt_read_pf2vf_data(struct amdgpu_device *adev) adev->virt.ras_en_caps.all = pf2vf->pf2vf_ras_caps.ras_en_caps.all; adev->virt.ras_telemetry_en_caps.all = pf2vf->pf2vf_ras_caps.ras_telemetry_en_caps.all; + + adev->have_atomics_support = pf2vf->pcie_atomic_ops_support_flags == + (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |PCI_EXP_DEVCAP2_ATOMIC_COMP64 );break ;default :dev_err (adev->dev,"invalid pf2vf version: 0x%x\n" , pf2vf_info->version);
--
2.34.1