aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
diff options
context:
space:
mode:
authorHawking Zhang <Hawking.Zhang@amd.com>2018-11-06 23:00:50 -0500
committerAlex Deucher <alexander.deucher@amd.com>2018-11-07 17:05:54 -0500
commitdb0049129359eca348e5cc2782a90e78fda5bc85 (patch)
tree1cd26359a18764af00fe4cf205631d09cd5cac2f /drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
parentbb8310cc22d7acd34db72f890c267b513dbc24ff (diff)
drm/amdgpu: fix frame size of amdgpu_xgmi_add_devices excceed 1024 bytes
Instead of stack-allocated psp_xgmi_topology_info in function amdgpu_xgmi_add_device, dynamically allocated this structure to avoid the frame size of this function excceed 1024 bytes Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com> Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
index e92b4548db49..56acdeab3812 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c
@@ -63,7 +63,7 @@ static struct amdgpu_hive_info *amdgpu_get_xgmi_hive(struct amdgpu_device *adev)
63 63
64int amdgpu_xgmi_add_device(struct amdgpu_device *adev) 64int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
65{ 65{
66 struct psp_xgmi_topology_info tmp_topology; 66 struct psp_xgmi_topology_info *tmp_topology;
67 struct amdgpu_hive_info *hive; 67 struct amdgpu_hive_info *hive;
68 struct amdgpu_xgmi *entry; 68 struct amdgpu_xgmi *entry;
69 struct amdgpu_device *tmp_adev; 69 struct amdgpu_device *tmp_adev;
@@ -76,7 +76,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
76 adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp); 76 adev->gmc.xgmi.node_id = psp_xgmi_get_node_id(&adev->psp);
77 adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp); 77 adev->gmc.xgmi.hive_id = psp_xgmi_get_hive_id(&adev->psp);
78 78
79 memset(&tmp_topology, 0, sizeof(tmp_topology)); 79 tmp_topology = kzalloc(sizeof(struct psp_xgmi_topology_info), GFP_KERNEL);
80 if (!tmp_topology)
81 return -ENOMEM;
80 mutex_lock(&xgmi_mutex); 82 mutex_lock(&xgmi_mutex);
81 hive = amdgpu_get_xgmi_hive(adev); 83 hive = amdgpu_get_xgmi_hive(adev);
82 if (!hive) 84 if (!hive)
@@ -84,9 +86,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
84 86
85 list_add_tail(&adev->gmc.xgmi.head, &hive->device_list); 87 list_add_tail(&adev->gmc.xgmi.head, &hive->device_list);
86 list_for_each_entry(entry, &hive->device_list, head) 88 list_for_each_entry(entry, &hive->device_list, head)
87 tmp_topology.nodes[count++].node_id = entry->node_id; 89 tmp_topology->nodes[count++].node_id = entry->node_id;
88 90
89 ret = psp_xgmi_get_topology_info(&adev->psp, count, &tmp_topology); 91 ret = psp_xgmi_get_topology_info(&adev->psp, count, tmp_topology);
90 if (ret) { 92 if (ret) {
91 dev_err(adev->dev, 93 dev_err(adev->dev,
92 "XGMI: Get topology failure on device %llx, hive %llx, ret %d", 94 "XGMI: Get topology failure on device %llx, hive %llx, ret %d",
@@ -96,7 +98,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
96 } 98 }
97 /* Each psp need to set the latest topology */ 99 /* Each psp need to set the latest topology */
98 list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) { 100 list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) {
99 ret = psp_xgmi_set_topology_info(&tmp_adev->psp, count, &tmp_topology); 101 ret = psp_xgmi_set_topology_info(&tmp_adev->psp, count, tmp_topology);
100 if (ret) { 102 if (ret) {
101 dev_err(tmp_adev->dev, 103 dev_err(tmp_adev->dev,
102 "XGMI: Set topology failure on device %llx, hive %llx, ret %d", 104 "XGMI: Set topology failure on device %llx, hive %llx, ret %d",
@@ -113,5 +115,6 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev)
113 115
114exit: 116exit:
115 mutex_unlock(&xgmi_mutex); 117 mutex_unlock(&xgmi_mutex);
118 kfree(tmp_topology);
116 return ret; 119 return ret;
117} 120}