From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: qemu-devel@nongnu.org, "Michael Tokarev" <mjt@tls.msk.ru>,
"Eric Blake" <eblake@redhat.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"John Snow" <jsnow@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-block@nongnu.org, "Thomas Huth" <thuth@redhat.com>,
qemu-trivial@nongnu.org,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-arm@nongnu.org, "Markus Armbruster" <armbru@redhat.com>,
"Laurent Vivier" <lvivier@redhat.com>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>
Subject: Re: [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command
Date: Tue, 21 Apr 2020 19:00:24 +0100 [thread overview]
Message-ID: <20200421180024.GL3029@work-vm> (raw)
In-Reply-To: <20200421121626.23791-4-f4bug@amsat.org>
* Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
> Add a command to display current devices temperature in the monitor:
>
> (qemu) info temp
> Temperatures (in C):
> videocore 25.00
> bcm2835-thermal-0 25.00
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
How do I set the temperature?
> ---
> include/monitor/hmp.h | 1 +
> hw/misc/temp-sensor.c | 29 +++++++++++++++++++++++++++++
> hmp-commands-info.hx | 11 +++++++++++
> 3 files changed, 41 insertions(+)
>
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index e33ca5a911..f023230bd1 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -129,5 +129,6 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
> void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
> void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
> void hmp_info_sev(Monitor *mon, const QDict *qdict);
> +void hmp_info_temp(Monitor *mon, const QDict *qdict);
>
> #endif
> diff --git a/hw/misc/temp-sensor.c b/hw/misc/temp-sensor.c
> index 27750c533d..5f591bd9c3 100644
> --- a/hw/misc/temp-sensor.c
> +++ b/hw/misc/temp-sensor.c
> @@ -12,6 +12,8 @@
> #include "hw/misc/temp-sensor.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/error.h"
> +#include "monitor/monitor.h"
> +#include "monitor/hmp.h"
>
> static int query_temperature_sensors_foreach(Object *obj, void *opaque)
> {
> @@ -59,6 +61,33 @@ TemperatureSensorList *qmp_query_temperature_sensors(Error **errp)
> return list;
> }
>
> +void hmp_info_temp(Monitor *mon, const QDict *qdict)
> +{
> + TemperatureSensorList *list, *sensor;
> + Error *err = NULL;
> +
> + list = qmp_query_temperature_sensors(&err);
> + if (!list) {
> + monitor_printf(mon, "No temperature sensors\n");
> + return;
> + }
> + if (err) {
> + monitor_printf(mon, "Error while getting temperatures: %s\n",
> + error_get_pretty(err));
> + error_free(err);
Maybe use hmp_handle_error
> + goto out;
> + }
> +
> + monitor_printf(mon, "Temperatures (in C):\n");
> + for (sensor = list; sensor; sensor = sensor->next) {
> + monitor_printf(mon, "%-33s %6.2f\n", sensor->value->name,
> + sensor->value->temperature);
See my question on the earlier patch; I'm curious here whether we want
device name, and then subname within that device.
Dave
> + }
> +
> +out:
> + qapi_free_TemperatureSensorList(list);
> +}
> +
> static TypeInfo tempsensor_interface_type_info = {
> .name = TYPE_TEMPSENSOR_INTERFACE,
> .parent = TYPE_INTERFACE,
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ca5198438d..77f1c43ce3 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -880,4 +880,15 @@ SRST
> Show SEV information.
> ERST
>
> + {
> + .name = "temp",
> + .args_type = "",
> + .params = "",
> + .help = "show device temperatures",
> + .cmd = hmp_info_temp,
> + },
>
> +SRST
> + ``info temp``
> + Show device temperatures.
> +ERST
> --
> 2.21.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, qemu-trivial@nongnu.org,
"Eric Blake" <eblake@redhat.com>,
"Michael Tokarev" <mjt@tls.msk.ru>,
qemu-devel@nongnu.org,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"John Snow" <jsnow@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command
Date: Tue, 21 Apr 2020 19:00:24 +0100 [thread overview]
Message-ID: <20200421180024.GL3029@work-vm> (raw)
In-Reply-To: <20200421121626.23791-4-f4bug@amsat.org>
* Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
> Add a command to display current devices temperature in the monitor:
>
> (qemu) info temp
> Temperatures (in C):
> videocore 25.00
> bcm2835-thermal-0 25.00
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
How do I set the temperature?
> ---
> include/monitor/hmp.h | 1 +
> hw/misc/temp-sensor.c | 29 +++++++++++++++++++++++++++++
> hmp-commands-info.hx | 11 +++++++++++
> 3 files changed, 41 insertions(+)
>
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index e33ca5a911..f023230bd1 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -129,5 +129,6 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
> void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
> void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
> void hmp_info_sev(Monitor *mon, const QDict *qdict);
> +void hmp_info_temp(Monitor *mon, const QDict *qdict);
>
> #endif
> diff --git a/hw/misc/temp-sensor.c b/hw/misc/temp-sensor.c
> index 27750c533d..5f591bd9c3 100644
> --- a/hw/misc/temp-sensor.c
> +++ b/hw/misc/temp-sensor.c
> @@ -12,6 +12,8 @@
> #include "hw/misc/temp-sensor.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/error.h"
> +#include "monitor/monitor.h"
> +#include "monitor/hmp.h"
>
> static int query_temperature_sensors_foreach(Object *obj, void *opaque)
> {
> @@ -59,6 +61,33 @@ TemperatureSensorList *qmp_query_temperature_sensors(Error **errp)
> return list;
> }
>
> +void hmp_info_temp(Monitor *mon, const QDict *qdict)
> +{
> + TemperatureSensorList *list, *sensor;
> + Error *err = NULL;
> +
> + list = qmp_query_temperature_sensors(&err);
> + if (!list) {
> + monitor_printf(mon, "No temperature sensors\n");
> + return;
> + }
> + if (err) {
> + monitor_printf(mon, "Error while getting temperatures: %s\n",
> + error_get_pretty(err));
> + error_free(err);
Maybe use hmp_handle_error
> + goto out;
> + }
> +
> + monitor_printf(mon, "Temperatures (in C):\n");
> + for (sensor = list; sensor; sensor = sensor->next) {
> + monitor_printf(mon, "%-33s %6.2f\n", sensor->value->name,
> + sensor->value->temperature);
See my question on the earlier patch; I'm curious here whether we want
device name, and then subname within that device.
Dave
> + }
> +
> +out:
> + qapi_free_TemperatureSensorList(list);
> +}
> +
> static TypeInfo tempsensor_interface_type_info = {
> .name = TYPE_TEMPSENSOR_INTERFACE,
> .parent = TYPE_INTERFACE,
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ca5198438d..77f1c43ce3 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -880,4 +880,15 @@ SRST
> Show SEV information.
> ERST
>
> + {
> + .name = "temp",
> + .args_type = "",
> + .params = "",
> + .help = "show device temperatures",
> + .cmd = hmp_info_temp,
> + },
>
> +SRST
> + ``info temp``
> + Show device temperatures.
> +ERST
> --
> 2.21.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
WARNING: multiple messages have this Message-ID (diff)
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Thomas Huth" <thuth@redhat.com>,
qemu-block@nongnu.org, qemu-trivial@nongnu.org,
"Michael Tokarev" <mjt@tls.msk.ru>,
qemu-devel@nongnu.org,
"Andrew Baumann" <Andrew.Baumann@microsoft.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"John Snow" <jsnow@redhat.com>,
"Markus Armbruster" <armbru@redhat.com>
Subject: Re: [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command
Date: Tue, 21 Apr 2020 19:00:24 +0100 [thread overview]
Message-ID: <20200421180024.GL3029@work-vm> (raw)
In-Reply-To: <20200421121626.23791-4-f4bug@amsat.org>
* Philippe Mathieu-Daudé (f4bug@amsat.org) wrote:
> Add a command to display current devices temperature in the monitor:
>
> (qemu) info temp
> Temperatures (in C):
> videocore 25.00
> bcm2835-thermal-0 25.00
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
How do I set the temperature?
> ---
> include/monitor/hmp.h | 1 +
> hw/misc/temp-sensor.c | 29 +++++++++++++++++++++++++++++
> hmp-commands-info.hx | 11 +++++++++++
> 3 files changed, 41 insertions(+)
>
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index e33ca5a911..f023230bd1 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -129,5 +129,6 @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict);
> void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict);
> void hmp_info_memory_size_summary(Monitor *mon, const QDict *qdict);
> void hmp_info_sev(Monitor *mon, const QDict *qdict);
> +void hmp_info_temp(Monitor *mon, const QDict *qdict);
>
> #endif
> diff --git a/hw/misc/temp-sensor.c b/hw/misc/temp-sensor.c
> index 27750c533d..5f591bd9c3 100644
> --- a/hw/misc/temp-sensor.c
> +++ b/hw/misc/temp-sensor.c
> @@ -12,6 +12,8 @@
> #include "hw/misc/temp-sensor.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/error.h"
> +#include "monitor/monitor.h"
> +#include "monitor/hmp.h"
>
> static int query_temperature_sensors_foreach(Object *obj, void *opaque)
> {
> @@ -59,6 +61,33 @@ TemperatureSensorList *qmp_query_temperature_sensors(Error **errp)
> return list;
> }
>
> +void hmp_info_temp(Monitor *mon, const QDict *qdict)
> +{
> + TemperatureSensorList *list, *sensor;
> + Error *err = NULL;
> +
> + list = qmp_query_temperature_sensors(&err);
> + if (!list) {
> + monitor_printf(mon, "No temperature sensors\n");
> + return;
> + }
> + if (err) {
> + monitor_printf(mon, "Error while getting temperatures: %s\n",
> + error_get_pretty(err));
> + error_free(err);
Maybe use hmp_handle_error
> + goto out;
> + }
> +
> + monitor_printf(mon, "Temperatures (in C):\n");
> + for (sensor = list; sensor; sensor = sensor->next) {
> + monitor_printf(mon, "%-33s %6.2f\n", sensor->value->name,
> + sensor->value->temperature);
See my question on the earlier patch; I'm curious here whether we want
device name, and then subname within that device.
Dave
> + }
> +
> +out:
> + qapi_free_TemperatureSensorList(list);
> +}
> +
> static TypeInfo tempsensor_interface_type_info = {
> .name = TYPE_TEMPSENSOR_INTERFACE,
> .parent = TYPE_INTERFACE,
> diff --git a/hmp-commands-info.hx b/hmp-commands-info.hx
> index ca5198438d..77f1c43ce3 100644
> --- a/hmp-commands-info.hx
> +++ b/hmp-commands-info.hx
> @@ -880,4 +880,15 @@ SRST
> Show SEV information.
> ERST
>
> + {
> + .name = "temp",
> + .args_type = "",
> + .params = "",
> + .help = "show device temperatures",
> + .cmd = hmp_info_temp,
> + },
>
> +SRST
> + ``info temp``
> + Show device temperatures.
> +ERST
> --
> 2.21.1
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2020-04-21 18:00 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 12:16 [RFC PATCH 00/17] hw/misc: Introduce a temperature sensor interface Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 01/17] hw/misc: Introduce the " Philippe Mathieu-Daudé
2020-04-21 12:16 ` 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 12:16 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
2020-04-21 16:27 ` Dr. David Alan Gilbert
2020-04-21 16:27 ` Dr. David Alan Gilbert
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 12:16 ` Philippe Mathieu-Daudé
2020-04-21 18:00 ` Dr. David Alan Gilbert [this message]
2020-04-21 18:00 ` Dr. David Alan Gilbert
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 ` 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 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` 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 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` 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 ` 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 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` 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 ` 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 ` 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 ` 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 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` 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 ` 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 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 15/17] hw/ide/qdev: " Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 16/17] hw/misc/imx6ul_ccm: " Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
2020-04-21 12:16 ` [RFC PATCH 17/17] tests/qtest/tmp105-test: Trivial test for TempSensorClass Philippe Mathieu-Daudé
2020-04-21 12:16 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200421180024.GL3029@work-vm \
--to=dgilbert@redhat.com \
--cc=Andrew.Baumann@microsoft.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=f4bug@amsat.org \
--cc=jcd@tribudubois.net \
--cc=jsnow@redhat.com \
--cc=lvivier@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.