RFC: https://lkml.org/lkml/2021/6/4/791 PATCH v1: https://lkml.org/lkml/2021/6/16/805 PATCH v2: https://lkml.org/lkml/2021/7/6/138 PATCH v3: https://lkml.org/lkml/2021/7/12/2799 PATCH v4: https://lkml.org/lkml/2021/7/16/532 PATCH v5: https://lkml.org/lkml/2021/7/19/247 PATCH v6: https://lkml.org/lkml/2021/7/20/36 PATCH v7: https://lkml.org/lkml/2021/7/23/26 PATCH v8: https://lkml.org/lkml/2021/9/28/554 Changelog v8-->v9 1. Edited interface documentation to be in line with the current formatting 2. Created a parent abstraction for cleaning up the functions exporting energy scale information. Also commented the need to make a new hcall each time instead of caching objects as energy modes may change dynamically 3. Added a dynamically reallocating buffer for the hcall return attributes in the case of H_PARTIAL and H_P4 4. Added support to discover H_GET_ENERGY_SCALE_INFO feature via the ibm,hypertas-function device tree property 5. Removed versioning check for hcall as the PAPR documents backward compatibility support for this hcall 6. Decoupled allocation and registering for sysfs interfaces for handling faliures gracefully 7. Cleaned up functions, return codes, variable and label naming as per comments Additional comment: Currently the interface is modeled to calling it as papr_platform_attributes.c as to keep it open to adding more attributes in the future. However, if believed that its not necessary then I could rename it to energy_scale_info.c instead and remove the "papr" parent directory from the interface as well. Pratik R. Sampat (2): powerpc/pseries: Interface to represent PAPR firmware attributes selftest/powerpc: Add PAPR sysfs attributes sniff test .../sysfs-firmware-papr-energy-scale-info | 29 ++ arch/powerpc/include/asm/firmware.h | 4 +- arch/powerpc/include/asm/hvcall.h | 3 +- arch/powerpc/kvm/trace_hv.h | 1 + arch/powerpc/platforms/pseries/Makefile | 3 +- arch/powerpc/platforms/pseries/firmware.c | 1 + .../pseries/papr_platform_attributes.c | 361 ++++++++++++++++++ tools/testing/selftests/powerpc/Makefile | 1 + .../powerpc/papr_attributes/.gitignore | 2 + .../powerpc/papr_attributes/Makefile | 7 + .../powerpc/papr_attributes/attr_test.c | 107 ++++++ 11 files changed, 516 insertions(+), 3 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-firmware-papr-energy-scale-info create mode 100644 arch/powerpc/platforms/pseries/papr_platform_attributes.c create mode 100644 tools/testing/selftests/powerpc/papr_attributes/.gitignore create mode 100644 tools/testing/selftests/powerpc/papr_attributes/Makefile create mode 100644 tools/testing/selftests/powerpc/papr_attributes/attr_test.c -- 2.34.1