Add Ampere's Altra SMPro MFD and its child drivers
Subsystems (5)
v7 cover Add Ampere's Altra SMPro MFD and its child drivers
The SMpro co-processor on Ampere Altra processor family is to monitor and report various data included hwmon-related info, RAS errors, and other miscellaneous information. The SMPro MFD driver intializes the register map and instantiates all sub-devices. All the specifics will be handled in the child drivers.
This patch set includes support for Ampere SMpro hwmon, errmon, and misc as the child drivers. The hwmon driver supports accessing various CPU sensors provided by the SMpro co-processor including temperature, power, voltages, and current found on Ampere Altra processor family. The errmon driver supports monitoring and reporting RAS-related errors. The misc driver is to support reporting boot progress and other miscellaneous information.
Discuss for v6: https://lkml.org/lkml/2021/12/23/760
v7:
+ Add docs to Documentation/ABI/testing [Greg]
+ Re-order patches to avoid compile dependency [Lee Jones]
+ Remove regmap_acquire/release_lock() [Quan]
+ Install regmap bus->read/write() to handle multiple types of bus
access [Quan]
+ Replace i2c block read by regmap_noinc_read() [Quan]
+ Fix wrong return type of *show/store() [kernel test robot]
+ Update GPL version [Quan]
+ Add some others minor code refactor [Quan]
v6:
+ Introduced smpro-errmon, smpro-misc as smpro-mfd sub-device [Quan]
v5:
+ Introduced the smpro-mfd driver and drop the use of simple-mfd-i2c driver to avoid DT node with no resource in child device DT nodes [Rob]
+ Removed the use of reg DT property in child driver [Quan]
+ Validated ManufactureID when probing smpro-mfd drivers [Quan]
+ As child devices are instantiated by SMPro MFD driver, drop the ManufacturerID checking in child driver, ie: smpro-hwmon [Quan]
+ Revised commit messages [Quan]
v4:
+ Revised commit message [Quan]
+ Fixed build issue found by kernel test robot [Guenter]
+ Returned regmap_read() error code [Guenter]
v3:
+ Supported list of compatible string [Rob]
+ Introduced reg property in DT to specify reg offset [Rob]
+ Updated description and other minor changes in yaml file [Rob]
+ Handled negative temperature value [Guenter]
+ Returned -ENODEV if Manufacturer ID is wrong [Guenter]
+ Refactored smpro_read_string() and smpro_temp_read() [Guenter]
+ Removed smpro_write() function [Guenter]
+ Added minor refactor changes [Quan]
v2:
+ Used 'struct of_device_id's .data attribute [Lee Jones]
+ Removed "virtual" sensors [Guenter]
+ Fixed typo "mili" to "milli", "nanoWatt" to "microWatt" [Guenter]
+ Reported SOC_TDP as "Socket TDP" using max attributes [Guenter]
+ Clarified "highest" meaning in documentation [Guenter]
+ Corrected return error code when host is turn off [Guenter]
+ Reported MEM HOT Threshold for all DIMMs as temp*_crit [Guenter]
+ Removed license info as SPDX-License-Identifier existed [Guenter]
+ Added is_visible() support [Guenter]
+ Used HWMON_CHANNEL_INFO() macro and LABEL attributes [Guenter]
+ Made is_valid_id() return boolean [Guenter]
+ Returned -EPROBE_DEFER when smpro reg inaccessible [Guenter]
+ Removed unnecessary error message when dev register fail [Guenter]
+ Removed Socket TDP sensor [Quan]
+ Changed "ampere,ac01-smpro" to "ampere,smpro" [Quan]
+ Included sensor type and channel in labels [Quan]
+ Refactorized code to fix checkpatch.pl --strict complaint [Quan]
Quan Nguyen (9):
hwmon: smpro: Add Ampere's Altra smpro-hwmon driver
docs: hwmon: (smpro-hwmon) Add documentation
misc: smpro-errmon: Add Ampere's SMpro error monitor driver
docs: misc-devices: (smpro-errmon) Add documentation
misc: smpro-misc: Add Ampere's Altra SMpro misc driver
docs: misc-devices: (smpro-misc) Add documentation
dt-bindings: mfd: Add bindings for Ampere Altra SMPro MFD driver
mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver
docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs
interfaces
.../sysfs-bus-platform-devices-ampere-smpro | 133 +++++ .../devicetree/bindings/mfd/ampere,smpro.yaml | 48 ++ Documentation/hwmon/index.rst | 1 + Documentation/hwmon/smpro-hwmon.rst | 101 ++++ Documentation/misc-devices/index.rst | 2 + Documentation/misc-devices/smpro-errmon.rst | 206 +++++++ Documentation/misc-devices/smpro-misc.rst | 82 +++ drivers/hwmon/Kconfig | 8 + drivers/hwmon/Makefile | 1 + drivers/hwmon/smpro-hwmon.c | 463 ++++++++++++++++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/smpro-mfd.c | 134 +++++ drivers/misc/Kconfig | 14 + drivers/misc/Makefile | 2 + drivers/misc/smpro-errmon.c | 517 ++++++++++++++++++ drivers/misc/smpro-misc.c | 177 ++++++ 17 files changed, 1902 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro create mode 100644 Documentation/devicetree/bindings/mfd/ampere,smpro.yaml create mode 100644 Documentation/hwmon/smpro-hwmon.rst create mode 100644 Documentation/misc-devices/smpro-errmon.rst create mode 100644 Documentation/misc-devices/smpro-misc.rst create mode 100644 drivers/hwmon/smpro-hwmon.c create mode 100644 drivers/mfd/smpro-mfd.c create mode 100644 drivers/misc/smpro-errmon.c create mode 100644 drivers/misc/smpro-misc.c
Signature · 1 line
2.35.1
PATCH v7 1/9 hwmon: smpro: Add Ampere's Altra smpro-hwmon driver
This commit adds support for Ampere SMpro hwmon driver. This driver supports accessing various CPU sensors provided by the SMpro co-processor including temperature, power, voltages, and current.
---
Changes in v7:
+ Update GPL version [Quan]
Changes in v6:
+ None
Changes in v5:
+ Drop ManufacturerID checking when probe as it was checked during smpro-mfd probing [Quan]
+ Drop the use of register offset [Quan]
+ Removed the use of compatible string as it is instantiated by smpro-mfd driver [Quan]
+ Thanks Guenter for the Reviewed-by in last version, but it was not added because there's some changes in this version. Really appreciate if you could help again, thank you.
Changes in v4:
+ Returned regmap_read() error code [Guenter]
Changes in v3:
+ Handled negative temperature value [Guenter]
+ Returned -ENODEV if Manufacturer ID is wrong [Guenter]
+ Refactored smpro_read_string() and smpro_temp_read() [Guenter]
+ Removed smpro_write() function [Guenter]
+ Added minor refactor changes [Quan]
Changes in v2:
+ Removed "virtual" sensors [Guenter]
+ Reported SOC_TDP as "Socket TDP" using max attributes [Guenter]
+ Corrected return error code when host is turn off [Guenter]
+ Reported MEM HOT Threshold for all DIMMs as temp*_crit [Guenter]
+ Removed license info as SPDX-License-Identifier existed [Guenter]
+ Added is_visible() support [Guenter]
+ Used HWMON_CHANNEL_INFO() macro and LABEL attributes [Guenter]
+ Made is_valid_id() return boolean [Guenter]
+ Returned -EPROBE_DEFER when smpro reg inaccessible [Guenter]
+ Removed unnecessary error message when dev register fail [Guenter]
+ Removed Socket TDP sensor [Quan]
+ Included sensor type and channel in labels [Quan]
+ Refactorized code to fix checkpatch.pl --strict complaint [Quan]
drivers/hwmon/Kconfig | 8 + drivers/hwmon/Makefile | 1 + drivers/hwmon/smpro-hwmon.c | 463 ++++++++++++++++++++++++++++++++++++ 3 files changed, 472 insertions(+) create mode 100644 drivers/hwmon/smpro-hwmon.c
drivers/hwmon/Kconfig +8 -0
@@ -67,6 +67,14 @@ config SENSORS_ABITUGURU3 This driver can also be built as a module. If so, the module will be called abituguru3. +config SENSORS_SMPRO + tristate "Ampere's Altra SMpro hardware monitoring driver" + depends on MFD_SMPRO + help + If you say yes here you get support for the thermal, voltage, + current and power sensors of Ampere's Altra processor family SoC + with SMpro co-processor. + config SENSORS_AD7314 tristate "Analog Devices AD7314 and compatibles" depends on SPI
drivers/hwmon/Makefile +1 -0
@@ -182,6 +182,7 @@ obj-$(CONFIG_SENSORS_SHT4x) += sht4x.o obj-$(CONFIG_SENSORS_SHTC1) += shtc1.o obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o obj-$(CONFIG_SENSORS_SMM665) += smm665.o +obj-$(CONFIG_SENSORS_SMPRO) += smpro-hwmon.o obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
drivers/hwmon/smpro-hwmon.c new file +463 -0
463 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v7 2/9 docs: hwmon: (smpro-hwmon) Add documentation
In reply to Quan NguyenAdd documentation for the Ampere(R)'s Altra(R) SMpro hwmon driver.
---
Changes in v7:
+ None
Changes in v6:
+ None
Changes in v5:
+ None
Changes in v4:
+ None
Changes in v3:
+ None
Changes in v2:
+ Removed "virtual" sensors [Guenter]
+ Fixed typo "mili" to "milli", "nanoWatt" to "microWatt" [Guenter]
+ Reported SOC_TDP as "Socket TDP" using max attributes [Guenter]
+ Clarified "highest" meaning in documentation [Guenter]
+ Reported MEM HOT Threshold for all DIMMs as temp*_crit [Guenter]
+ Removed Socket TDP sensor [Quan]
+ Included sensor type and channel in labels [Quan]
Documentation/hwmon/index.rst | 1 + Documentation/hwmon/smpro-hwmon.rst | 101 ++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+) create mode 100644 Documentation/hwmon/smpro-hwmon.rst
Documentation/hwmon/index.rst +1 -0
@@ -184,6 +184,7 @@ Hardware Monitoring Kernel Drivers sis5595 sl28cpld smm665 + smpro-hwmon smsc47b397 smsc47m192 smsc47m1
Documentation/hwmon/smpro-hwmon.rst new file +101 -0
101 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v7 3/9 misc: smpro-errmon: Add Ampere's SMpro error monitor driver
In reply to Quan NguyenThis commit adds Ampere's SMpro error monitor driver for monitoring and reporting RAS-related errors as reported by SMpro co-processor found on Ampere's Altra processor family.
---
Changes in v7:
+ Remove regmap_acquire/release_lock(), read_i2c_block_data() [Quan]
+ Use regmap_noinc_read() instead of errmon_read_block() [Quan]
+ Validate number of errors before read [Quan]
+ Fix wrong return type of *_show() function [kernel test robot]
+ Adjust patch order to avoid dependence with smpro-mfd [Lee Jones]
+ Use pointer instead of stack memory [Quan]
Changes in v6:
+ First introduced in v6 [Quan]
drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/smpro-errmon.c | 517 ++++++++++++++++++++++++++++++++++++ 3 files changed, 525 insertions(+) create mode 100644 drivers/misc/smpro-errmon.c
drivers/misc/Kconfig +7 -0
@@ -176,6 +176,13 @@ config SGI_XP this feature will allow for direct communication between SSIs based on a network adapter and DMA messaging. +config SMPRO_ERRMON + tristate "Ampere Computing SMPro error monitor driver" + depends on MFD_SMPRO || COMPILE_TEST + help + If you say yes here you get support for error monitor function + provides by Ampere Computing's SoC with SMpro processor. + config CS5535_MFGPT tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support" depends on MFD_CS5535
drivers/misc/Makefile +1 -0
@@ -23,6 +23,7 @@ obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o obj-$(CONFIG_KGDB_TESTS) += kgdbts.o obj-$(CONFIG_SGI_XP) += sgi-xp/ obj-$(CONFIG_SGI_GRU) += sgi-gru/ +obj-$(CONFIG_SMPRO_ERRMON) += smpro-errmon.o obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o obj-$(CONFIG_GEHC_ACHC) += gehc-achc.o obj-$(CONFIG_HP_ILO) += hpilo.o
drivers/misc/smpro-errmon.c new file +517 -0
517 lines not on this page · raw message
Signature · 1 line
2.35.1
kernel test robot
build botRe: [PATCH v7 3/9] misc: smpro-errmon: Add Ampere's SMpro error monitor driver
I love your patch! Perhaps something to improve:
Hi Quan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on groeck-staging/hwmon-next lee-mfd/for-mfd-next v5.17 next-20220318] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 37fd83916da2e4cae03d350015c82a67b1b334c4 config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220321/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/3e85c45303bab9bd02a4761bc7e182fb001ac625
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811 git checkout 3e85c45303bab9bd02a4761bc7e182fb001ac625
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hwmon/ drivers/misc/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/misc/smpro-errmon.c:276:6: warning: variable 'data_hi' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (addr2 != 0xff) {
^~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:303:28: note: uninitialized use occurs here
ret_hi & 0xff, ret_lo, data_hi, data_lo);
^~~~~~~
drivers/misc/smpro-errmon.c:276:2: note: remove the 'if' if its condition is always true
if (addr2 != 0xff) {
^~~~~~~~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:265:47: note: initialize the variable 'data_hi' to silence this warning
unsigned int ret_hi, ret_lo, data_lo, data_hi;
^
= 0
>> drivers/misc/smpro-errmon.c:276:6: warning: variable 'data_lo' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (addr2 != 0xff) {
^~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:303:37: note: uninitialized use occurs here
ret_hi & 0xff, ret_lo, data_hi, data_lo);
^~~~~~~
drivers/misc/smpro-errmon.c:276:2: note: remove the 'if' if its condition is always true
if (addr2 != 0xff) {
^~~~~~~~~~~~~~~~~~~
drivers/misc/smpro-errmon.c:265:38: note: initialize the variable 'data_lo' to silence this warning
unsigned int ret_hi, ret_lo, data_lo, data_hi;
^
= 02 warnings generated.
vim +276 drivers/misc/smpro-errmon.c
261
262 static s32 smpro_internal_err_get_info(struct regmap *regmap, u8 addr, u8 addr1,
263 u8 addr2, u8 addr3, u8 subtype, char *buf)
264 {
265 unsigned int ret_hi, ret_lo, data_lo, data_hi;
266 int ret;
267
268 ret = regmap_read(regmap, addr, &ret_lo);
269 if (ret)
270 return ret;
271
272 ret = regmap_read(regmap, addr1, &ret_hi);
273 if (ret)
274 return ret;
275
> 276 if (addr2 != 0xff) {
277 ret = regmap_read(regmap, addr2, &data_lo);
278 if (ret)
279 return ret;
280 ret = regmap_read(regmap, addr3, &data_hi);
281 if (ret)
282 return ret;
283 }
284 /*
285 * Output format:
286 * <errType> <image> <dir> <Location> <errorCode> <data>
287 * Where:
288 * + errType: SCP Error Type (3 bits)
289 * 1: Warning
290 * 2: Error
291 * 4: Error with data
292 * + image: SCP Image Code (8 bits)
293 * + dir: Direction (1 bit)
294 * 0: Enter
295 * 1: Exit
296 * + location: SCP Module Location Code (8 bits)
297 * + errorCode: SCP Error Code (16 bits)
298 * + data : Extensive data (32 bits) 299 * All bits are 0 when errType is warning or error.
300 */
301 return scnprintf(buf, MAX_MSG_LEN, "%01x %02x %01x %02x %04x %04x%04x\n",
302 subtype, (ret_hi & 0xf000) >> 12, (ret_hi & 0x0800) >> 11,
303 ret_hi & 0xff, ret_lo, data_hi, data_lo);
304 }
305
Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
PATCH v7 4/9 docs: misc-devices: (smpro-errmon) Add documentation
In reply to Quan NguyenAdds documentation for Ampere(R)'s Altra(R) SMpro errmon driver.
---
Changes in v7:
+ None
Changes in v6:
+ First introduced in v6 [Quan]
Documentation/misc-devices/index.rst | 1 + Documentation/misc-devices/smpro-errmon.rst | 206 ++++++++++++++++++++ 2 files changed, 207 insertions(+) create mode 100644 Documentation/misc-devices/smpro-errmon.rst
Documentation/misc-devices/index.rst +1 -0
@@ -26,6 +26,7 @@ fit into other categories. lis3lv02d max6875 pci-endpoint-test + smpro-errmon spear-pcie-gadget uacce xilinx_sdfec
Documentation/misc-devices/smpro-errmon.rst new file +206 -0
206 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v7 5/9 misc: smpro-misc: Add Ampere's Altra SMpro misc driver
In reply to Quan NguyenThis commit adds driver support for accessing various information reported by Ampere's SMpro co-processor such as Boot Progress and other miscellaneous data.
---
Changes in v7:
+ Fix wrong return type of *_show/store() functions [kernel robot
test]
+ Adjust patch order to remove dependence with smpro-mfd [Lee
Jones]
Changes in v6:
+ First introduced in v6 [Quan]
drivers/misc/Kconfig | 7 ++ drivers/misc/Makefile | 1 + drivers/misc/smpro-misc.c | 177 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 185 insertions(+) create mode 100644 drivers/misc/smpro-misc.c
drivers/misc/Kconfig +7 -0
@@ -183,6 +183,13 @@ config SMPRO_ERRMON If you say yes here you get support for error monitor function provides by Ampere Computing's SoC with SMpro processor. +config SMPRO_MISC + tristate "Ampere Computing SMPro miscellaneous driver" + depends on MFD_SMPRO || COMPILE_TEST + help + If you say yes here you get support for the miscellaleous function + provides by Ampere Computing's SoC with SMpro processor. + config CS5535_MFGPT tristate "CS5535/CS5536 Geode Multi-Function General Purpose Timer (MFGPT) support" depends on MFD_CS5535
drivers/misc/Makefile +1 -0
@@ -24,6 +24,7 @@ obj-$(CONFIG_KGDB_TESTS) += kgdbts.o obj-$(CONFIG_SGI_XP) += sgi-xp/ obj-$(CONFIG_SGI_GRU) += sgi-gru/ obj-$(CONFIG_SMPRO_ERRMON) += smpro-errmon.o +obj-$(CONFIG_SMPRO_MISC) += smpro-misc.o obj-$(CONFIG_CS5535_MFGPT) += cs5535-mfgpt.o obj-$(CONFIG_GEHC_ACHC) += gehc-achc.o obj-$(CONFIG_HP_ILO) += hpilo.o
drivers/misc/smpro-misc.c new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerRe: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver
Quoted 5 lines · Quan Nguyen
This commit adds driver support for accessing various information reported by Ampere's SMpro co-processor such as Boot Progress and other miscellaneous data.
Signed-off-by Quan Nguyen <[email protected]>
No Documentation/ABI/ entries for your sysfs file?
Quoted 37 lines
drivers/misc/smpro-misc.c new file +37
-0+static ssize_t boot_progress_show (struct device *dev,struct device_attribute *da,char *buf) +{ +struct smpro_misc *misc =dev_get_drvdata (dev); +u32 boot_progress; +u8 current_stage; +u8 boot_status; +u8 boot_stage; +u32 select; +u32 reg_lo; +u32 reg; +int ret; + +/* Read current boot stage */ + ret =regmap_read (misc->regmap,BOOTSTAGE_CUR_STAGE , ®); +if (ret) +return ret; + + current_stage = reg &0xff ; + +/* Read the boot progress */ + ret =regmap_read (misc->regmap,BOOTSTAGE_SELECT , &select); +if (ret) +return ret; + + boot_stage = (select >>8 ) &0xff ; + boot_status = select &0xff ; + +if (boot_stage > current_stage) +return -EINVAL ; + + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_LO , ®_lo); +if (!ret) + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_HI , ®); +if (ret) +return ret; + + boot_progress =swab16 (reg) <<16 |swab16 (reg_lo);
drivers/misc/smpro-misc.c line 86
Quoted 10 lines
drivers/misc/smpro-misc.c new file +10
-0+ +/* Tell firmware to provide next boot stage next time */ +if (boot_stage < current_stage) { + ret =regmap_write (misc->regmap,BOOTSTAGE_SELECT , ((select &0xff00 ) |0x1 )); +if (ret) +return ret; + } + +return snprintf (buf,PAGE_SIZE ,"0x%02x 0x%02x 0x%08x\n" , + boot_stage, boot_status, boot_progress);
sysfs_emit() please.
Also, this is 3 different things, put all of these in different sysfs files.
thanks,
greg k-h
Re: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver
Quoted 9 lines · Greg Kroah-Hartman
Quoted 5 lines · Quan Nguyen
This commit adds driver support for accessing various information reported by Ampere's SMpro co-processor such as Boot Progress and other miscellaneous data.
Signed-off-by Quan Nguyen <[email protected]>No
Documentation/ABI/entries for your sysfs file?
Thank you, Greg, for a very quick review.
I have put this file in other patch.
Quoted 41 lines
Quoted 41 lines
drivers/misc/smpro-misc.c new file +41
-0+static ssize_t boot_progress_show (struct device *dev,struct device_attribute *da,char *buf) +{ +struct smpro_misc *misc =dev_get_drvdata (dev); +u32 boot_progress; +u8 current_stage; +u8 boot_status; +u8 boot_stage; +u32 select; +u32 reg_lo; +u32 reg; +int ret; + +/* Read current boot stage */ + ret =regmap_read (misc->regmap,BOOTSTAGE_CUR_STAGE , ®); +if (ret) +return ret; + + current_stage = reg &0xff ; + +/* Read the boot progress */ + ret =regmap_read (misc->regmap,BOOTSTAGE_SELECT , &select); +if (ret) +return ret; + + boot_stage = (select >>8 ) &0xff ; + boot_status = select &0xff ; + +if (boot_stage > current_stage) +return -EINVAL ; + + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_LO , ®_lo); +if (!ret) + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_HI , ®); +if (ret) +return ret; + + boot_progress =swab16 (reg) <<16 |swab16 (reg_lo); + +/* Tell firmware to provide next boot stage next time */ +if (boot_stage < current_stage) { + ret =regmap_write (misc->regmap,BOOTSTAGE_SELECT , ((select &0xff00 ) |0x1 ));
Quoted 9 lines
drivers/misc/smpro-misc.c line 86
Quoted 6 lines
drivers/misc/smpro-misc.c new file +6
-0+if (ret) +return ret; + } + +return snprintf (buf,PAGE_SIZE ,"0x%02x 0x%02x 0x%08x\n" , + boot_stage, boot_status, boot_progress);
sysfs_emit()please.
Thanks, Greg.
Will switch to sysfs_emit() in my next version.
Quoted 6 lines
Also, this is 3 different things, put all of these in different sysfs files.
thanks,
greg k-h
Actually, no. It is single value of boot stage.
Let me explain:
The boot progress consists of three things together: boot_stage, boot_status and boot_progress and they have no meaning if reported them as three separate values:
+ boot_stage is to indicate the boot stage
+ boot_status is to report the result of that boot_stage: started, complete or error.
+ boot_progress is to report more extra information for the stage other than the boot_stage/boot_status.
There is more information in the Documentation/ABI/testing sysfs patch.
- Quan
Greg Kroah-Hartman
maintainerRe: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver
Quoted 70 lines · Quan Nguyen
Quoted 9 lines · Greg Kroah-Hartman
Quoted 5 lines · Quan Nguyen
This commit adds driver support for accessing various information reported by Ampere's SMpro co-processor such as Boot Progress and other miscellaneous data.
Signed-off-by Quan Nguyen <[email protected]>No
Documentation/ABI/entries for your sysfs file?Thank you, Greg, for a very quick review.
I have put this file in other patch.Quoted 41 lines
Quoted 41 lines
drivers/misc/smpro-misc.c new file +41
-0+static ssize_t boot_progress_show (struct device *dev,struct device_attribute *da,char *buf) +{ +struct smpro_misc *misc =dev_get_drvdata (dev); +u32 boot_progress; +u8 current_stage; +u8 boot_status; +u8 boot_stage; +u32 select; +u32 reg_lo; +u32 reg; +int ret; + +/* Read current boot stage */ + ret =regmap_read (misc->regmap,BOOTSTAGE_CUR_STAGE , ®); +if (ret) +return ret; + + current_stage = reg &0xff ; + +/* Read the boot progress */ + ret =regmap_read (misc->regmap,BOOTSTAGE_SELECT , &select); +if (ret) +return ret; + + boot_stage = (select >>8 ) &0xff ; + boot_status = select &0xff ; + +if (boot_stage > current_stage) +return -EINVAL ; + + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_LO , ®_lo); +if (!ret) + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_HI , ®); +if (ret) +return ret; + + boot_progress =swab16 (reg) <<16 |swab16 (reg_lo); + +/* Tell firmware to provide next boot stage next time */ +if (boot_stage < current_stage) { + ret =regmap_write (misc->regmap,BOOTSTAGE_SELECT , ((select &0xff00 ) |0x1 ));Quoted 9 lines
drivers/misc/smpro-misc.c line 86
Quoted 6 lines
drivers/misc/smpro-misc.c new file +6
-0+if (ret) +return ret; + } + +return snprintf (buf,PAGE_SIZE ,"0x%02x 0x%02x 0x%08x\n" , + boot_stage, boot_status, boot_progress);
sysfs_emit()please.Thanks, Greg.
Will switch to
sysfs_emit()in my next version.
Quoted 8 lines
Quoted 6 lines
Also, this is 3 different things, put all of these in different sysfs files.
thanks,
greg k-h
Actually, no. It is single value of boot stage.
You are displaying 3 things in a single line, those are 3 different things.
Quoted 9 lines
Let me explain:
The boot progress consists of three things together:boot_stage,boot_statusandboot_progressand they have no meaning if reported them as three separate values:
+boot_stageis to indicate the boot stage
+boot_statusis to report the result of thatboot_stage: started, complete or error.
+boot_progressis to report more extra information for the stage other than the boot_stage/boot_status.
Why are these just not 3 different files? They describe three different things, please do not EVER force userspace to parse a sysfs file other than a single value.
thanks,
greg k-h
Re: [PATCH v7 5/9] misc: smpro-misc: Add Ampere's Altra SMpro misc driver
Quoted 93 lines · Greg Kroah-Hartman
Quoted 70 lines · Quan Nguyen
Quoted 9 lines · Greg Kroah-Hartman
Quoted 5 lines · Quan Nguyen
This commit adds driver support for accessing various information reported by Ampere's SMpro co-processor such as Boot Progress and other miscellaneous data.
Signed-off-by Quan Nguyen <[email protected]>No
Documentation/ABI/entries for your sysfs file?Thank you, Greg, for a very quick review.
I have put this file in other patch.Quoted 41 lines
Quoted 41 lines
drivers/misc/smpro-misc.c new file +41
-0+static ssize_t boot_progress_show (struct device *dev,struct device_attribute *da,char *buf) +{ +struct smpro_misc *misc =dev_get_drvdata (dev); +u32 boot_progress; +u8 current_stage; +u8 boot_status; +u8 boot_stage; +u32 select; +u32 reg_lo; +u32 reg; +int ret; + +/* Read current boot stage */ + ret =regmap_read (misc->regmap,BOOTSTAGE_CUR_STAGE , ®); +if (ret) +return ret; + + current_stage = reg &0xff ; + +/* Read the boot progress */ + ret =regmap_read (misc->regmap,BOOTSTAGE_SELECT , &select); +if (ret) +return ret; + + boot_stage = (select >>8 ) &0xff ; + boot_status = select &0xff ; + +if (boot_stage > current_stage) +return -EINVAL ; + + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_LO , ®_lo); +if (!ret) + ret =regmap_read (misc->regmap,BOOTSTAGE_STATUS_HI , ®); +if (ret) +return ret; + + boot_progress =swab16 (reg) <<16 |swab16 (reg_lo); + +/* Tell firmware to provide next boot stage next time */ +if (boot_stage < current_stage) { + ret =regmap_write (misc->regmap,BOOTSTAGE_SELECT , ((select &0xff00 ) |0x1 ));Quoted 9 lines
drivers/misc/smpro-misc.c line 86
Quoted 6 lines
drivers/misc/smpro-misc.c new file +6
-0+if (ret) +return ret; + } + +return snprintf (buf,PAGE_SIZE ,"0x%02x 0x%02x 0x%08x\n" , + boot_stage, boot_status, boot_progress);
sysfs_emit()please.Thanks, Greg.
Will switch to
sysfs_emit()in my next version.Quoted 8 lines
Quoted 6 lines
Also, this is 3 different things, put all of these in different sysfs files.
thanks,
greg k-h
Actually, no. It is single value of boot stage.
You are displaying 3 things in a single line, those are 3 different things.
Quoted 9 lines
Let me explain:
The boot progress consists of three things together:boot_stage,boot_statusandboot_progressand they have no meaning if reported them as three separate values:
+boot_stageis to indicate the boot stage
+boot_statusis to report the result of thatboot_stage: started, complete or error.
+boot_progressis to report more extra information for the stage other than the boot_stage/boot_status.
Quoted 4 lines
Why are these just not 3 different files? They describe three different things, please do not EVER force userspace to parse a sysfs file other than a single value.
Thanks Greg for the comment.
As there are multiple boot stages that occur even before the firmware is able to report, the firmware will stores all the stages and make them ready for later access. Later, on each access, ie: read to sysfs, the earliest boot stages will be read out and the next stage info is made ready for the next read by clearing the current reported stage.
As these three piece of info only make sense when put together, we chose to providing a single file only so that when the sysfs is read, we can provide them as a single value and do the clearing so that the next read will return with the next stage.
My intention for next version is to report a single 12-byte hex value for this sysfs.
- Quan
PATCH v7 6/9 docs: misc-devices: (smpro-misc) Add documentation
In reply to Quan NguyenAdds documentation for the Ampere(R)'s Altra(R) SMpro misc driver.
---
Changes in v7:
+ None
Changes in v6:
+ First introduced in v6 [Quan]
Documentation/misc-devices/index.rst | 1 + Documentation/misc-devices/smpro-misc.rst | 82 +++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 Documentation/misc-devices/smpro-misc.rst
Documentation/misc-devices/index.rst +1 -0
@@ -27,6 +27,7 @@ fit into other categories. max6875 pci-endpoint-test smpro-errmon + smpro-misc spear-pcie-gadget uacce xilinx_sdfec
Documentation/misc-devices/smpro-misc.rst new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
2.35.1
PATCH v7 7/9 dt-bindings: mfd: Add bindings for Ampere Altra SMPro MFD driver
In reply to Quan NguyenAdds device tree bindings for SMPro MFD driver found on the Mt.Jade hardware reference platform with Ampere's Altra Processor family.
The SMpro co-processor on Ampere Altra processor family is to monitor and report various data included hwmon-related info, RAS errors, and other miscellaneous information.
---
Changes in v7:
+ None
Changes in v6:
+ None
.../devicetree/bindings/mfd/ampere,smpro.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ampere,smpro.yaml
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ampere Altra SMPro firmware driver + +maintainers: + - Quan Nguyen <[email protected]> + +description: | + Ampere Altra SMPro firmware may contain different blocks like hardware + monitoring, error monitoring and other miscellaneous features. + +properties: + compatible: + enum: + - ampere,smpro + + reg: + description: + I2C device address. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + smpro@4f { + compatible = "ampere,smpro"; + reg = <0x4f>; + }; + };
Signature · 1 line
2.35.1
Re: [PATCH v7 7/9] dt-bindings: mfd: Add bindings for Ampere Altra SMPro MFD driver
Quoted 46 lines · Quan Nguyen
Adds device tree bindings for SMPro MFD driver found on the Mt.Jade hardware reference platform with Ampere's Altra Processor family.
The SMpro co-processor on Ampere Altra processor family is to monitor and report various data included hwmon-related info, RAS errors, and other miscellaneous information.
Signed-off-by Quan Nguyen <[email protected]>Reviewed-by Rob Herring <[email protected]>---
Changes in v7:
+ NoneChanges in v6:
+ None.../devicetree/bindings/mfd/ampere,smpro.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/mfd/ampere,smpro.yamlDocumentation/devicetree/bindings/mfd/ampere,smpro.yaml new file +20
-0@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ampere Altra SMPro firmware driver + +maintainers: + - Quan Nguyen <[email protected]> + +description: | + Ampere Altra SMPro firmware may contain different blocks like hardware + monitoring, error monitoring and other miscellaneous features. + +properties: + compatible: + enum: + - ampere,smpro +
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml new file +10
-0+ reg: + description: + I2C device address. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0
Why do you need address/size cells? Is the binding not complete? The commit description does not mention such case.
Best regards,
Krzysztof
Re: [PATCH v7 7/9] dt-bindings: mfd: Add bindings for Ampere Altra SMPro MFD driver
Quoted 52 lines · Krzysztof Kozlowski
Quoted 51 lines · Quan Nguyen
Adds device tree bindings for SMPro MFD driver found on the Mt.Jade hardware reference platform with Ampere's Altra Processor family.
The SMpro co-processor on Ampere Altra processor family is to monitor and report various data included hwmon-related info, RAS errors, and other miscellaneous information.
Signed-off-by Quan Nguyen <[email protected]>Reviewed-by Rob Herring <[email protected]>---
Changes in v7:
+ NoneChanges in v6:
+ None.../devicetree/bindings/mfd/ampere,smpro.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+)create mode 100644
Documentation/devicetree/bindings/mfd/ampere,smpro.yamlDocumentation/devicetree/bindings/mfd/ampere,smpro.yaml new file +25
-0@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/ampere,smpro.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Ampere Altra SMPro firmware driver + +maintainers: + - Quan Nguyen <[email protected]> + +description: | + Ampere Altra SMPro firmware may contain different blocks like hardware + monitoring, error monitoring and other miscellaneous features. + +properties: + compatible: + enum: + - ampere,smpro + + reg: + description: + I2C device address. + maxItems: 1 +
Quoted 9 lines
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml line 30
Quoted 5 lines
Documentation/devicetree/bindings/mfd/ampere,smpro.yaml new file +5
-0+ "#address-cells": + const: 1 + + "#size-cells": + const: 0Why do you need address/size cells? Is the binding not complete? The commit description does not mention such case.
Thanks Krzysztof for the comment.
The address/size cells are indeed not used. The child drivers are instantiated by the parent MFD and there is no child nodes in DT. This part will be removed in my next version.
- Quan
PATCH v7 8/9 mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver
In reply to Quan NguyenAdds Multi-function devices driver for SMpro co-processor found on the Mt.Jade hardware reference platform with Ampere's Altra processor family.
---
Changes in v7:
+ Smpro-mfd now significant changes in compare with simple-mfd-i2c
driver, remove the copyright note about simple-mfd-i2c [Quan]
+ Install bus->read/write() to handle multiple types of bus
access. [Quan]
+ Update license to MODULE_LICENSE("GPL") [Quan]
+ Add others minor refactor the code [Quan]Changes in v6:
+ Update license part to reflect that this driver is clone from simple-mfd-i2c driver [Quan]
Changes in v5:
+ Dropped the use of simple-mfd-i2c driver [Quan]
+ Introduced drivers/mfd/smpro-mfd.c driver to instantiate sub-devices. This is to avoid DT nodes without resource issue [Quan]
+ Revised commit message [Quan]
Changes in v4:
+ Add "depends on I2C" to fix build issue found by kernel test robot [Guenter]
Changes in v3:
+ None
Changes in v2:
+ Used 'struct of_device_id's .data attribute [Lee Jones]
drivers/mfd/Kconfig | 12 ++++ drivers/mfd/Makefile | 1 + drivers/mfd/smpro-mfd.c | 134 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 drivers/mfd/smpro-mfd.c
drivers/mfd/Kconfig +12 -0
@@ -77,6 +77,18 @@ config MFD_AS3711 help Support for the AS3711 PMIC from AMS +config MFD_SMPRO + tristate "Ampere Computing MFD SMpro core driver" + depends on I2C + select MFD_CORE + select REGMAP_I2C + help + Say yes here to enable SMpro driver support for Ampere's Altra + processor family. + + Ampere's Altra SMpro exposes an I2C regmap interface that can + be accessed by child devices. + config MFD_AS3722 tristate "ams AS3722 Power Management IC" select MFD_CORE
drivers/mfd/Makefile +1 -0
@@ -266,6 +266,7 @@ obj-$(CONFIG_MFD_QCOM_PM8008) += qcom-pm8008.o obj-$(CONFIG_SGI_MFD_IOC3) += ioc3.o obj-$(CONFIG_MFD_SIMPLE_MFD_I2C) += simple-mfd-i2c.o +obj-$(CONFIG_MFD_SMPRO) += smpro-mfd.o obj-$(CONFIG_MFD_INTEL_M10_BMC) += intel-m10-bmc.o obj-$(CONFIG_MFD_ATC260X) += atc260x-core.o
drivers/mfd/smpro-mfd.c new file +134 -0
134 lines not on this page · raw message
Signature · 1 line
2.35.1
kernel test robot
build botRe: [PATCH v7 8/9] mfd: smpro-mfd: Adds Ampere's Altra SMpro MFD driver
I love your patch! Perhaps something to improve:
Hi Quan,
I love your patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on groeck-staging/hwmon-next lee-mfd/for-mfd-next v5.17 next-20220321] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 37fd83916da2e4cae03d350015c82a67b1b334c4 config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220322/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 85e9b2687a13d1908aa86d1b89c5ce398a06cd39)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/20d62dfe69d4a3a0cb64bf97df0062d050d6a4d4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Quan-Nguyen/Add-Ampere-s-Altra-SMPro-MFD-and-its-child-drivers/20220321-161811 git checkout 20d62dfe69d4a3a0cb64bf97df0062d050d6a4d4
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/hwmon/
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/hwmon/smpro-hwmon.c:378:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
default:
^
drivers/hwmon/smpro-hwmon.c:378:2: note: insert 'break;' to avoid fall-through
default:
^
break; 1 warning generated.
vim +378 drivers/hwmon/smpro-hwmon.c
91d3fe230bebb1c Quan Nguyen 2022-03-21 359
91d3fe230bebb1c Quan Nguyen 2022-03-21 360 static umode_t smpro_is_visible(const void *data, enum hwmon_sensor_types type,
91d3fe230bebb1c Quan Nguyen 2022-03-21 361 u32 attr, int channel)
91d3fe230bebb1c Quan Nguyen 2022-03-21 362 {
91d3fe230bebb1c Quan Nguyen 2022-03-21 363 const struct smpro_hwmon *hwmon = data;
91d3fe230bebb1c Quan Nguyen 2022-03-21 364 unsigned int value;
91d3fe230bebb1c Quan Nguyen 2022-03-21 365 int ret;
91d3fe230bebb1c Quan Nguyen 2022-03-21 366
91d3fe230bebb1c Quan Nguyen 2022-03-21 367 switch (type) {
91d3fe230bebb1c Quan Nguyen 2022-03-21 368 case hwmon_temp:
91d3fe230bebb1c Quan Nguyen 2022-03-21 369 switch (attr) {
91d3fe230bebb1c Quan Nguyen 2022-03-21 370 case hwmon_temp_input:
91d3fe230bebb1c Quan Nguyen 2022-03-21 371 case hwmon_temp_label:
91d3fe230bebb1c Quan Nguyen 2022-03-21 372 case hwmon_temp_crit:
91d3fe230bebb1c Quan Nguyen 2022-03-21 373 ret = regmap_read(hwmon->regmap, temperature[channel].reg, &value);
91d3fe230bebb1c Quan Nguyen 2022-03-21 374 if (ret || value == 0xFFFF)
91d3fe230bebb1c Quan Nguyen 2022-03-21 375 return 0;
91d3fe230bebb1c Quan Nguyen 2022-03-21 376 break;
91d3fe230bebb1c Quan Nguyen 2022-03-21 377 }
91d3fe230bebb1c Quan Nguyen 2022-03-21 @378 default:
91d3fe230bebb1c Quan Nguyen 2022-03-21 379 break;
91d3fe230bebb1c Quan Nguyen 2022-03-21 380 }
91d3fe230bebb1c Quan Nguyen 2022-03-21 381
91d3fe230bebb1c Quan Nguyen 2022-03-21 382 return 0444;
91d3fe230bebb1c Quan Nguyen 2022-03-21 383 }
91d3fe230bebb1c Quan Nguyen 2022-03-21 384 Signature · 2 lines
0-DAY CI Kernel Test Service https://01.org/lkp
PATCH v7 9/9 docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs interfaces
In reply to Quan NguyenAdd documentation for the Ampere(R)'s Altra(R) SMpro sysfs interfaces
---
Changes in v7:
+ First introduce in v7 [Greg]
.../sysfs-bus-platform-devices-ampere-smpro | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +133 -0
@@ -0,0 +1,133 @@ +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[core|mem|pcie|other]_[ce|ue] +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the 48-byte Ampere (Vendor-Specific) Error Record, see [1] + printed in hex format as below: + + AA BB CCCC DDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD \ + DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD + Where: + AA : Error Type + BB : Subtype + CCCC : Instance + DDD...DDD: Similar to the Arm RAS standard error record + + See [1] below for the format details. + + The detail of each sysfs entries is as below: + +-------------+---------------------------------------------------------+ + | Error | Sysfs entry | + +-------------+---------------------------------------------------------+ + | Core's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ce | + | Core's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ue | + | Memory's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ce | + | Memory's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ue | + | PCIe's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ce | + | PCIe's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ue | + | Other's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ce| + | Other's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ue| + +-------------+---------------------------------------------------------+ + UE: Uncorrect-able Error + CE: Correct-able Error + + [1] Section 3.3 Ampere (Vendor-Specific) Error Record Formats, + Altra Family RAS Supplement. + + +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[smpro|pmpro] +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the internal firmware error record printed as hex format + as below: + + A BB C DD EEEE FFFFFFFF + Where: + A : Firmware Error Type + 1: Warning + 2: Error + 4: Error with data + BB : Firmware Image Code (8-bit value) + C : Direction: + 0: Enter + 1: Exit + DD : Location, firmware module location code (8-bit value) + EEEE : Error Code, firmware Error Code (16-bit value) + FFFFFFFF: Extensive data (32-bit value) + + Example: + root@mtjade:~# cat /sys/bus/platform/devices/smpro-errmon.1.auto/errors_smpro + 1 09 0 08 000a 00000000 + + The detail of each sysfs entries is as below: + +-------------+-------------------------------------------------------+ + | Error | Sysfs entry | + +-------------+-------------------------------------------------------+ + | SMpro error | /sys/bus/platform/devices/smpro-errmon.*/errors_smpro | + | PMpro error | /sys/bus/platform/devices/smpro-errmon.*/errors_pmpro | + +-------------+-------------------------------------------------------+ + See more details in section 5.10 RAS Internal Error Register Definitions, + Altra Family Soc BMC Interface Specification. + + +What: /sys/bus/platform/devices/smpro-errmon.*/event_[vrd_warn_fault|vrd_hot|dimm_hot] +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the detail information in case of VRD/DIMM warning/hot events + in hex format as below: + + AA BBBB + Where: + AA : The event channel + 00: VRD Warning Fault + 01: VRD Hot + 02: DIMM host + BBBB: The event detail information data + + See more details in section 5.7 GPI Status Registers, + Altra Family Soc BMC Interface Specification. + + +What: /sys/bus/platform/devices/smpro-misc.*/boot_progress +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the boot stages information in hex as format below: + + AA BB CCCCCCCC + Where: + AA : The boot stages + 00: SMpro firmware booting + 01: PMpro firmware booting + 02: ATF BL1 firmware booting + 03: DDR initialization + 04: DDR training report status + 05: ATF BL2 firmware booting + 06: ATF BL31 firmware booting + 07: ATF BL32 firmware booting + 08: UEFI firmware booting + 09: OS booting + BB : Boot status + 00: Not started + 01: Started + 02: Completed without error + 03: Failed. + CCCCCCCC: Boot status information defined for each boot stages + + See more details in section 5.11 Boot Stage Register Definitions, + and section 6. Processor Boot Progress Codes, Altra Family Soc BMC + Interface Specification. + + +What: /sys/bus/platform/devices/smpro-misc*/soc_power_limit +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RW) Contains the desired SoC power limit in Watt. + Writes to this sysfs set the desired SoC power limit (W). + Reads from this register return the current SoC power limit (W). + The value ranges: + Minimum: 120 W + Maximum: Socket TDP power
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerRe: [PATCH v7 9/9] docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs interfaces
Quoted 17 lines · Quan Nguyen
Add documentation for the Ampere(R)'s Altra(R) SMpro sysfs interfaces
Signed-off-by Quan Nguyen <[email protected]>---
Changes in v7:
+ First introduce in v7 [Greg].../sysfs-bus-platform-devices-ampere-smpro | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smproDocumentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +0
-0
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 1
Quoted 1 line
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0@@ -0,0 +1,133 @@ +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[core|mem|pcie|other]_[ce|ue]
Please split this out as one entry per file.
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 2
Quoted 1 line
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0+KernelVersion: 5.14
5.14 is a long time ago.
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 14
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +12
-0+Contact: [email protected] +Description: + (RO) Contains the 48-byte Ampere (Vendor-Specific) Error Record, see [1] + printed in hex format as below: + + AA BB CCCC DDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD \ + DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD + Where: + AA : Error Type + BB : Subtype + CCCC : Instance + DDD...DDD: Similar to the Arm RAS standard error record
No, this is not a valid sysfs file, sorry. This should just be one value per file.
Quoted 21 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +21
-0+ + See [1] below for the format details. + + The detail of each sysfs entries is as below: + +-------------+---------------------------------------------------------+ + | Error | Sysfs entry | + +-------------+---------------------------------------------------------+ + | Core's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ce | + | Core's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ue | + | Memory's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ce | + | Memory's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ue | + | PCIe's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ce | + | PCIe's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ue | + | Other's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ce| + | Other's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ue| + +-------------+---------------------------------------------------------+ + UE: Uncorrect-able Error + CE: Correct-able Error + + [1] Section 3.3 Ampere (Vendor-Specific) Error Record Formats, + Altra Family RAS Supplement.
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 45
Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +10
-0+ + +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[smpro|pmpro] +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the internal firmware error record printed as hex format + as below: + + A BB C DD EEEE FFFFFFFF
Again this isn't a good sysfs entry. You should never have to parse a sysfs file except for a single value.
thanks,
greg k-h
Re: [PATCH v7 9/9] docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs interfaces
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Quan Nguyen
Add documentation for the Ampere(R)'s Altra(R) SMpro sysfs interfaces
Signed-off-by Quan Nguyen <[email protected]>---
Changes in v7:
+ First introduce in v7 [Greg].../sysfs-bus-platform-devices-ampere-smpro | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro
Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0@@ -0,0 +1,133 @@ +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[core|mem|pcie|other]_[ce|ue]Please split this out as one entry per file.
These sysfs share same format of HW errors (the 48-byte Arm vendor specific HW error record) but for separate HW domains: Core, PCIe, Mem... etc
Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 2
Quoted 1 line
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0+KernelVersion: 5.145.14 is a long time ago.
Quoted 16 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 14
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +12
-0+Contact: [email protected] +Description: + (RO) Contains the 48-byte Ampere (Vendor-Specific) Error Record, see [1] + printed in hex format as below: + + AA BB CCCC DDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD \ + DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD + Where: + AA : Error Type + BB : Subtype + CCCC : Instance + DDD...DDD: Similar to the Arm RAS standard error recordNo, this is not a valid sysfs file, sorry. This should just be one value per file.
This 48-byte value is unable to separate into smaller values because it contain all information necessary to indicate a single HW error as per ARM RAS supplement document [1]. The format is to make it read-able other than a single 48-byte hex value.
[1] https://developer.arm.com/documentation/ddi0587/latest/
Quoted 36 lines
Quoted 22 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +21
-0+ + See [1] below for the format details. + + The detail of each sysfs entries is as below: + +-------------+---------------------------------------------------------+ + | Error | Sysfs entry | + +-------------+---------------------------------------------------------+ + | Core's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ce | + | Core's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_core_ue | + | Memory's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ce | + | Memory's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_mem_ue | + | PCIe's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ce | + | PCIe's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_pcie_ue | + | Other's CE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ce| + | Other's UE | /sys/bus/platform/devices/smpro-errmon.*/errors_other_ue| + +-------------+---------------------------------------------------------+ + UE: Uncorrect-able Error + CE: Correct-able Error + + [1] Section 3.3 Ampere (Vendor-Specific) Error Record Formats, + Altra Family RAS Supplement.Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 45
Quoted 10 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +10
-0+ + +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[smpro|pmpro] +KernelVersion: 5.14 +Contact: [email protected] +Description: + (RO) Contains the internal firmware error record printed as hex format + as below: + + A BB C DD EEEE FFFFFFFFAgain this isn't a good sysfs entry. You should never have to parse a sysfs file except for a single value.
Quoted 3 lines
thanks,
greg k-h
This error is also unable to separate further as well.
Thanks Greg for the review.
- Quan
Greg Kroah-Hartman
maintainerRe: [PATCH v7 9/9] docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs interfaces
Quoted 50 lines · Quan Nguyen
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Quan Nguyen
Add documentation for the Ampere(R)'s Altra(R) SMpro sysfs interfaces
Signed-off-by Quan Nguyen <[email protected]>---
Changes in v7:
+ First introduce in v7 [Greg].../sysfs-bus-platform-devices-ampere-smpro | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smproQuoted 10 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0@@ -0,0 +1,133 @@ +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[core|mem|pcie|other]_[ce|ue]Please split this out as one entry per file.
These sysfs share same format of HW errors (the 48-byte Arm vendor specific HW error record) but for separate HW domains: Core, PCIe, Mem... etc
Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 2
Quoted 1 line
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0+KernelVersion: 5.145.14 is a long time ago.
Quoted 16 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 14
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +12
-0+Contact: [email protected] +Description: + (RO) Contains the 48-byte Ampere (Vendor-Specific) Error Record, see [1] + printed in hex format as below: + + AA BB CCCC DDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD \ + DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD + Where: + AA : Error Type + BB : Subtype + CCCC : Instance + DDD...DDD: Similar to the Arm RAS standard error recordNo, this is not a valid sysfs file, sorry. This should just be one value per file.
Quoted 6 lines
This 48-byte value is unable to separate into smaller values because it contain all information necessary to indicate a single HW error as per ARM RAS supplement document [1]. The format is to make it read-able other than a single 48-byte hex value.
Just export the 48 byte hex value and make userspace split it up if it wants to do so. Don't do things in the kernel that can be done in userspace.
thanks,
greg k-h
Re: [PATCH v7 9/9] docs: ABI: testing: Document the Ampere Altra Family's SMpro sysfs interfaces
Quoted 56 lines · Greg Kroah-Hartman
Quoted 55 lines · Quan Nguyen
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Quan Nguyen
Add documentation for the Ampere(R)'s Altra(R) SMpro sysfs interfaces
Signed-off-by Quan Nguyen <[email protected]>---
Changes in v7:
+ First introduce in v7 [Greg].../sysfs-bus-platform-devices-ampere-smpro | 133 ++++++++++++++++++ 1 file changed, 133 insertions(+)create mode 100644
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smproQuoted 10 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 1
Quoted 7 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0@@ -0,0 +1,133 @@ +What: /sys/bus/platform/devices/smpro-errmon.*/errors_[core|mem|pcie|other]_[ce|ue]Please split this out as one entry per file.
These sysfs share same format of HW errors (the 48-byte Arm vendor specific HW error record) but for separate HW domains: Core, PCIe, Mem... etc
Quoted 4 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 2
Quoted 1 line
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +1
-0+KernelVersion: 5.145.14 is a long time ago.
Quoted 16 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro line 14
Quoted 12 lines
Documentation/ABI/testing/sysfs-bus-platform-devices-ampere-smpro new file +12
-0+Contact: [email protected] +Description: + (RO) Contains the 48-byte Ampere (Vendor-Specific) Error Record, see [1] + printed in hex format as below: + + AA BB CCCC DDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD \ + DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD DDDDDDDDDDDDDDDD + Where: + AA : Error Type + BB : Subtype + CCCC : Instance + DDD...DDD: Similar to the Arm RAS standard error recordNo, this is not a valid sysfs file, sorry. This should just be one value per file.
This 48-byte value is unable to separate into smaller values because it contain all information necessary to indicate a single HW error as per ARM RAS supplement document [1]. The format is to make it read-able other than a single 48-byte hex value.
Quoted 6 lines
Quoted 1 line
Just export the 48 byte hex value and make userspace split it up if it wants to do so. Don't do things in the kernel that can be done in userspace.
Thanks Greg for the suggestion,
Will do this in my next version.
Thanks,
- Quan