some changes for thermal interrupts
Subsystems (2)
cover some changes for thermal interrupts
Eric Huang (4):
drm/amdgpu: add cgs query info of pci bus devfn drm/amd/powerplay: add register thermal interrupt in hwmgr_hw_init drm/amd/powerplay: implement register thermal interrupt for Vega10 drm/amd/powerplay: change alert temperature range
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 + drivers/gpu/drm/amd/include/cgs_common.h | 1 + .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 4 +- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 75 +++++++++++++++++++++- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 33 ++++++++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 6 ++ 6 files changed, 119 insertions(+), 3 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): 1505844408-9731-1-git-send-email-JinHuiEric.Huang-5C7GfCeVMHo@public.gmane.org
PATCH 1/4 drm/amdgpu: add cgs query info of pci bus devfn
--- drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 +++ drivers/gpu/drm/amd/include/cgs_common.h | 1 + 2 files changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c +3 -0
@@ -796,6 +796,9 @@ static int amdgpu_cgs_query_system_info(struct cgs_device *cgs_device,case CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID : sys_info->value = adev->pdev->subsystem_vendor;break ; +case CGS_SYSTEM_INFO_PCIE_BUS_DEVFN : + sys_info->value = adev->pdev->devfn; +break ;default :return -ENODEV ; }
drivers/gpu/drm/amd/include/cgs_common.h +1 -0
@@ -100,6 +100,7 @@ enum cgs_system_info_id {CGS_SYSTEM_INFO_GFX_SE_INFO ,CGS_SYSTEM_INFO_PCIE_SUB_SYS_ID ,CGS_SYSTEM_INFO_PCIE_SUB_SYS_VENDOR_ID , +CGS_SYSTEM_INFO_PCIE_BUS_DEVFN , CGS_SYSTEM_INFO_ID_MAXIMUM, };
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 2/4 drm/amd/powerplay: add register thermal interrupt in hwmgr_hw_init
In reply to a message not in the archive--- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 75 ++++++++++++++++++++++++++++- drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 6 +++ 2 files changed, 80 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c +74 -1
@@ -26,8 +26,8 @@#include <linux/types.h> #include <linux/kernel.h> #include <linux/slab.h> +#include <linux/pci.h> #include <drm/amdgpu_drm.h> -#include "cgs_common.h" #include "power_state.h" #include "hwmgr.h" #include "pppcielanes.h"
@@ -50,6 +50,75 @@ uint8_t convert_to_vid(uint16_t vddc)return (uint8_t ) ((6200 - (vddc *VOLTAGE_SCALE )) /25 ); } +static int phm_get_pci_bus_devfn (struct pp_hwmgr *hwmgr, +struct cgs_system_info *sys_info) +{ + sys_info->size =sizeof (struct cgs_system_info ); + sys_info->info_id =CGS_SYSTEM_INFO_PCIE_BUS_DEVFN ; + +return cgs_query_system_info (hwmgr->device, sys_info); +} + +static int phm_thermal_l2h_irq (void *private_data, +unsigned src_id,const uint32_t *iv_entry) +{ +struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; +struct cgs_system_info sys_info = {0 }; +int result; + + result =phm_get_pci_bus_devfn (hwmgr, &sys_info); +if (result) +return -EINVAL ; + +pr_warn ("GPU over temperature range detected on PCIe %lld:%lld.%lld!\n" , +PCI_BUS_NUM (sys_info.value), +PCI_SLOT (sys_info.value), +PCI_FUNC (sys_info.value)); +return 0 ; +} + +static int phm_thermal_h2l_irq (void *private_data, +unsigned src_id,const uint32_t *iv_entry) +{ +struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; +struct cgs_system_info sys_info = {0 }; +int result; + + result =phm_get_pci_bus_devfn (hwmgr, &sys_info); +if (result) +return -EINVAL ; + +pr_warn ("GPU under temperature range detected on PCIe %lld:%lld.%lld!\n" , +PCI_BUS_NUM (sys_info.value), +PCI_SLOT (sys_info.value), +PCI_FUNC (sys_info.value)); +return 0 ; +} + +static int phm_ctf_irq (void *private_data, +unsigned src_id,const uint32_t *iv_entry) +{ +struct pp_hwmgr *hwmgr = (struct pp_hwmgr *)private_data; +struct cgs_system_info sys_info = {0 }; +int result; + + result =phm_get_pci_bus_devfn (hwmgr, &sys_info); +if (result) +return -EINVAL ; + +pr_warn ("GPU Critical Temperature Fault detected on PCIe %lld:%lld.%lld!\n" , +PCI_BUS_NUM (sys_info.value), +PCI_SLOT (sys_info.value), +PCI_FUNC (sys_info.value)); +return 0 ; +} + +static const struct cgs_irq_src_funcs thermal_irq_src[3 ] = { + {NULL , phm_thermal_l2h_irq}, + {NULL , phm_thermal_h2l_irq}, + {NULL , phm_ctf_irq} +}; +int hwmgr_early_init (struct pp_instance *handle) {struct pp_hwmgr *hwmgr;
@@ -170,6 +239,10 @@ int hwmgr_hw_init(struct pp_instance *handle)if (ret) goto err2; + ret =phm_register_thermal_interrupt (hwmgr, &thermal_irq_src); +if (ret) + goto err2; +return 0 ; err2:if (hwmgr->hwmgr_func->backend_fini)
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +6 -0
@@ -32,6 +32,7 @@#include "ppatomctrl.h" #include "hwmgr_ppt.h" #include "power_state.h" +#include "cgs_linux.h" struct pp_instance ;struct pp_hwmgr ;
@@ -796,6 +797,11 @@ struct pp_hwmgr {bool en_umd_pstate; }; +struct cgs_irq_src_funcs { +cgs_irq_source_set_func_t set; +cgs_irq_handler_func_t handler; +}; +extern int hwmgr_early_init (struct pp_instance *handle);extern int hwmgr_hw_init (struct pp_instance *handle);extern int hwmgr_hw_fini (struct pp_instance *handle);
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 3/4 drm/amd/powerplay: implement register thermal interrupt for Vega10
In reply to a message not in the archive--- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+)
drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c +33 -0
@@ -4999,6 +4999,38 @@ static int vega10_set_mclk_od(struct pp_hwmgr *hwmgr, uint32_t value)return 0 ; } +static int vega10_register_thermal_interrupt (struct pp_hwmgr *hwmgr, +const void *info) +{ +struct cgs_irq_src_funcs *irq_src = + (struct cgs_irq_src_funcs *)info; + +if (hwmgr->thermal_controller.ucType == +ATOM_VEGA10_PP_THERMALCONTROLLER_VEGA10 || + hwmgr->thermal_controller.ucType == +ATOM_VEGA10_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL ) { +PP_ASSERT_WITH_CODE (!cgs_add_irq_source (hwmgr->device, +0xf ,/* AMDGPU_IH_CLIENTID_THM */ +0 ,0 , irq_src[0 ].set, irq_src[0 ].handler, hwmgr), +"Failed to register high thermal interrupt!" , + return -EINVAL ); +PP_ASSERT_WITH_CODE (!cgs_add_irq_source (hwmgr->device, +0xf ,/* AMDGPU_IH_CLIENTID_THM */ +1 ,0 , irq_src[1 ].set, irq_src[1 ].handler, hwmgr), +"Failed to register low thermal interrupt!" , + return -EINVAL ); + } + +/* Register CTF(GPIO_19) interrupt */ +PP_ASSERT_WITH_CODE (!cgs_add_irq_source (hwmgr->device, +0x16 ,/* AMDGPU_IH_CLIENTID_ROM_SMUIO, */ +83 ,0 , irq_src[2 ].set, irq_src[2 ].handler, hwmgr), +"Failed to register CTF thermal interrupt!" , + return -EINVAL ); + +return 0 ; +} +static const struct pp_hwmgr_func vega10_hwmgr_funcs = { .backend_init = vega10_hwmgr_backend_init, .backend_fini = vega10_hwmgr_backend_fini,
@@ -5052,6 +5084,7 @@ static const struct pp_hwmgr_func vega10_hwmgr_funcs = { .get_mclk_od = vega10_get_mclk_od, .set_mclk_od = vega10_set_mclk_od, .avfs_control = vega10_avfs_enable, + .register_internal_thermal_interrupt = vega10_register_thermal_interrupt, };int vega10_hwmgr_init (struct pp_hwmgr *hwmgr)
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
PATCH 4/4 drm/amd/powerplay: change alert temperature range
In reply to a message not in the archiveChange to more meaningful range that triggers thermal interrupts.
--- drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c +2 -2
@@ -27,8 +27,8 @@#include "power_state.h" -#define TEMP_RANGE_MIN (90 * 1000) -#define TEMP_RANGE_MAX (120 * 1000) +#define TEMP_RANGE_MIN (0) +#define TEMP_RANGE_MAX (80 * 1000)#define PHM_FUNC_CHECK (hw) \ do { \
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Deucher, Alexander
Reviewed-by Alex DeucherQuoted 8 lines
-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Eric Huang
Sent: Tuesday, September 19, 2017 2:07 PM
To: [email protected]
Cc: Huang, JinHuiEric
Subject: [PATCH 0/4] some changes for thermal interrupts
Quoted 5 lines
Eric Huang (4):
drm/amdgpu: add cgs query info of pci bus devfn drm/amd/powerplay: add register thermal interrupt inhwmgr_hw_initdrm/amd/powerplay: implement register thermal interrupt for Vega10 drm/amd/powerplay: change alert temperature range
Series is:
Quoted 11 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c | 3 + drivers/gpu/drm/amd/include/cgs_common.h | 1 + .../gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c | 4 +- drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 75 +++++++++++++++++++++- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 33 ++++++++++ drivers/gpu/drm/amd/powerplay/inc/hwmgr.h | 6 ++ 6 files changed, 119 insertions(+), 3 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