• Srinivas Pandruvada's avatar
    tools/power/x86/intel-speed-select: Store topology information · fb186158
    Srinivas Pandruvada authored
    Once the CPU is offline, the topology information (core-id, package-id,
    die-id) is not accessible via sysfs. So when user selects a config level
    more than base config 0 and offlined CPUs to match the config level,
    to return to base config he has to manually online CPUs before. Without
    this CPUs information mapping from Punit CPU numbering will lot work
    as it needs atlest package id for each CPU.
    
    To avoid this additional steps store the topology information in a file
    , which is created on the very first run after boot. Since system boots
    in base config and all CPUs are online, we can get information about
    every CPU.
    
    Once any of the APIs like get_physical_package_id(),
    get_physical_core_id() or get_physical_die_id() fails to read from
    sysfs, read from the stored mapping file.
    
    This mapping file is stored in /tmp file system. so on every boot
    it is recreated to make sure that any new CPUs are added to the
    system before boot are taken into account.
    
    But don't use the stored physical device id  when trying to get
    information for CPU to send message in for_each_online_package_in_set().
    Here use the real value from syfs and in case fails try the next CPU.
    Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
    Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
    fb186158
isst-config.c 58.4 KB