Commit graph

753 commits

Author SHA1 Message Date
Linus Torvalds ff2ae607c6 SPDX patches for 5.7-rc1.
Here are 3 SPDX patches for 5.7-rc1.
 
 One fixes up the SPDX tag for a single driver, while the other two go
 through the tree and add SPDX tags for all of the .gitignore files as
 needed.
 
 Nothing too complex, but you will get a merge conflict with your current
 tree, that should be trivial to handle (one file modified by two things,
 one file deleted.)
 
 All 3 of these have been in linux-next for a while, with no reported
 issues other than the merge conflict.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCXodg5A8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ykySQCgy9YDrkz7nWq6v3Gohl6+lW/L+rMAnRM4uTZm
 m5AuCzO3Azt9KBi7NL+L
 =2Lm5
 -----END PGP SIGNATURE-----

Merge tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx

Pull SPDX updates from Greg KH:
 "Here are three SPDX patches for 5.7-rc1.

  One fixes up the SPDX tag for a single driver, while the other two go
  through the tree and add SPDX tags for all of the .gitignore files as
  needed.

  Nothing too complex, but you will get a merge conflict with your
  current tree, that should be trivial to handle (one file modified by
  two things, one file deleted.)

  All three of these have been in linux-next for a while, with no
  reported issues other than the merge conflict"

* tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
  ASoC: MT6660: make spdxcheck.py happy
  .gitignore: add SPDX License Identifier
  .gitignore: remove too obvious comments
2020-04-03 13:12:26 -07:00
Linus Torvalds dba43fc4ba platform-drivers-x86 for v5.7-1
* Fix for improper handling of fan_boost_mode in sysfs for ASUS laptops.
 * On newer ASUS laptops the 1st battery is named differently, here is a fix.
 * Fix Lex 2I385SW to allow both network cards to be used.
 * The power integrated circuit driver for Surface 3 has been added.
 * Refactor and clean up of Intel PMC driver and enable it on Intel Jasper Lake.
 * Clean up of Dell RBU driver.
 * Big update for Intel Speed Select technology support tool and driver.
 
 The following is an automated git shortlog grouped by driver:
 
 asus-wmi:
  -  Support laptops where the first battery is named BATT
  -  Fix return value of fan_boost_mode_store
 
 dell_rbu:
  -  Unify format of the printed messages
  -  Use max_t() to get rid of casting
  -  Simplify cleanup code in create_packet()
  -  don't open code list_for_each_entry*()
  -  Use sysfs_create_group() API
 
 GPD pocket fan:
  -  Fix error message when temp-limits are out of range
 
 i2c-multi-instantiate:
  -  Replace zero-length array with flexible-array member
 
 intel-hid:
  -  Move MODULE_DEVICE_TABLE() closer to the table
 
 intel_pmc_core:
  -  Make pmc_core_substate_res_show() generic
  -  Make pmc_core_lpm_display() generic for platforms that support sub-states
  -  Add slp_s0_offset attribute back to tgl_reg_map
  -  Remove duplicate 'if' to create debugfs entry
  -  Relocate pmc_core_*_display() to outside of CONFIG_DEBUG_FS
  -  Add debugfs support to access live status registers
  -  Dump low power status registers on an S0ix.y failure
  -  Add an additional parameter to pmc_core_lpm_display()
  -  Remove slp_s0 attributes from tgl_reg_map
  -  Refactor the driver by removing redundant code
  -  Add debugfs entry for low power mode status registers
  -  Add debugfs entry to access sub-state residencies
  -  Add Atom based Jasper Lake (JSL) platform support
 
 intel-vbtn:
  -  Move MODULE_DEVICE_TABLE() closer to the table
 
 ISST:
  -  Fix wrong unregister type
 
 PDx86:
  -  Kconfig: Fix a typo
  -  Kconfig: Group modules by companies and functions
  -  MAINTAINERS: Sort entries in database for PDx86
  -  Makefile: Group modules by companies and functions
 
 platform/x86/intel-uncore-freq:
  -  Add release callback
  -  Fix static checker issue and potential race condition
 
 pmc_atom:
  -  Add Lex 2I385SW to critclk_systems DMI table
 
 sony-laptop:
  -  Use scnprintf() for avoiding potential buffer overflow
 
 surface3_power:
  -  Fix always true condition in mshw0011_space_handler()
  -  Fix Kconfig section ordering
  -  Add missed headers
  -  Reformat GUID assignment
  -  Drop useless macro ACPI_PTR()
  -  Prefix POLL_INTERVAL with SURFACE_3
  -  Simplify mshw0011_adp_psr() to one liner
  -  Use dev_err() instead of pr_err()
  -  Drop unused structure definition
  -  MSHW0011 rev-eng implementation
 
 tools/power/x86/intel-speed-select:
  -  Fix a typo in error message
  -  Update version
  -  Avoid duplicate Package strings for json
  -  Add display for enabled cpus count
  -  Print friendly warning for bad command line
  -  Fix avx options for turbo-freq feature
  -  Improve CLX commands
  -  Show error for invalid CPUs in the options
  -  Improve core-power result and error display
  -  Kernel interface error handling
  -  Improve error display for turbo-freq feature
  -  Improve error display for base-freq feature
  -  Improve output of perf-profile commands
  -  Enhance help for core-power assoc
  -  Display error for invalid priority type
  -  Check feature status first
  -  Improve error display for perf-profile feature
  -  Add an API for error/information print
  -  Enhance --info option
  -  Enhance help
  -  Helpful warning for missing kernel interface
  -  Store topology information
  -  Max CPU count calculation when CPU0 is offline
  -  Special handling for CPU 0 online/offline
  -  Use more verbiage for clos information
  -  Enhance core-power info command
  -  Make target CPU optional for core-power info
  -  Warn for invalid package id
  -  Fix last cpu number
  -  Fix mailbox usage for CLOS_PM_QOS_CONFIG
  -  Avoid duplicate names for json parsing
  -  Fix display for turbo-freq auto mode
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEqaflIX74DDDzMJJtb7wzTHR8rCgFAl6DMoEACgkQb7wzTHR8
 rChW3w//WgzlhbKCl3EO8WjfSGmQHwszLq/Zcj+LLzoPQOl7t1nel1cEIWv7Y4+P
 /I24l2pqAD2JRgs03hNDg9i/YovPuqhLtS7t7hDNKFfNGdOhIJQkMwhrjXcapbBj
 UgE5cFbzXjf4400Tv1EkOylIZhOlpTmv5eGk/Dbw+5adTOlTH3MYLntv8ZfBulOh
 A6Dolto+zPvrbCyrMrgJSpQRIx1Rd8JV3YDXQRTpimmdsTJ7VFC55i1RLJSQ5sGw
 rF2qAekMExKScezSV8Yy9npDGJ1qUolhj/PciLPr71rmIuWqfdqc8eLeLmsJzIfY
 WO4TIQ3CTTY1FlZsOZyoeh+Kla//hRyaUoHAU0xEWDD9xKJBdzOIMEs4O/islWYL
 ILHs7ZdZPrHFI63mxyF0Mw5SgsSG1c6VNa19+H+YxpC4Pp8hbo891RRF7+7hBbdT
 YRT5yaQMD2M8QowMgxJQ7Xt3Kyz/jRO/8L59v202v3RzJvJ0UJhT+fmHV6OSz5MD
 SLOmLsXcWvgteNxM8TQ5yxmuDJdQVRuJqQpvPhysqlUEyhoTSLsII5evu/U/jXA4
 vIx+QfUejDiy0vMeQu2xUOzxIzSzja6gLO6hKgiAw2cvUMqbOi2CIG7qwbRZkIis
 uj/GxlwiNfIsEKUE4728ivOHwT9Yke1x+QLl/oVwMh7zSgb+noE=
 =G0jF
 -----END PGP SIGNATURE-----

Merge tag 'platform-drivers-x86-v5.7-1' of git://git.infradead.org/linux-platform-drivers-x86

Pull x86 platform driver updates from Andy Shevchenko:

 - Fix for improper handling of fan_boost_mode in sysfs for ASUS
   laptops.

 - On newer ASUS laptops the 1st battery is named differently, here is a
   fix.

 - Fix Lex 2I385SW to allow both network cards to be used.

 - The power integrated circuit driver for Surface 3 has been added.

 - Refactor and clean up of Intel PMC driver and enable it on Intel
   Jasper Lake.

 - Clean up of Dell RBU driver.

 - Big update for Intel Speed Select technology support tool and driver.

* tag 'platform-drivers-x86-v5.7-1' of git://git.infradead.org/linux-platform-drivers-x86: (75 commits)
  platform/x86: surface3_power: Fix always true condition in mshw0011_space_handler()
  platform/x86: surface3_power: Fix Kconfig section ordering
  platform/x86: surface3_power: Add missed headers
  platform/x86: surface3_power: Reformat GUID assignment
  platform/x86: surface3_power: Drop useless macro ACPI_PTR()
  platform/x86: surface3_power: Prefix POLL_INTERVAL with SURFACE_3
  platform/x86: surface3_power: Simplify mshw0011_adp_psr() to one liner
  platform/x86: surface3_power: Use dev_err() instead of pr_err()
  platform/x86: surface3_power: Drop unused structure definition
  platform/x86: surface3_power: MSHW0011 rev-eng implementation
  platform/x86: intel_pmc_core: Make pmc_core_substate_res_show() generic
  platform/x86: intel_pmc_core: Make pmc_core_lpm_display() generic for platforms that support sub-states
  tools/power/x86/intel-speed-select: Fix a typo in error message
  tools/power/x86/intel-speed-select: Update version
  tools/power/x86/intel-speed-select: Avoid duplicate Package strings for json
  tools/power/x86/intel-speed-select: Add display for enabled cpus count
  tools/power/x86/intel-speed-select: Print friendly warning for bad command line
  tools/power/x86/intel-speed-select: Fix avx options for turbo-freq feature
  tools/power/x86/intel-speed-select: Improve CLX commands
  tools/power/x86/intel-speed-select: Show error for invalid CPUs in the options
  ...
2020-03-31 16:43:40 -07:00
Doug Smythies 2f6bdb05e0 tools/power/x86/intel_pstate_tracer: fix a broken y-axis scale
A fixed y-axis scale was missed during a change to autoscale.

Correct it.

Fixes: 709bd70d07 ("tools/power/x86/intel_pstate_tracer: change several graphs to autoscale y-axis")
Signed-off-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-03-26 20:05:58 +01:00
Masahiro Yamada d198b34f38 .gitignore: add SPDX License Identifier
Add SPDX License Identifier to all .gitignore files.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-25 11:50:48 +01:00
Len Brown b95fffb9b4 tools/power turbostat: update version
A stitch in time saves nine.

Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-21 00:48:02 -04:00
Len Brown abdcbdb265 tools/power turbostat: Print cpuidle information
Print cpuidle driver and governor.

Originally-by: Antti Laakso <antti.laakso@linux.intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-21 00:47:47 -04:00
Masanari Iida 9945a24798 tools/power/x86/intel-speed-select: Fix a typo in error message
This patch fix a spelling typo in error message.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:27 +02:00
Srinivas Pandruvada 1e46d1d59a tools/power/x86/intel-speed-select: Update version
Fair number of changes including bug fixes done to change version.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:23 +02:00
Srinivas Pandruvada 74062363f8 tools/power/x86/intel-speed-select: Avoid duplicate Package strings for json
For platforms where multiple packages/die, this makes "Package-" key
duplicate. To make unique, add die and cpu id to key name.

So "Package-0" key name will change to "Package-0-die-x:cpu-x".

For example:
$sudo ./intel-speed-select -f json  perf-profile info
Intel(R) Speed Select Technology
Executing on CPU model:106[0x6a]
{
  "package-0:die-0:cpu-0": {
    "perf-profile-level-0": {
      "cpu-count": "32",
      "enable-cpu-count": "32",
...
...
 "package-1:die-0:cpu-16": {

    "perf-profile-level-0": {
      "cpu-count": "32",
      "enable-cpu-count": "32",
      "enable-cpu-mask": "ffff0000,ffff0000",
...
...

For non json format, there is no change. Here when print_package_info()
is called, it will return the level to print for other information.
This level is used formatting. Also in some function duplicate code
was there to print package,die and CPU information. Replace all that
code with a call to print_package_info().

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:23 +02:00
Srinivas Pandruvada e44d76569b tools/power/x86/intel-speed-select: Add display for enabled cpus count
In addition to total CPU count also display "enabled-cpu-count" for
perf-profile info command. This will show number of CPUs in the
"enable-cpu-mask".

For example:

 perf-profile-level-4
        cpu-count:32
        enable-cpu-count:16
        enable-cpu-mask:e42d0000,e42d0000

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:23 +02:00
Srinivas Pandruvada 4a9603534a tools/power/x86/intel-speed-select: Print friendly warning for bad command line
When user specifies invalid option, display "Unknown Option: ignore",
instead of "no match". Also display error for garbage on the command
line.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:23 +02:00
Srinivas Pandruvada b86639e195 tools/power/x86/intel-speed-select: Fix avx options for turbo-freq feature
Specifying "avx2" and "avx512" option for display filter doesn't work
with short option "-r", only works with --try-type. Also compare full
6 characters for "avx512" string.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada 7fc9fefd99 tools/power/x86/intel-speed-select: Improve CLX commands
CLX doesn't have capability to change the feature in the hardware, but
this acts as "--auto | -a" option. So even if user didn't specify the
option, use this as --auto | -a to set cpufreq scaling frequency limits.

Also remove perror with debug_printf as they don't bring any value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada 070fdea13d tools/power/x86/intel-speed-select: Show error for invalid CPUs in the options
When --cpu or -c is used to specify target CPUs and non of them are valid,
display error.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada fe6fb2165a tools/power/x86/intel-speed-select: Improve core-power result and error display
This change adds improved error display and handling for commands related
to core-power feature. The changes include:
- Replace perror with helpful error message
- Use ordered priority for SKX based platform by default as the
proportional priority is not supported
- Don't show weight and epp in help and also give error when user
tries to set them in SKX based platforms
- Range check for epp and weights and display error

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada 95f8e56945 tools/power/x86/intel-speed-select: Kernel interface error handling
Treat a case when mailbox/mmio command can't be handled by the kernel
drivers when the module is removed or send a command which no driver can
handle. In this case ENOTTY result is returned, so print error.

Also when the isst_if_mmio module is removed, we can't send CLOS message
messages via Mailbox on non SKX based platforms. When this module is
removed,  isst_platform_info.mmio_supported is set to 0. So it can't be
used as a condition to send via mailbox. Here replace check for Skylake
based platform to send via mailbox, other platforms can't use mailbox in
lieu of MMIO.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada a9fd6ae739 tools/power/x86/intel-speed-select: Improve error display for turbo-freq feature
This change adds improved error display and handling for commands related
to turbo-freq feature. The changes include:
- Replace perror/fprintf with helpful error message
- Error for not specifying TDP level when required
- Show error for invalid bucket number
- Show message to enable core-power before enabling turbo-freq feature

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:22 +02:00
Srinivas Pandruvada 39bae0fce4 tools/power/x86/intel-speed-select: Improve error display for base-freq feature
This change adds improved error display and handling for commands related
to base-freq feature. The changes include:
- Replace perror/fprintf with helpful error message
- Error for not specifying TDP level when required
- For CLX show help which shows limitation

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada 3d1a857981 tools/power/x86/intel-speed-select: Improve output of perf-profile commands
Improve output of perf-profile commands:
get-config-enabled
get-lock-status

Instead of showing 0/1, show meaningful strings. Also show error when
command is failed.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada 68e2f10971 tools/power/x86/intel-speed-select: Enhance help for core-power assoc
Enhance help to specify CPU and clos by an example.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada 6d1f2dc8a5 tools/power/x86/intel-speed-select: Display error for invalid priority type
When priority type for core-power enable command is anything more than 1
display error before change to 1, which is ordered priority.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada 6c8edba37c tools/power/x86/intel-speed-select: Check feature status first
Before looking for information about the base-freq or turbo-freq details,
first check if the feature is supported at that level. If not print error
and return.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada ac9d05ea4c tools/power/x86/intel-speed-select: Improve error display for perf-profile feature
This change adds improved error display and handling for commands related
to perf-profile feature. The changes include:
- When invalid TDP level is passed. display error and exit
- Replace perror with helpful error message
- Show error when TDP level can't be set
- Print error when information can't be read for a level
- Validate user options for invalid level
- Display error for TDP lock status

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:21 +02:00
Srinivas Pandruvada 87e115b325 tools/power/x86/intel-speed-select: Add an API for error/information print
Add a common API which can be used to print all error and information
messages. In this way a common format can be used.

For json output an error index in suffixed to make unique error key.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada 1ba148ae9e tools/power/x86/intel-speed-select: Enhance --info option
Add additional information, which will allow user to detect available
features. This will allow users to check presence of features before
continue to test.
A sample output:

$sudo ./intel-speed-select --info

Intel(R) Speed Select Technology
Executing on CPU model:85[0x55]
Platform: API version : 1
Platform: Driver version : 1
Platform: mbox supported : 1
Platform: mmio supported : 0
Intel(R) SST-PP (feature perf-profile) is not supported
Only performance level 0 (base level) is present
TDP level change control is locked
Intel(R) SST-TF (feature turbo-freq) is supported
Intel(R) SST-BF (feature base-freq) is supported
Intel(R) SST-CP (feature core-power) is supported

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada addd116d8d tools/power/x86/intel-speed-select: Enhance help
Enhance help message which adds some example. The changes include:
- Print help when options are not recognized.
- For CLX, display only options which are applicable.
- Sort options in alphatical order.
- Disply help() instead of error:
"Feature name and|or command not specified"
- Remove duplicate display of
Intel(R) Speed Select Technology

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada f362cdccca tools/power/x86/intel-speed-select: Helpful warning for missing kernel interface
When the device file "/dev/isst_interface" is not present, instead of
failing on access, check at the start and print a helpful warning.

Here CLX platform is an exception, which doesn't depend on the device
file. So continue for CLX platform.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada fb18615828 tools/power/x86/intel-speed-select: Store topology information
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: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada 864dc09e69 tools/power/x86/intel-speed-select: Max CPU count calculation when CPU0 is offline
Currently /sys/devices/system/cpu/cpu0/topology/thread_siblings is used to
get the max CPU count. But when CPU0 is offline, then this file will be
absent.

So add processing so that we can get count from any first CPU in the
system. which is online.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada 696691985c tools/power/x86/intel-speed-select: Special handling for CPU 0 online/offline
When "-o" option for force online/offline is used with command:
perf-profile set-config-level

If the config level calls for CPU 0 online/offline, then call fails
as there is special kernel setup required for CPU 0 online/offline
and the currently not setup for that.

But when call is for online CPU 0, then don't fail. Just warn that
this system is not setup for CPU 0 online/offline.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:20 +02:00
Srinivas Pandruvada 6320c9fb91 tools/power/x86/intel-speed-select: Use more verbiage for clos information
Instead of displaying 0 and 1 for enable status, display "disabled"
and "enabled" respectively.

Similarly for priority type, display "ordered or proportional" instead
of 0 and 1.

An example display:

$intel-speed-select -c 1 core-power info
Intel(R) Speed Select Technology
..
 package-0
  die-0
    cpu-1
      core-power
        support-status:supported
        enable-status:enabled
        clos-enable-status:enabled
        priority-type:proportional

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:19 +02:00
Srinivas Pandruvada 143ad32209 tools/power/x86/intel-speed-select: Enhance core-power info command
In addition to CLOS enable status, also show the core-power feature
status. This will help why clos enable status didn't give desired
results as the core-power feature may be disabled or unsupported.

The new display looks as follows:

$intel-speed-select core-power info
Intel(R) Speed Select Technology
..
 package-0
  die-0
    cpu-0
      core-power
        support-status:supported
        enable-status:enabled
        clos-enable-status:1
        priority-type:0

In the above display "support-status" and "enable-status", shows the
status of the core-power feature and "clos-enable-status", shows the
status of the clos.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:19 +02:00
Srinivas Pandruvada f5205f4931 tools/power/x86/intel-speed-select: Make target CPU optional for core-power info
Currently "-c" is a mandatory option for "core-power info" command. Make
this optional as this is a per package/die property. When not specified,
it will print info for every package/die.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:19 +02:00
Srinivas Pandruvada f0e0b4d17b tools/power/x86/intel-speed-select: Warn for invalid package id
When CPU is offline, we can't get package id. So print error for this
and don't use output.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:19 +02:00
Srinivas Pandruvada ced2f5304d tools/power/x86/intel-speed-select: Fix last cpu number
Here topology_max_cpus is used for total CPU count, not the last CPU
number. So remove "-1".

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:01 +02:00
Srinivas Pandruvada 8ddbda7624 tools/power/x86/intel-speed-select: Fix mailbox usage for CLOS_PM_QOS_CONFIG
Even for the products using MMIO, this message needs to be sent via
mail box. The previous fix done for this didn't properly address this.
That fix simply removed sending command via MMIO, but still didn't
trigger sending via mailbox.

Add additional condition to check for CLOS_PM_QOS_CONFIG, when MMIO
is supported on a platform.

Fixes: cd0e637065 (tools/power/x86/intel-speed-select: Use mailbox for CLOS_PM_QOS_CONFIG)
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-03-20 14:46:01 +02:00
Len Brown fcaa681c03 tools/power turbostat: Fix 32-bit capabilities warning
warning: `turbostat' uses 32-bit capabilities (legacy support in use)

Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:28 -04:00
Len Brown 1f81c5efc0 tools/power turbostat: Fix missing SYS_LPI counter on some Chromebooks
Some Chromebook BIOS' do not export an ACPI LPIT, which is how
Linux finds the residency counter for CPU and SYSTEM low power states,
that is exports in /sys/devices/system/cpu/cpuidle/*residency_us

When these sysfs attributes are missing, check the debugfs attrubte
from the pmc_core driver, which accesses the same counter value.

Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:28 -04:00
Chen Yu f670840070 tools/power turbostat: Support Elkhart Lake
From a turbostat point of view the Tremont-based Elkhart Lake
is very similar to Goldmont, reuse the code of Goldmont.

Elkhart Lake does not support 'group turbo limit counter'
nor C3, adjust the code accordingly.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Chen Yu d7814c3098 tools/power turbostat: Support Jasper Lake
Jasper Lake, like Elkhart Lake, uses a Tremont CPU.
So reuse the code.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Chen Yu 23274faf96 tools/power turbostat: Support Ice Lake server
From a turbostat point of view, Ice Lake server looks like Sky Lake server.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Chen Yu 4bf7132a0a tools/power turbostat: Support Tiger Lake
From a turbostat point of view, Tiger Lake looks like Ice Lake.

Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Len Brown d8d005ba6a tools/power turbostat: Fix gcc build warnings
Warning: ‘__builtin_strncpy’ specified bound 20 equals destination size
	[-Wstringop-truncation]

reduce param to strncpy, to guarantee that a null byte is always copied
into destination buffer.

Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Chen Yu 081c54323b tools/power turbostat: Support Cometlake
From a turbostat point of view, Cometlake is like Kabylake.

Suggested-by: Rui Zhang <rui.zhang@intel.com>
Signed-off-by: Chen Yu <yu.c.chen@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
2020-03-20 00:32:27 -04:00
Mike Gilbert 2de7fb60a4 cpupower: avoid multiple definition with gcc -fno-common
Building cpupower with -fno-common in CFLAGS results in errors due to
multiple definitions of the 'cpu_count' and 'start_time' variables.

./utils/idle_monitor/snb_idle.o:./utils/idle_monitor/cpupower-monitor.h:28:
multiple definition of `cpu_count';
./utils/idle_monitor/nhm_idle.o:./utils/idle_monitor/cpupower-monitor.h:28:
first defined here
...
./utils/idle_monitor/cpuidle_sysfs.o:./utils/idle_monitor/cpuidle_sysfs.c:22:
multiple definition of `start_time';
./utils/idle_monitor/amd_fam14h_idle.o:./utils/idle_monitor/amd_fam14h_idle.c:85:
first defined here

The -fno-common option will be enabled by default in GCC 10.

Bug: https://bugs.gentoo.org/707462
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
2020-03-02 08:53:34 -07:00
Srinivas Pandruvada 3b0fe3bab3 tools/power/x86/intel-speed-select: Avoid duplicate names for json parsing
For the command
"intel-speed-select perf-profile info":

There are two instances of “speed-select-turbo-freq” underneath
“perf-profile-level-0” for each package. When we load the output into
python with json.load(), the second instance overwrites the first.

Result is that we can only access:
"speed-select-turbo-freq": {
            "bucket-0": {
              "high-priority-cores-count": "2",
              "high-priority-max-frequency(MHz)": "3000",
              "high-priority-max-avx2-frequency(MHz)": "2800",
              "high-priority-max-avx512-frequency(MHz)": "2600"
            },
Because it is a duplicate of "speed-select-turbo-freq": "disabled"
Same is true for "speed-select-base-freq".

To avoid this add "-properties" suffix for the second instance to
differentiate.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-02-10 17:47:38 +02:00
Srinivas Pandruvada 14a8aa4964 tools/power/x86/intel-speed-select: Fix display for turbo-freq auto mode
When mailbox command for the turbo-freq enable fails, then don't display
result for auto-mode. When turbo-freq enable fails, there is no point
to set CPU priorities.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-02-10 17:47:38 +02:00
Linus Torvalds cf3c8f84d1 More power manadement updates for 5.6-rc1
Prevent cpufreq from creating excessively large stack frames and fix
 the handling of devices deleted during system-wide resume in the PM
 core (Rafael Wysocki), revert a problematic commit affecting the
 cpupower utility and correct its man page (Thomas Renninger,
 Brahadambal Srinivasan), and improve the intel_pstate_tracer
 utility (Doug Smythies).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAl4z9xsSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxRDYQAJKGKxja7SWIeEMNAVb7ji9VM9qLFmDc
 sqDqUbqjB3Po2t/1RVN/7W1GUxA5cmvbd2gW3dNLddDd1HgM5LH+fzQSRCtxI10x
 Hw3sk1IoKBcH/wCJdBm8JJLDu5A8nU+bTWX1rLjz/qRu2AomLxlNzNQ0ocPfIHKX
 5ZQbtJRqMHan6tx9SAbrE5BA4WP6UrZ2lzQmKLFk7pBynV4wTAaUmixxc8FqA0Lv
 Dm+IIubi0X31CtcrcO8/jgsduLYJpRqJ0P/xievlph38I6nUZ0KrI/gGcHYRg/3y
 1jOtwvpQ+YZ15jXgBCjjB/w5acIzo5apcyOmsn5+wi/sGD5q5vjJs9+sQp98sjdC
 IdRLO8ooIGPptbS/juGZMcaF8YsqCMVlPcE0ybSAqyV82v6ozlFo2NgXXkIGrXiq
 682mx84jpWtpoFR4roDkGGS1/kZvH0cuKu0K48F//h+Sh+GLmsS0JUFdjEAfBGnh
 OEGsZmcuYf+VKGqQuXbWHe/xS4TbRAJ/SnEOX0Tqu4SPsIn2X7DvHfhOSzs5izrI
 euhjSNkRWgkABOIFvAtf0G8UFdRxNAU9+mBTjto3kPjaRwy+yGbVuhJPn0elng2h
 y4impgtyQ9dWPpSfnAX84F4qH2q3MLpskDTEbxovS7mCMsVxR6pvApzKLIfGhdfD
 cuk/ooyTuQG/
 =ctQq
 -----END PGP SIGNATURE-----

Merge tag 'pm-5.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power manadement updates from Rafael Wysocki:
 "Prevent cpufreq from creating excessively large stack frames and fix
  the handling of devices deleted during system-wide resume in the PM
  core (Rafael Wysocki), revert a problematic commit affecting the
  cpupower utility and correct its man page (Thomas Renninger,
  Brahadambal Srinivasan), and improve the intel_pstate_tracer utility
  (Doug Smythies)"

* tag 'pm-5.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  tools/power/x86/intel_pstate_tracer: change several graphs to autoscale y-axis
  tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
  Correction to manpage of cpupower
  cpufreq: Avoid creating excessively large stack frames
  PM: core: Fix handling of devices deleted during system-wide resume
  cpupower: Revert library ABI changes from commit ae2917093f
2020-01-31 14:36:35 -08:00
Doug Smythies 709bd70d07 tools/power/x86/intel_pstate_tracer: change several graphs to autoscale y-axis
Processors have exceeded some of the fixed y-axis scale maximum values.
Change them to autoscale the y-axis.

Signed-off-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-01-28 23:46:03 +01:00
Doug Smythies e749e09db3 tools/power/x86/intel_pstate_tracer: changes for python 3 compatibility
Some syntax needs to be more rigorous for python 3.
Backwards compatibility tested with python 2.7

Signed-off-by: Doug Smythies <dsmythies@telus.net>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2020-01-28 23:46:03 +01:00