Commit a2676149 authored by Hawking Zhang's avatar Hawking Zhang Committed by Alex Deucher

drm/amdgpu: retire support_vmr_ring interface

vmr ring is dedicated for sriov vf (i.e.guest driver
in sriov), which is general communication interface
between driver and psp fw accross all ip version.
it is not correct to make it as ip specific callback.
it is even worse to check specific tOS version per IP
version (like psp_v11/v12).
Signed-off-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarGuchun Chen <guchun.chen@amd.com>
Reviewed-by: default avatarJohn Clements <john.clements@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent fe158997
...@@ -274,7 +274,7 @@ static void psp_prep_tmr_cmd_buf(struct psp_context *psp, ...@@ -274,7 +274,7 @@ static void psp_prep_tmr_cmd_buf(struct psp_context *psp,
struct psp_gfx_cmd_resp *cmd, struct psp_gfx_cmd_resp *cmd,
uint64_t tmr_mc, uint32_t size) uint64_t tmr_mc, uint32_t size)
{ {
if (psp_support_vmr_ring(psp)) if (amdgpu_sriov_vf(psp->adev))
cmd->cmd_id = GFX_CMD_ID_SETUP_VMR; cmd->cmd_id = GFX_CMD_ID_SETUP_VMR;
else else
cmd->cmd_id = GFX_CMD_ID_SETUP_TMR; cmd->cmd_id = GFX_CMD_ID_SETUP_TMR;
......
...@@ -104,7 +104,6 @@ struct psp_funcs ...@@ -104,7 +104,6 @@ struct psp_funcs
struct psp_xgmi_topology_info *topology); struct psp_xgmi_topology_info *topology);
int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices, int (*xgmi_set_topology_info)(struct psp_context *psp, int number_devices,
struct psp_xgmi_topology_info *topology); struct psp_xgmi_topology_info *topology);
bool (*support_vmr_ring)(struct psp_context *psp);
int (*ras_trigger_error)(struct psp_context *psp, int (*ras_trigger_error)(struct psp_context *psp,
struct ta_ras_trigger_error_input *info); struct ta_ras_trigger_error_input *info);
int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr); int (*ras_cure_posion)(struct psp_context *psp, uint64_t *mode_ptr);
...@@ -320,8 +319,6 @@ struct amdgpu_psp_funcs { ...@@ -320,8 +319,6 @@ struct amdgpu_psp_funcs {
((psp)->funcs->bootloader_load_sos ? (psp)->funcs->bootloader_load_sos((psp)) : 0) ((psp)->funcs->bootloader_load_sos ? (psp)->funcs->bootloader_load_sos((psp)) : 0)
#define psp_smu_reload_quirk(psp) \ #define psp_smu_reload_quirk(psp) \
((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false) ((psp)->funcs->smu_reload_quirk ? (psp)->funcs->smu_reload_quirk((psp)) : false)
#define psp_support_vmr_ring(psp) \
((psp)->funcs->support_vmr_ring ? (psp)->funcs->support_vmr_ring((psp)) : false)
#define psp_mode1_reset(psp) \ #define psp_mode1_reset(psp) \
((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false) ((psp)->funcs->mode1_reset ? (psp)->funcs->mode1_reset((psp)) : false)
#define psp_xgmi_get_node_id(psp, node_id) \ #define psp_xgmi_get_node_id(psp, node_id) \
......
...@@ -446,13 +446,6 @@ static int psp_v11_0_ring_init(struct psp_context *psp, ...@@ -446,13 +446,6 @@ static int psp_v11_0_ring_init(struct psp_context *psp,
return 0; return 0;
} }
static bool psp_v11_0_support_vmr_ring(struct psp_context *psp)
{
if (amdgpu_sriov_vf(psp->adev) && psp->sos_fw_version > 0x80045)
return true;
return false;
}
static int psp_v11_0_ring_stop(struct psp_context *psp, static int psp_v11_0_ring_stop(struct psp_context *psp,
enum psp_ring_type ring_type) enum psp_ring_type ring_type)
{ {
...@@ -460,7 +453,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp, ...@@ -460,7 +453,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp,
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
/* Write the ring destroy command*/ /* Write the ring destroy command*/
if (psp_v11_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING); GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
else else
...@@ -471,7 +464,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp, ...@@ -471,7 +464,7 @@ static int psp_v11_0_ring_stop(struct psp_context *psp,
mdelay(20); mdelay(20);
/* Wait for response flag (bit 31) */ /* Wait for response flag (bit 31) */
if (psp_v11_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
0x80000000, 0x80000000, false); 0x80000000, 0x80000000, false);
else else
...@@ -489,7 +482,7 @@ static int psp_v11_0_ring_create(struct psp_context *psp, ...@@ -489,7 +482,7 @@ static int psp_v11_0_ring_create(struct psp_context *psp,
struct psp_ring *ring = &psp->km_ring; struct psp_ring *ring = &psp->km_ring;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v11_0_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(adev)) {
ret = psp_v11_0_ring_stop(psp, ring_type); ret = psp_v11_0_ring_stop(psp, ring_type);
if (ret) { if (ret) {
DRM_ERROR("psp_v11_0_ring_stop_sriov failed!\n"); DRM_ERROR("psp_v11_0_ring_stop_sriov failed!\n");
...@@ -1099,7 +1092,7 @@ static uint32_t psp_v11_0_ring_get_wptr(struct psp_context *psp) ...@@ -1099,7 +1092,7 @@ static uint32_t psp_v11_0_ring_get_wptr(struct psp_context *psp)
uint32_t data; uint32_t data;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v11_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
else else
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
...@@ -1111,7 +1104,7 @@ static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value) ...@@ -1111,7 +1104,7 @@ static void psp_v11_0_ring_set_wptr(struct psp_context *psp, uint32_t value)
{ {
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v11_0_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(adev)) {
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD);
} else } else
...@@ -1209,7 +1202,6 @@ static const struct psp_funcs psp_v11_0_funcs = { ...@@ -1209,7 +1202,6 @@ static const struct psp_funcs psp_v11_0_funcs = {
.xgmi_set_topology_info = psp_v11_0_xgmi_set_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_hive_id = psp_v11_0_xgmi_get_hive_id,
.xgmi_get_node_id = psp_v11_0_xgmi_get_node_id, .xgmi_get_node_id = psp_v11_0_xgmi_get_node_id,
.support_vmr_ring = psp_v11_0_support_vmr_ring,
.ras_trigger_error = psp_v11_0_ras_trigger_error, .ras_trigger_error = psp_v11_0_ras_trigger_error,
.ras_cure_posion = psp_v11_0_ras_cure_posion, .ras_cure_posion = psp_v11_0_ras_cure_posion,
.rlc_autoload_start = psp_v11_0_rlc_autoload_start, .rlc_autoload_start = psp_v11_0_rlc_autoload_start,
......
...@@ -228,13 +228,6 @@ static int psp_v12_0_ring_init(struct psp_context *psp, ...@@ -228,13 +228,6 @@ static int psp_v12_0_ring_init(struct psp_context *psp,
return 0; return 0;
} }
static bool psp_v12_0_support_vmr_ring(struct psp_context *psp)
{
if (amdgpu_sriov_vf(psp->adev) && psp->sos_fw_version > 0x80045)
return true;
return false;
}
static int psp_v12_0_ring_create(struct psp_context *psp, static int psp_v12_0_ring_create(struct psp_context *psp,
enum psp_ring_type ring_type) enum psp_ring_type ring_type)
{ {
...@@ -243,7 +236,7 @@ static int psp_v12_0_ring_create(struct psp_context *psp, ...@@ -243,7 +236,7 @@ static int psp_v12_0_ring_create(struct psp_context *psp,
struct psp_ring *ring = &psp->km_ring; struct psp_ring *ring = &psp->km_ring;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v12_0_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(psp->adev)) {
/* Write low address of the ring to C2PMSG_102 */ /* Write low address of the ring to C2PMSG_102 */
psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr); psp_ring_reg = lower_32_bits(ring->ring_mem_mc_addr);
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, psp_ring_reg);
...@@ -295,7 +288,7 @@ static int psp_v12_0_ring_stop(struct psp_context *psp, ...@@ -295,7 +288,7 @@ static int psp_v12_0_ring_stop(struct psp_context *psp,
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
/* Write the ring destroy command*/ /* Write the ring destroy command*/
if (psp_v12_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING); GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
else else
...@@ -306,7 +299,7 @@ static int psp_v12_0_ring_stop(struct psp_context *psp, ...@@ -306,7 +299,7 @@ static int psp_v12_0_ring_stop(struct psp_context *psp,
mdelay(20); mdelay(20);
/* Wait for response flag (bit 31) */ /* Wait for response flag (bit 31) */
if (psp_v12_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101), ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
0x80000000, 0x80000000, false); 0x80000000, 0x80000000, false);
else else
...@@ -495,7 +488,7 @@ static uint32_t psp_v12_0_ring_get_wptr(struct psp_context *psp) ...@@ -495,7 +488,7 @@ static uint32_t psp_v12_0_ring_get_wptr(struct psp_context *psp)
uint32_t data; uint32_t data;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v12_0_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
else else
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
...@@ -507,7 +500,7 @@ static void psp_v12_0_ring_set_wptr(struct psp_context *psp, uint32_t value) ...@@ -507,7 +500,7 @@ static void psp_v12_0_ring_set_wptr(struct psp_context *psp, uint32_t value)
{ {
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v12_0_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(adev)) {
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, GFX_CTRL_CMD_ID_CONSUME_CMD);
} else } else
......
...@@ -52,7 +52,6 @@ MODULE_FIRMWARE("amdgpu/vega12_asd.bin"); ...@@ -52,7 +52,6 @@ MODULE_FIRMWARE("amdgpu/vega12_asd.bin");
static uint32_t sos_old_versions[] = {1517616, 1510592, 1448594, 1446554}; static uint32_t sos_old_versions[] = {1517616, 1510592, 1448594, 1446554};
static bool psp_v3_1_support_vmr_ring(struct psp_context *psp);
static int psp_v3_1_ring_stop(struct psp_context *psp, static int psp_v3_1_ring_stop(struct psp_context *psp,
enum psp_ring_type ring_type); enum psp_ring_type ring_type);
...@@ -302,7 +301,7 @@ static int psp_v3_1_ring_create(struct psp_context *psp, ...@@ -302,7 +301,7 @@ static int psp_v3_1_ring_create(struct psp_context *psp,
psp_v3_1_reroute_ih(psp); psp_v3_1_reroute_ih(psp);
if (psp_v3_1_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(adev)) {
ret = psp_v3_1_ring_stop(psp, ring_type); ret = psp_v3_1_ring_stop(psp, ring_type);
if (ret) { if (ret) {
DRM_ERROR("psp_v3_1_ring_stop_sriov failed!\n"); DRM_ERROR("psp_v3_1_ring_stop_sriov failed!\n");
...@@ -360,34 +359,26 @@ static int psp_v3_1_ring_stop(struct psp_context *psp, ...@@ -360,34 +359,26 @@ static int psp_v3_1_ring_stop(struct psp_context *psp,
enum psp_ring_type ring_type) enum psp_ring_type ring_type)
{ {
int ret = 0; int ret = 0;
unsigned int psp_ring_reg = 0;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v3_1_support_vmr_ring(psp)) { /* Write the ring destroy command*/
/* Write the Destroy GPCOM ring command to C2PMSG_101 */ if (amdgpu_sriov_vf(adev))
psp_ring_reg = GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING; WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, psp_ring_reg); GFX_CTRL_CMD_ID_DESTROY_GPCOM_RING);
else
/* there might be handshake issue which needs delay */ WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64,
mdelay(20); GFX_CTRL_CMD_ID_DESTROY_RINGS);
/* Wait for response flag (bit 31) in C2PMSG_101 */
ret = psp_wait_for(psp,
SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
0x80000000, 0x80000000, false);
} else {
/* Write the ring destroy command to C2PMSG_64 */
psp_ring_reg = 3 << 16;
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_64, psp_ring_reg);
/* there might be handshake issue which needs delay */ /* there might be handshake issue with hardware which needs delay */
mdelay(20); mdelay(20);
/* Wait for response flag (bit 31) in C2PMSG_64 */ /* Wait for response flag (bit 31) */
ret = psp_wait_for(psp, if (amdgpu_sriov_vf(adev))
SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64), ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_101),
0x80000000, 0x80000000, false); 0x80000000, 0x80000000, false);
} else
ret = psp_wait_for(psp, SOC15_REG_OFFSET(MP0, 0, mmMP0_SMN_C2PMSG_64),
0x80000000, 0x80000000, false);
return ret; return ret;
} }
...@@ -575,20 +566,12 @@ static int psp_v3_1_mode1_reset(struct psp_context *psp) ...@@ -575,20 +566,12 @@ static int psp_v3_1_mode1_reset(struct psp_context *psp)
return 0; return 0;
} }
static bool psp_v3_1_support_vmr_ring(struct psp_context *psp)
{
if (amdgpu_sriov_vf(psp->adev))
return true;
return false;
}
static uint32_t psp_v3_1_ring_get_wptr(struct psp_context *psp) static uint32_t psp_v3_1_ring_get_wptr(struct psp_context *psp)
{ {
uint32_t data; uint32_t data;
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v3_1_support_vmr_ring(psp)) if (amdgpu_sriov_vf(adev))
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102);
else else
data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67); data = RREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_67);
...@@ -599,7 +582,7 @@ static void psp_v3_1_ring_set_wptr(struct psp_context *psp, uint32_t value) ...@@ -599,7 +582,7 @@ static void psp_v3_1_ring_set_wptr(struct psp_context *psp, uint32_t value)
{ {
struct amdgpu_device *adev = psp->adev; struct amdgpu_device *adev = psp->adev;
if (psp_v3_1_support_vmr_ring(psp)) { if (amdgpu_sriov_vf(adev)) {
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value); WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_102, value);
/* send interrupt to PSP for SRIOV ring write pointer update */ /* send interrupt to PSP for SRIOV ring write pointer update */
WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101, WREG32_SOC15(MP0, 0, mmMP0_SMN_C2PMSG_101,
...@@ -619,7 +602,6 @@ static const struct psp_funcs psp_v3_1_funcs = { ...@@ -619,7 +602,6 @@ static const struct psp_funcs psp_v3_1_funcs = {
.compare_sram_data = psp_v3_1_compare_sram_data, .compare_sram_data = psp_v3_1_compare_sram_data,
.smu_reload_quirk = psp_v3_1_smu_reload_quirk, .smu_reload_quirk = psp_v3_1_smu_reload_quirk,
.mode1_reset = psp_v3_1_mode1_reset, .mode1_reset = psp_v3_1_mode1_reset,
.support_vmr_ring = psp_v3_1_support_vmr_ring,
.ring_get_wptr = psp_v3_1_ring_get_wptr, .ring_get_wptr = psp_v3_1_ring_get_wptr,
.ring_set_wptr = psp_v3_1_ring_set_wptr, .ring_set_wptr = psp_v3_1_ring_set_wptr,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment