aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch221
1 files changed, 221 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch
new file mode 100644
index 00000000..828514f5
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1267-drm-amdkfd-Disable-the-perf-counters-for-old-kernels.patch
@@ -0,0 +1,221 @@
+From 1172044eb10d38e7560de34df8c6441d8fa3a52b Mon Sep 17 00:00:00 2001
+From: Yong Zhao <Yong.Zhao@amd.com>
+Date: Fri, 28 Apr 2017 18:08:09 -0400
+Subject: [PATCH 1267/4131] drm/amdkfd: Disable the perf counters for old
+ kernels
+
+Because IOMMU functions are missing for old kernels such as 3.10 on
+Redhat 7.3, we choose to disable the performance counter feature on
+those kernels.
+
+Change-Id: Ie159d61a9b36cc38bd306b5e28fa5a3b83646d09
+Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
+---
+ drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 27 +++++++++++++++++++++++++--
+ drivers/gpu/drm/amd/amdkfd/kfd_topology.h | 8 ++++++++
+ 2 files changed, 33 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+index 603fcde9..82a3960 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+@@ -139,7 +139,9 @@ static void kfd_release_topology_device(struct kfd_topology_device *dev)
+ struct kfd_mem_properties *mem;
+ struct kfd_cache_properties *cache;
+ struct kfd_iolink_properties *iolink;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct kfd_perf_properties *perf;
++#endif
+
+ BUG_ON(!dev);
+
+@@ -166,12 +168,14 @@ static void kfd_release_topology_device(struct kfd_topology_device *dev)
+ kfree(iolink);
+ }
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ while (dev->perf_props.next != &dev->perf_props) {
+ perf = container_of(dev->perf_props.next,
+ struct kfd_perf_properties, list);
+ list_del(&perf->list);
+ kfree(perf);
+ }
++#endif
+
+ kfree(dev);
+
+@@ -206,7 +210,9 @@ struct kfd_topology_device *kfd_create_topology_device(
+ INIT_LIST_HEAD(&dev->mem_props);
+ INIT_LIST_HEAD(&dev->cache_props);
+ INIT_LIST_HEAD(&dev->io_link_props);
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ INIT_LIST_HEAD(&dev->perf_props);
++#endif
+
+ list_add_tail(&dev->list, device_list);
+ sys_props.num_devices++;
+@@ -373,6 +379,7 @@ static struct kobj_type cache_type = {
+ .sysfs_ops = &cache_ops,
+ };
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ /****** Sysfs of Performance Counters ******/
+
+ struct kfd_perf_attr {
+@@ -405,6 +412,7 @@ static struct kfd_perf_attr perf_attr_iommu[] = {
+ KFD_PERF_DESC(counter_ids, 0),
+ };
+ /****************************************/
++#endif
+
+ static ssize_t node_show(struct kobject *kobj, struct attribute *attr,
+ char *buffer)
+@@ -545,7 +553,9 @@ static void kfd_remove_sysfs_node_entry(struct kfd_topology_device *dev)
+ struct kfd_iolink_properties *iolink;
+ struct kfd_cache_properties *cache;
+ struct kfd_mem_properties *mem;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct kfd_perf_properties *perf;
++#endif
+
+ BUG_ON(!dev);
+
+@@ -584,6 +594,7 @@ static void kfd_remove_sysfs_node_entry(struct kfd_topology_device *dev)
+ dev->kobj_mem = NULL;
+ }
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ if (dev->kobj_perf) {
+ list_for_each_entry(perf, &dev->perf_props, list) {
+ kfree(perf->attr_group);
+@@ -593,6 +604,7 @@ static void kfd_remove_sysfs_node_entry(struct kfd_topology_device *dev)
+ kobject_put(dev->kobj_perf);
+ dev->kobj_perf = NULL;
+ }
++#endif
+
+ if (dev->kobj_node) {
+ sysfs_remove_file(dev->kobj_node, &dev->attr_gpuid);
+@@ -610,10 +622,13 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
+ struct kfd_iolink_properties *iolink;
+ struct kfd_cache_properties *cache;
+ struct kfd_mem_properties *mem;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct kfd_perf_properties *perf;
+- int ret;
+- uint32_t i, num_attrs;
++ uint32_t num_attrs;
+ struct attribute **attrs;
++#endif
++ int ret;
++ uint32_t i;
+
+ BUG_ON(!dev);
+
+@@ -642,9 +657,11 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
+ if (!dev->kobj_iolink)
+ return -ENOMEM;
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ dev->kobj_perf = kobject_create_and_add("perf", dev->kobj_node);
+ if (!dev->kobj_perf)
+ return -ENOMEM;
++#endif
+
+ /*
+ * Creating sysfs files for node properties
+@@ -725,6 +742,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
+ i++;
+ }
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ /* All hardware blocks have the same number of attributes. */
+ num_attrs = sizeof(perf_attr_iommu)/sizeof(struct kfd_perf_attr);
+ list_for_each_entry(perf, &dev->perf_props, list) {
+@@ -750,6 +768,7 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
+ if (ret < 0)
+ return ret;
+ }
++#endif
+
+ return 0;
+ }
+@@ -915,6 +934,7 @@ static void find_system_memory(const struct dmi_header *dm,
+ }
+ }
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ /*
+ * Performance counters information is not part of CRAT but we would like to
+ * put them in the sysfs under topology directory for Thunk to get the data.
+@@ -936,6 +956,7 @@ static int kfd_add_perf_to_topology(struct kfd_topology_device *kdev)
+
+ return 0;
+ }
++#endif
+
+ /* kfd_add_non_crat_information - Add information that is not currently
+ * defined in CRAT but is necessary for KFD topology
+@@ -1047,9 +1068,11 @@ int kfd_topology_init(void)
+ }
+ }
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ kdev = list_first_entry(&temp_topology_device_list,
+ struct kfd_topology_device, list);
+ kfd_add_perf_to_topology(kdev);
++#endif
+
+ down_write(&topology_lock);
+ num_nodes = kfd_topology_update_device_list(&temp_topology_device_list,
+diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+index a968e58..89d08c4 100644
+--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
++++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+@@ -139,12 +139,14 @@ struct kfd_iolink_properties {
+ struct attribute attr;
+ };
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct kfd_perf_properties {
+ struct list_head list;
+ char block_name[16];
+ uint32_t max_concurrent;
+ struct attribute_group *attr_group;
+ };
++#endif
+
+ struct kfd_topology_device {
+ struct list_head list;
+@@ -156,13 +158,17 @@ struct kfd_topology_device {
+ struct list_head cache_props;
+ uint32_t io_link_count;
+ struct list_head io_link_props;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct list_head perf_props;
++#endif
+ struct kfd_dev *gpu;
+ struct kobject *kobj_node;
+ struct kobject *kobj_mem;
+ struct kobject *kobj_cache;
+ struct kobject *kobj_iolink;
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ struct kobject *kobj_perf;
++#endif
+ struct attribute attr_gpuid;
+ struct attribute attr_name;
+ struct attribute attr_props;
+@@ -187,8 +193,10 @@ struct kfd_topology_device *kfd_create_topology_device(
+ struct list_head *device_list);
+ void kfd_release_live_view(void);
+
++#if LINUX_VERSION_CODE > KERNEL_VERSION(3, 10, 0)
+ extern bool amd_iommu_pc_supported(void);
+ extern u8 amd_iommu_pc_get_max_banks(u16 devid);
+ extern u8 amd_iommu_pc_get_max_counters(u16 devid);
++#endif
+
+ #endif /* __KFD_TOPOLOGY_H__ */
+--
+2.7.4
+