]> www.infradead.org Git - users/jedix/linux-maple.git/commit
powerpc/pseries: Add ibm,get-dynamic-sensor-state RTAS call support
authorHaren Myneni <haren@linux.ibm.com>
Wed, 16 Apr 2025 22:57:40 +0000 (15:57 -0700)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Thu, 17 Apr 2025 06:12:29 +0000 (11:42 +0530)
commit496c7524dcec16d3993382db35b960f8c3955083
treeb31963672ec10a8172a28ac57f33cdac4130a4ed
parentf60a3796f84f96d21de1a4fa2b9fd0637378f026
powerpc/pseries: Add ibm,get-dynamic-sensor-state RTAS call support

The RTAS call ibm,get-dynamic-sensor-state is used to get the
sensor state identified by the location code and the sensor
token. The librtas library provides an API
rtas_get_dynamic_sensor() which uses /dev/mem access for work
area allocation but is restricted under system lockdown.

This patch provides an interface with new ioctl
 PAPR_DYNAMIC_SENSOR_IOC_GET to the papr-indices character
driver which executes this HCALL and copies the sensor state
in the user specified ioctl buffer.

Refer PAPR 7.3.19 ibm,get-dynamic-sensor-state for more
information on this RTAS call.
- User input parameters to the RTAS call: location code string
  and the sensor token

Expose these interfaces to user space with a /dev/papr-indices
character device using the following programming model:
 int fd = open("/dev/papr-indices", O_RDWR);
 int ret = ioctl(fd, PAPR_DYNAMIC_SENSOR_IOC_GET,
struct papr_indices_io_block)
  - The user space specifies input parameters in
    papr_indices_io_block struct
  - Returned state for the specified sensor is copied to
    papr_indices_io_block.dynamic_param.state

Signed-off-by: Haren Myneni <haren@linux.ibm.com>
Tested-by: Sathvika Vasireddy <sv@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20250416225743.596462-6-haren@linux.ibm.com
arch/powerpc/include/asm/rtas.h
arch/powerpc/kernel/rtas.c
arch/powerpc/platforms/pseries/papr-indices.c