summaryrefslogtreecommitdiffstats
path: root/hw/occ-sensor.c
Commit message (Collapse)AuthorAgeFilesLines
* occ: Move occ declarations into occ.hAndrew Donnellan2018-06-271-1/+1
| | | | | | | | | | | | | OCC declarations are currently split between skiboot.h and occ-sensor.h. Given the growing unwieldyness of skiboot.h it's probably time to move it all into one header. Rename occ-sensor.h to occ.h, move all OCC-related declarations out of skiboot.h, and add #includes as necessary. Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com> Reviewed-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* occ-sensor: Avoid using uninitialised struct cpu_threadJoel Stanley2018-06-181-2/+4
| | | | | | | | | | | | | | When adding the sensors in occ_sensors_init, if the type is not OCC_SENSOR_LOC_CORE, then the loop to find 'c' will not be executed. Then c->pir is used for both of the the add_sensor_node calls below. This provides a default value of 0 instead. Found using scan-build. Signed-off-by: Joel Stanley <joel@jms.id.au> Reviewed-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* sensors: Dont add DTS sensors when OCC inband sensors are availableShilpasri G Bhat2018-04-191-6/+8
| | | | | | | | | | | | | | | | | | There are two sets of core temperature sensors today. One is DTS scom based core temperature sensors and the second group is the sensors provided by OCC. DTS is the highest temperature among the different temperature zones in the core while OCC core temperature sensors are the average temperature of the core. DTS sensors are read directly by the host by SCOMing the DTS sensors while OCC sensors are read and updated by OCC to main memory. Reading DTS sensors by SCOMing is a heavy and slower operation as compared to reading OCC sensors which is as good as reading memory. So dont add DTS sensors when OCC sensors are available. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Acked-by: Vaidyanathan Srinivasan <svaidy@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
* occ-sensors: Remove NULL checks after dereferenceCyril Bur2018-03-271-2/+2
| | | | | | | | | | | | | | | | | Both scale_sensor() and scale_energy() take the value to scale as a pointer. These functions do not NULL check the pointer before the first time they dereference it, which is fine since passing NULL would be completely pointless. Both functions do perform a pointless NULL check later on. This confuses coverity and really doesn't make much sense at all. Since calling these functions with NULL as the sensor parameter makes no sense, and currently theres a dereference before the check, just remove the check. Fixes: CID 264276 and 264275 Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensor-groups: occ: Add support to disable/enable sensor groupShilpasri G Bhat2018-02-211-248/+15
| | | | | | | | | | This patch adds a new opal call to enable/disable a sensor group. This call is used to select the sensor groups that needs to be copied to main memory by OCC at runtime. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> [stewart: rebase and bump OPAL API number] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Scale the sensor valuesShilpasri G Bhat2018-02-211-4/+107
| | | | | | | | | | | | | | Scale the sensor values appropriately to match the HWMON requirements. OCC sensor values should be scaled as per "scale_factor' field and then converted to HWMON required unit. Sensors like temperature and power are already scaled by the kernel driver which convert the values to millidegree Celsius and microWatt respectively. So apart from temperature and power the remaining sensors are converted to HWMON standards. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Add energy countersShilpasri G Bhat2018-02-211-70/+119
| | | | | | | | | | Export the accumulated power values as energy sensors. The accumulator field of power sensors are used for representing energy counters which can be exported as energy counters in Linux hwmon interface. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> [stewart: fix old gcc compiler warning] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: Support reading u64 sensor valuesShilpasri G Bhat2018-02-211-1/+1
| | | | | | | | | | | | | This patch adds support to read u64 sensor values. This also adds changes to the core and the backend implementation code to make this API as the base call. Host can use this new API to read sensors upto 64bits. This adds a list to store the pointer to the kernel u32 buffer, for older kernels making async sensor u32 reads. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Skip power sensors with zero sample valueShilpasri G Bhat2018-01-301-0/+21
| | | | | | | | | | | | | | APSS is not avialable on platforms like Zaius, Romulus where OCC can only measure Vdd (core) and Vdn (nest) power from the AVSbus reading. So all the sensors for APSS channels will be populated with 0. Different component power sensors like system, memory which point to the APSS channels will also be 0. As per OCC team (Martha Broyles) zero'ed power sensor means that the system doesnot have it. So this patch filters out these sensors. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Skip GPU sensors for non-gpu systemsShilpasri G Bhat2018-01-301-0/+7
| | | | | Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Skip counter type of sensorsShilpasri G Bhat2017-12-131-0/+3
| | | | | | | | Don't add counter type of sensors to device-tree as they don't fit into hwmon sensor interface. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: Fix dtc warning for new occ inband sensors.Pridhiviraj Paidipeddi2017-11-301-0/+3
| | | | | | | | | | | | | | | dtc complains about missing reg property when a DT node is having a unit name or address but no reg property. /ibm,opal/sensors/vrm-in@c00004 has a unit name, but no reg property /ibm,opal/sensors/gpu-in@c0001f has a unit name, but no reg property /ibm,opal/sensor-groups/occ-js@1c00040 has a unit name, but no reg property This patch fixes these warnings for new occ inband sensors and also for sensor-groups by adding necessary properties. Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* occ-sensors: Fix up quad/gpu location mixupOliver O'Halloran2017-11-281-2/+7
| | | | | | | | | The GPU and QUAD sensor location types are swapped compared to what exists in the OCC code base which is authoritive. Fix them up. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> Reviewed-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* occ-sensors : Add OCC inband sensor region to exportsShilpasri G Bhat2017-10-181-1/+13
| | | | | Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensor-groups : occ: Add 'ops' DT propertyShilpasri G Bhat2017-08-111-1/+1
| | | | | | | | Add new device-tree property 'ops' to define different operations supported on each sensor-group. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* hw/occ-sensor: fix 'sensor' may be used uninitialized warning on some GCCStewart Smith2017-07-281-1/+1
| | | | | | | | On some GCC versions we could get an (arguably incorrect) compiler warning saying we may use the value of sensor uninitialised. Fixes: 1ded56ceb6a1c Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Add support to clear sensor groupsShilpasri G Bhat2017-07-281-0/+15
| | | | | | | | | | Adds a generic API to clear sensor groups. OCC inband sensor groups such as CSM, Profiler and Job Scheduler can be cleared using this API. It will clear the min/max of all sensors belonging to OCC sensor groups. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Skip the deconfigured core sensorsShilpasri G Bhat2017-07-281-2/+19
| | | | | | | | | This patch skips the deconfigured cores from the core sensors while parsing the sensor names in the main memory as these sensor values are not updated by OCC. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Add CSM_{min/max} sensorsShilpasri G Bhat2017-07-281-11/+19
| | | | | | | | | HWMON's lowest/highest attribute is used by CSM agent, so map min/max device-tree properties "sensor-data-min" and "sensor-data-max" to the min/max of CSM. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
* sensors: occ: Add support for OCC inband sensorsShilpasri G Bhat2017-07-281-0/+596
Add support to parse and export OCC inband sensors which are copied by OCC to main memory in P9. Each OCC writes three buffers which includes one names buffer for sensor meta data and two buffers for sensor readings. While OCC writes to one buffer the sensor values can be read from the other buffer. The sensors are updated every 100ms. This patch adds power, temperature, current and voltage sensors to /ibm,opal/sensors device-tree node which can be exported by the ibmpowernv-hwmon driver in Linux. Signed-off-by: Shilpasri G Bhat <shilpa.bhat@linux.vnet.ibm.com> Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
OpenPOWER on IntegriCloud