diff options
author | Jacob Harvey <jlharvey@us.ibm.com> | 2016-10-13 09:29:46 -0500 |
---|---|---|
committer | Daniel M. Crowell <dcrowell@us.ibm.com> | 2016-10-27 11:06:51 -0400 |
commit | ee413cb5a6ae5b743582c61427ab3d9f8ec1afc7 (patch) | |
tree | 4669e9e0dbf2f2ef14faa1d8b6b621376a1182b8 /src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C | |
parent | 097b78713b5afd3a0e5ec4fbe6233237f5b2319b (diff) | |
download | talos-hostboot-ee413cb5a6ae5b743582c61427ab3d9f8ec1afc7.tar.gz talos-hostboot-ee413cb5a6ae5b743582c61427ab3d9f8ec1afc7.zip |
Started implementation of bulk_pwr_throttles
Added calc_power and calc_databus functions for throttling
Added testing for those calc functions
Added a set_power_attrs which decodes power curve attributes
Change-Id: I2f08f846f6b19b0200b1c1df4a095cabfa9ee840
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31163
Reviewed-by: Brian R. Silver <bsilver@us.ibm.com>
Reviewed-by: Louis Stermole <stermole@us.ibm.com>
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/31259
Reviewed-by: Matt Derksen <v2cibmd@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: JACOB L. HARVEY <jlharvey@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C')
-rw-r--r-- | src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C | 112 |
1 files changed, 103 insertions, 9 deletions
diff --git a/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C b/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C index ec918049c..361c3dbe6 100644 --- a/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C +++ b/src/import/chips/p9/procedures/hwp/memory/p9_mss_eff_config_thermal.C @@ -27,23 +27,117 @@ /// @file p9_mss_eff_config_thermal.C /// @brief Perform thermal calculations as part of the effective configuration /// -// *HWP HWP Owner: Andre Marin <aamarin@us.ibm.com> +// *HWP HWP Owner: Jacob Harvey <jlharvey@us.ibm.com> // *HWP HWP Backup: Brian Silver <bsilver@us.ibm.com> // *HWP Team: Memory // *HWP Level: 1 // *HWP Consumed by: FSP:HB #include <fapi2.H> +#include <vector> #include <p9_mss_eff_config_thermal.H> - +#include <p9_mss_bulk_pwr_throttles.H> +#include <lib/power_thermal/throttle.H> +#include <lib/power_thermal/decoder.H> +#include <lib/dimm/kind.H> +#include <mss.H> +extern "C" +{ /// /// @brief Perform thermal calculations as part of the effective configuration -/// @param[in] i_target the controller (e.g., MCS) +/// @param[in] i_targets an array of MCS targets all on the same VDDR domain /// @return FAPI2_RC_SUCCESS iff ok /// -fapi2::ReturnCode p9_mss_eff_config_thermal( const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target ) -{ - FAPI_INF("Start effective config thermal"); - FAPI_INF("End effective config thermal"); - return fapi2::FAPI2_RC_SUCCESS; -} + fapi2::ReturnCode p9_mss_eff_config_thermal( const std::vector< fapi2::Target<fapi2::TARGET_TYPE_MCS> >& i_targets ) + { + + FAPI_INF("Start effective config thermal"); + + uint16_t l_vddr_slope [mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + uint16_t l_vddr_int [mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + uint16_t l_total_slope [mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + uint16_t l_total_int [mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + uint32_t l_thermal_power [mss::PORTS_PER_MCS][mss::MAX_DIMM_PER_PORT] = {}; + + //Gotta convert into fapi2::buffers. Not very elegant + //Do it here or in the encode and decode functions + std::vector< uint64_t > l_tslope (mss::SIZE_OF_POWER_CURVES_ATTRS, 0); + std::vector< uint64_t > l_tintercept (mss::SIZE_OF_POWER_CURVES_ATTRS, 0); + std::vector< uint64_t > l_tthermal_power_limit (mss::SIZE_OF_THERMAL_ATTR, 0); + + std::vector< fapi2::buffer< uint64_t > > l_slope (mss::SIZE_OF_POWER_CURVES_ATTRS); + std::vector< fapi2::buffer< uint64_t > > l_intercept (mss::SIZE_OF_POWER_CURVES_ATTRS); + std::vector< fapi2::buffer< uint64_t > > l_thermal_power_limit (mss::SIZE_OF_THERMAL_ATTR); + + FAPI_TRY ( mss::mrw_pwr_slope (l_tslope.data() )); + FAPI_TRY ( mss::mrw_pwr_intercept (l_tintercept.data()) ); + FAPI_TRY ( mss::mrw_thermal_memory_power_limit (l_tthermal_power_limit.data()) ); + + for (size_t i = 0; i < l_slope.size(); ++i) + { + l_slope[i] = fapi2::buffer<uint64_t> (l_tslope[i]); + l_intercept[i] = fapi2::buffer<uint64_t>(l_tintercept[i]); + } + + for ( const auto& l_mcs : i_targets ) + { + FAPI_TRY (mss::power_thermal::get_power_attrs(l_mcs, + l_slope, + l_intercept, + l_thermal_power_limit, + l_vddr_slope, + l_vddr_int, + l_total_slope, + l_total_int, + l_thermal_power)); + + FAPI_TRY( mss::power_thermal::restore_runtime_throttles(l_mcs)); + + //Set the power attribute (TOTAL_PWR) to just VDDR for IPL, restoreto vddr+vpp later for OCC + //Set here because bulk_pwr_throttles takes input as attributes, and I can't change which attribute it takes + //So we have to use TOTAL_PWR_SLOPE + //Setting here and not in set_power_attrs because get_power_attrs decodes the attributes and stores them + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_TOTAL_PWR_SLOPE, + l_mcs, + l_vddr_slope)); + + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_TOTAL_PWR_INTERCEPT, + l_mcs, + l_vddr_int)); + } + + //get the thermal limits, done per dimm and set to worst case for the slot and port throttles + FAPI_TRY (p9_mss_bulk_pwr_throttles(i_targets, THERMAL)); + + //Set VDDR+VPP + for ( const auto& l_mcs : i_targets ) + { + FAPI_TRY (mss::power_thermal::get_power_attrs(l_mcs, + l_slope, + l_intercept, + l_thermal_power_limit, + l_vddr_slope, + l_vddr_int, + l_total_slope, + l_total_int, + l_thermal_power)); + + FAPI_TRY( mss::power_thermal::restore_runtime_throttles(l_mcs)); + + //Set the power attribute (TOTAL_PWR) to just VDDR for IPL, restoreto vddr+vpp later for OCC + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_TOTAL_PWR_SLOPE, + l_mcs, + l_total_slope)); + + FAPI_TRY( FAPI_ATTR_SET(fapi2::ATTR_MSS_TOTAL_PWR_INTERCEPT, + l_mcs, + l_total_int)); + } + + + FAPI_INF("End effective config thermal"); + + fapi_try_exit: + return fapi2::FAPI2_RC_SUCCESS; + } +} //extern C |