[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event
From: |
Eric Blake |
Subject: |
Re: [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event |
Date: |
Tue, 9 Jun 2020 09:29:24 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 6/9/20 7:34 AM, Philippe Mathieu-Daudé wrote:
Allow LED devices to emit STATUS_CHANGED events on a QMP chardev.
QMP event examples:
{
"timestamp": {
"seconds": 1591704274,
"microseconds": 520850
},
"event": "LED_STATUS_CHANGED",
"data": {
"name": "Green LED #0",
"status": "on"
}
}
{
"timestamp": {
"seconds": 1591704275,
"microseconds": 530912
},
"event": "LED_STATUS_CHANGED",
"data": {
"name": "Green LED #0",
"status": "off"
}
}
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
The QAPI addition looks reasonable, however,
+++ b/hw/misc/led.c
@@ -7,6 +7,7 @@
*/
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qapi/qapi-events-led.h"
#include "hw/qdev-properties.h"
#include "hw/misc/led.h"
#include "hw/irq.h"
@@ -19,6 +20,9 @@ static void led_set(void *opaque, int line, int new_state)
trace_led_set(s->name, s->current_state, new_state);
+ /* FIXME QMP rate limite? */
s/limite/limit/
Yes, this is under guest control, so you MUST rate limit to avoid the
guest being able to DoS qemu by changing the LED so frequently as to
overwhelm the QMP connection with events.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
- [RFC PATCH 0/5] hw/misc: Add LED device, Philippe Mathieu-Daudé, 2020/06/09
- [RFC PATCH 1/5] hw/misc: Add a LED device, Philippe Mathieu-Daudé, 2020/06/09
- [RFC PATCH 5/5] hw/arm/tosa: Use LED device for the Bluetooth led, Philippe Mathieu-Daudé, 2020/06/09
- [RFC PATCH 4/5] hw/arm/microbit: Add a fake LED to use as proof-of-concept with Zephyr, Philippe Mathieu-Daudé, 2020/06/09
- [RFC PATCH 3/5] hw/misc/led: Add create_led_by_gpio_id() helper, Philippe Mathieu-Daudé, 2020/06/09
- [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event, Philippe Mathieu-Daudé, 2020/06/09
- Re: [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event,
Eric Blake <=