Esempio n. 1
0
def is_sstbf_enabled():
    """
    Returns SST-BF enabled status
    """
    sys = power_common.get_pwr_sys()
    if not sys:
        return None

    return sys.sst_bf_enabled
Esempio n. 2
0
def is_sstcp_enabled():
    """
    Returns EPP enabled status
    """

    pwr_sys = power_common.get_pwr_sys()
    if not pwr_sys:
        return False

    return pwr_sys.sst_bf_enabled and pwr_sys.epp_enabled
Esempio n. 3
0
def is_sstbf_configured():
    """
    Returns SST-BF configured status
    """
    sys = power_common.get_pwr_sys()
    if not sys:
        return None

    sys.refresh_stats()
    return sys.sst_bf_configured
Esempio n. 4
0
def configure_sstbf(configure):
    """
    Configures or unconfigures SST-BF
    """

    sys = power_common.get_pwr_sys()
    if not sys:
        return -1

    if configure:
        new_core_cfg = PWR_CFG_SST_BF
    else:
        new_core_cfg = PWR_CFG_BASE

    sys.commit(new_core_cfg)

    log.sys("Intel SST-BF {}configured.".format("" if configure else "un"))

    return 0
Esempio n. 5
0
def _admission_control_check(data):
    """
    Validate Power Profiles configuration,
    admission control check done on PWR lib side

    Parameters
        data: configuration (dict)
    """

    profiles = {}
    for profile in data['power_profiles']:
        profiles[profile['id']] = deepcopy(profile)
        profiles[profile['id']]['cores'] = []

    for pool in data['pools']:
        if 'power_profile' not in pool:
            continue
        profiles[pool['power_profile']]['cores'].extend(pool['cores'])

    cores = power_common.get_pwr_cores()

    for core in cores:
        for profile in profiles.values():
            if core.core_id in profile['cores']:
                core.min_freq = profile['min_freq']
                core.max_freq = profile['max_freq']
                core.epp = profile['epp']
                break

    pwr_sys = power_common.get_pwr_sys()
    result = pwr_sys.request_config()
    pwr_sys.refresh_all()

    if not result:
        raise AdmissionControlError\
            ("Power Profiles configuration would cause CPU to be oversubscribed.")