]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amdkfd: report atomics support in io_links over xgmi
authorJonathan Kim <jonathan.kim@amd.com>
Wed, 21 Apr 2021 19:05:49 +0000 (15:05 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 10 May 2021 22:06:43 +0000 (18:06 -0400)
Link atomics support over xGMI should be reported independently of PCIe.
Do not set NO_ATOMICS flags on devices that support xGMI but that do not
have atomics support over PCIe.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Tested-by: Ramesh Errabolu <ramesh.errabolu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdkfd/kfd_topology.c

index 083ac9babfa8c83384301465bd74293be493666c..30430aefcfc7d7c8d0b0469e4da015f09b7b32e8 100644 (file)
@@ -1196,6 +1196,7 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
 {
        struct kfd_iolink_properties *link, *cpu_link;
        struct kfd_topology_device *cpu_dev;
+       struct amdgpu_device *adev;
        uint32_t cap;
        uint32_t cpu_flag = CRAT_IOLINK_FLAGS_ENABLED;
        uint32_t flag = CRAT_IOLINK_FLAGS_ENABLED;
@@ -1203,18 +1204,24 @@ static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
        if (!dev || !dev->gpu)
                return;
 
-       pcie_capability_read_dword(dev->gpu->pdev,
-                       PCI_EXP_DEVCAP2, &cap);
-
-       if (!(cap & (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
-                    PCI_EXP_DEVCAP2_ATOMIC_COMP64)))
-               cpu_flag |= CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT |
-                       CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT;
+       adev = (struct amdgpu_device *)(dev->gpu->kgd);
+       if (!adev->gmc.xgmi.connected_to_cpu) {
+               pcie_capability_read_dword(dev->gpu->pdev,
+                               PCI_EXP_DEVCAP2, &cap);
+
+               if (!(cap & (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
+                            PCI_EXP_DEVCAP2_ATOMIC_COMP64)))
+                       cpu_flag |= CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT |
+                               CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT;
+       }
 
-       if (!dev->gpu->pci_atomic_requested ||
-           dev->gpu->device_info->asic_family == CHIP_HAWAII)
-               flag |= CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT |
-                       CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT;
+       if (!adev->gmc.xgmi.num_physical_nodes) {
+               if (!dev->gpu->pci_atomic_requested ||
+                               dev->gpu->device_info->asic_family ==
+                                                       CHIP_HAWAII)
+                       flag |= CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT |
+                               CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT;
+       }
 
        /* GPU only creates direct links so apply flags setting to all */
        list_for_each_entry(link, &dev->io_link_props, list) {