Skip to contentSkip to conversation

drm/amdgpu: gfx off support

PATCH In review Huang Rui 4 participants 27 messages Apr 19, 2018 – Apr 20, 2018 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Huang Rui

author
#0 lore raw

cover drm/amdgpu: gfx off support

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

	$ make clean
	$ make REAL_CGPG=1
2. Faked CGPG: (by default)
	$ make clean
	$ make	

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
 drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
 include/uapi/drm/amdgpu_drm.h                     |   6 +
 20 files changed, 447 insertions(+), 129 deletions(-)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1524097356-4974-1-git-send-email-ray.huang-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 1/20 drm/amdgpu: update psp gfx if header

---
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h | 67 ++++++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 21 deletions(-)
drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h +46 -21
index 8da6da9..0cf48d2 100644
@@ -40,11 +40,20 @@ enum psp_gfx_crtl_cmd_id
     GFX_CTRL_CMD_ID_INIT_GPCOM_RING = 0x00020000,   /* initialize GPCOM ring */
     GFX_CTRL_CMD_ID_DESTROY_RINGS   = 0x00030000,   /* destroy rings */
     GFX_CTRL_CMD_ID_CAN_INIT_RINGS  = 0x00040000,   /* is it allowed to initialized the rings */
+    GFX_CTRL_CMD_ID_ENABLE_INT      = 0x00050000,   /* enable PSP-to-Gfx interrupt */
+    GFX_CTRL_CMD_ID_DISABLE_INT     = 0x00060000,   /* disable PSP-to-Gfx interrupt */
+    GFX_CTRL_CMD_ID_MODE1_RST       = 0x00070000,   /* trigger the Mode 1 reset */
 
     GFX_CTRL_CMD_ID_MAX             = 0x000F0000,   /* max command ID */
 };
 
 
+/*-----------------------------------------------------------------------------
+    NOTE:   All physical addresses used in this interface are actually
+            GPU Virtual Addresses.
+*/
+
+
 /* Control registers of the TEE Gfx interface. These are located in
 *  SRBM-to-PSP mailbox registers (total 8 registers).
 */
@@ -55,8 +64,8 @@ struct psp_gfx_ctrl
     volatile uint32_t   rbi_rptr;         /* +8   Read pointer (index) of RBI ring */
     volatile uint32_t   gpcom_wptr;       /* +12  Write pointer (index) of GPCOM ring */
     volatile uint32_t   gpcom_rptr;       /* +16  Read pointer (index) of GPCOM ring */
-    volatile uint32_t   ring_addr_lo;     /* +20  bits [31:0] of physical address of ring buffer */
-    volatile uint32_t   ring_addr_hi;     /* +24  bits [63:32] of physical address of ring buffer */
+    volatile uint32_t   ring_addr_lo;     /* +20  bits [31:0] of GPU Virtual of ring buffer (VMID=0)*/
+    volatile uint32_t   ring_addr_hi;     /* +24  bits [63:32] of GPU Virtual of ring buffer (VMID=0) */
     volatile uint32_t   ring_buf_size;    /* +28  Ring buffer size (in bytes) */
 
 };
@@ -78,6 +87,8 @@ enum psp_gfx_cmd_id
     GFX_CMD_ID_LOAD_ASD     = 0x00000004,   /* load ASD Driver */
     GFX_CMD_ID_SETUP_TMR    = 0x00000005,   /* setup TMR region */
     GFX_CMD_ID_LOAD_IP_FW   = 0x00000006,   /* load HW IP FW */
+    GFX_CMD_ID_DESTROY_TMR  = 0x00000007,   /* destroy TMR region */
+    GFX_CMD_ID_SAVE_RESTORE = 0x00000008,   /* save/restore HW IP FW */
 
 };
 
@@ -85,11 +96,11 @@ enum psp_gfx_cmd_id
 /* Command to load Trusted Application binary into PSP OS. */
 struct psp_gfx_cmd_load_ta
 {
-    uint32_t        app_phy_addr_lo;        /* bits [31:0] of the physical address of the TA binary (must be 4 KB aligned) */
-    uint32_t        app_phy_addr_hi;        /* bits [63:32] of the physical address of the TA binary */
+    uint32_t        app_phy_addr_lo;        /* bits [31:0] of the GPU Virtual address of the TA binary (must be 4 KB aligned) */
+    uint32_t        app_phy_addr_hi;        /* bits [63:32] of the GPU Virtual address of the TA binary */
     uint32_t        app_len;                /* length of the TA binary in bytes */
-    uint32_t        cmd_buf_phy_addr_lo;    /* bits [31:0] of the physical address of CMD buffer (must be 4 KB aligned) */
-    uint32_t        cmd_buf_phy_addr_hi;    /* bits [63:32] of the physical address of CMD buffer */
+    uint32_t        cmd_buf_phy_addr_lo;    /* bits [31:0] of the GPU Virtual address of CMD buffer (must be 4 KB aligned) */
+    uint32_t        cmd_buf_phy_addr_hi;    /* bits [63:32] of the GPU Virtual address of CMD buffer */
     uint32_t        cmd_buf_len;            /* length of the CMD buffer in bytes; must be multiple of 4 KB */
 
     /* Note: CmdBufLen can be set to 0. In this case no persistent CMD buffer is provided
@@ -111,8 +122,8 @@ struct psp_gfx_cmd_unload_ta
 */
 struct psp_gfx_buf_desc
 {
-    uint32_t        buf_phy_addr_lo;       /* bits [31:0] of physical address of the buffer (must be 4 KB aligned) */
-    uint32_t        buf_phy_addr_hi;       /* bits [63:32] of physical address of the buffer */
+    uint32_t        buf_phy_addr_lo;       /* bits [31:0] of GPU Virtual address of the buffer (must be 4 KB aligned) */
+    uint32_t        buf_phy_addr_hi;       /* bits [63:32] of GPU Virtual address of the buffer */
     uint32_t        buf_size;              /* buffer size in bytes (must be multiple of 4 KB and no bigger than 64 MB) */
 
 };
@@ -145,8 +156,8 @@ struct psp_gfx_cmd_invoke_cmd
 /* Command to setup TMR region. */
 struct psp_gfx_cmd_setup_tmr
 {
-    uint32_t        buf_phy_addr_lo;       /* bits [31:0] of physical address of TMR buffer (must be 4 KB aligned) */
-    uint32_t        buf_phy_addr_hi;       /* bits [63:32] of physical address of TMR buffer */
+    uint32_t        buf_phy_addr_lo;       /* bits [31:0] of GPU Virtual address of TMR buffer (must be 4 KB aligned) */
+    uint32_t        buf_phy_addr_hi;       /* bits [63:32] of GPU Virtual address of TMR buffer */
     uint32_t        buf_size;              /* buffer size in bytes (must be multiple of 4 KB) */
 
 };
@@ -174,18 +185,32 @@ enum psp_gfx_fw_type
     GFX_FW_TYPE_ISP         = 16,
     GFX_FW_TYPE_ACP         = 17,
     GFX_FW_TYPE_SMU         = 18,
+    GFX_FW_TYPE_MMSCH       = 19,
+    GFX_FW_TYPE_RLC_RESTORE_LIST_GPM_MEM        = 20,
+    GFX_FW_TYPE_RLC_RESTORE_LIST_SRM_MEM        = 21,
+    GFX_FW_TYPE_RLC_RESTORE_LIST_CNTL           = 22,
+    GFX_FW_TYPE_MAX         = 23
 };
 
 /* Command to load HW IP FW. */
 struct psp_gfx_cmd_load_ip_fw
 {
-    uint32_t                fw_phy_addr_lo;    /* bits [31:0] of physical address of FW location (must be 4 KB aligned) */
-    uint32_t                fw_phy_addr_hi;    /* bits [63:32] of physical address of FW location */
+    uint32_t                fw_phy_addr_lo;    /* bits [31:0] of GPU Virtual address of FW location (must be 4 KB aligned) */
+    uint32_t                fw_phy_addr_hi;    /* bits [63:32] of GPU Virtual address of FW location */
     uint32_t                fw_size;           /* FW buffer size in bytes */
     enum psp_gfx_fw_type    fw_type;           /* FW type */
 
 };
 
+/* Command to save/restore HW IP FW. */
+struct psp_gfx_cmd_save_restore_ip_fw
+{
+    uint32_t                save_fw;              /* if set, command is used for saving fw otherwise for resetoring*/
+    uint32_t                save_restore_addr_lo; /* bits [31:0] of FB address of GART memory used as save/restore buffer (must be 4 KB aligned) */
+    uint32_t                save_restore_addr_hi; /* bits [63:32] of FB address of GART memory used as save/restore buffer */
+    uint32_t                buf_size;             /* Size of the save/restore buffer in bytes */
+    enum psp_gfx_fw_type    fw_type;              /* FW type */
+};
 
 /* All GFX ring buffer commands. */
 union psp_gfx_commands
@@ -195,7 +220,7 @@ union psp_gfx_commands
     struct psp_gfx_cmd_invoke_cmd       cmd_invoke_cmd;
     struct psp_gfx_cmd_setup_tmr        cmd_setup_tmr;
     struct psp_gfx_cmd_load_ip_fw       cmd_load_ip_fw;
-
+    struct psp_gfx_cmd_save_restore_ip_fw cmd_save_restore_ip_fw;
 };
 
 
@@ -226,8 +251,8 @@ struct psp_gfx_cmd_resp
 
     /* These fields are used for RBI only. They are all 0 in GPCOM commands
     */
-    uint32_t        resp_buf_addr_lo;   /* +12 bits [31:0] of physical address of response buffer (must be 4 KB aligned) */
-    uint32_t        resp_buf_addr_hi;   /* +16 bits [63:32] of physical address of response buffer */
+    uint32_t        resp_buf_addr_lo;   /* +12 bits [31:0] of GPU Virtual address of response buffer (must be 4 KB aligned) */
+    uint32_t        resp_buf_addr_hi;   /* +16 bits [63:32] of GPU Virtual address of response buffer */
     uint32_t        resp_offset;        /* +20 offset within response buffer */
     uint32_t        resp_buf_size;      /* +24 total size of the response buffer in bytes */
 
@@ -251,19 +276,19 @@ struct psp_gfx_cmd_resp
 /* Structure of the Ring Buffer Frame */
 struct psp_gfx_rb_frame
 {
-    uint32_t    cmd_buf_addr_lo;    /* +0  bits [31:0] of physical address of command buffer (must be 4 KB aligned) */
-    uint32_t    cmd_buf_addr_hi;    /* +4  bits [63:32] of physical address of command buffer */
+    uint32_t    cmd_buf_addr_lo;    /* +0  bits [31:0] of GPU Virtual address of command buffer (must be 4 KB aligned) */
+    uint32_t    cmd_buf_addr_hi;    /* +4  bits [63:32] of GPU Virtual address of command buffer */
     uint32_t    cmd_buf_size;       /* +8  command buffer size in bytes */
-    uint32_t    fence_addr_lo;      /* +12 bits [31:0] of physical address of Fence for this frame */
-    uint32_t    fence_addr_hi;      /* +16 bits [63:32] of physical address of Fence for this frame */
+    uint32_t    fence_addr_lo;      /* +12 bits [31:0] of GPU Virtual address of Fence for this frame */
+    uint32_t    fence_addr_hi;      /* +16 bits [63:32] of GPU Virtual address of Fence for this frame */
     uint32_t    fence_value;        /* +20 Fence value */
     uint32_t    sid_lo;             /* +24 bits [31:0] of SID value (used only for RBI frames) */
     uint32_t    sid_hi;             /* +28 bits [63:32] of SID value (used only for RBI frames) */
     uint8_t     vmid;               /* +32 VMID value used for mapping of all addresses for this frame */
     uint8_t     frame_type;         /* +33 1: destory context frame, 0: all other frames; used only for RBI frames */
     uint8_t     reserved1[2];       /* +34 reserved, must be 0 */
-    uint32_t    reserved2[7];       /* +40 reserved, must be 0 */
-    /* total 64 bytes */
+    uint32_t    reserved2[7];       /* +36 reserved, must be 0 */
+                /* total 64 bytes */
 };
 
 #endif /* _PSP_TEE_GFX_IF_H_ */
Signature · 6 lines
2.7.4

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

PATCH 2/20 drm/amdgpu: add new rlc firmware header format v2.1

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 34 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h | 19 +++++++++++++++++
 2 files changed, 51 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +32 -2
index dd6f989..84d6525 100644
@@ -161,8 +161,38 @@ void amdgpu_ucode_print_rlc_hdr(const struct common_firmware_header *hdr)
 			  le32_to_cpu(rlc_hdr->reg_list_format_separate_array_offset_bytes));
 		DRM_DEBUG("reg_list_separate_size_bytes: %u\n",
 			  le32_to_cpu(rlc_hdr->reg_list_separate_size_bytes));
-		DRM_DEBUG("reg_list_separate_size_bytes: %u\n",
-			  le32_to_cpu(rlc_hdr->reg_list_separate_size_bytes));
+		DRM_DEBUG("reg_list_separate_array_offset_bytes: %u\n",
+			  le32_to_cpu(rlc_hdr->reg_list_separate_array_offset_bytes));
+		if (version_minor == 1) {
+			const struct rlc_firmware_header_v2_1 *v2_1 =
+				container_of(rlc_hdr, struct rlc_firmware_header_v2_1, v2_0);
+			DRM_DEBUG("reg_list_format_direct_reg_list_length: %u\n",
+				  le32_to_cpu(v2_1->reg_list_format_direct_reg_list_length));
+			DRM_DEBUG("save_restore_list_cntl_ucode_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_cntl_ucode_ver));
+			DRM_DEBUG("save_restore_list_cntl_feature_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_cntl_feature_ver));
+			DRM_DEBUG("save_restore_list_cntl_size_bytes %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_cntl_size_bytes));
+			DRM_DEBUG("save_restore_list_cntl_offset_bytes: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_cntl_offset_bytes));
+			DRM_DEBUG("save_restore_list_gpm_ucode_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_gpm_ucode_ver));
+			DRM_DEBUG("save_restore_list_gpm_feature_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_gpm_feature_ver));
+			DRM_DEBUG("save_restore_list_gpm_size_bytes %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_gpm_size_bytes));
+			DRM_DEBUG("save_restore_list_gpm_offset_bytes: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_gpm_offset_bytes));
+			DRM_DEBUG("save_restore_list_srm_ucode_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_srm_ucode_ver));
+			DRM_DEBUG("save_restore_list_srm_feature_ver: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_srm_feature_ver));
+			DRM_DEBUG("save_restore_list_srm_size_bytes %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_srm_size_bytes));
+			DRM_DEBUG("save_restore_list_srm_offset_bytes: %u\n",
+				  le32_to_cpu(v2_1->save_restore_list_srm_offset_bytes));
+		}
 	} else {
 		DRM_ERROR("Unknown RLC ucode version: %u.%u\n", version_major, version_minor);
 	}
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +19 -0
index 30b5500..0b262f4 100644
@@ -98,6 +98,24 @@ struct rlc_firmware_header_v2_0 {
 	uint32_t reg_list_separate_array_offset_bytes; /* payload offset from the start of the header */
 };
 
+/* version_major=2, version_minor=1 */
+struct rlc_firmware_header_v2_1 {
+	struct rlc_firmware_header_v2_0 v2_0;
+	uint32_t reg_list_format_direct_reg_list_length; /* length of direct reg list format array */
+	uint32_t save_restore_list_cntl_ucode_ver;
+	uint32_t save_restore_list_cntl_feature_ver;
+	uint32_t save_restore_list_cntl_size_bytes;
+	uint32_t save_restore_list_cntl_offset_bytes;
+	uint32_t save_restore_list_gpm_ucode_ver;
+	uint32_t save_restore_list_gpm_feature_ver;
+	uint32_t save_restore_list_gpm_size_bytes;
+	uint32_t save_restore_list_gpm_offset_bytes;
+	uint32_t save_restore_list_srm_ucode_ver;
+	uint32_t save_restore_list_srm_feature_ver;
+	uint32_t save_restore_list_srm_size_bytes;
+	uint32_t save_restore_list_srm_offset_bytes;
+};
+
 /* version_major=1, version_minor=0 */
 struct sdma_firmware_header_v1_0 {
 	struct common_firmware_header header;
@@ -148,6 +166,7 @@ union amdgpu_firmware_header {
 	struct gfx_firmware_header_v1_0 gfx;
 	struct rlc_firmware_header_v1_0 rlc;
 	struct rlc_firmware_header_v2_0 rlc_v2_0;
+	struct rlc_firmware_header_v2_1 rlc_v2_1;
 	struct sdma_firmware_header_v1_0 sdma;
 	struct sdma_firmware_header_v1_1 sdma_v1_1;
 	struct gpu_info_firmware_header_v1_0 gpu_info;
Signature · 6 lines
2.7.4

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

PATCH 3/20 drm/amdgpu: add save restore list cntl gpm and srm firmware support

In reply to a message not in the archive

RLC save/restore list cntl/gpm_mem/srm_mem ucodes are used for CGPG and gfxoff function.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h       | 15 +++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c   | 36 ++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 17 +++++++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h |  3 ++
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c     | 55 +++++++++++++++++++++++++++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c    |  9 +++++
 include/uapi/drm/amdgpu_drm.h             |  6 ++++
 7 files changed, 138 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +15 -0
index f5b2ec2..bed1f5d 100644
@@ -774,9 +774,18 @@ struct amdgpu_rlc {
 	u32 starting_offsets_start;
 	u32 reg_list_format_size_bytes;
 	u32 reg_list_size_bytes;
+	u32 reg_list_format_direct_reg_list_length;
+	u32 save_restore_list_cntl_size_bytes;
+	u32 save_restore_list_gpm_size_bytes;
+	u32 save_restore_list_srm_size_bytes;
 
 	u32 *register_list_format;
 	u32 *register_restore;
+	u8 *save_restore_list_cntl;
+	u8 *save_restore_list_gpm;
+	u8 *save_restore_list_srm;
+
+	bool is_rlc_v2_1;
 };
 
 #define AMDGPU_MAX_COMPUTE_QUEUES KGD_MAX_QUEUES
@@ -943,6 +952,12 @@ struct amdgpu_gfx {
 	uint32_t			ce_feature_version;
 	uint32_t			pfp_feature_version;
 	uint32_t			rlc_feature_version;
+	uint32_t			rlc_srlc_fw_version;
+	uint32_t			rlc_srlc_feature_version;
+	uint32_t			rlc_srlg_fw_version;
+	uint32_t			rlc_srlg_feature_version;
+	uint32_t			rlc_srls_fw_version;
+	uint32_t			rlc_srls_feature_version;
 	uint32_t			mec_feature_version;
 	uint32_t			mec2_feature_version;
 	struct amdgpu_ring		gfx_ring[AMDGPU_MAX_GFX_RINGS];
drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +36 -0
index f059d8e..6d55cae 100644
@@ -215,6 +215,18 @@ static int amdgpu_firmware_info(struct drm_amdgpu_info_firmware *fw_info,
 		fw_info->ver = adev->gfx.rlc_fw_version;
 		fw_info->feature = adev->gfx.rlc_feature_version;
 		break;
+	case AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL:
+		fw_info->ver = adev->gfx.rlc_srlc_fw_version;
+		fw_info->feature = adev->gfx.rlc_srlc_feature_version;
+		break;
+	case AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM:
+		fw_info->ver = adev->gfx.rlc_srlg_fw_version;
+		fw_info->feature = adev->gfx.rlc_srlg_feature_version;
+		break;
+	case AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM:
+		fw_info->ver = adev->gfx.rlc_srls_fw_version;
+		fw_info->feature = adev->gfx.rlc_srls_feature_version;
+		break;
 	case AMDGPU_INFO_FW_GFX_MEC:
 		if (query_fw->index == 0) {
 			fw_info->ver = adev->gfx.mec_fw_version;
@@ -1150,6 +1162,30 @@ static int amdgpu_debugfs_firmware_info(struct seq_file *m, void *data)
 	seq_printf(m, "RLC feature version: %u, firmware version: 0x%08x\n",
 		   fw_info.feature, fw_info.ver);
 
+	/* RLC SAVE RESTORE LIST CNTL */
+	query_fw.fw_type = AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL;
+	ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
+	if (ret)
+		return ret;
+	seq_printf(m, "RLC SRLC feature version: %u, firmware version: 0x%08x\n",
+		   fw_info.feature, fw_info.ver);
+
+	/* RLC SAVE RESTORE LIST GPM MEM */
+	query_fw.fw_type = AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM;
+	ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
+	if (ret)
+		return ret;
+	seq_printf(m, "RLC SRLG feature version: %u, firmware version: 0x%08x\n",
+		   fw_info.feature, fw_info.ver);
+
+	/* RLC SAVE RESTORE LIST SRM MEM */
+	query_fw.fw_type = AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM;
+	ret = amdgpu_firmware_info(&fw_info, &query_fw, adev);
+	if (ret)
+		return ret;
+	seq_printf(m, "RLC SRLS feature version: %u, firmware version: 0x%08x\n",
+		   fw_info.feature, fw_info.ver);
+
 	/* MEC */
 	query_fw.fw_type = AMDGPU_INFO_FW_GFX_MEC;
 	query_fw.index = 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +16 -1
index 84d6525..0c74c09 100644
@@ -337,7 +337,10 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
 	    (ucode->ucode_id != AMDGPU_UCODE_ID_CP_MEC1 &&
 	     ucode->ucode_id != AMDGPU_UCODE_ID_CP_MEC2 &&
 	     ucode->ucode_id != AMDGPU_UCODE_ID_CP_MEC1_JT &&
-	     ucode->ucode_id != AMDGPU_UCODE_ID_CP_MEC2_JT)) {
+	     ucode->ucode_id != AMDGPU_UCODE_ID_CP_MEC2_JT &&
+	     ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL &&
+	     ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM &&
+	     ucode->ucode_id != AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM)) {
 		ucode->ucode_size = le32_to_cpu(header->ucode_size_bytes);
 
 		memcpy(ucode->kaddr, (void *)((uint8_t *)ucode->fw->data +
@@ -359,6 +362,18 @@ static int amdgpu_ucode_init_single_fw(struct amdgpu_device *adev,
 					      le32_to_cpu(header->ucode_array_offset_bytes) +
 					      le32_to_cpu(cp_hdr->jt_offset) * 4),
 		       ucode->ucode_size);
+	} else if (ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL) {
+		ucode->ucode_size = adev->gfx.rlc.save_restore_list_cntl_size_bytes;
+		memcpy(ucode->kaddr, adev->gfx.rlc.save_restore_list_cntl,
+		       ucode->ucode_size);
+	} else if (ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM) {
+		ucode->ucode_size = adev->gfx.rlc.save_restore_list_gpm_size_bytes;
+		memcpy(ucode->kaddr, adev->gfx.rlc.save_restore_list_gpm,
+		       ucode->ucode_size);
+	} else if (ucode->ucode_id == AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM) {
+		ucode->ucode_size = adev->gfx.rlc.save_restore_list_srm_size_bytes;
+		memcpy(ucode->kaddr, adev->gfx.rlc.save_restore_list_srm,
+		       ucode->ucode_size);
 	}
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h +3 -0
index 0b262f4..08e3857 100644
@@ -187,6 +187,9 @@ enum AMDGPU_UCODE_ID {
 	AMDGPU_UCODE_ID_CP_MEC2,
 	AMDGPU_UCODE_ID_CP_MEC2_JT,
 	AMDGPU_UCODE_ID_RLC_G,
+	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL,
+	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM,
+	AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM,
 	AMDGPU_UCODE_ID_STORAGE,
 	AMDGPU_UCODE_ID_SMC,
 	AMDGPU_UCODE_ID_UVD,
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +53 -2

97 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/psp_v10_0.c +9 -0
index 8873d83..0ff136d 100644
@@ -70,6 +70,15 @@ psp_v10_0_get_fw_type(struct amdgpu_firmware_info *ucode, enum psp_gfx_fw_type *
 	case AMDGPU_UCODE_ID_RLC_G:
 		*type = GFX_FW_TYPE_RLC_G;
 		break;
+	case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_CNTL:
+		*type = GFX_FW_TYPE_RLC_RESTORE_LIST_CNTL;
+		break;
+	case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_GPM_MEM:
+		*type = GFX_FW_TYPE_RLC_RESTORE_LIST_GPM_MEM;
+		break;
+	case AMDGPU_UCODE_ID_RLC_RESTORE_LIST_SRM_MEM:
+		*type = GFX_FW_TYPE_RLC_RESTORE_LIST_SRM_MEM;
+		break;
 	case AMDGPU_UCODE_ID_SMC:
 		*type = GFX_FW_TYPE_SMU;
 		break;
include/uapi/drm/amdgpu_drm.h +6 -0
index 0087799..2525194 100644
@@ -623,6 +623,12 @@ struct drm_amdgpu_cs_chunk_data {
 	#define AMDGPU_INFO_FW_ASD		0x0d
 	/* Subquery id: Query VCN firmware version */
 	#define AMDGPU_INFO_FW_VCN		0x0e
+	/* Subquery id: Query GFX RLC SRLC firmware version */
+	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f
+	/* Subquery id: Query GFX RLC SRLG firmware version */
+	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10
+	/* Subquery id: Query GFX RLC SRLS firmware version */
+	#define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
 /* number of bytes moved for TTM migration */
 #define AMDGPU_INFO_NUM_BYTES_MOVED		0x0f
 /* the used VRAM size */
Signature · 6 lines
2.7.4

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

PATCH 4/20 drm/amdgpu: enter rlc safe mode before set cgpg

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -4
index f0ff604..537d624 100644
@@ -3391,8 +3391,7 @@ static void gfx_v9_0_exit_rlc_safe_mode(struct amdgpu_device *adev)
 static void gfx_v9_0_update_gfx_cg_power_gating(struct amdgpu_device *adev,
 						bool enable)
 {
-	/* TODO: double check if we need to perform under safe mdoe */
-	/* gfx_v9_0_enter_rlc_safe_mode(adev); */
+	gfx_v9_0_enter_rlc_safe_mode(adev);
 
 	if ((adev->pg_flags & AMD_PG_SUPPORT_GFX_PG) && enable) {
 		gfx_v9_0_enable_gfx_cg_power_gating(adev, true);
@@ -3403,7 +3402,7 @@ static void gfx_v9_0_update_gfx_cg_power_gating(struct amdgpu_device *adev,
 		gfx_v9_0_enable_gfx_pipeline_powergating(adev, false);
 	}
 
-	/* gfx_v9_0_exit_rlc_safe_mode(adev); */
+	gfx_v9_0_exit_rlc_safe_mode(adev);
 }
 
 static void gfx_v9_0_update_gfx_mg_power_gating(struct amdgpu_device *adev,
@@ -3794,7 +3793,7 @@ static void gfx_v9_0_ring_emit_ib_gfx(struct amdgpu_ring *ring,
 	}
 
 	amdgpu_ring_write(ring, header);
-BUG_ON(ib->gpu_addr & 0x3); /* Dword align */
+	BUG_ON(ib->gpu_addr & 0x3); /* Dword align */
 	amdgpu_ring_write(ring,
 #ifdef __BIG_ENDIAN
 		(2 << 0) |
Signature · 6 lines
2.7.4

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

PATCH 5/20 drm/amdgpu: cleanup init power gating function

In reply to a message not in the archive

Remove gfx_v9_0_enable_sck_slow_down_on_power_up/down and CP power gating enabling functions because they only need to be called on setting power gating behavior. We keep it in set_powergating callback to enable/disable PG in late_init.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +6 -18
index 537d624..6387fda 100644
@@ -2062,6 +2062,9 @@ static void gfx_v9_0_enable_gfx_dynamic_mg_power_gating(struct amdgpu_device *ad
 
 static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 {
+	if (!adev->gfx.rlc.is_rlc_v2_1)
+		return;
+
 	if (adev->pg_flags & (AMD_PG_SUPPORT_GFX_PG |
 			      AMD_PG_SUPPORT_GFX_SMG |
 			      AMD_PG_SUPPORT_GFX_DMG |
@@ -2072,24 +2075,9 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 		gfx_v9_0_init_rlc_save_restore_list(adev);
 		gfx_v9_0_enable_save_restore_machine(adev);
 
-		if (adev->asic_type == CHIP_RAVEN) {
-			WREG32(mmRLC_JUMP_TABLE_RESTORE,
-				adev->gfx.rlc.cp_table_gpu_addr >> 8);
-			gfx_v9_0_init_gfx_power_gating(adev);
-
-			if (adev->pg_flags & AMD_PG_SUPPORT_RLC_SMU_HS) {
-				gfx_v9_0_enable_sck_slow_down_on_power_up(adev, true);
-				gfx_v9_0_enable_sck_slow_down_on_power_down(adev, true);
-			} else {
-				gfx_v9_0_enable_sck_slow_down_on_power_up(adev, false);
-				gfx_v9_0_enable_sck_slow_down_on_power_down(adev, false);
-			}
-
-			if (adev->pg_flags & AMD_PG_SUPPORT_CP)
-				gfx_v9_0_enable_cp_power_gating(adev, true);
-			else
-				gfx_v9_0_enable_cp_power_gating(adev, false);
-		}
+		WREG32(mmRLC_JUMP_TABLE_RESTORE,
+		       adev->gfx.rlc.cp_table_gpu_addr >> 8);
+		gfx_v9_0_init_gfx_power_gating(adev);
 	}
 }
 
Signature · 6 lines
2.7.4

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

PATCH 6/20 drm/amdgpu: revise init_rlc_save_restore_list behavior to support latest register_list_format/register_restore table

In reply to a message not in the archive

RLC save/restore list will be used on CGPG and GFXOFF function, it loads two bin table of register_list_format/register_restore in RLC firmware.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 141 +++++++++++++++++++++-------------
 1 file changed, 87 insertions(+), 54 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +87 -54
index 6387fda..5e3ddd5 100644
@@ -184,6 +184,30 @@ static const struct soc15_reg_golden golden_settings_gc_9_2_1_vg12[] =
 	SOC15_REG_GOLDEN_VALUE(GC, 0, mmTD_CNTL, 0x01bd9f33, 0x01000000)
 };
 
+static const u32 GFX_RLC_SRM_INDEX_CNTL_ADDR_OFFSETS[] =
+{
+	mmRLC_SRM_INDEX_CNTL_ADDR_0 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_1 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_2 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_3 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_4 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_5 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_6 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+	mmRLC_SRM_INDEX_CNTL_ADDR_7 - mmRLC_SRM_INDEX_CNTL_ADDR_0,
+};
+
+static const u32 GFX_RLC_SRM_INDEX_CNTL_DATA_OFFSETS[] =
+{
+	mmRLC_SRM_INDEX_CNTL_DATA_0 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_1 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_2 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_3 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_4 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_5 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_6 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+	mmRLC_SRM_INDEX_CNTL_DATA_7 - mmRLC_SRM_INDEX_CNTL_DATA_0,
+};
+
 #define VEGA10_GB_ADDR_CONFIG_GOLDEN 0x2a114042
 #define VEGA12_GB_ADDR_CONFIG_GOLDEN 0x24104041
 #define RAVEN_GB_ADDR_CONFIG_GOLDEN 0x24000042
@@ -1760,55 +1784,42 @@ static void gfx_v9_0_init_csb(struct amdgpu_device *adev)
 			adev->gfx.rlc.clear_state_size);
 }
 
-static void gfx_v9_0_parse_ind_reg_list(int *register_list_format,
+static void gfx_v9_1_parse_ind_reg_list(int *register_list_format,
 				int indirect_offset,
 				int list_size,
 				int *unique_indirect_regs,
 				int *unique_indirect_reg_count,
-				int max_indirect_reg_count,
 				int *indirect_start_offsets,
-				int *indirect_start_offsets_count,
-				int max_indirect_start_offsets_count)
+				int *indirect_start_offsets_count)
 {
 	int idx;
-	bool new_entry = true;
 
 	for (; indirect_offset < list_size; indirect_offset++) {
+		indirect_start_offsets[*indirect_start_offsets_count] = indirect_offset;
+		*indirect_start_offsets_count = *indirect_start_offsets_count + 1;
 
-		if (new_entry) {
-			new_entry = false;
-			indirect_start_offsets[*indirect_start_offsets_count] = indirect_offset;
-			*indirect_start_offsets_count = *indirect_start_offsets_count + 1;
-			BUG_ON(*indirect_start_offsets_count >= max_indirect_start_offsets_count);
-		}
+		while (register_list_format[indirect_offset] != 0xFFFFFFFF) {
+			indirect_offset += 2;
 
-		if (register_list_format[indirect_offset] == 0xFFFFFFFF) {
-			new_entry = true;
-			continue;
-		}
+			/* look for the matching indice */
+			for (idx = 0; idx < *unique_indirect_reg_count; idx++) {
+				if (unique_indirect_regs[idx] ==
+					register_list_format[indirect_offset] ||
+					!unique_indirect_regs[idx])
+					break;
+			}
 
-		indirect_offset += 2;
+			BUG_ON(idx >= *unique_indirect_reg_count);
 
-		/* look for the matching indice */
-		for (idx = 0; idx < *unique_indirect_reg_count; idx++) {
-			if (unique_indirect_regs[idx] ==
-				register_list_format[indirect_offset])
-				break;
-		}
+			if (!unique_indirect_regs[idx])
+				unique_indirect_regs[idx] = register_list_format[indirect_offset];
 
-		if (idx >= *unique_indirect_reg_count) {
-			unique_indirect_regs[*unique_indirect_reg_count] =
-				register_list_format[indirect_offset];
-			idx = *unique_indirect_reg_count;
-			*unique_indirect_reg_count = *unique_indirect_reg_count + 1;
-			BUG_ON(*unique_indirect_reg_count >= max_indirect_reg_count);
+			indirect_offset++;
 		}
-
-		register_list_format[indirect_offset] = idx;
 	}
 }
 
-static int gfx_v9_0_init_rlc_save_restore_list(struct amdgpu_device *adev)
+static int gfx_v9_1_init_rlc_save_restore_list(struct amdgpu_device *adev)
 {
 	int unique_indirect_regs[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0};
 	int unique_indirect_reg_count = 0;
@@ -1817,7 +1828,7 @@ static int gfx_v9_0_init_rlc_save_restore_list(struct amdgpu_device *adev)
 	int indirect_start_offsets_count = 0;
 
 	int list_size = 0;
-	int i = 0;
+	int i = 0, j = 0;
 	u32 tmp = 0;
 
 	u32 *register_list_format =
@@ -1828,15 +1839,14 @@ static int gfx_v9_0_init_rlc_save_restore_list(struct amdgpu_device *adev)
 		adev->gfx.rlc.reg_list_format_size_bytes);
 
 	/* setup unique_indirect_regs array and indirect_start_offsets array */
-	gfx_v9_0_parse_ind_reg_list(register_list_format,
-				adev->gfx.rlc.reg_list_format_direct_reg_list_length,
-				adev->gfx.rlc.reg_list_format_size_bytes >> 2,
-				unique_indirect_regs,
-				&unique_indirect_reg_count,
-				ARRAY_SIZE(unique_indirect_regs),
-				indirect_start_offsets,
-				&indirect_start_offsets_count,
-				ARRAY_SIZE(indirect_start_offsets));
+	unique_indirect_reg_count = ARRAY_SIZE(unique_indirect_regs);
+	gfx_v9_1_parse_ind_reg_list(register_list_format,
+				    adev->gfx.rlc.reg_list_format_direct_reg_list_length,
+				    adev->gfx.rlc.reg_list_format_size_bytes >> 2,
+				    unique_indirect_regs,
+				    &unique_indirect_reg_count,
+				    indirect_start_offsets,
+				    &indirect_start_offsets_count);
 
 	/* enable auto inc in case it is disabled */
 	tmp = RREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_CNTL));
@@ -1850,19 +1860,37 @@ static int gfx_v9_0_init_rlc_save_restore_list(struct amdgpu_device *adev)
 		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_ARAM_DATA),
 			adev->gfx.rlc.register_restore[i]);
 
-	/* load direct register */
-	WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_ARAM_ADDR), 0);
-	for (i = 0; i < adev->gfx.rlc.reg_list_size_bytes >> 2; i++)
-		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_ARAM_DATA),
-			adev->gfx.rlc.register_restore[i]);
-
 	/* load indirect register */
 	WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_SCRATCH_ADDR),
 		adev->gfx.rlc.reg_list_format_start);
-	for (i = 0; i < adev->gfx.rlc.reg_list_format_size_bytes >> 2; i++)
+
+	/* direct register portion */
+	for (i = 0; i < adev->gfx.rlc.reg_list_format_direct_reg_list_length; i++)
 		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_SCRATCH_DATA),
 			register_list_format[i]);
 
+	/* indirect register portion */
+	while (i < (adev->gfx.rlc.reg_list_format_size_bytes >> 2)) {
+		if (register_list_format[i] == 0xFFFFFFFF) {
+			WREG32_SOC15(GC, 0, mmRLC_GPM_SCRATCH_DATA, register_list_format[i++]);
+			continue;
+		}
+
+		WREG32_SOC15(GC, 0, mmRLC_GPM_SCRATCH_DATA, register_list_format[i++]);
+		WREG32_SOC15(GC, 0, mmRLC_GPM_SCRATCH_DATA, register_list_format[i++]);
+
+		for (j = 0; j < unique_indirect_reg_count; j++) {
+			if (register_list_format[i] == unique_indirect_regs[j]) {
+				WREG32_SOC15(GC, 0, mmRLC_GPM_SCRATCH_DATA, j);
+				break;
+			}
+		}
+
+		BUG_ON(j >= unique_indirect_reg_count);
+
+		i++;
+	}
+
 	/* set save/restore list size */
 	list_size = adev->gfx.rlc.reg_list_size_bytes >> 2;
 	list_size = list_size >> 1;
@@ -1875,14 +1903,19 @@ static int gfx_v9_0_init_rlc_save_restore_list(struct amdgpu_device *adev)
 		adev->gfx.rlc.starting_offsets_start);
 	for (i = 0; i < ARRAY_SIZE(indirect_start_offsets); i++)
 		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_GPM_SCRATCH_DATA),
-			indirect_start_offsets[i]);
+		       indirect_start_offsets[i]);
 
 	/* load unique indirect regs*/
 	for (i = 0; i < ARRAY_SIZE(unique_indirect_regs); i++) {
-		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_INDEX_CNTL_ADDR_0) + i,
-			unique_indirect_regs[i] & 0x3FFFF);
-		WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_INDEX_CNTL_DATA_0) + i,
-			unique_indirect_regs[i] >> 20);
+		if (unique_indirect_regs[i] != 0) {
+			WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_INDEX_CNTL_ADDR_0)
+			       + GFX_RLC_SRM_INDEX_CNTL_ADDR_OFFSETS[i],
+			       unique_indirect_regs[i] & 0x3FFFF);
+
+			WREG32(SOC15_REG_OFFSET(GC, 0, mmRLC_SRM_INDEX_CNTL_DATA_0)
+			       + GFX_RLC_SRM_INDEX_CNTL_DATA_OFFSETS[i],
+			       unique_indirect_regs[i] >> 20);
+		}
 	}
 
 	kfree(register_list_format);
@@ -2072,7 +2105,7 @@ static void gfx_v9_0_init_pg(struct amdgpu_device *adev)
 			      AMD_PG_SUPPORT_GDS |
 			      AMD_PG_SUPPORT_RLC_SMU_HS)) {
 		gfx_v9_0_init_csb(adev);
-		gfx_v9_0_init_rlc_save_restore_list(adev);
+		gfx_v9_1_init_rlc_save_restore_list(adev);
 		gfx_v9_0_enable_save_restore_machine(adev);
 
 		WREG32(mmRLC_JUMP_TABLE_RESTORE,
Signature · 6 lines
2.7.4

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

PATCH 7/20 drm/amdgpu: add setting powergating method for gfx9

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +5 -0
index 5e3ddd5..20c57ac 100644
@@ -3352,6 +3352,11 @@ static int gfx_v9_0_late_init(void *handle)
 	if (r)
 		return r;
 
+	r = amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
+						   AMD_PG_STATE_GATE);
+	if (r)
+		return r;
+
 	return 0;
 }
 
Signature · 6 lines
2.7.4

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

PATCH 8/20 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 8 +++++++-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      | 1 +
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +7 -1
index 0f25226..f0727b4 100644
@@ -206,12 +206,18 @@ static int smu10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *input
 static int smu10_init_power_gate_state(struct pp_hwmgr *hwmgr)
 {
 	struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
+	struct amdgpu_device *adev = hwmgr->adev;
 
 	smu10_data->vcn_power_gated = true;
 	smu10_data->isp_tileA_power_gated = true;
 	smu10_data->isp_tileB_power_gated = true;
 
-	return 0;
+	if (adev->pg_flags & AMD_PG_SUPPORT_GFX_PG)
+		return smum_send_msg_to_smc_with_parameter(hwmgr,
+							   PPSMC_MSG_SetGfxCGPG,
+							   true);
+	else
+		return 0;
 }
 
 
drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h +1 -0
index 426bff2..5d07b6e 100644
@@ -75,6 +75,7 @@
 #define PPSMC_MSG_GetMinGfxclkFrequency         0x2C
 #define PPSMC_MSG_GetMaxGfxclkFrequency         0x2D
 #define PPSMC_MSG_SoftReset                     0x2E
+#define PPSMC_MSG_SetGfxCGPG			0x2F
 #define PPSMC_MSG_SetSoftMaxGfxClk              0x30
 #define PPSMC_MSG_SetHardMinGfxClk              0x31
 #define PPSMC_MSG_SetSoftMaxSocclkByFreq        0x32
Signature · 6 lines
2.7.4

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

PATCH 9/20 drm/amdgpu: move PP_FEATURE_MASK to amd_shared header

In reply to a message not in the archive

It will be used not only for powerplay but also on amdgpu part in future patches. So move it into amd_shared header file.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h   |  2 --
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c       |  2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c       |  2 +-
 drivers/gpu/drm/amd/include/amd_shared.h  | 18 ++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 18 ------------------
 5 files changed, 20 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +0 -2
index 354c6dc..dd6203a 100644
@@ -52,8 +52,6 @@ enum amdgpu_dpm_event_src {
 	AMDGPU_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL = 4
 };
 
-#define SCLK_DEEP_SLEEP_MASK 0x8
-
 struct amdgpu_ps {
 	u32 caps; /* vbios flags */
 	u32 class; /* vbios flags */
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
index be6b199..f48168f 100644
@@ -5903,7 +5903,7 @@ static int ci_dpm_init(struct amdgpu_device *adev)
 	pi->pcie_dpm_key_disabled = 0;
 	pi->thermal_sclk_dpm_enabled = 0;
 
-	if (amdgpu_pp_feature_mask & SCLK_DEEP_SLEEP_MASK)
+	if (amdgpu_pp_feature_mask & PP_SCLK_DEEP_SLEEP_MASK)
 		pi->caps_sclk_ds = true;
 	else
 		pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -1
index bc1720e..ef668a3 100644
@@ -2817,7 +2817,7 @@ static int kv_dpm_init(struct amdgpu_device *adev)
 		pi->caps_tcp_ramping = true;
 	}
 
-	if (amdgpu_pp_feature_mask & SCLK_DEEP_SLEEP_MASK)
+	if (amdgpu_pp_feature_mask & PP_SCLK_DEEP_SLEEP_MASK)
 		pi->caps_sclk_ds = true;
 	else
 		pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/include/amd_shared.h +18 -0
index 9fa3aae..a63e8da 100644
@@ -109,6 +109,24 @@ enum amd_powergating_state {
 #define AMD_PG_SUPPORT_GFX_PIPELINE		(1 << 12)
 #define AMD_PG_SUPPORT_MMHUB			(1 << 13)
 
+enum PP_FEATURE_MASK {
+	PP_SCLK_DPM_MASK = 0x1,
+	PP_MCLK_DPM_MASK = 0x2,
+	PP_PCIE_DPM_MASK = 0x4,
+	PP_SCLK_DEEP_SLEEP_MASK = 0x8,
+	PP_POWER_CONTAINMENT_MASK = 0x10,
+	PP_UVD_HANDSHAKE_MASK = 0x20,
+	PP_SMC_VOLTAGE_CONTROL_MASK = 0x40,
+	PP_VBI_TIME_SUPPORT_MASK = 0x80,
+	PP_ULV_MASK = 0x100,
+	PP_ENABLE_GFX_CG_THRU_SMU = 0x200,
+	PP_CLOCK_STRETCH_MASK = 0x400,
+	PP_OD_FUZZY_FAN_CONTROL_MASK = 0x800,
+	PP_SOCCLK_DPM_MASK = 0x1000,
+	PP_DCEFCLK_DPM_MASK = 0x2000,
+	PP_OVERDRIVE_MASK = 0x4000,
+};
+
 struct amd_ip_funcs {
 	/* Name of IP block */
 	char *name;
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +0 -18
index 9b3dd7d..0d2b3ce 100644
@@ -66,24 +66,6 @@ struct vi_dpm_table {
 #define PCIE_PERF_REQ_GEN2         3
 #define PCIE_PERF_REQ_GEN3         4
 
-enum PP_FEATURE_MASK {
-	PP_SCLK_DPM_MASK = 0x1,
-	PP_MCLK_DPM_MASK = 0x2,
-	PP_PCIE_DPM_MASK = 0x4,
-	PP_SCLK_DEEP_SLEEP_MASK = 0x8,
-	PP_POWER_CONTAINMENT_MASK = 0x10,
-	PP_UVD_HANDSHAKE_MASK = 0x20,
-	PP_SMC_VOLTAGE_CONTROL_MASK = 0x40,
-	PP_VBI_TIME_SUPPORT_MASK = 0x80,
-	PP_ULV_MASK = 0x100,
-	PP_ENABLE_GFX_CG_THRU_SMU = 0x200,
-	PP_CLOCK_STRETCH_MASK = 0x400,
-	PP_OD_FUZZY_FAN_CONTROL_MASK = 0x800,
-	PP_SOCCLK_DPM_MASK = 0x1000,
-	PP_DCEFCLK_DPM_MASK = 0x2000,
-	PP_OVERDRIVE_MASK = 0x4000,
-};
-
 enum PHM_BackEnd_Magic {
 	PHM_Dummy_Magic       = 0xAA5555AA,
 	PHM_RV770_Magic       = 0xDCBAABCD,
Signature · 6 lines
2.7.4

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

PATCH 10/20 drm/amdgpu: add gfxoff feature mask

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/include/amd_shared.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/include/amd_shared.h +1 -0
index a63e8da..850e8ef 100644
@@ -125,6 +125,7 @@ enum PP_FEATURE_MASK {
 	PP_SOCCLK_DPM_MASK = 0x1000,
 	PP_DCEFCLK_DPM_MASK = 0x2000,
 	PP_OVERDRIVE_MASK = 0x4000,
+	PP_GFXOFF_MASK = 0x8000,
 };
 
 struct amd_ip_funcs {
Signature · 6 lines
2.7.4

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

PATCH 11/20 drm/amdgpu: set gfxoff disabled by default

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +1 -1
index 5c0567a..3e07bd4 100644
@@ -121,7 +121,7 @@ uint amdgpu_pg_mask = 0xffffffff;
 uint amdgpu_sdma_phase_quantum = 32;
 char *amdgpu_disable_cu = NULL;
 char *amdgpu_virtual_display = NULL;
-uint amdgpu_pp_feature_mask = 0xffffbfff;
+uint amdgpu_pp_feature_mask = 0xffff3fff; /* gfxoff (bit 15) disabled by default */
 int amdgpu_ngg = 0;
 int amdgpu_prim_buf_per_se = 0;
 int amdgpu_pos_buf_per_se = 0;
Signature · 6 lines
2.7.4

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

PATCH 12/20 drm/amd/powerplay: add gfx off control function

In reply to a message not in the archive

gfx_off_control is used to be called for sending enabling/disabling gfxoff message.

---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 36 ++++++++++++++++++++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  1 +
 2 files changed, 36 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +35 -1
index f0727b4..fde1e5c 100644
@@ -42,6 +42,13 @@
 #define SMU10_DISPCLK_BYPASS_THRESHOLD     10000 /* 100Mhz */
 #define SMC_RAM_END                     0x40000
 
+#define mmPWR_MISC_CNTL_STATUS					0x0183
+#define mmPWR_MISC_CNTL_STATUS_BASE_IDX				0
+#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN__SHIFT	0x0
+#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS__SHIFT		0x1
+#define PWR_MISC_CNTL_STATUS__PWR_GFX_RLC_CGPG_EN_MASK		0x00000001L
+#define PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS_MASK		0x00000006L
+
 static const unsigned long SMU10_Magic = (unsigned long) PHM_Rv_Magic;
 
 
@@ -243,13 +250,31 @@ static int smu10_power_off_asic(struct pp_hwmgr *hwmgr)
 	return smu10_reset_cc6_data(hwmgr);
 }
 
+static bool smu10_is_gfx_on(struct pp_hwmgr *hwmgr)
+{
+	uint32_t reg;
+	struct amdgpu_device *adev = hwmgr->adev;
+
+	reg = RREG32_SOC15(PWR, 0, mmPWR_MISC_CNTL_STATUS);
+	if ((reg & PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS_MASK) ==
+	    (0x2 << PWR_MISC_CNTL_STATUS__PWR_GFXOFF_STATUS__SHIFT))
+		return true;
+
+	return false;
+}
+
 static int smu10_disable_gfx_off(struct pp_hwmgr *hwmgr)
 {
 	struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
 
-	if (smu10_data->gfx_off_controled_by_driver)
+	if (smu10_data->gfx_off_controled_by_driver) {
 		smum_send_msg_to_smc(hwmgr, PPSMC_MSG_DisableGfxOff);
 
+		/* confirm gfx is back to "on" state */
+		while (!smu10_is_gfx_on(hwmgr))
+			msleep(1);
+	}
+
 	return 0;
 }
 
@@ -273,6 +298,14 @@ static int smu10_enable_dpm_tasks(struct pp_hwmgr *hwmgr)
 	return smu10_enable_gfx_off(hwmgr);
 }
 
+static int smu10_gfx_off_control(struct pp_hwmgr *hwmgr, bool enable)
+{
+	if (enable)
+		return smu10_enable_gfx_off(hwmgr);
+	else
+		return smu10_disable_gfx_off(hwmgr);
+}
+
 static int smu10_apply_state_adjust_rules(struct pp_hwmgr *hwmgr,
 				struct pp_power_state  *prequest_ps,
 			const struct pp_power_state *pcurrent_ps)
@@ -1060,6 +1093,7 @@ static const struct pp_hwmgr_func smu10_hwmgr_funcs = {
 	.power_state_set = smu10_set_power_state_tasks,
 	.dynamic_state_management_disable = smu10_disable_dpm_tasks,
 	.set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu,
+	.gfx_off_control = smu10_gfx_off_control,
 };
 
 int smu10_init_function_pointers(struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 0d2b3ce..3d9743f 100644
@@ -296,6 +296,7 @@ struct pp_hwmgr_func {
 	int (*display_clock_voltage_request)(struct pp_hwmgr *hwmgr,
 			struct pp_display_clock_request *clock);
 	int (*get_max_high_clocks)(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks);
+	int (*gfx_off_control)(struct pp_hwmgr *hwmgr, bool enable);
 	int (*power_off_asic)(struct pp_hwmgr *hwmgr);
 	int (*force_clock_level)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, uint32_t mask);
 	int (*print_clock_levels)(struct pp_hwmgr *hwmgr, enum pp_clock_type type, char *buf);
Signature · 6 lines
2.7.4

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

PATCH 13/20 drm/amd/powerplay: enable/disable gfxoff through smu

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +9 -0
index bd0d387..6976596 100644
@@ -222,10 +222,19 @@ static int pp_set_powergating_state(void *handle,
 {
 	struct amdgpu_device *adev = handle;
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
+	int ret;
 
 	if (!hwmgr || !hwmgr->pm_en)
 		return 0;
 
+	if (hwmgr->hwmgr_func->gfx_off_control) {
+		/* Enable/disable GFX off through SMU */
+		ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr,
+							 state == AMD_PG_STATE_GATE);
+		if (ret)
+			pr_err("gfx off control failed!\n");
+	}
+
 	if (hwmgr->hwmgr_func->enable_per_cu_power_gating == NULL) {
 		pr_info("%s was not implemented.\n", __func__);
 		return 0;
Signature · 6 lines
2.7.4

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

PATCH 14/20 drm/amdgpu: use pp_feature member to store the mask

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h           | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c    | 2 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c           | 2 +-
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c           | 2 +-
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 2 +-
 5 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index bed1f5d..59df4b7 100644
@@ -1433,6 +1433,7 @@ enum amd_hw_ip_block_type {
 struct amd_powerplay {
 	void *pp_handle;
 	const struct amd_pm_funcs *pp_funcs;
+	uint32_t pp_feature;
 };
 
 #define AMDGPU_RESET_MAGIC_NUM 64
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -0
index 6f1a8b7..8e63832 100644
@@ -1545,6 +1545,8 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev)
 			return -EAGAIN;
 	}
 
+	adev->powerplay.pp_feature = amdgpu_pp_feature_mask;
+
 	for (i = 0; i < adev->num_ip_blocks; i++) {
 		if ((amdgpu_ip_block_mask & (1 << i)) == 0) {
 			DRM_ERROR("disabled ip block: %d <%s>\n",
drivers/gpu/drm/amd/amdgpu/ci_dpm.c +1 -1
index f48168f..a266dcf 100644
@@ -5903,7 +5903,7 @@ static int ci_dpm_init(struct amdgpu_device *adev)
 	pi->pcie_dpm_key_disabled = 0;
 	pi->thermal_sclk_dpm_enabled = 0;
 
-	if (amdgpu_pp_feature_mask & PP_SCLK_DEEP_SLEEP_MASK)
+	if (adev->powerplay.pp_feature & PP_SCLK_DEEP_SLEEP_MASK)
 		pi->caps_sclk_ds = true;
 	else
 		pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/amdgpu/kv_dpm.c +1 -1
index ef668a3..17f7f07 100644
@@ -2817,7 +2817,7 @@ static int kv_dpm_init(struct amdgpu_device *adev)
 		pi->caps_tcp_ramping = true;
 	}
 
-	if (amdgpu_pp_feature_mask & PP_SCLK_DEEP_SLEEP_MASK)
+	if (adev->powerplay.pp_feature & PP_SCLK_DEEP_SLEEP_MASK)
 		pi->caps_sclk_ds = true;
 	else
 		pi->caps_sclk_ds = false;
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +1 -1
index 6976596..246f8e9 100644
@@ -53,7 +53,7 @@ static int amd_powerplay_create(struct amdgpu_device *adev)
 	mutex_init(&hwmgr->smu_lock);
 	hwmgr->chip_family = adev->family;
 	hwmgr->chip_id = adev->asic_type;
-	hwmgr->feature_mask = amdgpu_pp_feature_mask;
+	hwmgr->feature_mask = adev->powerplay.pp_feature;
 	hwmgr->display_config = &adev->pm.pm_display_cfg;
 	adev->powerplay.pp_handle = hwmgr;
 	adev->powerplay.pp_funcs = &pp_dpm_funcs;
Signature · 6 lines
2.7.4

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

PATCH 15/20 drm/amdgpu: clear gfxoff featue mask if the asic is not raven

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +5 -1
index bca67df..d1052b5 100644
@@ -95,7 +95,8 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 		hwmgr->smumgr_funcs = &ci_smu_funcs;
 		ci_set_asic_special_caps(hwmgr);
 		hwmgr->feature_mask &= ~(PP_VBI_TIME_SUPPORT_MASK |
-					PP_ENABLE_GFX_CG_THRU_SMU);
+					 PP_ENABLE_GFX_CG_THRU_SMU |
+					 PP_GFXOFF_MASK);
 		hwmgr->pp_table_version = PP_TABLE_V0;
 		hwmgr->od_enabled = false;
 		smu7_init_function_pointers(hwmgr);
@@ -103,9 +104,11 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 	case AMDGPU_FAMILY_CZ:
 		hwmgr->od_enabled = false;
 		hwmgr->smumgr_funcs = &smu8_smu_funcs;
+		hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 		smu8_init_function_pointers(hwmgr);
 		break;
 	case AMDGPU_FAMILY_VI:
+		hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 		switch (hwmgr->chip_id) {
 		case CHIP_TOPAZ:
 			hwmgr->smumgr_funcs = &iceland_smu_funcs;
@@ -139,6 +142,7 @@ int hwmgr_early_init(struct pp_hwmgr *hwmgr)
 		smu7_init_function_pointers(hwmgr);
 		break;
 	case AMDGPU_FAMILY_AI:
+		hwmgr->feature_mask &= ~PP_GFXOFF_MASK;
 		switch (hwmgr->chip_id) {
 		case CHIP_VEGA10:
 			hwmgr->smumgr_funcs = &vega10_smu_funcs;
Signature · 6 lines
2.7.4

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

PATCH 16/20 drm/amd/powerplay: add control gfxoff enabling in late init

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +9 -0
index 246f8e9..b493369 100644
@@ -180,6 +180,7 @@ static int pp_late_init(void *handle)
 {
 	struct amdgpu_device *adev = handle;
 	struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle;
+	int ret;
 
 	if (hwmgr && hwmgr->pm_en) {
 		mutex_lock(&hwmgr->smu_lock);
@@ -189,6 +190,14 @@ static int pp_late_init(void *handle)
 	}
 	if (adev->pm.smu_prv_buffer_size != 0)
 		pp_reserve_vram_for_smu(adev);
+
+	if (hwmgr->hwmgr_func->gfx_off_control &&
+	    (hwmgr->feature_mask & PP_GFXOFF_MASK)) {
+		ret = hwmgr->hwmgr_func->gfx_off_control(hwmgr, true);
+		if (ret)
+			pr_err("gfx off enabling failed!\n");
+	}
+
 	return 0;
 }
 
Signature · 6 lines
2.7.4

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

PATCH 17/20 drm/amdgpu: it should disable gfxoff when system is going to suspend

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +6 -0
index 8e63832..f509d32 100644
@@ -1902,6 +1902,12 @@ int amdgpu_device_ip_suspend(struct amdgpu_device *adev)
 	if (amdgpu_sriov_vf(adev))
 		amdgpu_virt_request_full_gpu(adev, false);
 
+	/* ungate SMC block powergating */
+	if (adev->powerplay.pp_feature & PP_GFXOFF_MASK)
+		amdgpu_device_ip_set_powergating_state(adev,
+						       AMD_IP_BLOCK_TYPE_SMC,
+						       AMD_CG_STATE_UNGATE);
+
 	/* ungate SMC block first */
 	r = amdgpu_device_ip_set_clockgating_state(adev, AMD_IP_BLOCK_TYPE_SMC,
 						   AMD_CG_STATE_UNGATE);
Signature · 6 lines
2.7.4

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

PATCH 18/20 drm/amdgpu: fix to disable powergating in hw_fini

In reply to a message not in the archive

We need enable CGPG and GFXOFF together. If only enable one of them, this system will get hang after startx (do draw command). So when gfxoff is disabled, it also need disable CGPG after that.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c +3 -0
index 20c57ac..d4da610 100644
@@ -3134,6 +3134,9 @@ static int gfx_v9_0_hw_fini(void *handle)
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 	int i;
 
+	amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_GFX,
+					       AMD_PG_STATE_UNGATE);
+
 	amdgpu_irq_put(adev, &adev->gfx.priv_reg_irq, 0);
 	amdgpu_irq_put(adev, &adev->gfx.priv_inst_irq, 0);
 
Signature · 6 lines
2.7.4

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

PATCH 19/20 drm/amdgpu: set CGPG if gfxoff is enabled for raven

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/amdgpu/soc15.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/amdgpu/soc15.c +5 -0
index 65e781f..9006576 100644
@@ -682,6 +682,11 @@ static int soc15_common_early_init(void *handle)
 			AMD_CG_SUPPORT_SDMA_LS;
 		adev->pg_flags = AMD_PG_SUPPORT_SDMA;
 
+		if (adev->powerplay.pp_feature & PP_GFXOFF_MASK)
+			adev->pg_flags |= AMD_PG_SUPPORT_GFX_PG |
+				AMD_PG_SUPPORT_CP |
+				AMD_PG_SUPPORT_RLC_SMU_HS;
+
 		adev->external_rev_id = 0x1;
 		break;
 	default:
Signature · 6 lines
2.7.4

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

PATCH 20/20 drm/amd/powerplay: use the flag to decide whether send gfxoff smc message

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c +5 -1
index fde1e5c..7712eb6 100644
@@ -81,11 +81,15 @@ static int smu10_initialize_dpm_defaults(struct pp_hwmgr *hwmgr)
 	smu10_data->thermal_auto_throttling_treshold = 0;
 	smu10_data->is_nb_dpm_enabled = 1;
 	smu10_data->dpm_flags = 1;
-	smu10_data->gfx_off_controled_by_driver = false;
 	smu10_data->need_min_deep_sleep_dcefclk = true;
 	smu10_data->num_active_display = 0;
 	smu10_data->deep_sleep_dcefclk = 0;
 
+	if (hwmgr->feature_mask & PP_GFXOFF_MASK)
+		smu10_data->gfx_off_controled_by_driver = true;
+	else
+		smu10_data->gfx_off_controled_by_driver = false;
+
 	phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
 					PHM_PlatformCaps_SclkDeepSleep);
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#22 lore raw
In reply to a message not in the archive

I can't judge technical correctness, but coding style, commit messages etc..  look good on first glance.

Series is Acked-by: Christian König <[email protected]>.

Regards,
Christian.

Am 19.04.2018 um 02:22 schrieb Huang Rui:

Quoted 64 lines

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

	$ make clean
	$ make REAL_CGPG=1
2. Faked CGPG: (by default)
	$ make clean
	$ make	

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

  drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
  drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
  drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
  drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
  drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
  drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
  drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
  drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
  drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
  drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
Quoted 9 lines
  drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
  drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
  drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
  drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
  drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
  include/uapi/drm/amdgpu_drm.h                     |   6 +
  20 files changed, 447 insertions(+), 129 deletions(-)

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

#23 lore raw
In reply to a message not in the archive
Quoted 16 lines · Huang Rui

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

Quoted 7 lines
        $ make clean
        $ make REAL_CGPG=1
2. Faked CGPG: (by default)
        $ make clean
        $ make

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

A couple of things we need to take care of before enabling this:
1. Need to switch it off when selecting stable pstate or profiling mode in powerplay
2. Need to check if gfx is on before accessing the RLC_GPU_CLOCK_COUNT registers.

Alex

Quoted 50 lines

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
 drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
 include/uapi/drm/amdgpu_drm.h                     |   6 +
 20 files changed, 447 insertions(+), 129 deletions(-)
Quoted 7 lines

--
2.7.4

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

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

A message that is not in the archive (sent off-list or not yet received): CADnq5_Nn-sa0TXeLdy+1SHva=1D5aXdMy+ngokmS+GyxtHRisw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#25 lore raw
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Huang Rui

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

        $ make clean
        $ make REAL_CGPG=1
2. Faked CGPG: (by default)
        $ make clean
        $ make
Quoted 6 lines
Quoted 1 line

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

A couple of things we need to take care of before enabling this:
1. Need to switch it off when selecting stable pstate or profiling mode in powerplay
2. Need to check if gfx is on before accessing the RLC_GPU_CLOCK_COUNT registers.

I second that. Access to RLC_GPU_CLOCK_COUNT is used for some ROCm profiling features. Accessing the register while GFX is OFF can lead to hangs according to HW engineers. Also, GFX OFF resets the counter to 0, which would confuse any profiling code using it.

Would it be possible to control the GFX OFF feature as part of power profiles? For example we could have the feature disabled in the compute power profile.

Regards,
  Felix

Quoted 55 lines

Alex

Quoted 52 lines

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
 drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
 include/uapi/drm/amdgpu_drm.h                     |   6 +
 20 files changed, 447 insertions(+), 129 deletions(-)

--
2.7.4

Quoted 8 lines
Quoted 4 lines

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

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

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

A message that is not in the archive (sent off-list or not yet received): 64cd5bd0-1b0f-1372-b4df-7db92eccfc1f-5C7GfCeVMHo@public.gmane.org

#27 lore raw
Quoted 31 lines · Felix Kuehling
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Huang Rui

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

        $ make clean
        $ make REAL_CGPG=1
2. Faked CGPG: (by default)
        $ make clean
        $ make
Quoted 6 lines
Quoted 1 line

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

A couple of things we need to take care of before enabling this:
1. Need to switch it off when selecting stable pstate or profiling mode in powerplay
2. Need to check if gfx is on before accessing the RLC_GPU_CLOCK_COUNT registers.

Quoted 8 lines

I second that. Access to RLC_GPU_CLOCK_COUNT is used for some ROCm profiling features. Accessing the register while GFX is OFF can lead to hangs according to HW engineers. Also, GFX OFF resets the counter to 0, which would confuse any profiling code using it.

Would it be possible to control the GFX OFF feature as part of power profiles? For example we could have the feature disabled in the compute power profile.

Yes, we should be able to do that.

Alex

Quoted 68 lines

Regards,
Felix

Quoted 55 lines

Alex

Quoted 52 lines

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
 drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
 include/uapi/drm/amdgpu_drm.h                     |   6 +
 20 files changed, 447 insertions(+), 129 deletions(-)

--
2.7.4

Quoted 8 lines
Quoted 4 lines

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

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

Quoted 4 lines

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

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

author
#28 lore raw
In reply to a message not in the archive
Quoted 31 lines · Felix
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Huang Rui

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

        $ make clean
        $ make REAL_CGPG=1
2. Faked CGPG: (by default)
        $ make clean
        $ make
Quoted 6 lines
Quoted 1 line

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

A couple of things we need to take care of before enabling this:
1. Need to switch it off when selecting stable pstate or profiling mode in powerplay
2. Need to check if gfx is on before accessing the RLC_GPU_CLOCK_COUNT registers.

Quoted 9 lines

I second that. Access to RLC_GPU_CLOCK_COUNT is used for some ROCm profiling features. Accessing the register while GFX is OFF can lead to hangs according to HW engineers. Also, GFX OFF resets the counter to 0, which would confuse any profiling code using it.

Would it be possible to control the GFX OFF feature as part of power profiles? For example we could have the feature disabled in the compute power profile.

Yes, you're right. We have to take care the runtime RLC_GPU_CLOCK_COUNT(GC domain) register access. :-)
We don't support enable/disable gfxoff feature dynamically yet. Yes, this is the next step that I should try to do it. With the issue is resolved, I think we can provide an interface as you can configure it in the power profile.

Before that, can we return "0" at gfx_v9_0_get_gpu_clock_counter when gfx is in off in order to bypass RLC_GPU_CLOCK_COUNT registers?

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

author
#29 lore raw
In reply to a message not in the archive
Quoted 23 lines · Alex Deucher
Quoted 22 lines · Huang Rui

GFXOFF is the new GPU feature that save power consumption. It used RLC to poweroff the gfx engine dynamicly when there is no workload on gfx pipe and make gfx into "idle" state.
1. Add three additional RLC ucodes, and use psp to load them.
2. Revise RLC save restore list.
3. Enable CGPG (GFX power gating).
4. Enable gfxoff.
5. Revise suspend/resume sequence.

Currently, only raven is able to support gfxoff at first. And after CQE do series rounds of testing, and there is no regression that bring by gfxoff feature till now.

We support two types of gfxoff, and user is able to build them manually from firmware repo:
1. Real CGPG

        $ make clean
        $ make REAL_CGPG=1
2. Faked CGPG: (by default)
        $ make clean
        $ make
Quoted 5 lines
Quoted 1 line

Then configure to enable gfxoff with ppfeaturemask=0xffffbfff.

A couple of things we need to take care of before enabling this:
1. Need to switch it off when selecting stable pstate or profiling mode in powerplay

Got it. We don't support enable/disable gfxoff dynamically yet. It needs more stability testing, you know, feature is disabled by default at current. I will try to find good sequence to make dynamically enable/disable workable smoothly next step.

Quoted 3 lines

2. Need to check if gfx is on before accessing the RLC_GPU_CLOCK_COUNT registers.

Please check next mail with Felix's comments.

Thanks,
Ray

Quoted 59 lines

Alex

Quoted 57 lines

Thanks,
Ray

Huang Rui (20):
drm/amdgpu: update psp gfx if header
drm/amdgpu: add new rlc firmware header format v2.1 drm/amdgpu: add save restore list cntl gpm and srm firmware support drm/amdgpu: enter rlc safe mode before set cgpg drm/amdgpu: cleanup init power gating function drm/amdgpu: revise init_rlc_save_restore_list behavior to support
latest register_list_format/register_restore table
drm/amdgpu: add setting powergating method for gfx9 drm/amd/powerplay: send CGPG smc message if PG is enabled for raven drm/amdgpu: move PP_FEATURE_MASK to amd_shared header drm/amdgpu: add gfxoff feature mask
drm/amdgpu: set gfxoff disabled by default drm/amd/powerplay: add gfx off control function drm/amd/powerplay: enable/disable gfxoff through smu drm/amdgpu: use pp_feature member to store the mask drm/amdgpu: clear gfxoff featue mask if the asic is not raven drm/amd/powerplay: add control gfxoff enabling in late init drm/amdgpu: it should disable gfxoff when system is going to suspend drm/amdgpu: fix to disable powergating in hw_fini drm/amdgpu: set CGPG if gfxoff is enabled for raven drm/amd/powerplay: use the flag to decide whether send gfxoff smc
message

 drivers/gpu/drm/amd/amdgpu/amdgpu.h               |  16 ++
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c        |   8 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h           |   2 -
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c           |   2 +-
 drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c           |  36 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c         |  51 ++++-
 drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.h         |  22 ++
 drivers/gpu/drm/amd/amdgpu/ci_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c             | 233 +++++++++++++++-------
 drivers/gpu/drm/amd/amdgpu/kv_dpm.c               |   2 +-
 drivers/gpu/drm/amd/amdgpu/psp_gfx_if.h           |  67 +++++--
 drivers/gpu/drm/amd/amdgpu/psp_v10_0.c            |   9 +
 drivers/gpu/drm/amd/amdgpu/soc15.c                |   5 +
 drivers/gpu/drm/amd/include/amd_shared.h          |  19 ++
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c     |  20 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c       |   6 +-
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c |  50 ++++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h         |  19 +-
 drivers/gpu/drm/amd/powerplay/inc/rv_ppsmc.h      |   1 +
 include/uapi/drm/amdgpu_drm.h                     |   6 +
 20 files changed, 447 insertions(+), 129 deletions(-)

--
2.7.4

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

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