Skip to contentSkip to conversation

drm/amd/powerplay: export new smu messages for vega10

PATCH In review Rex Zhu 2 participants 16 messages Oct 9, 2017 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/9 drm/amd/powerplay: export new smu messages for vega10

Change-Id I5afa09980174ef191c7aa4e4f9dadaaa189783ca
---
 drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h +2 -0
index cb070eb..d06ece4 100644
@@ -124,6 +124,8 @@
 #define PPSMC_MSG_NumOfDisplays                  0x56
 #define PPSMC_MSG_ReadSerialNumTop32             0x58
 #define PPSMC_MSG_ReadSerialNumBottom32          0x59
+#define PPSMC_MSG_SetSystemVirtualDramAddrHigh   0x5A
+#define PPSMC_MSG_SetSystemVirtualDramAddrLow    0x5B
 #define PPSMC_MSG_RunAcgBtc                      0x5C
 #define PPSMC_MSG_RunAcgInClosedLoop             0x5D
 #define PPSMC_MSG_RunAcgInOpenLoop               0x5E
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#2 lore raw

PATCH 2/9 drm/amd/powerplay: add new function point in hwmgr.

used for notify SMU the allocated buffer address.

Change-Id I91badca7729b8d9c35faf7fc09dbdee70c26099a
---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +6 -0
index 126b44d..004a40e 100644
@@ -363,6 +363,12 @@ struct pp_hwmgr_func {
 	int (*set_active_display_count)(struct pp_hwmgr *hwmgr, uint32_t count);
 	int (*set_deep_sleep_dcefclk)(struct pp_hwmgr *hwmgr, uint32_t clock);
 	int (*start_thermal_controller)(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *range);
+	int (*notify_cac_buffer_info)(struct pp_hwmgr *hwmgr,
+					uint32_t virtual_addr_low,
+					uint32_t virtual_addr_hi,
+					uint32_t mc_addr_low,
+					uint32_t mc_addr_hi,
+					uint32_t size);
 };
 
 struct pp_table_func {
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#4 lore raw

Re: [PATCH 2/9] drm/amd/powerplay: add new function point in hwmgr.

Quoted 4 lines · Rex Zhu

used for notify SMU the allocated buffer address.

Change-Id I91badca7729b8d9c35faf7fc09dbdee70c26099a
Quoted 24 lines
---
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +6 -1
index 126b44d..004a40e 100644
@@ -363,6 +363,12 @@ struct pp_hwmgr_func {
        int (*set_active_display_count)(struct pp_hwmgr *hwmgr, uint32_t count);
        int (*set_deep_sleep_dcefclk)(struct pp_hwmgr *hwmgr, uint32_t clock);
        int (*start_thermal_controller)(struct pp_hwmgr *hwmgr, struct PP_TemperatureRange *range);
+       int (*notify_cac_buffer_info)(struct pp_hwmgr *hwmgr,
+                                       uint32_t virtual_addr_low,
+                                       uint32_t virtual_addr_hi,
+                                       uint32_t mc_addr_low,
+                                       uint32_t mc_addr_hi,
+                                       uint32_t size);
 };
 
 struct pp_table_func {
--

1.9.1

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
#5 lore raw

PATCH 3/9 drm/amd/powrplay: implement function notify_cac_buffer_info on Vega

In reply to a message not in the archive
Change-Id I4d50bf04ba6f5caf6919b6177517c7b38b9a606a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +28 -0
index 48de45e..ebaea5c 100644
@@ -4994,6 +4994,33 @@ static int vega10_set_mclk_od(struct pp_hwmgr *hwmgr, uint32_t value)
 	return 0;
 }
 
+static int vega10_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
+					uint32_t virtual_addr_low,
+					uint32_t virtual_addr_hi,
+					uint32_t mc_addr_low,
+					uint32_t mc_addr_hi,
+					uint32_t size)
+{
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_SetSystemVirtualDramAddrHigh,
+					virtual_addr_hi);
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_SetSystemVirtualDramAddrLow,
+					virtual_addr_low);
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramLogSetDramAddrHigh,
+					mc_addr_hi);
+
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramLogSetDramAddrLow,
+					mc_addr_low);
+
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramLogSetDramSize,
+					size);
+	return 0;
+}
+
 static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
 		const void *info)
 {
@@ -5079,6 +5106,7 @@ static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
 	.get_mclk_od = vega10_get_mclk_od,
 	.set_mclk_od = vega10_set_mclk_od,
 	.avfs_control = vega10_avfs_enable,
+	.notify_cac_buffer_info = vega10_notify_cac_buffer_info,
 	.register_internal_thermal_interrupt = vega10_register_thermal_interrupt,
 };
 
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-3-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#7 lore raw

Re: [PATCH 3/9] drm/amd/powrplay: implement function notify_cac_buffer_info on Vega

Quoted 2 lines · Rex Zhu
Change-Id I4d50bf04ba6f5caf6919b6177517c7b38b9a606a
Quoted 53 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +28 -1
index 48de45e..ebaea5c 100644
@@ -4994,6 +4994,33 @@ static int vega10_set_mclk_od(struct pp_hwmgr *hwmgr, uint32_t value)
        return 0;
 }
 
+static int vega10_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
+                                       uint32_t virtual_addr_low,
+                                       uint32_t virtual_addr_hi,
+                                       uint32_t mc_addr_low,
+                                       uint32_t mc_addr_hi,
+                                       uint32_t size)
+{
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_SetSystemVirtualDramAddrHigh,
+                                       virtual_addr_hi);
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_SetSystemVirtualDramAddrLow,
+                                       virtual_addr_low);
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramLogSetDramAddrHigh,
+                                       mc_addr_hi);
+
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramLogSetDramAddrLow,
+                                       mc_addr_low);
+
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramLogSetDramSize,
+                                       size);
+       return 0;
+}
+
 static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
                const void *info)
 {
@@ -5079,6 +5106,7 @@ static int vega10_register_thermal_interrupt(struct pp_hwmgr *hwmgr,
        .get_mclk_od = vega10_get_mclk_od,
        .set_mclk_od = vega10_set_mclk_od,
        .avfs_control = vega10_avfs_enable,
+       .notify_cac_buffer_info = vega10_notify_cac_buffer_info,
        .register_internal_thermal_interrupt = vega10_register_thermal_interrupt,
 };
 
--

1.9.1

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
#8 lore raw

PATCH 4/9 drm/amd/powerplay: implement function notify_cac_buffer_info on VI

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 28 +++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 42 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |  5 +++
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smc.c      | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 10 ++++++
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 10 ++++++
 8 files changed, 125 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +28 -0
index 189f3b5..a91b58d 100644
@@ -1871,6 +1871,33 @@ static int cz_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 	}
 }
 
+static int cz_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
+					uint32_t virtual_addr_low,
+					uint32_t virtual_addr_hi,
+					uint32_t mc_addr_low,
+					uint32_t mc_addr_hi,
+					uint32_t size)
+{
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramAddrHiVirtual,
+					mc_addr_hi);
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramAddrLoVirtual,
+					mc_addr_low);
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramAddrHiPhysical,
+					virtual_addr_hi);
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramAddrLoPhysical,
+					virtual_addr_low);
+
+	smum_send_msg_to_smc_with_parameter(hwmgr,
+					PPSMC_MSG_DramBufferSize,
+					size);
+	return 0;
+}
+
+
 static const struct pp_hwmgr_func cz_hwmgr_funcs = {
 	.backend_init = cz_hwmgr_backend_init,
 	.backend_fini = cz_hwmgr_backend_fini,
@@ -1900,6 +1927,7 @@ static int cz_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 	.dynamic_state_management_enable = cz_enable_dpm_tasks,
 	.power_state_set = cz_set_power_state_tasks,
 	.dynamic_state_management_disable = cz_disable_dpm_tasks,
+	.notify_cac_buffer_info = cz_notify_cac_buffer_info,
 };
 
 int cz_init_function_pointers(struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +42 -0

54 lines not on this page · raw message

drivers/gpu/drm/amd/powerplay/inc/smumgr.h +5 -0
index 7c9aba8..b1b27b2 100644
@@ -75,6 +75,11 @@ enum SMU_MEMBER {
 	VceBootLevel,
 	SamuBootLevel,
 	LowSclkInterruptThreshold,
+	DRAM_LOG_ADDR_H,
+	DRAM_LOG_ADDR_L,
+	DRAM_LOG_PHY_ADDR_H,
+	DRAM_LOG_PHY_ADDR_L,
+	DRAM_LOG_BUFF_SIZE,
 };
 
 
drivers/gpu/drm/amd/powerplay/smumgr/ci_smc.c +10 -0
index 0017b9e..4d672cd 100644
@@ -2266,6 +2266,16 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU7_SoftRegisters, PreVBlankGap);
 		case VBlankTimeout:
 			return offsetof(SMU7_SoftRegisters, VBlankTimeout);
+		case DRAM_LOG_ADDR_H:
+			return offsetof(SMU7_SoftRegisters, DRAM_LOG_ADDR_H);
+		case DRAM_LOG_ADDR_L:
+			return offsetof(SMU7_SoftRegisters, DRAM_LOG_ADDR_L);
+		case DRAM_LOG_PHY_ADDR_H:
+			return offsetof(SMU7_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+		case DRAM_LOG_PHY_ADDR_L:
+			return offsetof(SMU7_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+		case DRAM_LOG_BUFF_SIZE:
+			return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +10 -0
index b1a66b5..e130b77 100644
@@ -2199,6 +2199,16 @@ uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU73_SoftRegisters, VBlankTimeout);
 		case UcodeLoadStatus:
 			return offsetof(SMU73_SoftRegisters, UcodeLoadStatus);
+		case DRAM_LOG_ADDR_H:
+			return offsetof(SMU73_SoftRegisters, DRAM_LOG_ADDR_H);
+		case DRAM_LOG_ADDR_L:
+			return offsetof(SMU73_SoftRegisters, DRAM_LOG_ADDR_L);
+		case DRAM_LOG_PHY_ADDR_H:
+			return offsetof(SMU73_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+		case DRAM_LOG_PHY_ADDR_L:
+			return offsetof(SMU73_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+		case DRAM_LOG_BUFF_SIZE:
+			return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +10 -0
index efb0fc0..da0c93b 100644
@@ -2125,6 +2125,16 @@ uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU71_SoftRegisters, VBlankTimeout);
 		case UcodeLoadStatus:
 			return offsetof(SMU71_SoftRegisters, UcodeLoadStatus);
+		case DRAM_LOG_ADDR_H:
+			return offsetof(SMU71_SoftRegisters, DRAM_LOG_ADDR_H);
+		case DRAM_LOG_ADDR_L:
+			return offsetof(SMU71_SoftRegisters, DRAM_LOG_ADDR_L);
+		case DRAM_LOG_PHY_ADDR_H:
+			return offsetof(SMU71_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+		case DRAM_LOG_PHY_ADDR_L:
+			return offsetof(SMU71_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+		case DRAM_LOG_BUFF_SIZE:
+			return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +10 -0
index c92ea38..113cadb 100644
@@ -2190,6 +2190,16 @@ uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU74_SoftRegisters, VBlankTimeout);
 		case UcodeLoadStatus:
 			return offsetof(SMU74_SoftRegisters, UcodeLoadStatus);
+		case DRAM_LOG_ADDR_H:
+			return offsetof(SMU74_SoftRegisters, DRAM_LOG_ADDR_H);
+		case DRAM_LOG_ADDR_L:
+			return offsetof(SMU74_SoftRegisters, DRAM_LOG_ADDR_L);
+		case DRAM_LOG_PHY_ADDR_H:
+			return offsetof(SMU74_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+		case DRAM_LOG_PHY_ADDR_L:
+			return offsetof(SMU74_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+		case DRAM_LOG_BUFF_SIZE:
+			return offsetof(SMU74_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +10 -0
index 1f720cc..6675a85 100644
@@ -2668,6 +2668,16 @@ uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
 			return offsetof(SMU72_SoftRegisters, VBlankTimeout);
 		case UcodeLoadStatus:
 			return offsetof(SMU72_SoftRegisters, UcodeLoadStatus);
+		case DRAM_LOG_ADDR_H:
+			return offsetof(SMU72_SoftRegisters, DRAM_LOG_ADDR_H);
+		case DRAM_LOG_ADDR_L:
+			return offsetof(SMU72_SoftRegisters, DRAM_LOG_ADDR_L);
+		case DRAM_LOG_PHY_ADDR_H:
+			return offsetof(SMU72_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+		case DRAM_LOG_PHY_ADDR_L:
+			return offsetof(SMU72_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+		case DRAM_LOG_BUFF_SIZE:
+			return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE);
 		}
 	case SMU_Discrete_DpmTable:
 		switch (member) {
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-4-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#10 lore raw

Re: [PATCH 4/9] drm/amd/powerplay: implement function notify_cac_buffer_info on VI

Quoted 1 line · Rex Zhu
Quoted 241 lines
---
 drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c     | 28 +++++++++++++++
 drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c   | 42 ++++++++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/smumgr.h         |  5 +++
 drivers/gpu/drm/amd/powerplay/smumgr/ci_smc.c      | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c    | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c | 10 ++++++
 .../gpu/drm/amd/powerplay/smumgr/polaris10_smc.c   | 10 ++++++
 drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c   | 10 ++++++
 8 files changed, 125 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/cz_hwmgr.c +28 -0
index 189f3b5..a91b58d 100644
@@ -1871,6 +1871,33 @@ static int cz_read_sensor(struct pp_hwmgr *hwmgr, int idx,
        }
 }
 
+static int cz_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
+                                       uint32_t virtual_addr_low,
+                                       uint32_t virtual_addr_hi,
+                                       uint32_t mc_addr_low,
+                                       uint32_t mc_addr_hi,
+                                       uint32_t size)
+{
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramAddrHiVirtual,
+                                       mc_addr_hi);
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramAddrLoVirtual,
+                                       mc_addr_low);
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramAddrHiPhysical,
+                                       virtual_addr_hi);
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramAddrLoPhysical,
+                                       virtual_addr_low);
+
+       smum_send_msg_to_smc_with_parameter(hwmgr,
+                                       PPSMC_MSG_DramBufferSize,
+                                       size);
+       return 0;
+}
+
+
 static const struct pp_hwmgr_func cz_hwmgr_funcs = {
        .backend_init = cz_hwmgr_backend_init,
        .backend_fini = cz_hwmgr_backend_fini,
@@ -1900,6 +1927,7 @@ static int cz_read_sensor(struct pp_hwmgr *hwmgr, int idx,
        .dynamic_state_management_enable = cz_enable_dpm_tasks,
        .power_state_set = cz_set_power_state_tasks,
        .dynamic_state_management_disable = cz_disable_dpm_tasks,
+       .notify_cac_buffer_info = cz_notify_cac_buffer_info,
 };
 
 int cz_init_function_pointers(struct pp_hwmgr *hwmgr)
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +42 -0
index 4826b29..e32f18a 100644
@@ -4645,6 +4645,47 @@ static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)
        return 0;
 }
 
+static int smu7_notify_cac_buffer_info(struct pp_hwmgr *hwmgr,
+                                       uint32_t virtual_addr_low,
+                                       uint32_t virtual_addr_hi,
+                                       uint32_t mc_addr_low,
+                                       uint32_t mc_addr_hi,
+                                       uint32_t size)
+{
+       struct smu7_hwmgr *data = (struct smu7_hwmgr *)(hwmgr->backend);
+
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
+                                       data->soft_regs_start +
+                                       smum_get_offsetof(hwmgr,
+                                       SMU_SoftRegisters, DRAM_LOG_ADDR_H),
+                                       mc_addr_hi);
+
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
+                                       data->soft_regs_start +
+                                       smum_get_offsetof(hwmgr,
+                                       SMU_SoftRegisters, DRAM_LOG_ADDR_L),
+                                       mc_addr_low);
+
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
+                                       data->soft_regs_start +
+                                       smum_get_offsetof(hwmgr,
+                                       SMU_SoftRegisters, DRAM_LOG_PHY_ADDR_H),
+                                       virtual_addr_hi);
+
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
+                                       data->soft_regs_start +
+                                       smum_get_offsetof(hwmgr,
+                                       SMU_SoftRegisters, DRAM_LOG_PHY_ADDR_L),
+                                       virtual_addr_low);
+
+       cgs_write_ind_register(hwmgr->device, CGS_IND_REG__SMC,
+                                       data->soft_regs_start +
+                                       smum_get_offsetof(hwmgr,
+                                       SMU_SoftRegisters, DRAM_LOG_BUFF_SIZE),
+                                       size);
+       return 0;
+}
+
 static const struct pp_hwmgr_func smu7_hwmgr_funcs = {
        .backend_init = &smu7_hwmgr_backend_init,
        .backend_fini = &smu7_hwmgr_backend_fini,
@@ -4696,6 +4737,7 @@ static int smu7_avfs_control(struct pp_hwmgr *hwmgr, bool enable)
        .avfs_control = smu7_avfs_control,
        .disable_smc_firmware_ctf = smu7_thermal_disable_alert,
        .start_thermal_controller = smu7_start_thermal_controller,
+       .notify_cac_buffer_info = smu7_notify_cac_buffer_info,
 };
 
 uint8_t smu7_get_sleep_divider_id_from_clock(uint32_t clock,
drivers/gpu/drm/amd/powerplay/inc/smumgr.h +5 -0
index 7c9aba8..b1b27b2 100644
@@ -75,6 +75,11 @@ enum SMU_MEMBER {
        VceBootLevel,
        SamuBootLevel,
        LowSclkInterruptThreshold,
+       DRAM_LOG_ADDR_H,
+       DRAM_LOG_ADDR_L,
+       DRAM_LOG_PHY_ADDR_H,
+       DRAM_LOG_PHY_ADDR_L,
+       DRAM_LOG_BUFF_SIZE,
 };
 
 
drivers/gpu/drm/amd/powerplay/smumgr/ci_smc.c +10 -0
index 0017b9e..4d672cd 100644
@@ -2266,6 +2266,16 @@ static uint32_t ci_get_offsetof(uint32_t type, uint32_t member)
                        return offsetof(SMU7_SoftRegisters, PreVBlankGap);
                case VBlankTimeout:
                        return offsetof(SMU7_SoftRegisters, VBlankTimeout);
+               case DRAM_LOG_ADDR_H:
+                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_ADDR_H);
+               case DRAM_LOG_ADDR_L:
+                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_ADDR_L);
+               case DRAM_LOG_PHY_ADDR_H:
+                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+               case DRAM_LOG_PHY_ADDR_L:
+                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+               case DRAM_LOG_BUFF_SIZE:
+                       return offsetof(SMU7_SoftRegisters, DRAM_LOG_BUFF_SIZE);
                }
        case SMU_Discrete_DpmTable:
                switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c +10 -0
index b1a66b5..e130b77 100644
@@ -2199,6 +2199,16 @@ uint32_t fiji_get_offsetof(uint32_t type, uint32_t member)
                        return offsetof(SMU73_SoftRegisters, VBlankTimeout);
                case UcodeLoadStatus:
                        return offsetof(SMU73_SoftRegisters, UcodeLoadStatus);
+               case DRAM_LOG_ADDR_H:
+                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_ADDR_H);
+               case DRAM_LOG_ADDR_L:
+                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_ADDR_L);
+               case DRAM_LOG_PHY_ADDR_H:
+                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+               case DRAM_LOG_PHY_ADDR_L:
+                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+               case DRAM_LOG_BUFF_SIZE:
+                       return offsetof(SMU73_SoftRegisters, DRAM_LOG_BUFF_SIZE);
                }
        case SMU_Discrete_DpmTable:
                switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c +10 -0
index efb0fc0..da0c93b 100644
@@ -2125,6 +2125,16 @@ uint32_t iceland_get_offsetof(uint32_t type, uint32_t member)
                        return offsetof(SMU71_SoftRegisters, VBlankTimeout);
                case UcodeLoadStatus:
                        return offsetof(SMU71_SoftRegisters, UcodeLoadStatus);
+               case DRAM_LOG_ADDR_H:
+                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_ADDR_H);
+               case DRAM_LOG_ADDR_L:
+                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_ADDR_L);
+               case DRAM_LOG_PHY_ADDR_H:
+                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+               case DRAM_LOG_PHY_ADDR_L:
+                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+               case DRAM_LOG_BUFF_SIZE:
+                       return offsetof(SMU71_SoftRegisters, DRAM_LOG_BUFF_SIZE);
                }
        case SMU_Discrete_DpmTable:
                switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c +10 -0
index c92ea38..113cadb 100644
@@ -2190,6 +2190,16 @@ uint32_t polaris10_get_offsetof(uint32_t type, uint32_t member)
                        return offsetof(SMU74_SoftRegisters, VBlankTimeout);
                case UcodeLoadStatus:
                        return offsetof(SMU74_SoftRegisters, UcodeLoadStatus);
+               case DRAM_LOG_ADDR_H:
+                       return offsetof(SMU74_SoftRegisters, DRAM_LOG_ADDR_H);
+               case DRAM_LOG_ADDR_L:
+                       return offsetof(SMU74_SoftRegisters, DRAM_LOG_ADDR_L);
+               case DRAM_LOG_PHY_ADDR_H:
+                       return offsetof(SMU74_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+               case DRAM_LOG_PHY_ADDR_L:
+                       return offsetof(SMU74_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+               case DRAM_LOG_BUFF_SIZE:
+                       return offsetof(SMU74_SoftRegisters, DRAM_LOG_BUFF_SIZE);
                }
        case SMU_Discrete_DpmTable:
                switch (member) {
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c +10 -1
index 1f720cc..6675a85 100644
@@ -2668,6 +2668,16 @@ uint32_t tonga_get_offsetof(uint32_t type, uint32_t member)
                        return offsetof(SMU72_SoftRegisters, VBlankTimeout);
                case UcodeLoadStatus:
                        return offsetof(SMU72_SoftRegisters, UcodeLoadStatus);
+               case DRAM_LOG_ADDR_H:
+                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_ADDR_H);
+               case DRAM_LOG_ADDR_L:
+                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_ADDR_L);
+               case DRAM_LOG_PHY_ADDR_H:
+                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_PHY_ADDR_H);
+               case DRAM_LOG_PHY_ADDR_L:
+                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_PHY_ADDR_L);
+               case DRAM_LOG_BUFF_SIZE:
+                       return offsetof(SMU72_SoftRegisters, DRAM_LOG_BUFF_SIZE);
                }
        case SMU_Discrete_DpmTable:
                switch (member) {
--

1.9.1

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
#11 lore raw

PATCH 5/9 drm/amdgpu: add new pp function point notify_smu_memory_info

In reply to a message not in the archive
Change-Id Ib915cd5ac32a6b75667ff6e8ddafcea61e06cd67
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h        | 6 ++++++
 drivers/gpu/drm/amd/include/kgd_pp_interface.h | 5 +++++
 2 files changed, 11 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h +6 -0
index 56caaee..a8437a3 100644
@@ -360,6 +360,12 @@ enum amdgpu_pcie_gen {
 		((adev)->powerplay.pp_funcs->set_clockgating_by_smu(\
 			(adev)->powerplay.pp_handle, msg_id))
 
+#define amdgpu_dpm_notify_smu_memory_info(adev, virtual_addr_low, \
+			virtual_addr_hi, mc_addr_low, mc_addr_hi, size) \
+		((adev)->powerplay.pp_funcs->notify_smu_memory_info)( \
+			(adev)->powerplay.pp_handle, virtual_addr_low, \
+			virtual_addr_hi, mc_addr_low, mc_addr_hi, size)
+
 struct amdgpu_dpm {
 	struct amdgpu_ps        *ps;
 	/* number of valid power states */
drivers/gpu/drm/amd/include/kgd_pp_interface.h +5 -0
index f104668..eab504e 100644
@@ -260,6 +260,11 @@ struct amd_pm_funcs {
 	int (*load_firmware)(void *handle);
 	int (*wait_for_fw_loading_complete)(void *handle);
 	int (*set_clockgating_by_smu)(void *handle, uint32_t msg_id);
+	int (*notify_smu_memory_info)(void *handle, uint32_t virtual_addr_low,
+					uint32_t virtual_addr_hi,
+					uint32_t mc_addr_low,
+					uint32_t mc_addr_hi,
+					uint32_t size);
 /* export to DC */
 	u32 (*get_sclk)(void *handle, bool low);
 	u32 (*get_mclk)(void *handle, bool low);
Signature · 6 lines
1.9.1

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

PATCH 6/9 drm/amd/powerplay: implement notify_smu_memory_info on Powerplay

In reply to a message not in the archive
Change-Id I69a8a7637be35b9b03d7f7390cd3571cd24f9781
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 36 +++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +36 -0
index 463905b..c7ab8b3 100644
@@ -1163,6 +1163,41 @@ static int pp_dpm_switch_power_profile(void *handle,
 	return 0;
 }
 
+static int pp_dpm_notify_smu_memory_info(void *handle,
+					uint32_t virtual_addr_low,
+					uint32_t virtual_addr_hi,
+					uint32_t mc_addr_low,
+					uint32_t mc_addr_hi,
+					uint32_t size)
+{
+	struct pp_hwmgr  *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	if (hwmgr->hwmgr_func->notify_cac_buffer_info == NULL) {
+		pr_info("%s was not implemented.\n", __func__);
+		return -EINVAL;
+	}
+
+	mutex_lock(&pp_handle->pp_lock);
+
+	ret = hwmgr->hwmgr_func->notify_cac_buffer_info(hwmgr, virtual_addr_low,
+					virtual_addr_hi, mc_addr_low, mc_addr_hi,
+					size);
+
+	mutex_unlock(&pp_handle->pp_lock);
+
+	return ret;
+}
+
+
 /* export this function to DAL */
 
 static int pp_display_configuration_change(void *handle,
@@ -1434,6 +1469,7 @@ static int pp_get_display_mode_validation_clocks(void *handle,
 	.set_power_profile_state = pp_dpm_set_power_profile_state,
 	.switch_power_profile = pp_dpm_switch_power_profile,
 	.set_clockgating_by_smu = pp_set_clockgating_by_smu,
+	.notify_smu_memory_info = pp_dpm_notify_smu_memory_info,
 /* export to DC */
 	.get_sclk = pp_dpm_get_sclk,
 	.get_mclk = pp_dpm_get_mclk,
Signature · 6 lines
1.9.1

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

PATCH 7/9 drm/amdgpu: add smu_memory_pool_size module parameter

In reply to a message not in the archive

this allow allocate system memmoy for smu
debug usage.

Change-Id Iac0489e528395448abeaf23a22cd6a1031a5b55b
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 07a699d..3a79d41 100644
@@ -132,6 +132,7 @@
 #ifdef CONFIG_DRM_AMDGPU_CIK
 extern int amdgpu_cik_support;
 #endif
+extern uint amdgpu_smu_memory_pool_size;
 
 #define AMDGPU_DEFAULT_GTT_SIZE_MB		3072ULL /* 3GB by default */
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS	        3000
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -0
index 374a7a1..a7b6732 100644
@@ -125,6 +125,7 @@
 int amdgpu_job_hang_limit = 0;
 int amdgpu_lbpw = -1;
 int amdgpu_compute_multipipe = -1;
+uint amdgpu_smu_memory_pool_size = 0;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -300,6 +301,10 @@
 module_param_named(cik_support, amdgpu_cik_support, int, 0444);
 #endif
 
+MODULE_PARM_DESC(smu_memory_pool_size,
+	"Allocate system memory for smu debug usage, 0 = disable,"
+		"0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
+module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
 
 static const struct pci_device_id pciidlist[] = {
 #ifdef  CONFIG_DRM_AMDGPU_SI
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-7-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#15 lore raw

Re: [PATCH 7/9] drm/amdgpu: add smu_memory_pool_size module parameter

Quoted 5 lines · Rex Zhu

this allow allocate system memmoy for smu
debug usage.

Change-Id Iac0489e528395448abeaf23a22cd6a1031a5b55b

I'd prefer to expose this via debugfs so we can enable/disable it on the fly. We can clamp the size based on the gart size and if we want a larger buffer, just tell the user to change amdgpu.gart_size

Alex

Quoted 43 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h     | 1 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 5 +++++
 2 files changed, 6 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +1 -0
index 07a699d..3a79d41 100644
@@ -132,6 +132,7 @@
 #ifdef CONFIG_DRM_AMDGPU_CIK
 extern int amdgpu_cik_support;
 #endif
+extern uint amdgpu_smu_memory_pool_size;
 
 #define AMDGPU_DEFAULT_GTT_SIZE_MB             3072ULL /* 3GB by default */
 #define AMDGPU_WAIT_IDLE_TIMEOUT_IN_MS         3000
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +5 -1
index 374a7a1..a7b6732 100644
@@ -125,6 +125,7 @@
 int amdgpu_job_hang_limit = 0;
 int amdgpu_lbpw = -1;
 int amdgpu_compute_multipipe = -1;
+uint amdgpu_smu_memory_pool_size = 0;
 
 MODULE_PARM_DESC(vramlimit, "Restrict VRAM for testing, in megabytes");
 module_param_named(vramlimit, amdgpu_vram_limit, int, 0600);
@@ -300,6 +301,10 @@
 module_param_named(cik_support, amdgpu_cik_support, int, 0444);
 #endif
 
+MODULE_PARM_DESC(smu_memory_pool_size,
+       "Allocate system memory for smu debug usage, 0 = disable,"
+               "0x1 = 256Mbyte, 0x2 = 512Mbyte, 0x4 = 1 Gbyte, 0x8 = 2GByte");
+module_param_named(smu_memory_pool_size, amdgpu_smu_memory_pool_size, uint, 0444);
 
 static const struct pci_device_id pciidlist[] = {
 #ifdef  CONFIG_DRM_AMDGPU_SI
--

1.9.1

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
#16 lore raw

PATCH 8/9 drm/amdgpu: allocate requested gtt buffer for smu

In reply to a message not in the archive

v2: simplify check smu_memory_size code.
simplify allocate smu memroy code.

Change-Id I8eb4f542dc2351c6393e4723f4985df92ff527cd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 79 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  3 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      |  2 +
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      |  3 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      |  2 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      |  2 +
 7 files changed, 93 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 3a79d41..534b313 100644
@@ -1615,6 +1615,8 @@ struct amdgpu_device {
 	bool has_hw_reset;
 	u8				reset_magic[AMDGPU_RESET_MAGIC_NUM];
 
+	struct amdgpu_bo		*smu_prv_buffer;
+
 	/* record last mm index being written through WREG32*/
 	unsigned long last_mm_index;
 	bool                            in_sriov_reset;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +79 -0

109 lines not on this page · raw message

drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -0
index 1086f03..75e10b6 100644
@@ -1270,6 +1270,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
 			       adev->mc.mc_vram_size);
 	else
 		gtt_size = (uint64_t)amdgpu_gtt_size << 20;
+
+	gtt_size = gtt_size + amdgpu_smu_memory_pool_size;
+
 	r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
 	if (r) {
 		DRM_ERROR("Failed initializing GTT heap.\n");
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -0
index f4603a7..e1f97b1 100644
@@ -350,6 +350,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
 		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+	adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
 	gmc_v6_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +3 -0
index b0528ca..ac481a0 100644
@@ -407,6 +407,9 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
 		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+
+	adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
 	gmc_v7_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -0
index f368cfe..0f5bccc 100644
@@ -582,6 +582,8 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
 		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+	adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
 	gmc_v8_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -0
index 6216993..09cf381 100644
@@ -511,6 +511,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
 		adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
 	}
 
+	adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
 	gmc_v9_0_vram_gtt_location(adev, &adev->mc);
 
 	return 0;
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-8-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#18 lore raw

Re: [PATCH 8/9] drm/amdgpu: allocate requested gtt buffer for smu

Quoted 2 lines · Rex Zhu

v2: simplify check smu_memory_size code.
simplify allocate smu memroy code.

See my comment in patch 7. More comments below.

Quoted 31 lines
Change-Id I8eb4f542dc2351c6393e4723f4985df92ff527cd
---
 drivers/gpu/drm/amd/amdgpu/amdgpu.h        |  2 +
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 79 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c    |  3 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c      |  2 +
 drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c      |  3 ++
 drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c      |  2 +
 drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c      |  2 +
 7 files changed, 93 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +2 -0
index 3a79d41..534b313 100644
@@ -1615,6 +1615,8 @@ struct amdgpu_device {
        bool has_hw_reset;
        u8                              reset_magic[AMDGPU_RESET_MAGIC_NUM];
 
+       struct amdgpu_bo                *smu_prv_buffer;
+
        /* record last mm index being written through WREG32*/
        unsigned long last_mm_index;
        bool                            in_sriov_reset;
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +0 -0
index 24f6e3c..9311096 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c static void amdgpu_check_vm_size(struct amdgpu_device *adev) · line 1080

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -1077,6 +1077,46 @@ static void amdgpu_check_vm_size(struct amdgpu_device *adev)
        amdgpu_vm_size = -1;
 }
 
+static void amdgpu_check_smu_prv_buffer_size(struct amdgpu_device *adev)

For consistency, please prefix this function with amdgpu_device. E.g., amdgpu_device_check_smu_prv_buffer_size()

Quoted 52 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +41 -0
+{
+       struct sysinfo si;
+       bool is_os_64 = (sizeof(void *) == 8) ? true : false;
+       uint64_t total_memory;
+       uint64_t dram_size_seven_GB = 0x1B8000000;
+       uint64_t dram_size_three_GB = 0xB8000000;
+
+       if (amdgpu_smu_memory_pool_size == 0)
+               return;
+
+       if (!is_os_64) {
+               DRM_WARN("Not 64-bit OS, feature not supported\n");
+               goto def_value;
+       }
+       si_meminfo(&si);
+       total_memory = (uint64_t)si.totalram * si.mem_unit;
+
+       if ((amdgpu_smu_memory_pool_size == 1) ||
+               (amdgpu_smu_memory_pool_size == 2)) {
+               if (total_memory < dram_size_three_GB)
+                       goto def_value1;
+       } else if ((amdgpu_smu_memory_pool_size == 4) ||
+               (amdgpu_smu_memory_pool_size == 8)) {
+               if (total_memory < dram_size_seven_GB)
+                       goto def_value1;
+       } else {
+               DRM_WARN("Smu memory pool size not supported\n");
+               goto def_value;
+       }
+       amdgpu_smu_memory_pool_size = amdgpu_smu_memory_pool_size << 28;
+
+       return;
+
+def_value1:
+       DRM_WARN("No enough system memory\n");
+def_value:
+       amdgpu_smu_memory_pool_size = 0;
+}
+
 /**
  * amdgpu_check_arguments - validate module params
  *
@@ -1118,6 +1158,8 @@ static void amdgpu_check_arguments(struct amdgpu_device *adev)
                amdgpu_vm_fragment_size = -1;
        }
 
+       amdgpu_check_smu_prv_buffer_size(adev);
+
        amdgpu_check_vm_size(adev);
 
        amdgpu_check_block_size(adev);

drivers/gpu/drm/amd/amdgpu/amdgpu_device.c bool amdgpu_device_has_dc_support(struct amdgpu_device *adev) · line 2072

Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +1 -0
@@ -2027,6 +2069,36 @@ bool amdgpu_device_has_dc_support(struct amdgpu_device *adev)
        return amdgpu_device_asic_has_dc_support(adev->asic_type);
 }
 
+static void amdgpu_alloc_mem_for_smu(struct amdgpu_device *adev)

amdgpu_device_alloc_mem_for_smu

Quoted 123 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +36 -0
+{
+       int r = -EINVAL;
+       void *cpu_ptr = NULL;
+       uint64_t gpu_addr;
+
+       if (amdgpu_bo_create_kernel(adev, amdgpu_smu_memory_pool_size,
+                                      PAGE_SIZE, AMDGPU_GEM_DOMAIN_GTT,
+                                      &adev->smu_prv_buffer,
+                                      &gpu_addr,
+                                      &cpu_ptr)) {
+               DRM_ERROR("amdgpu: failed to create smu prv buffer (%d).\n", r);
+               return;
+       }
+
+       if (adev->powerplay.pp_funcs->notify_smu_memory_info)
+               r = amdgpu_dpm_notify_smu_memory_info(adev,
+                                       lower_32_bits((unsigned long)cpu_ptr),
+                                       upper_32_bits((unsigned long)cpu_ptr),
+                                       lower_32_bits(gpu_addr),
+                                       upper_32_bits(gpu_addr),
+                                       amdgpu_smu_memory_pool_size);
+
+       if (r) {
+               amdgpu_bo_free_kernel(&adev->smu_prv_buffer, NULL, NULL);
+               adev->smu_prv_buffer = NULL;
+               DRM_ERROR("amdgpu: failed to notify SMU buffer address.\n");
+       }
+}
+
 /**
  * amdgpu_device_init - initialize the driver
  *
@@ -2307,6 +2379,9 @@ int amdgpu_device_init(struct amdgpu_device *adev,
                        DRM_INFO("amdgpu: acceleration disabled, skipping benchmarks\n");
        }
 
+       if (amdgpu_smu_memory_pool_size)
+               amdgpu_alloc_mem_for_smu(adev);
+
        /* enable clockgating, etc. after ib tests, etc. since some blocks require
         * explicit gating rather than handling it automatically.
         */
@@ -2352,6 +2427,10 @@ void amdgpu_device_fini(struct amdgpu_device *adev)
                release_firmware(adev->firmware.gpu_info_fw);
                adev->firmware.gpu_info_fw = NULL;
        }
+       if (adev->smu_prv_buffer) {
+               amdgpu_bo_free_kernel(&adev->smu_prv_buffer, NULL, NULL);
+               adev->smu_prv_buffer = NULL;
+       }
        adev->accel_working = false;
        cancel_delayed_work_sync(&adev->late_init_work);
        /* free i2c buses */
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +3 -0
index 1086f03..75e10b6 100644
@@ -1270,6 +1270,9 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
                               adev->mc.mc_vram_size);
        else
                gtt_size = (uint64_t)amdgpu_gtt_size << 20;
+
+       gtt_size = gtt_size + amdgpu_smu_memory_pool_size;
+
        r = ttm_bo_init_mm(&adev->mman.bdev, TTM_PL_TT, gtt_size >> PAGE_SHIFT);
        if (r) {
                DRM_ERROR("Failed initializing GTT heap.\n");
drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c +2 -0
index f4603a7..e1f97b1 100644
@@ -350,6 +350,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
                adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
        }
 
+       adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
        gmc_v6_0_vram_gtt_location(adev, &adev->mc);
 
        return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +3 -0
index b0528ca..ac481a0 100644
@@ -407,6 +407,9 @@ static int gmc_v7_0_mc_init(struct amdgpu_device *adev)
                adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
        }
 
+
+       adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
        gmc_v7_0_vram_gtt_location(adev, &adev->mc);
 
        return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +2 -0
index f368cfe..0f5bccc 100644
@@ -582,6 +582,8 @@ static int gmc_v8_0_mc_init(struct amdgpu_device *adev)
                adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
        }
 
+       adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
        gmc_v8_0_vram_gtt_location(adev, &adev->mc);
 
        return 0;
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +2 -1
index 6216993..09cf381 100644
@@ -511,6 +511,8 @@ static int gmc_v9_0_mc_init(struct amdgpu_device *adev)
                adev->mc.gart_size = (u64)amdgpu_gart_size << 20;
        }
 
+       adev->mc.gart_size += amdgpu_smu_memory_pool_size;
+
        gmc_v9_0_vram_gtt_location(adev, &adev->mc);
 
        return 0;
--

1.9.1

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
#19 lore raw

PATCH 9/9 drm/amd/powerplay: delete an outdated comment in amd_powerplay.c

In reply to a message not in the archive
Change-Id I96abfea4eb7d257d2b6461392683c280b268ef76
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0 -3
index c7ab8b3..6b0cf8e 100644
@@ -1197,9 +1197,6 @@ static int pp_dpm_notify_smu_memory_info(void *handle,
 	return ret;
 }
 
-
-/* export this function to DAL */
-
 static int pp_display_configuration_change(void *handle,
 	const struct amd_pp_display_configuration *display_config)
 {
Signature · 6 lines
1.9.1

_______________________________________________
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): 1507524126-28194-9-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#21 lore raw

Re: [PATCH 9/9] drm/amd/powerplay: delete an outdated comment in amd_powerplay.c

Quoted 2 lines · Rex Zhu
Change-Id I96abfea4eb7d257d2b6461392683c280b268ef76
Quoted 21 lines
---
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/amd/powerplay/amd_powerplay.c +0 -4
index c7ab8b3..6b0cf8e 100644
@@ -1197,9 +1197,6 @@ static int pp_dpm_notify_smu_memory_info(void *handle,
        return ret;
 }
 
-
-/* export this function to DAL */
-
 static int pp_display_configuration_change(void *handle,
        const struct amd_pp_display_configuration *display_config)
 {
--

1.9.1

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

Reviewed-by
#22 lore raw
In reply to a message not in the archive
Quoted 2 lines · Rex Zhu
Change-Id I5afa09980174ef191c7aa4e4f9dadaaa189783ca
Quoted 20 lines
---
 drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/powerplay/inc/vega10_ppsmc.h +2 -1
index cb070eb..d06ece4 100644
@@ -124,6 +124,8 @@
 #define PPSMC_MSG_NumOfDisplays                  0x56
 #define PPSMC_MSG_ReadSerialNumTop32             0x58
 #define PPSMC_MSG_ReadSerialNumBottom32          0x59
+#define PPSMC_MSG_SetSystemVirtualDramAddrHigh   0x5A
+#define PPSMC_MSG_SetSystemVirtualDramAddrLow    0x5B
 #define PPSMC_MSG_RunAcgBtc                      0x5C
 #define PPSMC_MSG_RunAcgInClosedLoop             0x5D
 #define PPSMC_MSG_RunAcgInOpenLoop               0x5E
--

1.9.1

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