[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface |
Date: |
Tue, 21 Apr 2020 14:16:09 +0200 |
Hi,
This series is part of a bigger one I was preparing for a GSoC
project, but unfortunately no student got interested.
The idea is to allow device with temperature sensors to use a
common API with temperature operations.
While guest are running, you can modify the temperatures to check
the guest reactions. Some devices can trigger IRQ when temperature
pass thresholds. Somehow similar to inject NMI.
Some devices could also modify their temperature regarding their
workload.
The tsc2xxxx devices are interesting but can't be converted as
they predate QOM/QDev.
Temperature changes rate is <1Hz (not enforced in this model) so
using a QMP to get/set is acceptable.
The query-temperature-sensors command is for informative purpose,
also acceptable for QMP use.
Next step might be to publish QMP events when temperature change.
The original goal is to better interface ADCs with real world data.
Here using QMP is not an option. Here the idea is to use the
AudioState and audio_sample API from "audio.h" but it seems not
very used, see: https://bugs.launchpad.net/qemu/+bug/1861677
What is not clear yet to me is what's the best way to externally
set a specific sensor temperature. The TMPxxx I2C sensors use
object_property_set_int(). I could move that to the temp-sensor
interface but it seems a bit overkill. Any simpler idea?
Cc: Alex Bennée <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Keith Busch <address@hidden>
Cc: Cédric Le Goater <address@hidden>
Cc: Joel Stanley <address@hidden>
Cc: Guenter Roeck <address@hidden>
Cc: Joaquin de Andres <address@hidden>
Philippe Mathieu-Daudé (17):
hw/misc: Introduce the temperature sensor interface
hw/misc/temp-sensor: Add 'query-temperature-sensors' QMP command
hw/misc/temp-sensor: Add 'info temp' HMP command
hw/misc/tmp105: Extract get_temp_mC() and set_temp_mC() helpers
hw/misc/tmp105: Implement the 'temperature-sensor' qdev interface
hw/misc/tmp421: Add definition for SENSORS_COUNT
hw/misc/tmp421: Extract get_temp_mC() helper
hw/misc/tmp421: Extract set_temp_mC() helper
hw/misc/tmp421: Implement the 'temperature-sensor' qdev interface
hw/misc/bcm2835_thermal: Hold the temperature in the device state
hw/misc/bcm2835_thermal: Implement the 'temperature-sensor' interface
hw/misc/bcm2835_property: Hold the temperature in the device state
hw/misc/bcm2835_property: Implement the 'temperature-sensor' interface
hw/display/ads7846: Implement the 'temperature-sensor' qdev interface
hw/ide/qdev: Implement the 'temperature-sensor' qdev interface
hw/misc/imx6ul_ccm: Implement the 'temperature-sensor' qdev interface
tests/qtest/tmp105-test: Trivial test for TempSensorClass
qapi/misc.json | 24 +++++++
include/hw/misc/bcm2835_property.h | 1 +
include/hw/misc/bcm2835_thermal.h | 1 +
include/hw/misc/temp-sensor.h | 69 +++++++++++++++++++
include/monitor/hmp.h | 1 +
hw/display/ads7846.c | 38 +++++++++++
hw/ide/qdev.c | 14 ++++
hw/misc/bcm2835_property.c | 39 ++++++++++-
hw/misc/bcm2835_thermal.c | 42 ++++++++++--
hw/misc/imx6ul_ccm.c | 7 ++
hw/misc/temp-sensor.c | 102 +++++++++++++++++++++++++++++
hw/misc/tmp105.c | 51 +++++++++++----
hw/misc/tmp421.c | 74 ++++++++++++++++-----
tests/qtest/tmp105-test.c | 18 +++++
MAINTAINERS | 6 ++
hmp-commands-info.hx | 11 ++++
hw/misc/Makefile.objs | 1 +
17 files changed, 463 insertions(+), 36 deletions(-)
create mode 100644 include/hw/misc/temp-sensor.h
create mode 100644 hw/misc/temp-sensor.c
--
2.21.1
- [RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface,
Philippe Mathieu-Daudé <=
- [RFC PATCH 02/17] hw/misc/temp-sensor: Add 'query-temperature-sensors' QMP command, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 01/17] hw/misc: Introduce the temperature sensor interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 06/17] hw/misc/tmp421: Add definition for SENSORS_COUNT, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 08/17] hw/misc/tmp421: Extract set_temp_mC() helper, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 04/17] hw/misc/tmp105: Extract get_temp_mC() and set_temp_mC() helpers, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 05/17] hw/misc/tmp105: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 09/17] hw/misc/tmp421: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21