[Skiboot] [PATCH V3] sensors: dts: Assert special wakeup on idle cores while reading temperature
Stewart Smith
stewart at linux.vnet.ibm.com
Tue Oct 31 13:56:27 AEDT 2017
Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com> writes:
> In P9, when a core enters a stop state, its clocks will be stopped
> to save power and hence we will not be able to perform a scom
> operation to read the DTS temperature sensor. Hence, assert
> a special wakeup on cores that have entered a stop state in order to
> successfully complete the scom operation.
>
> Signed-off-by: Shilpasri G Bhat <shilpa.bhat at linux.vnet.ibm.com>
> ---
> Changes from V2:
> - Rebase on msater to use dctl_{set/clear}_special_wakeup()
>
> core/direct-controls.c | 4 +--
> core/sensor.c | 2 +-
> hw/dts.c | 83 +++++++++++++++++++++++++++++++++++++++++---------
> include/cpu.h | 3 ++
> include/dts.h | 2 +-
> 5 files changed, 76 insertions(+), 18 deletions(-)
>
> diff --git a/core/direct-controls.c b/core/direct-controls.c
> index 9acdab5..1f44bc7 100644
> --- a/core/direct-controls.c
> +++ b/core/direct-controls.c
> @@ -217,7 +217,7 @@ static int p9_sreset_thread(struct cpu_thread *cpu)
> return 0;
> }
>
> -static int dctl_set_special_wakeup(struct cpu_thread *t)
> +int dctl_set_special_wakeup(struct cpu_thread *t)
> {
> struct cpu_thread *c = t->primary;
> int rc = OPAL_SUCCESS;
> @@ -235,7 +235,7 @@ static int dctl_set_special_wakeup(struct cpu_thread *t)
> return rc;
> }
>
> -static int dctl_clear_special_wakeup(struct cpu_thread *t)
> +int dctl_clear_special_wakeup(struct cpu_thread *t)
> {
> struct cpu_thread *c = t->primary;
> int rc = OPAL_SUCCESS;
> diff --git a/core/sensor.c b/core/sensor.c
> index 57b21bc..0e2a5ca 100644
> --- a/core/sensor.c
> +++ b/core/sensor.c
> @@ -28,7 +28,7 @@ static int64_t opal_sensor_read(uint32_t sensor_hndl, int token,
> {
> switch (sensor_get_family(sensor_hndl)) {
> case SENSOR_DTS:
> - return dts_sensor_read(sensor_hndl, sensor_data);
> + return dts_sensor_read(sensor_hndl, token, sensor_data);
> case SENSOR_OCC:
> return occ_sensor_read(sensor_hndl, sensor_data);
> default:
> diff --git a/hw/dts.c b/hw/dts.c
> index a10df58..2fda769 100644
> --- a/hw/dts.c
> +++ b/hw/dts.c
> @@ -20,6 +20,9 @@
> #include <dts.h>
> #include <skiboot.h>
> #include <opal-api.h>
> +#include <opal-msg.h>
> +#include <timer.h>
> +#include <timebase.h>
>
> struct dts {
> uint8_t valid;
> @@ -27,6 +30,14 @@ struct dts {
> int16_t temp;
> };
>
> +/*
> + * Attributes for the core temperature sensor
> + */
> +enum {
> + SENSOR_DTS_ATTR_TEMP_MAX,
> + SENSOR_DTS_ATTR_TEMP_TRIP
> +};
> +
> /* Different sensor locations */
> #define P7_CT_ZONE_LSU 0
> #define P7_CT_ZONE_ISU 1
> @@ -196,7 +207,7 @@ static int dts_read_core_temp_p8(uint32_t pir, struct dts *dts)
> * Returns the temperature as the max of all zones and a global trip
> * attribute.
> */
> -static int dts_read_core_temp_p9(uint32_t pir, struct dts *dts)
> +static int _dts_read_core_temp_p9(u32 pir, struct dts *dts)
> {
> int32_t chip_id = pir_to_chip_id(pir);
> int32_t core = pir_to_core_id(pir);
> @@ -225,7 +236,52 @@ static int dts_read_core_temp_p9(uint32_t pir, struct dts *dts)
> return 0;
> }
>
> -static int dts_read_core_temp(uint32_t pir, struct dts *dts)
> +static struct timer dts_timer;
> +static struct dts_async_data {
> + struct cpu_thread *cpu;
> + u32 *sensor_data;
> + int token;
> + u8 attr;
> +} dts_async_data;
this means that only one concurrent request can be going on.
We should *not* put that limit here (where we would silently overwrite
previous attempts and end up somewhere really weird)..
Please fix.
--
Stewart Smith
OPAL Architect, IBM.
More information about the Skiboot
mailing list