[PATCH v2 1/4] drm/amdkfd: Store kfd_dev in iolink and cache properties

2019-09-16 Thread Kasiviswanathan, Harish
This is required to check against cgroup permissions.

Signed-off-by: Harish Kasiviswanathan 
Reviewed-by: Felix Kuehling 
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index f2170f0e4334..8d0cfd391d67 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1098,6 +1098,9 @@ static struct kfd_topology_device *kfd_assign_gpu(struct 
kfd_dev *gpu)
 {
struct kfd_topology_device *dev;
struct kfd_topology_device *out_dev = NULL;
+   struct kfd_mem_properties *mem;
+   struct kfd_cache_properties *cache;
+   struct kfd_iolink_properties *iolink;
 
down_write(_lock);
list_for_each_entry(dev, _device_list, list) {
@@ -,6 +1114,13 @@ static struct kfd_topology_device *kfd_assign_gpu(struct 
kfd_dev *gpu)
if (!dev->gpu && (dev->node_props.simd_count > 0)) {
dev->gpu = gpu;
out_dev = dev;
+
+   list_for_each_entry(mem, >mem_props, list)
+   mem->gpu = dev->gpu;
+   list_for_each_entry(cache, >cache_props, list)
+   cache->gpu = dev->gpu;
+   list_for_each_entry(iolink, >io_link_props, list)
+   iolink->gpu = dev->gpu;
break;
}
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index d4718d58d0f2..15843e0fc756 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -102,6 +102,7 @@ struct kfd_mem_properties {
uint32_tflags;
uint32_twidth;
uint32_tmem_clk_max;
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
@@ -123,6 +124,7 @@ struct kfd_cache_properties {
uint32_tcache_latency;
uint32_tcache_type;
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
@@ -141,6 +143,7 @@ struct kfd_iolink_properties {
uint32_tmax_bandwidth;
uint32_trec_transfer_size;
uint32_tflags;
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[PATCH v2 1/4] drm/amdkfd: Store kfd_dev in iolink and cache properties

2019-05-17 Thread Kasiviswanathan, Harish
This is required to check against cgroup permissions.

Signed-off-by: Harish Kasiviswanathan 
Reviewed-by: Felix Kuehling 
---
 drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 10 ++
 drivers/gpu/drm/amd/amdkfd/kfd_topology.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
index 2c06d6c16eab..64d667ae0d36 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.c
@@ -1104,6 +1104,9 @@ static struct kfd_topology_device *kfd_assign_gpu(struct 
kfd_dev *gpu)
 {
struct kfd_topology_device *dev;
struct kfd_topology_device *out_dev = NULL;
+   struct kfd_mem_properties *mem;
+   struct kfd_cache_properties *cache;
+   struct kfd_iolink_properties *iolink;
 
down_write(_lock);
list_for_each_entry(dev, _device_list, list) {
@@ -1117,6 +1120,13 @@ static struct kfd_topology_device *kfd_assign_gpu(struct 
kfd_dev *gpu)
if (!dev->gpu && (dev->node_props.simd_count > 0)) {
dev->gpu = gpu;
out_dev = dev;
+
+   list_for_each_entry(mem, >mem_props, list)
+   mem->gpu = dev->gpu;
+   list_for_each_entry(cache, >cache_props, list)
+   cache->gpu = dev->gpu;
+   list_for_each_entry(iolink, >io_link_props, list)
+   iolink->gpu = dev->gpu;
break;
}
}
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h 
b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
index 949e885dfb53..5fd3df80bb0e 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_topology.h
@@ -101,6 +101,7 @@ struct kfd_mem_properties {
uint32_tflags;
uint32_twidth;
uint32_tmem_clk_max;
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
@@ -122,6 +123,7 @@ struct kfd_cache_properties {
uint32_tcache_latency;
uint32_tcache_type;
uint8_t sibling_map[CRAT_SIBLINGMAP_SIZE];
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
@@ -140,6 +142,7 @@ struct kfd_iolink_properties {
uint32_tmax_bandwidth;
uint32_trec_transfer_size;
uint32_tflags;
+   struct kfd_dev  *gpu;
struct kobject  *kobj;
struct attributeattr;
 };
-- 
2.17.1

___
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx