diff options
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1566-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch')
-rw-r--r-- | meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1566-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1566-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1566-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch new file mode 100644 index 00000000..49e7f117 --- /dev/null +++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1566-drm-amdkfd-Reject-devices-without-host-atomic-suppor.patch @@ -0,0 +1,132 @@ +From 4a7f84e2f79ee37d0d72b6705d57de5e09e31499 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 1566/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/amdgpu/gmc_v8_0.c | 4 ---- + drivers/gpu/drm/amd/amdkfd/kfd_device.c | 18 ++++++++++++++++++ + drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + + 3 files changed, 19 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +index b0d094a..4e5003c 100644 +--- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c ++++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +@@ -1160,10 +1160,6 @@ static int gmc_v8_0_sw_init(void *handle) + return -ENOMEM; + atomic_set(&adev->mc.vm_fault_info_updated, 0); + +- /* Allow BIF to recode atomics to PCIe 3.0 AtomicOps. +- */ +- pci_enable_atomic_ops_to_root(adev->pdev); +- + return 0; + } + +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 40dd5db..30bc546 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 + |