drm/amdgpu: Change nbio v7.9 xcp status definition
Subsystems (2)
PATCH v2 1/3 drm/amdgpu: Change nbio v7.9 xcp status definition
PARTITION_MODE field in PARTITION_COMPUTE_STATUS register is defined as below by firmware.
SPX = 0, DPX = 1, TPX = 2, QPX = 3, CPX = 4
Change driver definition accordingly.
--- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +3 -5
@@ -390,7 +390,7 @@ static int nbio_v7_9_get_compute_partition_mode(struct amdgpu_device *adev) px =REG_GET_FIELD (tmp,BIF_BX_PF0_PARTITION_COMPUTE_STATUS ,PARTITION_MODE ); -return ffs (px); +return px; } static void nbio_v7_9_set_compute_partition_mode(struct amdgpu_device *adev,
@@ -398,12 +398,10 @@ static void nbio_v7_9_set_compute_partition_mode(struct amdgpu_device *adev, {u32 tmp; -/* Each bit represents DPX,TPX,QPX,CPX mode. No bit set means default -* SPX mode. -*/ +/* SPX=0, DPX=1, TPX=2, QPX=3, CPX=4 */ tmp =RREG32_SOC15 (NBIO ,0 , regBIF_BX_PF0_PARTITION_COMPUTE_STATUS); tmp =REG_SET_FIELD (tmp,BIF_BX_PF0_PARTITION_COMPUTE_STATUS , -PARTITION_MODE , mode ?BIT (mode -1 ) : mode); +PARTITION_MODE , mode);WREG32_SOC15 (NBIO ,0 , regBIF_BX_PF0_PARTITION_COMPUTE_STATUS, tmp); }
Signature · 1 line
2.25.1
PATCH v2 2/3 drm/amdgpu: Use PSP FW API for partition switch
Use PSP firmware interface for switching compute partitions.
---
v2:
Changed the return value to int
.../drm/amd/amdgpu/aqua_vanjaram_reg_init.c | 3 --- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 18 ++++++------------ 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c +0 -3
@@ -518,9 +518,6 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp); -if (adev->nbio.funcs->set_compute_partition_mode) - adev->nbio.funcs->set_compute_partition_mode (adev, mode); -/* Init info about new xcps */ *num_xcps = num_xcc / num_xcc_per_xcp;amdgpu_xcp_init (xcp_mgr, *num_xcps, mode);
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +6 -12
@@ -623,22 +623,16 @@ static void gfx_v9_4_3_select_me_pipe_q(struct amdgpu_device *adev,static int gfx_v9_4_3_switch_compute_partition (struct amdgpu_device *adev,int num_xccs_per_xcp) { -int i, num_xcc; -u32 tmp =0 ; - - num_xcc =NUM_XCC (adev->gfx.xcc_mask); +int ret; -for (i =0 ; i < num_xcc; i++) { - tmp =REG_SET_FIELD (tmp,CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP , - num_xccs_per_xcp); - tmp =REG_SET_FIELD (tmp,CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID , - i % num_xccs_per_xcp); -WREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL, tmp); - } + ret =psp_spatial_partition (&adev->psp,NUM_XCC (adev->gfx.xcc_mask) / + num_xccs_per_xcp); +if (ret) +return ret; adev->gfx.num_xcc_per_xcp = num_xccs_per_xcp; -return 0 ; +return ret; }static int gfx_v9_4_3_ih_to_xcc_inst (struct amdgpu_device *adev,int ih_node)
Signature · 1 line
2.25.1
RE: [PATCH v2 2/3] drm/amdgpu: Use PSP FW API for partition switch
[AMD Official Use Only - General]
Series is
Regards
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Lijo Lazar
Sent: Tuesday, June 13, 2023 19:03
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Ma, Le <[email protected]>; Kamal, Asad <[email protected]>; Zhang, Hawking <[email protected]>
Subject: [PATCH v2 2/3] drm/amdgpu: Use PSP FW API for partition switch
Use PSP firmware interface for switching compute partitions.
---
v2:
Changed the return value to int
.../drm/amd/amdgpu/aqua_vanjaram_reg_init.c | 3 --- drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 18 ++++++------------ 2 files changed, 6 insertions(+), 15 deletions(-)
drivers/gpu/drm/amd/amdgpu/aqua_vanjaram_reg_init.c +0 -3
@@ -518,9 +518,6 @@ static int aqua_vanjaram_switch_partition_mode(struct amdgpu_xcp_mgr *xcp_mgr, adev->gfx.funcs->switch_partition_mode (xcp_mgr->adev, num_xcc_per_xcp); -if (adev->nbio.funcs->set_compute_partition_mode) - adev->nbio.funcs->set_compute_partition_mode (adev, mode); -/* Init info about new xcps */ *num_xcps = num_xcc / num_xcc_per_xcp; amdgpu_xcp_init(xcp_mgr, *num_xcps, mode); diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
index f5b8d3f388ff..c1ee54d4c3d3 100644
drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c +6 -13
@@ -623,22 +623,16 @@ static void gfx_v9_4_3_select_me_pipe_q(struct amdgpu_device *adev, static int gfx_v9_4_3_switch_compute_partition(struct amdgpu_device *adev, int num_xccs_per_xcp) { -int i, num_xcc; -u32 tmp =0 ; - - num_xcc =NUM_XCC (adev->gfx.xcc_mask); +int ret; -for (i =0 ; i < num_xcc; i++) { - tmp =REG_SET_FIELD (tmp,CP_HYP_XCP_CTL ,NUM_XCC_IN_XCP , - num_xccs_per_xcp); - tmp =REG_SET_FIELD (tmp,CP_HYP_XCP_CTL ,VIRTUAL_XCC_ID , - i % num_xccs_per_xcp); -WREG32_SOC15 (GC ,GET_INST (GC , i), regCP_HYP_XCP_CTL, tmp); - } + ret =psp_spatial_partition (&adev->psp,NUM_XCC (adev->gfx.xcc_mask) / + num_xccs_per_xcp); +if (ret) +return ret; adev->gfx.num_xcc_per_xcp = num_xccs_per_xcp; -return 0 ; +return ret; }static int gfx_v9_4_3_ih_to_xcc_inst (struct amdgpu_device *adev,int ih_node) --
2.25.1
PATCH v2 3/3 drm/amdgpu: Remove unused NBIO interface
In reply to Lijo LazarSet compute partition mode interface in NBIO is no longer used. Remove the only implementation from NBIO v7.9
--- drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h | 2 -- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c | 14 -------------- 2 files changed, 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_nbio.h +0 -2
@@ -99,8 +99,6 @@ struct amdgpu_nbio_funcs {int (*get_compute_partition_mode)(struct amdgpu_device *adev);u32 (*get_memory_partition_mode)(struct amdgpu_device *adev,u32 *supp_modes); -void (*set_compute_partition_mode)(struct amdgpu_device *adev, -enum amdgpu_gfx_partition mode); };struct amdgpu_nbio {
drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +0 -14
@@ -393,19 +393,6 @@ static int nbio_v7_9_get_compute_partition_mode(struct amdgpu_device *adev)return px; } -static void nbio_v7_9_set_compute_partition_mode (struct amdgpu_device *adev, -enum amdgpu_gfx_partition mode) -{ -u32 tmp; - -/* SPX=0, DPX=1, TPX=2, QPX=3, CPX=4 */ - tmp =RREG32_SOC15 (NBIO ,0 , regBIF_BX_PF0_PARTITION_COMPUTE_STATUS); - tmp =REG_SET_FIELD (tmp,BIF_BX_PF0_PARTITION_COMPUTE_STATUS , -PARTITION_MODE , mode); - -WREG32_SOC15 (NBIO ,0 , regBIF_BX_PF0_PARTITION_COMPUTE_STATUS, tmp); -} -static u32 nbio_v7_9_get_memory_partition_mode (struct amdgpu_device *adev,u32 *supp_modes) {
@@ -461,7 +448,6 @@ const struct amdgpu_nbio_funcs nbio_v7_9_funcs = { .ih_control = nbio_v7_9_ih_control, .remap_hdp_registers = nbio_v7_9_remap_hdp_registers, .get_compute_partition_mode = nbio_v7_9_get_compute_partition_mode, - .set_compute_partition_mode = nbio_v7_9_set_compute_partition_mode, .get_memory_partition_mode = nbio_v7_9_get_memory_partition_mode, .init_registers = nbio_v7_9_init_registers, };
Signature · 1 line
2.25.1