Skip to contentSkip to conversation

drm/amdgpu: Change nbio v7.9 xcp status definition

PATCH Superseded Lijo Lazar 3 participants 6 messages Jun 13, 2023 – Jun 14, 2023

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 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
index d19325476752..b033935d6749 100644
@@ -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
author
#1 lore raw

PATCH 2/3 drm/amdgpu: Use PSP FW API for partition switch

Use PSP firmware interface for switching compute partitions.

---
 .../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
index a595bb958215..16471b81a1f5 100644
@@ -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
index f5b8d3f388ff..9e3e4fcf344d 100644
@@ -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);
+	u32 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
author
#2 lore raw

PATCH 3/3 drm/amdgpu: Remove unused NBIO interface

In reply to Lijo Lazar

Set 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
index 095aecfb201e..8ab8ae01f87c 100644
@@ -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
index b033935d6749..cd1a02d30420 100644
@@ -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
maintainer Acked-by on v1 3/3
#3 lore raw

Re: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

[Public]

Series is:

________________________________
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, June 13, 2023 6:53 AM
To: [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Ma, Le <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

Set 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
index 095aecfb201e..8ab8ae01f87c 100644
@@ -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
index b033935d6749..cd1a02d30420 100644
@@ -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,
 };

--
2.25.1

maintainer Acked-by
#4 lore raw

Re: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

[Public]

Sorry, replied to the wrong rev of the patch. my AB applies to v2 as well.

Alex
________________________________
From: amd-gfx <[email protected]> on behalf of Deucher, Alexander <[email protected]>
Sent: Tuesday, June 13, 2023 9:25 AM
To: Lazar, Lijo <[email protected]>; [email protected] <[email protected]>
Cc: Ma, Le <[email protected]>; Kamal, Asad <[email protected]>; Zhang, Hawking <[email protected]>
Subject: Re: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

[Public]

[Public]

Series is:

________________________________
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, June 13, 2023 6:53 AM
To: [email protected] <[email protected]>
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Ma, Le <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

Set 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
index 095aecfb201e..8ab8ae01f87c 100644
@@ -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
index b033935d6749..cd1a02d30420 100644
@@ -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,
 };

--
2.25.1

#5 lore raw

RE: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

In reply to Lijo Lazar

[AMD Official Use Only - General]

Series is Reviewed-by: Le Ma <[email protected]>

Quoted 75 lines

-----Original Message-----
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, June 13, 2023 6:54 PM
To: [email protected]
Cc: Zhang, Hawking <[email protected]>; Deucher, Alexander <[email protected]>; Kamal, Asad <[email protected]>; Ma, Le <[email protected]>
Subject: [PATCH 3/3] drm/amdgpu: Remove unused NBIO interface

Set 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
index 095aecfb201e..8ab8ae01f87c 100644
@@ -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 -8
index b033935d6749..cd1a02d30420 100644
@@ -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,

drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +0 -3
-                         PARTITION_MODE, mode);
-
-     WREG32_SOC15(NBIO, 0,

regBIF_BX_PF0_PARTITION_COMPUTE_STATUS, tmp);

drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +0 -2
-}
-
 static u32 nbio_v7_9_get_memory_partition_mode(struct amdgpu_device

*adev,

                                             u32 *supp_modes)

{

drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c +0 -1
@@ -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,  };

--
2.25.1