From e8543b3db81b1cce5ce9ae191d58516b9faa85c0 Mon Sep 17 00:00:00 2001 From: jsg Date: Mon, 19 Jun 2023 00:34:28 +0000 Subject: [PATCH] drm/amdgpu: set gfx9 onwards APU atomics support to be true From Yifan Zhang 3e336ad6f517d1078b1e6e874e1578827088f269 in linux-6.1.y/6.1.33 af7828fbceed4f9e503034111066a0adef3db383 in mainline linux --- sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c index b8926763fc2..f4581db1dee 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_device.c @@ -3773,6 +3773,12 @@ int amdgpu_device_init(struct amdgpu_device *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); + /* 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))) + adev->have_atomics_support = true; else adev->have_atomics_support = !pci_enable_atomic_ops_to_root(adev->pdev, @@ -3781,7 +3787,14 @@ int amdgpu_device_init(struct amdgpu_device *adev, if (!adev->have_atomics_support) dev_info(adev->dev, "PCIE atomic ops is not supported\n"); #else - adev->have_atomics_support = false; + /* 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) && + (adev->ip_versions[GC_HWIP][0] > IP_VERSION(9, 0, 0))) + adev->have_atomics_support = true; + else + adev->have_atomics_support = false; #endif /* doorbell bar mapping and doorbell index init*/ -- 2.20.1