[PATCH v2 0/1] Interface to represent PAPR firmware attributes
From: Pratik R. Sampat
Date: Tue Jul 06 2021 - 04:24:36 EST
RFC: https://lkml.org/lkml/2021/6/4/791
PATCH v1: https://lkml.org/lkml/2021/6/16/805
Changelog v1 --> v2
Based on comments from Fabiano and Gautham, the following changes
were made:
1. Added flag attributes to fetch either single or all attributes from
the H_GET_ENERGY_SCALE_INFO HCALL
2. Seperated the header and the attribute structs, therfore allocating
for them through a single abstract buffer and later parsing them
into their own structures based on the offset
3. Renamed Energy Management(em) prefixed variables to energy scale
attributes(esi) prefixed variables to maintain consistency.
4. Removed bailing on version checks as to avoid faliure in future
versions which can be backwards compatible
5. Moved check for FW_FEATURE_LPAR before the HCALL is made to save
cycles and allocations on an event of faliure
6. Updated descriptions and comments
Also, have implemented a POC using this interface for the powerpc-utils'
ppc64_cpu --frequency command-line tool to utilize this information
in userspace.
The POC for the new interface has been hosted here:
https://github.com/pratiksampat/powerpc-utils/tree/H_GET_ENERGY_SCALE_INFO_v2
Sample output from the powerpc-utils tool is as follows:
# ppc64_cpu --frequency
Power and Performance Mode: XXXX
Idle Power Saver Status : XXXX
Processor Folding Status : XXXX --> Printed if Idle power save status is supported
Platform reported frequencies --> Frequencies reported from the platform's H_CALL i.e PAPR interface
min : NNNN GHz
max : NNNN GHz
static : NNNN GHz
Tool Computed frequencies
min : NNNN GHz (cpu XX)
max : NNNN GHz (cpu XX)
avg : NNNN GHz
Pratik R. Sampat (1):
powerpc/pseries: Interface to represent PAPR firmware attributes
.../sysfs-firmware-papr-energy-scale-info | 26 ++
arch/powerpc/include/asm/hvcall.h | 23 +-
arch/powerpc/kvm/trace_hv.h | 1 +
arch/powerpc/platforms/pseries/Makefile | 3 +-
.../pseries/papr_platform_attributes.c | 320 ++++++++++++++++++
5 files changed, 371 insertions(+), 2 deletions(-)
create mode 100644 Documentation/ABI/testing/sysfs-firmware-papr-energy-scale-info
create mode 100644 arch/powerpc/platforms/pseries/papr_platform_attributes.c
--
2.31.1