All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface
@ 2020-04-21 12:16 Philippe Mathieu-Daudé
  2020-04-21 12:16 ` [RFC PATCH 01/17] hw/misc: Introduce the " Philippe Mathieu-Daudé
                   ` (16 more replies)
  0 siblings, 17 replies; 20+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-21 12:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Joaquin de Andres, Michael Tokarev, Keith Busch,
	qemu-block, qemu-trivial, John Snow, Markus Armbruster,
	Joel Stanley, Philippe Mathieu-Daudé,
	Guenter Roeck, Laurent Vivier, Thomas Huth,
	Dr. David Alan Gilbert, qemu-arm, Cédric Le Goater,
	Alex Bennée, Philippe Mathieu-Daudé,
	Andrew Baumann, Jean-Christophe Dubois, Paolo Bonzini

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 <alex.bennee@linaro.org>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Keith Busch <keith.busch@intel.com>
Cc: Cédric Le Goater <clg@kaod.org>
Cc: Joel Stanley <joel@jms.id.au>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Joaquin de Andres <me@xcancerberox.com.ar>

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



^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-04-21 18:01 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21 12:16 [RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 01/17] hw/misc: Introduce the " Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 02/17] hw/misc/temp-sensor: Add 'query-temperature-sensors' QMP command Philippe Mathieu-Daudé
2020-04-21 16:27   ` Dr. David Alan Gilbert
2020-04-21 12:16 ` [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command Philippe Mathieu-Daudé
2020-04-21 18:00   ` Dr. David Alan Gilbert
2020-04-21 12:16 ` [RFC PATCH 04/17] hw/misc/tmp105: Extract get_temp_mC() and set_temp_mC() helpers Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 05/17] hw/misc/tmp105: Implement the 'temperature-sensor' qdev interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 06/17] hw/misc/tmp421: Add definition for SENSORS_COUNT Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 07/17] hw/misc/tmp421: Extract get_temp_mC() helper Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 08/17] hw/misc/tmp421: Extract set_temp_mC() helper Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 09/17] hw/misc/tmp421: Implement the 'temperature-sensor' qdev interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 10/17] hw/misc/bcm2835_thermal: Hold the temperature in the device state Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 11/17] hw/misc/bcm2835_thermal: Implement the 'temperature-sensor' interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 12/17] hw/misc/bcm2835_property: Hold the temperature in the device state Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 13/17] hw/misc/bcm2835_property: Implement the 'temperature-sensor' interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 14/17] hw/display/ads7846: Implement the 'temperature-sensor' qdev interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 15/17] hw/ide/qdev: " Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 16/17] hw/misc/imx6ul_ccm: " Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 17/17] tests/qtest/tmp105-test: Trivial test for TempSensorClass Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.