diff options
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 29 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c | 12 |
2 files changed, 18 insertions, 23 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h index 28700a80cddd..9ec5d1a666a6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | |||
@@ -37,6 +37,7 @@ | |||
37 | #define PSP_TMR_SIZE 0x400000 | 37 | #define PSP_TMR_SIZE 0x400000 |
38 | 38 | ||
39 | struct psp_context; | 39 | struct psp_context; |
40 | struct psp_xgmi_node_info; | ||
40 | struct psp_xgmi_topology_info; | 41 | struct psp_xgmi_topology_info; |
41 | 42 | ||
42 | enum psp_ring_type | 43 | enum psp_ring_type |
@@ -85,9 +86,9 @@ struct psp_funcs | |||
85 | uint64_t (*xgmi_get_node_id)(struct psp_context *psp); | 86 | uint64_t (*xgmi_get_node_id)(struct psp_context *psp); |
86 | uint64_t (*xgmi_get_hive_id)(struct psp_context *psp); | 87 | uint64_t (*xgmi_get_hive_id)(struct psp_context *psp); |
87 | int (*xgmi_get_topology_info)(struct psp_context *psp, int number_devices, | 88 | int (*xgmi_get_topology_info)(struct psp_context *psp, int number_devices, |
88 | struct psp_xgmi_topology_info *topology); | 89 | struct psp_xgmi_topology_info *topology); |
89 | int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices, | 90 | int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices, |
90 | struct psp_xgmi_topology_info *topology); | 91 | struct psp_xgmi_topology_info *topology); |
91 | }; | 92 | }; |
92 | 93 | ||
93 | struct psp_xgmi_context { | 94 | struct psp_xgmi_context { |
@@ -161,21 +162,17 @@ struct amdgpu_psp_funcs { | |||
161 | enum AMDGPU_UCODE_ID); | 162 | enum AMDGPU_UCODE_ID); |
162 | }; | 163 | }; |
163 | 164 | ||
165 | #define AMDGPU_XGMI_MAX_CONNECTED_NODES 64 | ||
166 | struct psp_xgmi_node_info { | ||
167 | uint64_t node_id; | ||
168 | uint8_t num_hops; | ||
169 | uint8_t is_sharing_enabled; | ||
170 | enum ta_xgmi_assigned_sdma_engine sdma_engine; | ||
171 | }; | ||
172 | |||
164 | struct psp_xgmi_topology_info { | 173 | struct psp_xgmi_topology_info { |
165 | /* Generated by PSP to identify the GPU instance within xgmi connection */ | 174 | uint32_t num_nodes; |
166 | uint64_t node_id; | 175 | struct psp_xgmi_node_info nodes[AMDGPU_XGMI_MAX_CONNECTED_NODES]; |
167 | /* | ||
168 | * If all bits set to 0 , driver indicates it wants to retrieve the xgmi | ||
169 | * connection vector topology, but not access enable the connections | ||
170 | * if some or all bits are set to 1, driver indicates it want to retrieve the | ||
171 | * current xgmi topology and access enable the link to GPU[i] associated | ||
172 | * with the bit position in the vector. | ||
173 | * On return,: bits indicated which xgmi links are present/active depending | ||
174 | * on the value passed in. The relative bit offset for the relative GPU index | ||
175 | * within the hive is always marked active. | ||
176 | */ | ||
177 | uint32_t connection_mask; | ||
178 | uint32_t reserved; /* must be 0 */ | ||
179 | }; | 176 | }; |
180 | 177 | ||
181 | #define psp_prep_cmd_buf(ucode, type) (psp)->funcs->prep_cmd_buf((ucode), (type)) | 178 | #define psp_prep_cmd_buf(ucode, type) (psp)->funcs->prep_cmd_buf((ucode), (type)) |
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_xgmi.c index 32896ba12c67..e92b4548db49 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 | ||
64 | int amdgpu_xgmi_add_device(struct amdgpu_device *adev) | 64 | int amdgpu_xgmi_add_device(struct amdgpu_device *adev) |
65 | { | 65 | { |
66 | struct psp_xgmi_topology_info tmp_topology[AMDGPU_MAX_XGMI_DEVICE_PER_HIVE]; | 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,7 @@ 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], 0, sizeof(tmp_topology)); | 79 | memset(&tmp_topology, 0, sizeof(tmp_topology)); |
80 | mutex_lock(&xgmi_mutex); | 80 | mutex_lock(&xgmi_mutex); |
81 | hive = amdgpu_get_xgmi_hive(adev); | 81 | hive = amdgpu_get_xgmi_hive(adev); |
82 | if (!hive) | 82 | if (!hive) |
@@ -84,9 +84,9 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) | |||
84 | 84 | ||
85 | list_add_tail(&adev->gmc.xgmi.head, &hive->device_list); | 85 | list_add_tail(&adev->gmc.xgmi.head, &hive->device_list); |
86 | list_for_each_entry(entry, &hive->device_list, head) | 86 | list_for_each_entry(entry, &hive->device_list, head) |
87 | tmp_topology[count++].node_id = entry->node_id; | 87 | tmp_topology.nodes[count++].node_id = entry->node_id; |
88 | 88 | ||
89 | ret = psp_xgmi_get_topology_info(&adev->psp, count, tmp_topology); | 89 | ret = psp_xgmi_get_topology_info(&adev->psp, count, &tmp_topology); |
90 | if (ret) { | 90 | if (ret) { |
91 | dev_err(adev->dev, | 91 | dev_err(adev->dev, |
92 | "XGMI: Get topology failure on device %llx, hive %llx, ret %d", | 92 | "XGMI: Get topology failure on device %llx, hive %llx, ret %d", |
@@ -96,7 +96,7 @@ int amdgpu_xgmi_add_device(struct amdgpu_device *adev) | |||
96 | } | 96 | } |
97 | /* Each psp need to set the latest topology */ | 97 | /* Each psp need to set the latest topology */ |
98 | list_for_each_entry(tmp_adev, &hive->device_list, gmc.xgmi.head) { | 98 | 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); | 99 | ret = psp_xgmi_set_topology_info(&tmp_adev->psp, count, &tmp_topology); |
100 | if (ret) { | 100 | if (ret) { |
101 | dev_err(tmp_adev->dev, | 101 | dev_err(tmp_adev->dev, |
102 | "XGMI: Set topology failure on device %llx, hive %llx, ret %d", | 102 | "XGMI: Set topology failure on device %llx, hive %llx, ret %d", |
@@ -115,5 +115,3 @@ exit: | |||
115 | mutex_unlock(&xgmi_mutex); | 115 | mutex_unlock(&xgmi_mutex); |
116 | return ret; | 116 | return ret; |
117 | } | 117 | } |
118 | |||
119 | |||