Page MenuHomeFreeBSD

Basic OPAL sensor support for POWER9 platforms
ClosedPublic

Authored by jhibbits on May 9 2018, 2:51 AM.

Details

Summary

PowerNV architectures (in the test case POWER9) export sensors via the device
tree, which are accessed via OPAL calls. This adds sysctl nodes for each
device in a generic fashion. New sysctl nodes are:

dev.opal_sensor.N.sensor
dev.opal_sensor.N.sensor_min
dev.opal_sensor.N.sensor_max
dev.opal_sensor.N.type
dev.opal_sensor.N.label

These are rooted at a parent attachment under opal, called opalsens. This does
not add support for the "sensor grooups" defined in the device tree.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

jhibbits created this revision.May 9 2018, 2:51 AM

Just a note, the OPAL calls additions to opal.h are separate, and simply \#define additions. I'm sure there must be a better name than opal_sensor, so soliciting opinions on that.

Hi Justin.

It seems that this diff does not contain the changes in opal.h, as the definition for OPAL_SENSOR_READ and others.

sys/powerpc/powernv/opal_sensor.c
102 ↗(On Diff #42298)

What if OPAL_SUCCESS is returned? it seems that val32 will be empty later.

107 ↗(On Diff #42298)

We probably want to check for OPAL_BUSY_EVENT and quite the loop after a while, mainly if OPAL_BUSY is returned forever.

116 ↗(On Diff #42298)

val32 will be empty if we get OPAL_SUCCESS on the first call

Hi Justin.
It seems that this diff does not contain the changes in opal.h, as the definition for OPAL_SENSOR_READ and others.

I mentioned above that those definitions aren't included here because I've already made other changes to opal.h so extracting them for the diff seemed silly for first glance. They are:

#define OPAL_SENSOR_READ 88
#define OPAL_SENSOR_GROUP_CLEAR 156
#define OPAL_SENSOR_READ_U64 162
#define OPAL_SENSOR_GROUP_ENABLE 163

sys/powerpc/powernv/opal_sensor.c
102 ↗(On Diff #42298)

If OPAL_SUCCESS is returned val32 will have been populated by the OPAL_SENSOR_READ call.

116 ↗(On Diff #42298)

Se above, it gets populated immediately by the call.

jhibbits updated this revision to Diff 42757.May 20 2018, 4:24 AM

Add a small delay, and a timeout, if a sensor needs extra time
(OPAL_ASYNC_COMPLETION/OPAL_BUSY).

jhibbits added inline comments.May 21 2018, 2:42 PM
sys/powerpc/powernv/opal_sensor.c
108 ↗(On Diff #42757)

Oops, typo. Should be OPAL_CHECK_ASYNC_COMPLETION.

I reviewed this code and it seems OK to be integrated.

This revision is now accepted and ready to land.May 21 2018, 6:36 PM
This revision was automatically updated to reflect the committed changes.