[PATCH v2 8/9] hw/core: Add qdev stub for user-mode

Philippe Mathieu-Daudé posted 9 patches 5 years, 8 months ago
Maintainers: Markus Armbruster <armbru@redhat.com>, Michael Roth <mdroth@linux.vnet.ibm.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
There is a newer version of this series
[PATCH v2 8/9] hw/core: Add qdev stub for user-mode
Posted by Philippe Mathieu-Daudé 5 years, 8 months ago
While user-mode does not use peripherals (devices), it uses a
CPU which is a device.
In the next commit we will reduce the QAPI generated code for
user-mode. Since qdev.c calls qapi_event_send_device_deleted(),
let's add a stub for it.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
v2: use common-obj-$(CONFIG_ALL) (Paolo)
---
 hw/core/qdev-stubs.c  | 20 ++++++++++++++++++++
 hw/core/Makefile.objs |  3 +++
 2 files changed, 23 insertions(+)
 create mode 100644 hw/core/qdev-stubs.c

diff --git a/hw/core/qdev-stubs.c b/hw/core/qdev-stubs.c
new file mode 100644
index 0000000000..0819dcba12
--- /dev/null
+++ b/hw/core/qdev-stubs.c
@@ -0,0 +1,20 @@
+/*
+ * QAPI qdev stubs
+ *
+ * Copyright (c) 2020 Red Hat, Inc.
+ *
+ * Author:
+ *   Philippe Mathieu-Daudé <philmd@redhat.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/qapi-events-qdev.h"
+
+void qapi_event_send_device_deleted(bool has_device,
+                                    const char *device, const char *path)
+{
+}
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index 6215e7c208..9f874a8840 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -31,3 +31,6 @@ common-obj-$(CONFIG_OR_IRQ) += or-irq.o
 common-obj-$(CONFIG_SPLIT_IRQ) += split-irq.o
 common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
 common-obj-$(CONFIG_GENERIC_LOADER) += generic-loader.o
+
+common-obj-$(call lnot,$(CONFIG_SOFTMMU)) += qdev-stubs.o
+common-obj-$(CONFIG_ALL) += qdev-stubs.o
-- 
2.21.1


Re: [PATCH v2 8/9] hw/core: Add qdev stub for user-mode
Posted by Richard Henderson 5 years, 8 months ago
On 3/15/20 5:11 PM, Philippe Mathieu-Daudé wrote:
> While user-mode does not use peripherals (devices), it uses a
> CPU which is a device.
> In the next commit we will reduce the QAPI generated code for
> user-mode. Since qdev.c calls qapi_event_send_device_deleted(),
> let's add a stub for it.
> 
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> v2: use common-obj-$(CONFIG_ALL) (Paolo)
> ---
>  hw/core/qdev-stubs.c  | 20 ++++++++++++++++++++
>  hw/core/Makefile.objs |  3 +++
>  2 files changed, 23 insertions(+)
>  create mode 100644 hw/core/qdev-stubs.c

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~