[PATCH 8/9] drm/amdgpu: make PSP sub modules(ASD/XGMI/TMR) support configurable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As not every generation can support all these PSP sub modules.

Change-Id: I866884e6453a37ff844427eb2d6fd56a91058ebe
Signed-off-by: Evan Quan <evan.quan@xxxxxxx>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 41 +++++++++++++++++++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 14 ++++++++-
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c  |  6 ++++
 drivers/gpu/drm/amd/amdgpu/psp_v11_0.c  |  8 +++++
 drivers/gpu/drm/amd/amdgpu/psp_v3_1.c   |  6 ++++
 5 files changed, 64 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
index bf51686bdd0f..ecfbf618652a 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
@@ -32,9 +32,6 @@
 #include "psp_v3_1.h"
 #include "psp_v10_0.h"
 #include "psp_v11_0.h"
-#include "psp_xgmi.h"
-#include "psp_tmr.h"
-#include "psp_asd.h"
 
 #define psp_ring_init(psp, type) \
 		(psp)->funcs->ring_init((psp), (type))
@@ -50,6 +47,30 @@
 		(psp)->funcs->submit_cmd_buf((psp), (ucode), (cmd), (fence_mc))
 #define psp_support_vmr_ring(psp) \
 		((psp)->funcs->support_vmr_ring ? (psp)->funcs->support_vmr_ring((psp)) : false)
+#define psp_init_asd(psp) \
+		((psp)->funcs->asd_init ? (psp)->funcs->asd_init((psp)) : 0)
+#define psp_load_asd(psp) \
+		((psp)->funcs->asd_load ? (psp)->funcs->asd_load((psp)) : 0)
+#define psp_unload_asd(psp) \
+		((psp)->funcs->asd_unload ? (psp)->funcs->asd_unload((psp)) : 0)
+#define psp_destory_asd(psp) \
+		((psp)->funcs->asd_destory ? (psp)->funcs->asd_destory((psp)) : 0)
+#define psp_init_tmr(psp) \
+		((psp)->funcs->tmr_init ? (psp)->funcs->tmr_init((psp)) : 0)
+#define psp_load_tmr(psp) \
+		((psp)->funcs->tmr_load ? (psp)->funcs->tmr_load((psp)) : 0)
+#define psp_unload_tmr(psp) \
+		((psp)->funcs->tmr_unload ? (psp)->funcs->tmr_unload((psp)) : 0)
+#define psp_destory_tmr(psp) \
+		((psp)->funcs->tmr_destory ? (psp)->funcs->tmr_destory((psp)) : 0)
+#define psp_init_xgmi(psp) \
+		((psp)->funcs->xgmi_init ? (psp)->funcs->xgmi_init((psp)) : 0)
+#define psp_load_xgmi(psp) \
+		((psp)->funcs->xgmi_load ? (psp)->funcs->xgmi_load((psp)) : 0)
+#define psp_unload_xgmi(psp) \
+		((psp)->funcs->xgmi_unload ? (psp)->funcs->xgmi_unload((psp)) : 0)
+#define psp_destory_xgmi(psp) \
+		((psp)->funcs->xgmi_destory ? (psp)->funcs->xgmi_destory((psp)) : 0)
 #define psp_compare_sram_data(psp, ucode, type) \
 		(psp)->funcs->compare_sram_data((psp), (ucode), (type))
 #define psp_init_microcode(psp) \
@@ -127,16 +148,16 @@ static int psp_hw_start(struct psp_context *psp)
 	if (ret)
 		return ret;
 
-	ret = psp_tmr_load(psp);
+	ret = psp_load_tmr(psp);
 	if (ret)
 		return ret;
 
-	ret = psp_asd_load(psp);
+	ret = psp_load_asd(psp);
 	if (ret)
 		return ret;
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1) {
-		ret = psp_xgmi_initialize(psp);
+		ret = psp_init_xgmi(psp);
 		/* Warning the XGMI seesion initialize failure
 		 * Instead of stop driver initialization
 		 */
@@ -245,11 +266,11 @@ static int psp_load_fw(struct amdgpu_device *adev)
 	if (ret)
 		goto failed_mem;
 
-	ret = psp_tmr_init(psp);
+	ret = psp_init_tmr(psp);
 	if (ret)
 		goto failed_mem;
 
-	ret = psp_asd_init(psp);
+	ret = psp_init_asd(psp);
 	if (ret)
 		goto failed_mem;
 
@@ -316,7 +337,7 @@ static int psp_hw_fini(void *handle)
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1 &&
 	    psp->xgmi_context.initialized == 1)
-                psp_xgmi_terminate(psp);
+                psp_destory_xgmi(psp);
 
 	psp_ring_destroy(psp, PSP_RING_TYPE__KM);
 
@@ -344,7 +365,7 @@ static int psp_suspend(void *handle)
 
 	if (adev->gmc.xgmi.num_physical_nodes > 1 &&
 	    psp->xgmi_context.initialized == 1) {
-		ret = psp_xgmi_terminate(psp);
+		ret = psp_destory_xgmi(psp);
 		if (ret) {
 			DRM_ERROR("Failed to terminate xgmi ta\n");
 			return ret;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
index 16900d4c8034..4cc7fd3224f4 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
@@ -77,6 +77,19 @@ struct psp_funcs
 	int (*submit_cmd_buf)(struct psp_context *psp,
 	                   struct amdgpu_firmware_info *ucode,
 	                   struct psp_gfx_cmd_resp *cmd, uint64_t fence_mc_addr);
+	bool (*support_vmr_ring)(struct psp_context *psp);
+	int (*asd_init)(struct psp_context *psp);
+	int (*asd_load)(struct psp_context *psp);
+	int (*asd_unload)(struct psp_context *psp);
+	int (*asd_destory)(struct psp_context *psp);
+	int (*tmr_init)(struct psp_context *psp);
+	int (*tmr_load)(struct psp_context *psp);
+	int (*tmr_unload)(struct psp_context *psp);
+	int (*tmr_destory)(struct psp_context *psp);
+	int (*xgmi_init)(struct psp_context *psp);
+	int (*xgmi_load)(struct psp_context *psp);
+	int (*xgmi_unload)(struct psp_context *psp);
+	int (*xgmi_destory)(struct psp_context *psp);
 	bool (*compare_sram_data)(struct psp_context *psp,
 				  struct amdgpu_firmware_info *ucode,
 				  enum AMDGPU_UCODE_ID ucode_type);
@@ -88,7 +101,6 @@ struct psp_funcs
 				      struct psp_xgmi_topology_info *topology);
 	int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices,
 				      struct psp_xgmi_topology_info *topology);
-	bool (*support_vmr_ring)(struct psp_context *psp);
 };
 
 struct psp_xgmi_context {
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
index 87d9560a52ce..a469ff952045 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v10_0.c
@@ -35,6 +35,8 @@
 #include "sdma0/sdma0_4_1_offset.h"
 #include "psp_ring.h"
 #include "psp_cmn.h"
+#include "psp_asd.h"
+#include "psp_tmr.h"
 
 MODULE_FIRMWARE("amdgpu/raven_asd.bin");
 MODULE_FIRMWARE("amdgpu/picasso_asd.bin");
@@ -105,6 +107,10 @@ static const struct psp_funcs psp_v10_0_funcs = {
 	.ring_destroy = psp_ring_destroy_ring,
 	.prep_cmd_buf = psp_ring_prep_cmd_buf,
 	.submit_cmd_buf = psp_ring_submit_cmd_buf,
+	.asd_init = psp_asd_init,
+	.asd_load = psp_asd_load,
+	.tmr_init = psp_tmr_init,
+	.tmr_load = psp_tmr_load,
 	.compare_sram_data = psp_cmn_compare_sram_data,
 	.mode1_reset = psp_v10_0_mode1_reset,
 };
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
index b5c6057dd6ed..68ce4ccceec7 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v11_0.c
@@ -35,6 +35,8 @@
 #include "psp_ring.h"
 #include "psp_cmn.h"
 #include "psp_xgmi.h"
+#include "psp_asd.h"
+#include "psp_tmr.h"
 
 MODULE_FIRMWARE("amdgpu/vega20_sos.bin");
 MODULE_FIRMWARE("amdgpu/vega20_asd.bin");
@@ -257,6 +259,12 @@ static const struct psp_funcs psp_v11_0_funcs = {
 	.prep_cmd_buf = psp_ring_prep_cmd_buf,
 	.submit_cmd_buf = psp_ring_submit_cmd_buf,
 	.support_vmr_ring = psp_ring_support_vmr,
+	.asd_init = psp_asd_init,
+	.asd_load = psp_asd_load,
+	.tmr_init = psp_tmr_init,
+	.tmr_load = psp_tmr_load,
+	.xgmi_init = psp_xgmi_initialize,
+	.xgmi_destory = psp_xgmi_terminate,
 	.bootloader_load_sysdrv = psp_cmn_bootloader_load_sysdrv,
 	.bootloader_load_sos = psp_cmn_bootloader_load_sos,
 	.compare_sram_data = psp_cmn_compare_sram_data,
diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
index a013c3ae114b..8bcbc6bb9333 100644
--- a/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
+++ b/drivers/gpu/drm/amd/amdgpu/psp_v3_1.c
@@ -38,6 +38,8 @@
 #include "nbio/nbio_6_1_offset.h"
 #include "psp_ring.h"
 #include "psp_cmn.h"
+#include "psp_asd.h"
+#include "psp_tmr.h"
 
 MODULE_FIRMWARE("amdgpu/vega10_sos.bin");
 MODULE_FIRMWARE("amdgpu/vega10_asd.bin");
@@ -175,6 +177,10 @@ static const struct psp_funcs psp_v3_1_funcs = {
 	.ring_destroy = psp_ring_destroy_ring,
 	.prep_cmd_buf = psp_ring_prep_cmd_buf,
 	.submit_cmd_buf = psp_ring_submit_cmd_buf,
+	.asd_init = psp_asd_init,
+	.asd_load = psp_asd_load,
+	.tmr_init = psp_tmr_init,
+	.tmr_load = psp_tmr_load,
 	.bootloader_load_sysdrv = psp_cmn_bootloader_load_sysdrv,
 	.bootloader_load_sos = psp_v3_1_bootloader_load_sos,
 	.compare_sram_data = psp_cmn_compare_sram_data,
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux