umr needs that to correctly calculate the VRAM base address
inside the MC address space.
Only compile tested!
Signed-off-by: Christian König <christian.koenig@xxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 34 ++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index 68509f619ba3..21a5d07a1abf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -252,6 +252,26 @@ static ssize_t amdgpu_xgmi_show_device_id(struct device *dev,
}
+static ssize_t amdgpu_xgmi_show_node_segment_size(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct drm_device *ddev = dev_get_drvdata(dev);
+ struct amdgpu_device *adev = drm_to_adev(ddev);
+
+ return sysfs_emit(buf, "%llu\n", adev->gmc.xgmi.node_segment_size);
+}
+
+static ssize_t amdgpu_xgmi_show_physical_node_id(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct drm_device *ddev = dev_get_drvdata(dev);
+ struct amdgpu_device *adev = drm_to_adev(ddev);
+
+ return sysfs_emit(buf, "%u\n", adev->gmc.xgmi.physical_node_id);
+}
+
#define AMDGPU_XGMI_SET_FICAA(o) ((o) | 0x456801)
static ssize_t amdgpu_xgmi_show_error(struct device *dev,
struct device_attribute *attr,
@@ -287,6 +307,10 @@ static ssize_t amdgpu_xgmi_show_error(struct device *dev,
static DEVICE_ATTR(xgmi_device_id, S_IRUGO, amdgpu_xgmi_show_device_id, NULL);
+static DEVICE_ATTR(xgmi_node_segment_size, S_IRUGO,
+ amdgpu_xgmi_show_node_segment_size, NULL);
+static DEVICE_ATTR(xgmi_physical_node_id, S_IRUGO,
+ amdgpu_xgmi_show_physical_node_id, NULL);
static DEVICE_ATTR(xgmi_error, S_IRUGO, amdgpu_xgmi_show_error, NULL);
static void amdgpu_xgmi_sysfs_rem_dev_info(struct amdgpu_device *adev,
@@ -295,6 +319,8 @@ static void amdgpu_xgmi_sysfs_rem_dev_info(struct amdgpu_device *adev,
char node[10];
device_remove_file(adev->dev, &dev_attr_xgmi_device_id);
+ device_remove_file(adev->dev, &dev_attr_xgmi_node_segment_size);
+ device_remove_file(adev->dev, &dev_attr_xgmi_physical_node_id);
device_remove_file(adev->dev, &dev_attr_xgmi_error);
if (hive->kobj.parent != (&adev->dev->kobj))
@@ -318,6 +344,14 @@ static int amdgpu_xgmi_sysfs_add_dev_info(struct amdgpu_device *adev,
if (r)
goto error;
+ r = device_create_file(adev->dev, &dev_attr_xgmi_node_segment_size);
+ if (r)
+ goto error;
+
+ r = device_create_file(adev->dev, &dev_attr_xgmi_physical_node_id);
+ if (r)
+ goto error;
+
/* Create sysfs link to hive info folder on the first device */
if (hive->kobj.parent != (&adev->dev->kobj)) {
r = sysfs_create_link(&adev->dev->kobj, &hive->kobj,