[PATCH v2 17/27] monitor: Make Xen emulation commands generic ones

Philippe Mathieu-Daudé posted 27 patches 21 hours ago
[PATCH v2 17/27] monitor: Make Xen emulation commands generic ones
Posted by Philippe Mathieu-Daudé 21 hours ago
In order to build hmp-commands.hx once we need to stop using
device target-specific check. Use the generic pattern to make
the command available on all targets, providing a stub with
kind error message when the feature is not available.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/i386/kvm/xen-stubs.c | 12 ++++++++++++
 hmp-commands.hx         |  2 --
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/hw/i386/kvm/xen-stubs.c b/hw/i386/kvm/xen-stubs.c
index ce73119ee7a..bf6ac28bef4 100644
--- a/hw/i386/kvm/xen-stubs.c
+++ b/hw/i386/kvm/xen-stubs.c
@@ -12,6 +12,8 @@
 #include "qemu/osdep.h"
 
 #include "qapi/error.h"
+#include "monitor/monitor.h"
+#include "monitor/hmp.h"
 
 #include "xen_evtchn.h"
 #include "xen_primary_console.h"
@@ -37,3 +39,13 @@ void xen_primary_console_create(void)
 void xen_primary_console_set_be_port(uint16_t port)
 {
 }
+
+void hmp_xen_event_list(Monitor *mon, const QDict *qdict)
+{
+    monitor_printf(mon, "XEN emulation is not available in this QEMU\n");
+}
+
+void hmp_xen_event_inject(Monitor *mon, const QDict *qdict)
+{
+    monitor_printf(mon, "XEN emulation is not available in this QEMU\n");
+}
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 5cc4788f12d..06d7b17bf25 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -1839,7 +1839,6 @@ SRST
 ERST
 #endif
 
-#if defined(CONFIG_XEN_EMU)
     {
         .name       = "xen-event-inject",
         .args_type  = "port:i",
@@ -1866,4 +1865,3 @@ SRST
 ``xen-event-list``
   List event channels in the guest
 ERST
-#endif
-- 
2.53.0


Re: [PATCH v2 17/27] monitor: Make Xen emulation commands generic ones
Posted by David Woodhouse 21 hours ago
On Fri, 2026-04-10 at 21:53 +0200, Philippe Mathieu-Daudé wrote:
> In order to build hmp-commands.hx once we need to stop using
> device target-specific check. Use the generic pattern to make
> the command available on all targets, providing a stub with
> kind error message when the feature is not available.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Acked-by: David Woodhouse <dwmw@amazon.co.uk>