drm/amdgpu: Add sysfs entries for xgmi hive.
Subsystems (2)
PATCH 1/1 drm/amdgpu: Add sysfs entries for xgmi hive.
For each device a file xgmi_device_id is created.
On the first device a subdirectory named xgmi_hive_info is created, It contains a file named hive_id and symlinks named node 1-4 linking to each device in the hive.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +142 -3
@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ; + + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ; + } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + }; + + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;
@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);
@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:
@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4 -2
@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 1551808057-26683-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
Am 05.03.19 um 18:47 schrieb Andrey Grodzovsky:
Quoted 31 lines
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); +
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 57
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ;
Please return proper error codes here.
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +5
-0+ + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ;
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + };
Why do you put the attribute into the hive? Usually those are statically declared somewhere.
Apart from that looks good to me,
Christian.
Quoted 151 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +111
-2+ + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): c4764c12-1c1b-dad8-da9c-7fa45d02f140-5C7GfCeVMHo@public.gmane.org
Quoted 53 lines · Christian
Am 05.03.19 um 18:47 schrieb Andrey Grodzovsky:
Quoted 31 lines
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); +drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 57
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ;Please return proper error codes here.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +9
-0+ + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ; + } + + hive->dev_attr = (struct device_attribute ) { + .attr = {
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 72
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-0+ .name = "xgmi_hive_id", + .mode = S_IRUGO, + + }, + .show = amdgpu_xgmi_show_hive_id, + };Why do you put the attribute into the hive? Usually those are statically declared somewhere.
To access the hive from amdgpu_xgmi_show_hive_id using container_of
Andrey
Quoted 164 lines
Apart from that looks good to me,
Christian.Quoted 160 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +111
-2+ + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): d4c593ec-58fa-900f-1db9-3dca38420813-5C7GfCeVMHo@public.gmane.org
Am 05.03.19 um 19:24 schrieb Grodzovsky, Andrey:
Quoted 62 lines · Christian
Quoted 53 lines
Am 05.03.19 um 18:47 schrieb Andrey Grodzovsky:
Quoted 31 lines
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); +drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 57
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ;Please return proper error codes here.
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +9
-0+ + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ; + } + + hive->dev_attr = (struct device_attribute ) { + .attr = {Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 72
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-0+ .name = "xgmi_hive_id", + .mode = S_IRUGO, + + }, + .show = amdgpu_xgmi_show_hive_id, + };Why do you put the attribute into the hive? Usually those are statically declared somewhere.
Quoted 1 line
To access the hive from
amdgpu_xgmi_show_hive_idusingcontainer_of
Ok that is rather unusual.
Can't we use device_create_file() and a proper device attribute here?
See amdgpu_get_dpm_forced_performance_level for an example how to use it.
Christian.
Quoted 167 lines
Andrey
Quoted 163 lines
Apart from that looks good to me,
Christian.Quoted 160 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +111
-2+ + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 39bc6468-0c42-dd25-1e62-f2e2bac0b537-5C7GfCeVMHo@public.gmane.org
Quoted 63 lines · Christian
Am 05.03.19 um 19:24 schrieb Grodzovsky, Andrey:
Quoted 62 lines · Christian
Quoted 61 lines
Am 05.03.19 um 18:47 schrieb Andrey Grodzovsky:
Quoted 31 lines
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); +drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 57
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ;Please return proper error codes here.
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +5
-0+ + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ;drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + };Why do you put the attribute into the hive? Usually those are statically declared somewhere.
Quoted 6 lines
Quoted 1 line
To access the hive from
amdgpu_xgmi_show_hive_idusingcontainer_ofOk that is rather unusual.
Can't we use
device_create_file()and a proper device attribute here?See
amdgpu_get_dpm_forced_performance_levelfor an example how to use it.
device_create_file will attach the file to the device's kobj which will place it in sys/class/drm/cardX/device while we want it to reside inside the xgmi_hive_info folder, for this i added kobj to the hive and use sysfs_create_file directly (device_create_file is just a wrapper around this) to specify i want to create the file (device property) for hive's kobj.
Andrey
Quoted 169 lines
Christian.
Quoted 166 lines
Andrey
Quoted 163 lines
Apart from that looks good to me,
Christian.Quoted 160 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +111
-2+ + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 4b06eb07-972d-46e6-25fa-c74ecd630849-5C7GfCeVMHo@public.gmane.org
Am 05.03.19 um 19:36 schrieb Grodzovsky, Andrey:
Quoted 64 lines · Christian
Quoted 63 lines
Am 05.03.19 um 19:24 schrieb Grodzovsky, Andrey:
Quoted 62 lines · Christian
Quoted 61 lines
Am 05.03.19 um 18:47 schrieb Andrey Grodzovsky:
Quoted 31 lines
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +6
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); +drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 57
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ;Please return proper error codes here.
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +5
-0+ + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ;drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 72
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + };Why do you put the attribute into the hive? Usually those are statically declared somewhere.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
To access the hive from
amdgpu_xgmi_show_hive_idusingcontainer_ofOk that is rather unusual.
Can't we use
device_create_file()and a proper device attribute here?See
amdgpu_get_dpm_forced_performance_levelfor an example how to use it.
device_create_filewill attach the file to the device's kobj which will place it in sys/class/drm/cardX/device while we want it to reside inside thexgmi_hive_infofolder, for this i added kobj to the hive and usesysfs_create_filedirectly (device_create_fileis just a wrapper around this) to specify i want to create the file (device property) for hive's kobj.
Gotcha, now I understand. Not sure if that is the right approach, but it will certainly work.
Alternative would be to embed the kobject for the hive directory in the hive structure, that's how it is done with the devices as well.
Anyway feel free to go ahead with the current approach.
Christian.
Quoted 171 lines
Andrey
Quoted 168 lines
Christian.
Quoted 166 lines
Andrey
Quoted 163 lines
Apart from that looks good to me,
Christian.Quoted 160 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +111
-2+ + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) { + ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ + ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); + +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 1 line
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Couple of comments inline.
Since I don't have any XGMI gear it would probably help to see what the final directory layout/contents look like so I can update umr to automagically scan all of this.
Tom
Quoted 84 lines · Andrey Grodzovsky
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +59
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ; + + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ; + } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + }; + + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 110
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive)
Probably meant "sysfs" here right?
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +13
-0+{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) {
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 133
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */
"yourself"
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +11
-0+ ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique);
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 154
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive)
And here.
Quoted 70 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +29
-2+{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): b52a95ca-c717-c759-ccfa-559233b8fe9b-5C7GfCeVMHo@public.gmane.org
In each /sys/class/drm/cardX/device/ device you will see the following
xgmi_device_id /* contains the device id within the hive */ xgmi_hive_info -> ../../../../0000:00:01.1/0000:02:00.0/0000:03:00.0/0000:04:00.0/xgmi_hive_info/ /* hive info folder */
inside xgmi_hive_info are back pointers to /sys/class/drm/cardX/device/ for each hive member -
lrwxrwxrwx 1 root root 0 Mar 5 12:27 node1 -> ../../0000:04:00.0/ lrwxrwxrwx 1 root root 0 Mar 5 12:27 node2 -> ../../../../../0000:00:1b.0/0000:05:00.0/0000:06:00.0/0000:07:00.0/
-r--r--r-- 1 root root 4096 Mar 5 12:27 xgmi_hive_id /* contains the hive id */
Andrey
Quoted 231 lines · Tom
Couple of comments inline.
Since I don't have any XGMI gear it would probably help to see what the final directory layout/contents look like so I can update umr to automagically scan all of this.
Tom
Quoted 84 lines · Andrey Grodzovsky
For each device a file
xgmi_device_idis created.
On the first device a subdirectory namedxgmi_hive_infois created, It contains a file namedhive_idand symlinks named node 1-4 linking to each device in the hive.Signed-off-by Andrey Grodzovsky <[email protected]>--- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 145 ++++++++++++++++++++++++++++++- drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h | 6 +- 2 files changed, 146 insertions(+), 5 deletions(-)drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +59
-1@@ -34,12 +34,132 @@ static DEFINE_MUTEX(xgmi_mutex);static struct amdgpu_hive_info xgmi_hives[AMDGPU_MAX_XGMI_HIVE ];static unsigned hive_count =0 ; -void *amdgpu_xgmi_hive_try_lock (struct amdgpu_hive_info *hive) {return &hive->device_list; } +static ssize_t amdgpu_xgmi_show_hive_id (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct amdgpu_hive_info *hive = + container_of(attr, struct amdgpu_hive_info, dev_attr); + +return snprintf (buf,PAGE_SIZE ,"%llu\n" , hive->hive_id); +} + +static int amdgpu_xgmi_sysfs_create (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +int ret =0 ; + +if (WARN_ON (hive->kobj)) +return -1 ; + + hive->kobj =kobject_create_and_add ("xgmi_hive_info" , &adev->dev->kobj); +if (!hive->kobj) { +dev_err (adev->dev,"XGMI: Failed to allocate sysfs entry!\n" ); +return -1 ; + } + + hive->dev_attr = (struct device_attribute ) { + .attr = { + .name ="xgmi_hive_id" , + .mode =S_IRUGO , + + }, + .show = amdgpu_xgmi_show_hive_id, + }; + + ret =sysfs_create_file (hive->kobj, &hive->dev_attr.attr); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_hive_id\n" ); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; + } + +return ret; +} + +static void amdgpu_xgmi_sysfs_destroy (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive) +{ +sysfs_remove_file (hive->kobj, &hive->dev_attr.attr); +kobject_del (hive->kobj); +kobject_put (hive->kobj); + hive->kobj =NULL ; +} + +static ssize_t amdgpu_xgmi_show_device_id (struct device *dev, +struct device_attribute *attr, +char *buf) +{ +struct drm_device *ddev =dev_get_drvdata (dev); +struct amdgpu_device *adev = ddev->dev_private; +drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 110
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+return snprintf (buf,PAGE_SIZE ,"%llu\n" , adev->gmc.xgmi.node_id); + +} + + +static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL); + + +static int amdgpu_xgmi_sysf_add_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive)Probably meant "sysfs" here right?
Quoted 13 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +13
-0+{ +int ret =0 ; +char node[10 ] = {0 }; + +/* Create xgmi device id file */ + ret =device_create_file (adev->dev, &dev_attr_xgmi_device_id); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create device file xgmi_device_id\n" ); +return ret; + } + +/* Create sysfs link to hive info folder on the first device */ +if (adev != hive->adev) {drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 133
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ ret =sysfs_create_link (&adev->dev->kobj, hive->kobj, +"xgmi_hive_info" ); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link to hive info" ); + goto remove_file; + } + } + +sprintf (node,"node%d" , hive->number_devices); +/* Create sysfs link form the hive folder to yorself */ "yourself"
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +11
-0+ ret =sysfs_create_link (hive->kobj, &adev->dev->kobj, node); +if (ret) { +dev_err (adev->dev,"XGMI: Failed to create link from hive info" ); + goto remove_link; + } + + goto success; + + +remove_link: +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique);drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c static DEFINE_MUTEX(xgmi_mutex); · line 154
Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +10
-0+ +remove_file: +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); + +success: +return ret; +} + +static void amdgpu_xgmi_sysf_rem_dev_info (struct amdgpu_device *adev, +struct amdgpu_hive_info *hive)And here.
Quoted 78 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c +29
-2+{ +device_remove_file (adev->dev, &dev_attr_xgmi_device_id); +sysfs_remove_link (&adev->dev->kobj, adev->ddev->unique); +sysfs_remove_link (hive->kobj, adev->ddev->unique); +} + + +struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock) {int i;@@ -66,10 +186,18 @@ struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev, int lo/* initialize new hive if not exist */ tmp = &xgmi_hives[hive_count++]; + +if (amdgpu_xgmi_sysfs_create (adev, tmp)) { +mutex_unlock (&xgmi_mutex); +return NULL ; + } + + tmp->adev = adev; tmp->hive_id = adev->gmc.xgmi.hive_id;INIT_LIST_HEAD (&tmp->device_list);mutex_init (&tmp->hive_lock);mutex_init (&tmp->reset_lock); +if (lock)mutex_lock (&tmp->hive_lock);@@ -156,8 +284,17 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)break ; } -dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , - adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +if (!ret) + ret =amdgpu_xgmi_sysf_add_dev_info (adev, hive); + +if (!ret) +dev_info (adev->dev,"XGMI: Add node %d, hive 0x%llx.\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id); +else +dev_err (adev->dev,"XGMI: Failed to add node %d, hive 0x%llx ret: %d\n" , + adev->gmc.xgmi.physical_node_id, adev->gmc.xgmi.hive_id, + ret); +mutex_unlock (&hive->hive_lock); exit:@@ -176,9 +313,11 @@ void amdgpu_xgmi_remove_device(struct amdgpu_device *adev)return ;if (!(hive->number_devices--)) { +amdgpu_xgmi_sysfs_destroy (adev, hive);mutex_destroy (&hive->hive_lock);mutex_destroy (&hive->reset_lock); }else { +amdgpu_xgmi_sysf_rem_dev_info (adev, hive);mutex_unlock (&hive->hive_lock); } }drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +4
-2@@ -29,8 +29,10 @@ struct amdgpu_hive_info {struct list_head device_list;struct psp_xgmi_topology_info topology_info;int number_devices; -struct mutex hive_lock, - reset_lock; +struct mutex hive_lock, reset_lock; +struct kobject *kobj; +struct device_attribute dev_attr; +struct amdgpu_device *adev; };
Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h struct amdgpu_hive_info { · line 38
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.h +0
-0struct amdgpu_hive_info *amdgpu_get_xgmi_hive (struct amdgpu_device *adev,int lock);_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): fd879112-fa02-ad17-bf85-8314670941a8-5C7GfCeVMHo@public.gmane.org
Quoted 10 lines · Andrey
In each
/sys/class/drm/cardX/device/device you will see the following
xgmi_device_id/* contains the device id within the hive */xgmi_hive_info-> ../../../../0000:00:01.1/0000:02:00.0/0000:03:00.0/0000:04:00.0/xgmi_hive_info/ /* hive info folder */inside
xgmi_hive_infoare back pointers to/sys/class/drm/cardX/device/for each hive member -
Quoted 6 lines
lrwxrwxrwx 1 root root 0 Mar 5 12:27 node1 -> ../../0000:04:00.0/ lrwxrwxrwx 1 root root 0 Mar 5 12:27 node2 -> ../../../../../0000:00:1b.0/0000:05:00.0/0000:06:00.0/0000:07:00.0/
-r--r--r-- 1 root root 4096 Mar 5 12:27
xgmi_hive_id/* contains the hive id */
Could I get an ssh on such a box to test out the umr code (which I haven't written yet)?
Thanks,
Tom
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx