Skip to contentSkip to conversation

drm/amdgpu: switch to common xgmi ta helpers

PATCH In review Hawking Zhang 4 participants 7 messages May 6, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/4 drm/amdgpu: switch to common xgmi ta helpers

get_hive_id/get_node_id/get_topology_info/set_topology_info are common xgmi command supported by TA for all the ASICs that support xgmi link. They should be implemented as common helper functions to avoid duplicated code per IP generation

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 115 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  24 +++----
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 121 --------------------------------
 3 files changed, 123 insertions(+), 137 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +115 -0
index f061ad6..bb5b510 100644
@@ -664,6 +664,121 @@ int psp_xgmi_initialize(struct psp_context *psp)
 	return ret;
 }
 
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id)
+{
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
+
+	/* Invoke xgmi ta to get hive id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id)
+{
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
+
+	/* Invoke xgmi ta to get the node id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology)
+{
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	struct ta_xgmi_cmd_get_topology_info_output *topology_info_output;
+	int i;
+	int ret;
+
+	if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	/* Fill in the shared memory with topology information as input */
+	topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info;
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO;
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology->nodes[i].node_id;
+		topology_info_input->nodes[i].num_hops = topology->nodes[i].num_hops;
+		topology_info_input->nodes[i].is_sharing_enabled = topology->nodes[i].is_sharing_enabled;
+		topology_info_input->nodes[i].sdma_engine = topology->nodes[i].sdma_engine;
+	}
+
+	/* Invoke xgmi ta to get the topology information */
+	ret = psp_xgmi_invoke(psp, TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO);
+	if (ret)
+		return ret;
+
+	/* Read the output topology information from the shared memory */
+	topology_info_output = &xgmi_cmd->xgmi_out_message.get_topology_info;
+	topology->num_nodes = xgmi_cmd->xgmi_out_message.get_topology_info.num_nodes;
+	for (i = 0; i < topology->num_nodes; i++) {
+		topology->nodes[i].node_id = topology_info_output->nodes[i].node_id;
+		topology->nodes[i].num_hops = topology_info_output->nodes[i].num_hops;
+		topology->nodes[i].is_sharing_enabled = topology_info_output->nodes[i].is_sharing_enabled;
+		topology->nodes[i].sdma_engine = topology_info_output->nodes[i].sdma_engine;
+	}
+
+	return 0;
+}
+
+int psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology)
+{
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	int i;
+
+	if (!topology || topology->num_nodes > TA_XGMI__MAX_CONNECTED_NODES)
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp->xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	topology_info_input = &xgmi_cmd->xgmi_in_message.get_topology_info;
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__SET_TOPOLOGY_INFO;
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology->nodes[i].node_id;
+		topology_info_input->nodes[i].num_hops = topology->nodes[i].num_hops;
+		topology_info_input->nodes[i].is_sharing_enabled = 1;
+		topology_info_input->nodes[i].sdma_engine = topology->nodes[i].sdma_engine;
+	}
+
+	/* Invoke xgmi ta to set topology information */
+	return psp_xgmi_invoke(psp, TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);
+}
+
 // ras begin
 static int psp_ras_init_shared_buf(struct psp_context *psp)
 {
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +8 -16
index 7fcd63d..263bd8e 100644
@@ -95,12 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*xgmi_get_node_id)(struct psp_context *psp, uint64_t *node_id);
-	int (*xgmi_get_hive_id)(struct psp_context *psp, uint64_t *hive_id);
-	int (*xgmi_get_topology_info)(struct psp_context *psp, int number_devices,
-				      struct psp_xgmi_topology_info *topology);
-	int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices,
-				      struct psp_xgmi_topology_info *topology);
 	int (*ras_trigger_error)(struct psp_context *psp,
 			struct ta_ras_trigger_error_input *info);
 	int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr);
@@ -316,16 +310,6 @@ struct amdgpu_psp_funcs {
 		((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false)
 #define psp_mode1_reset(psp) \
 		((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false)
-#define psp_xgmi_get_node_id(psp, node_id) \
-		((psp)->funcs->xgmi_get_node_id ? (psp)->funcs->xgmi_get_node_id((psp), (node_id)) : -EINVAL)
-#define psp_xgmi_get_hive_id(psp, hive_id) \
-		((psp)->funcs->xgmi_get_hive_id ? (psp)->funcs->xgmi_get_hive_id((psp), (hive_id)) : -EINVAL)
-#define psp_xgmi_get_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_get_topology_info ? \
-		(psp)->funcs->xgmi_get_topology_info((psp), (num_device), (topology)) : -EINVAL)
-#define psp_xgmi_set_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_set_topology_info ?	 \
-		(psp)->funcs->xgmi_set_topology_info((psp), (num_device), (topology)) : -EINVAL)
 #define psp_rlc_autoload(psp) \
 		((psp)->funcs->rlc_autoload_start ? (psp)->funcs->rlc_autoload_start((psp)) : 0)
 #define psp_mem_training_init(psp) \
@@ -369,6 +353,14 @@ int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx,
 int psp_xgmi_initialize(struct psp_context *psp);
 int psp_xgmi_terminate(struct psp_context *psp);
 int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id);
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id);
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology);
+int psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology);
 
 int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 int psp_ras_enable_features(struct psp_context *psp,
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -121

133 lines not on this page · raw message

Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH 2/4 drm/amdgpu: switch to common ras ta helper

TRIGGER_ERROR is common ras ta command for all the ASICs that support RAS feature. switch to common helper to avoid duplicate implementation per IP generation

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 27 +++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  8 +++-----
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 28 ----------------------------
 3 files changed, 30 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +27 -0
index bb5b510..19f09b4 100644
@@ -978,6 +978,33 @@ static int psp_ras_initialize(struct psp_context *psp)
 
 	return 0;
 }
+
+int psp_ras_trigger_error(struct psp_context *psp,
+			  struct ta_ras_trigger_error_input *info)
+{
+	struct ta_ras_shared_memory *ras_cmd;
+	int ret;
+
+	if (!psp->ras.ras_initialized)
+		return -EINVAL;
+
+	ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
+	memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
+
+	ras_cmd->cmd_id = TA_RAS_COMMAND__TRIGGER_ERROR;
+	ras_cmd->ras_in_message.trigger_error = *info;
+
+	ret = psp_ras_invoke(psp, ras_cmd->cmd_id);
+	if (ret)
+		return -EINVAL;
+
+	/* If err_event_athub occurs error inject was successful, however
+	   return status from TA is no long reliable */
+	if (amdgpu_ras_intr_triggered())
+		return 0;
+
+	return ras_cmd->ras_status;
+}
 // ras end
 
 // HDCP start
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +3 -5
index 263bd8e..14802b5 100644
@@ -95,8 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*ras_trigger_error)(struct psp_context *psp,
-			struct ta_ras_trigger_error_input *info);
 	int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr);
 	int (*rlc_autoload_start)(struct psp_context *psp);
 	int (*mem_training_init)(struct psp_context *psp);
@@ -319,9 +317,6 @@ struct amdgpu_psp_funcs {
 #define psp_mem_training(psp, ops) \
 	((psp)->funcs->mem_training ? (psp)->funcs->mem_training((psp), (ops)) : 0)
 
-#define psp_ras_trigger_error(psp, info) \
-	((psp)->funcs->ras_trigger_error ? \
-	(psp)->funcs->ras_trigger_error((psp), (info)) : -EINVAL)
 #define psp_ras_cure_posion(psp, addr) \
 	((psp)->funcs->ras_cure_posion ? \
 	(psp)->funcs->ras_cure_posion(psp, (addr)) : -EINVAL)
@@ -365,6 +360,9 @@ int psp_xgmi_set_topology_info(struct psp_context *psp,
 int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 int psp_ras_enable_features(struct psp_context *psp,
 		union ta_ras_cmd_input *info, bool enable);
+int psp_ras_trigger_error(struct psp_context *psp,
+			  struct ta_ras_trigger_error_input *info);
+
 int psp_hdcp_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 int psp_dtm_invoke(struct psp_context *psp, uint32_t ta_cmd_id);
 
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -28
index 4f6c0df..9e4f582 100644
@@ -524,33 +524,6 @@ static int psp_v11_0_mode1_reset(struct psp_context *psp)
 	return 0;
 }
 
-static int psp_v11_0_ras_trigger_error(struct psp_context *psp,
-		struct ta_ras_trigger_error_input *info)
-{
-	struct ta_ras_shared_memory *ras_cmd;
-	int ret;
-
-	if (!psp->ras.ras_initialized)
-		return -EINVAL;
-
-	ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
-	memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
-
-	ras_cmd->cmd_id = TA_RAS_COMMAND__TRIGGER_ERROR;
-	ras_cmd->ras_in_message.trigger_error = *info;
-
-	ret = psp_ras_invoke(psp, ras_cmd->cmd_id);
-	if (ret)
-		return -EINVAL;
-
-	/* If err_event_athub occurs error inject was successful, however
-	   return status from TA is no long reliable */
-	if (amdgpu_ras_intr_triggered())
-		return 0;
-
-	return ras_cmd->ras_status;
-}
-
 static int psp_v11_0_ras_cure_posion(struct psp_context *psp, uint64_t *mode_ptr)
 {
 #if 0
@@ -878,7 +851,6 @@ static const struct psp_funcs psp_v11_0_funcs = {
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.ras_trigger_error = psp_v11_0_ras_trigger_error,
 	.ras_cure_posion = psp_v11_0_ras_cure_posion,
 	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
 	.mem_training_init = psp_v11_0_memory_training_init,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#2 lore raw

PATCH 3/4 drm/amdgpu: drop unused ras ta helper function

In reply to Hawking Zhang

cure posion command was replaced by ras recovery
solution and was not a formal command supported
by ras ta anymore

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  5 -----
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 27 ---------------------------
 2 files changed, 32 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -5
index 14802b5..46bd85f 100644
@@ -95,7 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr);
 	int (*rlc_autoload_start)(struct psp_context *psp);
 	int (*mem_training_init)(struct psp_context *psp);
 	void (*mem_training_fini)(struct psp_context *psp);
@@ -317,10 +316,6 @@ struct amdgpu_psp_funcs {
 #define psp_mem_training(psp, ops) \
 	((psp)->funcs->mem_training ? (psp)->funcs->mem_training((psp), (ops)) : 0)
 
-#define psp_ras_cure_posion(psp, addr) \
-	((psp)->funcs->ras_cure_posion ? \
-	(psp)->funcs->ras_cure_posion(psp, (addr)) : -EINVAL)
-
 #define psp_ring_get_wptr(psp) (psp)->funcs->ring_get_wptr((psp))
 #define psp_ring_set_wptr(psp, value) (psp)->funcs->ring_set_wptr((psp), (value))
 
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -27
index 9e4f582..cfbf30a 100644
@@ -524,32 +524,6 @@ static int psp_v11_0_mode1_reset(struct psp_context *psp)
 	return 0;
 }
 
-static int psp_v11_0_ras_cure_posion(struct psp_context *psp, uint64_t *mode_ptr)
-{
-#if 0
-	// not support yet.
-	struct ta_ras_shared_memory *ras_cmd;
-	int ret;
-
-	if (!psp->ras.ras_initialized)
-		return -EINVAL;
-
-	ras_cmd = (struct ta_ras_shared_memory *)psp->ras.ras_shared_buf;
-	memset(ras_cmd, 0, sizeof(struct ta_ras_shared_memory));
-
-	ras_cmd->cmd_id = TA_RAS_COMMAND__CURE_POISON;
-	ras_cmd->ras_in_message.cure_poison.mode_ptr = mode_ptr;
-
-	ret = psp_ras_invoke(psp, ras_cmd->cmd_id);
-	if (ret)
-		return -EINVAL;
-
-	return ras_cmd->ras_status;
-#else
-	return -EINVAL;
-#endif
-}
-
 static int psp_v11_0_rlc_autoload_start(struct psp_context *psp)
 {
 	return psp_rlc_autoload_start(psp);
@@ -851,7 +825,6 @@ static const struct psp_funcs psp_v11_0_funcs = {
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.ras_cure_posion = psp_v11_0_ras_cure_posion,
 	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
 	.mem_training_init = psp_v11_0_memory_training_init,
 	.mem_training_fini = psp_v11_0_memory_training_fini,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 4/4 drm/amdgpu: switch to common rlc_autoload helper

In reply to Hawking Zhang

drop IP specific psp functon for rlc autoload since the autoload_supported was introduced to mark ASICs that support rlc_autoload

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 3 ---
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 6 ------
 3 files changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
index 19f09b4..5146542 100644
@@ -1646,7 +1646,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 		/* Start rlc autoload after psp recieved all the gfx firmware */
 		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ?
 		    AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_G)) {
-			ret = psp_rlc_autoload(psp);
+			ret = psp_rlc_autoload_start(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
 				return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -3
index 46bd85f..2a56ad9 100644
@@ -95,7 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*rlc_autoload_start)(struct psp_context *psp);
 	int (*mem_training_init)(struct psp_context *psp);
 	void (*mem_training_fini)(struct psp_context *psp);
 	int (*mem_training)(struct psp_context *psp, uint32_t ops);
@@ -307,8 +306,6 @@ struct amdgpu_psp_funcs {
 		((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false)
 #define psp_mode1_reset(psp) \
 		((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false)
-#define psp_rlc_autoload(psp) \
-		((psp)->funcs->rlc_autoload_start ? (psp)->funcs->rlc_autoload_start((psp)) : 0)
 #define psp_mem_training_init(psp) \
 	((psp)->funcs->mem_training_init ? (psp)->funcs->mem_training_init((psp)) : 0)
 #define psp_mem_training_fini(psp) \
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -6
index cfbf30a..1de89cc 100644
@@ -524,11 +524,6 @@ static int psp_v11_0_mode1_reset(struct psp_context *psp)
 	return 0;
 }
 
-static int psp_v11_0_rlc_autoload_start(struct psp_context *psp)
-{
-	return psp_rlc_autoload_start(psp);
-}
-
 static int psp_v11_0_memory_training_send_msg(struct psp_context *psp, int msg)
 {
 	int ret;
@@ -825,7 +820,6 @@ static const struct psp_funcs psp_v11_0_funcs = {
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
 	.mem_training_init = psp_v11_0_memory_training_init,
 	.mem_training_fini = psp_v11_0_memory_training_fini,
 	.mem_training = psp_v11_0_memory_training,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

RE: [PATCH 4/4] drm/amdgpu: switch to common rlc_autoload helper

[AMD Public Use]

One spelling typo in the commit message, 'functon' should be 'function'. Apart from this, series is: Reviewed-by: Guchun Chen <[email protected]>

' drop IP specific psp functon for rlc autoload since the autoload_supported '

Regards,
Guchun

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: Wednesday, May 6, 2020 2:39 PM
To: [email protected]; Deucher, Alexander <[email protected]>; Clements, John <[email protected]>; Gao, Likun <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Zhou1, Tao <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 4/4] drm/amdgpu: switch to common rlc_autoload helper

drop IP specific psp functon for rlc autoload since the autoload_supported was introduced to mark ASICs that support rlc_autoload

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-  drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 3 ---  drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 6 ------
 3 files changed, 1 insertion(+), 10 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -1
index 19f09b4..5146542 100644
@@ -1646,7 +1646,7 @@ static int psp_np_fw_load(struct psp_context *psp)
 		/* Start rlc autoload after psp recieved all the gfx firmware */
 		if (psp->autoload_supported && ucode->ucode_id == (amdgpu_sriov_vf(adev) ?
 		    AMDGPU_UCODE_ID_CP_MEC2 : AMDGPU_UCODE_ID_RLC_G)) {
-			ret = psp_rlc_autoload(psp);
+			ret = psp_rlc_autoload_start(psp);
 			if (ret) {
 				DRM_ERROR("Failed to start rlc autoload\n");
 				return ret;
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -1
index 46bd85f..2a56ad9 100644
@@ -95,7 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*rlc_autoload_start)(struct psp_context *psp);
 	int (*mem_training_init)(struct psp_context *psp);
 	void (*mem_training_fini)(struct psp_context *psp);
 	int (*mem_training)(struct psp_context *psp, uint32_t ops); @@ -307,8 +306,6 @@ struct amdgpu_psp_funcs {

((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false) #define psp_mode1_reset(psp) \
((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false) -#define psp_rlc_autoload(psp) \
- ((psp)->funcs->rlc_autoload_start ? (psp)->funcs->rlc_autoload_start((psp)) : 0)
#define psp_mem_training_init(psp) \
((psp)->funcs->mem_training_init ? (psp)->funcs->mem_training_init((psp)) : 0) #define psp_mem_training_fini(psp) \ diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index cfbf30a..1de89cc 100644

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
@@ -524,11 +524,6 @@ static int psp_v11_0_mode1_reset(struct psp_context *psp)
 	return 0;
 }
 
-static int psp_v11_0_rlc_autoload_start(struct psp_context *psp) -{
-	return psp_rlc_autoload_start(psp);
-}
-
 static int psp_v11_0_memory_training_send_msg(struct psp_context *psp, int msg)  {
 	int ret;
@@ -825,7 +820,6 @@ static const struct psp_funcs psp_v11_0_funcs = {
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
 	.mem_training_init = psp_v11_0_memory_training_init,
 	.mem_training_fini = psp_v11_0_memory_training_fini,
 	.mem_training = psp_v11_0_memory_training,

--
2.7.4
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by on v1 1/4
#5 lore raw
In reply to Hawking Zhang

[AMD Public Use]

The series is:

Quoted 394 lines

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: 2020年5月6日 14:39
To: [email protected]; Deucher, Alexander <[email protected]>; Clements, John <[email protected]>; Gao, Likun <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Zhou1, Tao <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/4] drm/amdgpu: switch to common xgmi ta helpers

get_hive_id/get_node_id/get_topology_info/set_topology_info are common xgmi command supported by TA for all the ASICs that support xgmi link. They should be implemented as common helper functions to avoid duplicated code per IP generation

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 115
++++++++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h |  24 +++----
drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  | 121 --------------------------------
 3 files changed, 123 insertions(+), 137 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +48 -0
index f061ad6..bb5b510 100644
@@ -664,6 +664,121 @@ int psp_xgmi_initialize(struct psp_context *psp)
 	return ret;
 }
 
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
 >xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
+
+	/* Invoke xgmi ta to get hive id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
 >xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
+
+	/* Invoke xgmi ta to get the node id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	struct ta_xgmi_cmd_get_topology_info_output
 *topology_info_output;
+	int i;
+	int ret;
+
+	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	/* Fill in the shared memory with topology information as input */
+	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+	xgmi_cmd->cmd_id =

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].is_sharing_enabled =

topology->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	}
+
+	/* Invoke xgmi ta to get the topology information */
+	ret = psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
+	if (ret)
+		return ret;
+
+	/* Read the output topology information from the shared memory */
+	topology_info_output = &xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+	topology->num_nodes = xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info.num_nodes;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
+	for (i = 0; i < topology->num_nodes; i++) {
+		topology->nodes[i].node_id = topology_info_output-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].num_hops = topology_info_output-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].is_sharing_enabled =

topology_info_output->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].sdma_engine = topology_info_output-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +13 -0
+	}
+
+	return 0;
+}
+
+int psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	int i;
+
+	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__SET_TOPOLOGY_INFO;
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
+		topology_info_input->nodes[i].is_sharing_enabled = 1;
+		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	}
+
+	/* Invoke xgmi ta to set topology information */
+	return psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
+}
+
 // ras begin
 static int psp_ras_init_shared_buf(struct psp_context *psp)  { diff --git

a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 7fcd63d..263bd8e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -6
@@ -95,12 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*xgmi_get_node_id)(struct psp_context *psp, uint64_t *node_id);
-	int (*xgmi_get_hive_id)(struct psp_context *psp, uint64_t *hive_id);
-	int (*xgmi_get_topology_info)(struct psp_context *psp, int
 number_devices,
-				      struct psp_xgmi_topology_info *topology);
-	int (*xgmi_set_topology_info)(struct psp_context *psp, int
 number_devices,
-				      struct psp_xgmi_topology_info *topology);
 	int (*ras_trigger_error)(struct psp_context *psp,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -6
 			struct ta_ras_trigger_error_input *info);
 	int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr);
@@ -316,16 +310,6 @@ struct amdgpu_psp_funcs {
 		((psp)->funcs->smu_reload_quirk ? (psp)->funcs-
 >smu_reload_quirk((psp)) : false)  #define psp_mode1_reset(psp) \
 		((psp)->funcs->mode1_reset ? (psp)->funcs-
 >mode1_reset((psp)) : false) -#define psp_xgmi_get_node_id(psp, node_id) \
-		((psp)->funcs->xgmi_get_node_id ? (psp)->funcs-
 >xgmi_get_node_id((psp), (node_id)) : -EINVAL)
-#define psp_xgmi_get_hive_id(psp, hive_id) \
-		((psp)->funcs->xgmi_get_hive_id ? (psp)->funcs-
 >xgmi_get_hive_id((psp), (hive_id)) : -EINVAL)
-#define psp_xgmi_get_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_get_topology_info ? \
-		(psp)->funcs->xgmi_get_topology_info((psp), (num_device),

(topology)) : -EINVAL)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -3
-#define psp_xgmi_set_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_set_topology_info ?	 \
-		(psp)->funcs->xgmi_set_topology_info((psp), (num_device),

(topology)) : -EINVAL)
#define psp_rlc_autoload(psp) \
((psp)->funcs->rlc_autoload_start ? (psp)->funcs-

Quoted 1 line

rlc_autoload_start((psp)) : 0) #define psp_mem_training_init(psp) \ @@ -

369,6 +353,14 @@ int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx, int psp_xgmi_initialize(struct psp_context *psp); int psp_xgmi_terminate(struct psp_context *psp); int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +8 -0
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id);
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id);
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology); int
+psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology);
 
 int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id);  int

psp_ras_enable_features(struct psp_context *psp, diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index 97c80f1..4f6c0df 100644

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
@@ -524,123 +524,6 @@ static int psp_v11_0_mode1_reset(struct
 psp_context *psp)
 	return 0;
 }
 
-/* TODO: Fill in follow functions once PSP firmware interface for XGMI is

ready.
- * For now, return success and hack the hive_id so high level code can
- * start testing
- */

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -6
-static int psp_v11_0_xgmi_get_topology_info(struct psp_context *psp,
-	int number_devices, struct psp_xgmi_topology_info *topology)
-{
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
-	struct ta_xgmi_cmd_get_topology_info_output

*topology_info_output;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	int i;
-	int ret;
-
-	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-		return -EINVAL;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	/* Fill in the shared memory with topology information as input */
-	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-	xgmi_cmd->cmd_id =

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	topology_info_input->num_nodes = number_devices;
-
-	for (i = 0; i < topology_info_input->num_nodes; i++) {
-		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].is_sharing_enabled =

topology->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	}
-
-	/* Invoke xgmi ta to get the topology information */
-	ret = psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
-	if (ret)
-		return ret;
-
-	/* Read the output topology information from the shared memory */
-	topology_info_output = &xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-	topology->num_nodes = xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info.num_nodes;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -2
-	for (i = 0; i < topology->num_nodes; i++) {
-		topology->nodes[i].node_id = topology_info_output-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].num_hops = topology_info_output-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].is_sharing_enabled =

topology_info_output->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].sdma_engine = topology_info_output-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -13
-	}
-
-	return 0;
-}
-
-static int psp_v11_0_xgmi_set_topology_info(struct psp_context *psp,
-	int number_devices, struct psp_xgmi_topology_info *topology)
-{
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
-	int i;
-
-	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-		return -EINVAL;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__SET_TOPOLOGY_INFO;
-	topology_info_input->num_nodes = number_devices;
-
-	for (i = 0; i < topology_info_input->num_nodes; i++) {
-		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -2
-		topology_info_input->nodes[i].is_sharing_enabled = 1;
-		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	}
-
-	/* Invoke xgmi ta to set topology information */
-	return psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-}
-
-static int psp_v11_0_xgmi_get_hive_id(struct psp_context *psp, uint64_t

*hive_id) -{

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	int ret;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -15
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
-
-	/* Invoke xgmi ta to get hive id */
-	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
-	if (ret)
-		return ret;
-
-	*hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
-
-	return 0;
-}
-
-static int psp_v11_0_xgmi_get_node_id(struct psp_context *psp, uint64_t

*node_id) -{

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	int ret;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -14
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
-
-	/* Invoke xgmi ta to get the node id */
-	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
-	if (ret)
-		return ret;
-
-	*node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
-
-	return 0;
-}
-
 static int psp_v11_0_ras_trigger_error(struct psp_context *psp,
 		struct ta_ras_trigger_error_input *info)  { @@ -995,10 +878,6

@@ static const struct psp_funcs psp_v11_0_funcs = {

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.xgmi_get_topology_info = psp_v11_0_xgmi_get_topology_info,
-	.xgmi_set_topology_info = psp_v11_0_xgmi_set_topology_info,
-	.xgmi_get_hive_id = psp_v11_0_xgmi_get_hive_id,
-	.xgmi_get_node_id = psp_v11_0_xgmi_get_node_id,
 	.ras_trigger_error = psp_v11_0_ras_trigger_error,
 	.ras_cure_posion = psp_v11_0_ras_cure_posion,
 	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
--
Quoted 1 line

2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reviewed-by Reviewed-by Tao Zhou
#6 lore raw

[AMD Public Use]

-----Original Message-----
From: Zhou1, Tao <[email protected]>
Sent: Wednesday, May 6, 2020 4:39 PM
To: Zhang, Hawking <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>; Clements, John <[email protected]>; Gao, Likun <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: RE: [PATCH 1/4] drm/amdgpu: switch to common xgmi ta helpers

[AMD Public Use]

The series is:

Quoted 399 lines

-----Original Message-----
From: Hawking Zhang <[email protected]>
Sent: 2020年5月6日 14:39
To: [email protected]; Deucher, Alexander <[email protected]>; Clements, John <[email protected]>; Gao, Likun <[email protected]>; Chen, Guchun <[email protected]>; Li, Dennis <[email protected]>; Zhou1, Tao <[email protected]>
Cc: Zhang, Hawking <[email protected]>
Subject: [PATCH 1/4] drm/amdgpu: switch to common xgmi ta helpers

get_hive_id/get_node_id/get_topology_info/set_topology_info are common xgmi command supported by TA for all the ASICs that support xgmi link. They should be implemented as common helper functions to avoid duplicated code per IP generation

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 115

++++++++++++++++++++++++++++++
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 24 +++---- drivers/gpu/drm/amd/amdgpu/psp_v11_0.c | 121
--------------------------------

 3 files changed, 123 insertions(+), 137 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +48 -0
index f061ad6..bb5b510 100644
@@ -664,6 +664,121 @@ int psp_xgmi_initialize(struct psp_context *psp)
 	return ret;
 }
 
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
 >xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
+
+	/* Invoke xgmi ta to get hive id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	int ret;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
 >xgmi_context.xgmi_shared_buf;
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
+
+	/* Invoke xgmi ta to get the node id */
+	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
+	if (ret)
+		return ret;
+
+	*node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
+
+	return 0;
+}
+
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	struct ta_xgmi_cmd_get_topology_info_output
 *topology_info_output;
+	int i;
+	int ret;
+
+	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	/* Fill in the shared memory with topology information as input */
+	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+	xgmi_cmd->cmd_id =

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].is_sharing_enabled =

topology->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	}
+
+	/* Invoke xgmi ta to get the topology information */
+	ret = psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
+	if (ret)
+		return ret;
+
+	/* Read the output topology information from the shared memory */
+	topology_info_output = &xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+	topology->num_nodes = xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info.num_nodes;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
+	for (i = 0; i < topology->num_nodes; i++) {
+		topology->nodes[i].node_id = topology_info_output-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].num_hops = topology_info_output-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].is_sharing_enabled =

topology_info_output->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology->nodes[i].sdma_engine = topology_info_output-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +13 -0
+	}
+
+	return 0;
+}
+
+int psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology) {
+	struct ta_xgmi_shared_memory *xgmi_cmd;
+	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
+	int i;
+
+	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+		return -EINVAL;
+
+	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +3 -0
+	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
+
+	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +5 -0
+	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__SET_TOPOLOGY_INFO;
+	topology_info_input->num_nodes = number_devices;
+
+	for (i = 0; i < topology_info_input->num_nodes; i++) {
+		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +1 -0
+		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -0
+		topology_info_input->nodes[i].is_sharing_enabled = 1;
+		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +4 -0
+	}
+
+	/* Invoke xgmi ta to set topology information */
+	return psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +2 -1
+}
+
 // ras begin
 static int psp_ras_init_shared_buf(struct psp_context *psp)  { diff 
--git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h

b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 7fcd63d..263bd8e 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -6
@@ -95,12 +95,6 @@ struct psp_funcs
 			    enum psp_ring_type ring_type);
 	bool (*smu_reload_quirk)(struct psp_context *psp);
 	int (*mode1_reset)(struct psp_context *psp);
-	int (*xgmi_get_node_id)(struct psp_context *psp, uint64_t *node_id);
-	int (*xgmi_get_hive_id)(struct psp_context *psp, uint64_t *hive_id);
-	int (*xgmi_get_topology_info)(struct psp_context *psp, int
 number_devices,
-				      struct psp_xgmi_topology_info *topology);
-	int (*xgmi_set_topology_info)(struct psp_context *psp, int
 number_devices,
-				      struct psp_xgmi_topology_info *topology);
 	int (*ras_trigger_error)(struct psp_context *psp,
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -3
 			struct ta_ras_trigger_error_input *info);
 	int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr); 
@@ -316,16 +310,6 @@ struct amdgpu_psp_funcs {
 		((psp)->funcs->smu_reload_quirk ? (psp)->funcs-
 >smu_reload_quirk((psp)) : false)  #define psp_mode1_reset(psp) \
 		((psp)->funcs->mode1_reset ? (psp)->funcs-
 >mode1_reset((psp)) : false) -#define psp_xgmi_get_node_id(psp, 
 >node_id) \
-		((psp)->funcs->xgmi_get_node_id ? (psp)->funcs-
 >xgmi_get_node_id((psp), (node_id)) : -EINVAL)
-#define psp_xgmi_get_hive_id(psp, hive_id) \
-		((psp)->funcs->xgmi_get_hive_id ? (psp)->funcs-
Quoted 1 line

xgmi_get_hive_id((psp), (hive_id)) : -EINVAL)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -3
-#define psp_xgmi_get_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_get_topology_info ? \
-		(psp)->funcs->xgmi_get_topology_info((psp), (num_device),

(topology)) : -EINVAL)

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +0 -3
-#define psp_xgmi_set_topology_info(psp, num_device, topology) \
-		((psp)->funcs->xgmi_set_topology_info ?	 \
-		(psp)->funcs->xgmi_set_topology_info((psp), (num_device),

(topology)) : -EINVAL)
#define psp_rlc_autoload(psp) \
((psp)->funcs->rlc_autoload_start ? (psp)->funcs-

Quoted 2 lines

rlc_autoload_start((psp)) : 0) #define psp_mem_training_init(psp) \
@@ -

369,6 +353,14 @@ int psp_update_vcn_sram(struct amdgpu_device *adev, int inst_idx, int psp_xgmi_initialize(struct psp_context *psp); int psp_xgmi_terminate(struct psp_context *psp); int psp_xgmi_invoke(struct psp_context *psp, uint32_t ta_cmd_id);

drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h +8 -0
+int psp_xgmi_get_hive_id(struct psp_context *psp, uint64_t *hive_id); 
+int psp_xgmi_get_node_id(struct psp_context *psp, uint64_t *node_id); 
+int psp_xgmi_get_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology); int 
+psp_xgmi_set_topology_info(struct psp_context *psp,
+			       int number_devices,
+			       struct psp_xgmi_topology_info *topology);
 
 int psp_ras_invoke(struct psp_context *psp, uint32_t ta_cmd_id);  int 

psp_ras_enable_features(struct psp_context *psp, diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index 97c80f1..4f6c0df 100644

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
@@ -524,123 +524,6 @@ static int psp_v11_0_mode1_reset(struct 
 psp_context *psp)
 	return 0;
 }
 
-/* TODO: Fill in follow functions once PSP firmware interface for 

XGMI is ready.
- * For now, return success and hack the hive_id so high level code can
- * start testing
- */

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -6
-static int psp_v11_0_xgmi_get_topology_info(struct psp_context *psp,
-	int number_devices, struct psp_xgmi_topology_info *topology)
-{
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
-	struct ta_xgmi_cmd_get_topology_info_output

*topology_info_output;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	int i;
-	int ret;
-
-	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-		return -EINVAL;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	/* Fill in the shared memory with topology information as input */
-	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-	xgmi_cmd->cmd_id =

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	topology_info_input->num_nodes = number_devices;
-
-	for (i = 0; i < topology_info_input->num_nodes; i++) {
-		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].is_sharing_enabled =

topology->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	}
-
-	/* Invoke xgmi ta to get the topology information */
-	ret = psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__GET_GET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
-	if (ret)
-		return ret;
-
-	/* Read the output topology information from the shared memory */
-	topology_info_output = &xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-	topology->num_nodes = xgmi_cmd-
Quoted 1 line

xgmi_out_message.get_topology_info.num_nodes;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -2
-	for (i = 0; i < topology->num_nodes; i++) {
-		topology->nodes[i].node_id = topology_info_output-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].num_hops = topology_info_output-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].is_sharing_enabled =

topology_info_output->nodes[i].is_sharing_enabled;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology->nodes[i].sdma_engine = topology_info_output-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -13
-	}
-
-	return 0;
-}
-
-static int psp_v11_0_xgmi_set_topology_info(struct psp_context *psp,
-	int number_devices, struct psp_xgmi_topology_info *topology)
-{
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	struct ta_xgmi_cmd_get_topology_info_input *topology_info_input;
-	int i;
-
-	if (!topology || topology->num_nodes >

TA_XGMI__MAX_CONNECTED_NODES)

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-		return -EINVAL;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	topology_info_input = &xgmi_cmd-
Quoted 1 line

xgmi_in_message.get_topology_info;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__SET_TOPOLOGY_INFO;
-	topology_info_input->num_nodes = number_devices;
-
-	for (i = 0; i < topology_info_input->num_nodes; i++) {
-		topology_info_input->nodes[i].node_id = topology-
Quoted 1 line

nodes[i].node_id;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -1
-		topology_info_input->nodes[i].num_hops = topology-
Quoted 1 line

nodes[i].num_hops;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -2
-		topology_info_input->nodes[i].is_sharing_enabled = 1;
-		topology_info_input->nodes[i].sdma_engine = topology-
Quoted 1 line

nodes[i].sdma_engine;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	}
-
-	/* Invoke xgmi ta to set topology information */
-	return psp_xgmi_invoke(psp,

TA_COMMAND_XGMI__SET_TOPOLOGY_INFO);

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -3
-}
-
-static int psp_v11_0_xgmi_get_hive_id(struct psp_context *psp, 

uint64_t
*hive_id) -{

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	int ret;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -15
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_HIVE_ID;
-
-	/* Invoke xgmi ta to get hive id */
-	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
-	if (ret)
-		return ret;
-
-	*hive_id = xgmi_cmd->xgmi_out_message.get_hive_id.hive_id;
-
-	return 0;
-}
-
-static int psp_v11_0_xgmi_get_node_id(struct psp_context *psp, 

uint64_t
*node_id) -{

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -4
-	struct ta_xgmi_shared_memory *xgmi_cmd;
-	int ret;
-
-	xgmi_cmd = (struct ta_xgmi_shared_memory*)psp-
Quoted 1 line

xgmi_context.xgmi_shared_buf;

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -14
-	memset(xgmi_cmd, 0, sizeof(struct ta_xgmi_shared_memory));
-
-	xgmi_cmd->cmd_id = TA_COMMAND_XGMI__GET_NODE_ID;
-
-	/* Invoke xgmi ta to get the node id */
-	ret = psp_xgmi_invoke(psp, xgmi_cmd->cmd_id);
-	if (ret)
-		return ret;
-
-	*node_id = xgmi_cmd->xgmi_out_message.get_node_id.node_id;
-
-	return 0;
-}
-
 static int psp_v11_0_ras_trigger_error(struct psp_context *psp,
 		struct ta_ras_trigger_error_input *info)  { @@ -995,10 +878,6 @@ 

static const struct psp_funcs psp_v11_0_funcs = {

drivers/gpu/drm/amd/amdgpu/psp_v11_0.c +0 -5
 	.ring_stop = psp_v11_0_ring_stop,
 	.ring_destroy = psp_v11_0_ring_destroy,
 	.mode1_reset = psp_v11_0_mode1_reset,
-	.xgmi_get_topology_info = psp_v11_0_xgmi_get_topology_info,
-	.xgmi_set_topology_info = psp_v11_0_xgmi_set_topology_info,
-	.xgmi_get_hive_id = psp_v11_0_xgmi_get_hive_id,
-	.xgmi_get_node_id = psp_v11_0_xgmi_get_node_id,
 	.ras_trigger_error = psp_v11_0_ras_trigger_error,
 	.ras_cure_posion = psp_v11_0_ras_cure_posion,
 	.rlc_autoload_start = psp_v11_0_rlc_autoload_start,
--
Quoted 1 line

2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx