Commit d35f00d8 authored by Eric Huang's avatar Eric Huang Committed by Alex Deucher

drm/amdkfd: reflect atomic support in IO link properties

Add the flags of properties according to Asic type and pcie
capabilities.
Signed-off-by: default avatarEric Huang <JinHuiEric.Huang@amd.com>
Signed-off-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 7bb086cd
...@@ -366,6 +366,10 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, ...@@ -366,6 +366,10 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
return NULL; return NULL;
} }
kfd = kzalloc(sizeof(*kfd), GFP_KERNEL);
if (!kfd)
return NULL;
/* Allow BIF to recode atomics to PCIe 3.0 AtomicOps. /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps.
* 32 and 64-bit requests are possible and must be * 32 and 64-bit requests are possible and must be
* supported. * supported.
...@@ -377,12 +381,10 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd, ...@@ -377,12 +381,10 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
dev_info(kfd_device, dev_info(kfd_device,
"skipped device %x:%x, PCI rejects atomics\n", "skipped device %x:%x, PCI rejects atomics\n",
pdev->vendor, pdev->device); pdev->vendor, pdev->device);
kfree(kfd);
return NULL; return NULL;
} } else if (!ret)
kfd->pci_atomic_requested = true;
kfd = kzalloc(sizeof(*kfd), GFP_KERNEL);
if (!kfd)
return NULL;
kfd->kgd = kgd; kfd->kgd = kgd;
kfd->device_info = device_info; kfd->device_info = device_info;
......
...@@ -257,6 +257,8 @@ struct kfd_dev { ...@@ -257,6 +257,8 @@ struct kfd_dev {
/* xGMI */ /* xGMI */
uint64_t hive_id; uint64_t hive_id;
bool pci_atomic_requested;
}; };
/* KGD2KFD callbacks */ /* KGD2KFD callbacks */
......
...@@ -1127,17 +1127,40 @@ static void kfd_fill_mem_clk_max_info(struct kfd_topology_device *dev) ...@@ -1127,17 +1127,40 @@ static void kfd_fill_mem_clk_max_info(struct kfd_topology_device *dev)
static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev) static void kfd_fill_iolink_non_crat_info(struct kfd_topology_device *dev)
{ {
struct kfd_iolink_properties *link; struct kfd_iolink_properties *link, *cpu_link;
struct kfd_topology_device *cpu_dev;
uint32_t cap;
uint32_t cpu_flag = CRAT_IOLINK_FLAGS_ENABLED;
uint32_t flag = CRAT_IOLINK_FLAGS_ENABLED;
if (!dev || !dev->gpu) if (!dev || !dev->gpu)
return; return;
/* GPU only creates direck links so apply flags setting to all */ pcie_capability_read_dword(dev->gpu->pdev,
if (dev->gpu->device_info->asic_family == CHIP_HAWAII) PCI_EXP_DEVCAP2, &cap);
list_for_each_entry(link, &dev->io_link_props, list)
link->flags = CRAT_IOLINK_FLAGS_ENABLED | if (!(cap & (PCI_EXP_DEVCAP2_ATOMIC_COMP32 |
CRAT_IOLINK_FLAGS_NO_ATOMICS_32_BIT | PCI_EXP_DEVCAP2_ATOMIC_COMP64)))
CRAT_IOLINK_FLAGS_NO_ATOMICS_64_BIT; 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;
/* GPU only creates direct links so apply flags setting to all */
list_for_each_entry(link, &dev->io_link_props, list) {
link->flags = flag;
cpu_dev = kfd_topology_device_by_proximity_domain(
link->node_to);
if (cpu_dev) {
list_for_each_entry(cpu_link,
&cpu_dev->io_link_props, list)
if (cpu_link->node_to == link->node_from)
cpu_link->flags = cpu_flag;
}
}
} }
int kfd_topology_add_device(struct kfd_dev *gpu) int kfd_topology_add_device(struct kfd_dev *gpu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment