aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch116
1 files changed, 116 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch
new file mode 100644
index 00000000..6fb4cc9c
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1214-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch
@@ -0,0 +1,116 @@
+From 0b685485cffa7afeed6c51de923c7649cc6bb72e Mon Sep 17 00:00:00 2001
+From: Jay Cornwall <Jay.Cornwall@amd.com>
+Date: Thu, 1 Dec 2016 19:39:17 -0600
+Subject: [PATCH 1214/4131] drm/amdkfd: Reject devices without host atomic
+ support
+
+HSA requires atomic operations from device to host for all ASICs from
+Gfx8 onwards. APUs implicitly support this through ATS. Discrete GPUs
+require PCI support to route atomics to the host bridge and complete
+them.
+
+Do not bind to PCI devices which cannot route atomics to the host.
+
+Change-Id: Ieea113713229a81296a8f2565762b422eaf7122c
+Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.com>
+
+ Conflicts:
+ drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_device.c | 18 ++++++++++++++++++
+ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 +
+ 2 files changed, 19 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+index e426663..5aae159 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+@@ -44,6 +44,7 @@ static const struct kfd_device_info kaveri_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = true,
+ .supports_cwsr = false,
++ .needs_pci_atomics = false,
+ };
+
+ static const struct kfd_device_info hawaii_device_info = {
+@@ -57,6 +58,7 @@ static const struct kfd_device_info hawaii_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = false,
+ .supports_cwsr = false,
++ .needs_pci_atomics = false,
+ };
+
+ static const struct kfd_device_info carrizo_device_info = {
+@@ -70,6 +72,7 @@ static const struct kfd_device_info carrizo_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = true,
+ .supports_cwsr = true,
++ .needs_pci_atomics = false,
+ };
+
+ static const struct kfd_device_info tonga_device_info = {
+@@ -82,6 +85,7 @@ static const struct kfd_device_info tonga_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = false,
+ .supports_cwsr = false,
++ .needs_pci_atomics = true,
+ };
+
+ static const struct kfd_device_info fiji_device_info = {
+@@ -94,6 +98,7 @@ static const struct kfd_device_info fiji_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = false,
+ .supports_cwsr = true,
++ .needs_pci_atomics = true,
+ };
+
+ static const struct kfd_device_info polaris10_device_info = {
+@@ -106,6 +111,7 @@ static const struct kfd_device_info polaris10_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = false,
+ .supports_cwsr = true,
++ .needs_pci_atomics = true,
+ };
+
+ static const struct kfd_device_info polaris11_device_info = {
+@@ -118,6 +124,7 @@ static const struct kfd_device_info polaris11_device_info = {
+ .mqd_size_aligned = MQD_SIZE_ALIGNED,
+ .is_need_iommu_device = false,
+ .supports_cwsr = true,
++ .needs_pci_atomics = true,
+ };
+
+ struct kfd_deviceid {
+@@ -226,6 +233,17 @@ struct kfd_dev *kgd2kfd_probe(struct kgd_dev *kgd,
+ if (!device_info)
+ return NULL;
+
++ if (device_info->needs_pci_atomics) {
++ /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps.
++ */
++ if (pci_enable_atomic_ops_to_root(pdev) < 0) {
++ dev_info(kfd_device,
++ "skipped device (%x:%x), PCI rejects atomics",
++ pdev->vendor, pdev->device);
++ return NULL;
++ }
++ }
++
+ BUG_ON(!f2g);
+
+ kfd = kzalloc(sizeof(*kfd), GFP_KERNEL);
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+index 207b5bc..de34698 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+@@ -190,6 +190,7 @@ struct kfd_device_info {
+ uint16_t mqd_size_aligned;
+ bool is_need_iommu_device;
+ bool supports_cwsr;
++ bool needs_pci_atomics;
+ };
+
+ struct kfd_mem_obj {
+--
+2.7.4
+