summary refs log tree commit diff stats
path: root/stubs
diff options
context:
space:
mode:
Diffstat (limited to 'stubs')
-rw-r--r--stubs/colo-compare.c7
-rw-r--r--stubs/colo.c36
-rw-r--r--stubs/fdset.c6
-rw-r--r--stubs/hotplug-stubs.c34
-rw-r--r--stubs/isa-bus.c7
-rw-r--r--stubs/memory_device.c22
-rw-r--r--stubs/meson.build129
-rw-r--r--stubs/module-opts.c2
-rw-r--r--stubs/monitor-core.c6
-rw-r--r--stubs/monitor-internal.c (renamed from stubs/monitor.c)5
-rw-r--r--stubs/pci-bus.c7
-rw-r--r--stubs/qdev.c6
-rw-r--r--stubs/qtest.c10
-rw-r--r--stubs/ramfb.c15
-rw-r--r--stubs/replay-mode.c4
-rw-r--r--stubs/replay.c2
-rw-r--r--stubs/semihost-all.c17
-rw-r--r--stubs/semihost.c65
-rw-r--r--stubs/usb-dev-stub.c33
-rw-r--r--stubs/virtio-md-pci.c24
20 files changed, 118 insertions, 319 deletions
diff --git a/stubs/colo-compare.c b/stubs/colo-compare.c
deleted file mode 100644
index ec726665be..0000000000
--- a/stubs/colo-compare.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu/notify.h"
-#include "net/colo-compare.h"
-
-void colo_compare_cleanup(void)
-{
-}
diff --git a/stubs/colo.c b/stubs/colo.c
deleted file mode 100644
index f8c069b739..0000000000
--- a/stubs/colo.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu/notify.h"
-#include "net/colo-compare.h"
-#include "migration/colo.h"
-#include "qemu/error-report.h"
-#include "qapi/qapi-commands-migration.h"
-
-void colo_shutdown(void)
-{
-}
-
-int coroutine_fn colo_incoming_co(void)
-{
-    return 0;
-}
-
-void colo_checkpoint_delay_set(void)
-{
-}
-
-void migrate_start_colo_process(MigrationState *s)
-{
-    error_report("Impossible happened: trying to start COLO when COLO "
-                 "module is not built in");
-    abort();
-}
-
-bool migration_in_colo_state(void)
-{
-    return false;
-}
-
-bool migration_incoming_in_colo_state(void)
-{
-    return false;
-}
diff --git a/stubs/fdset.c b/stubs/fdset.c
index 56b3663d58..d7c39a28ac 100644
--- a/stubs/fdset.c
+++ b/stubs/fdset.c
@@ -1,5 +1,7 @@
 #include "qemu/osdep.h"
+#include "qapi/error.h"
 #include "monitor/monitor.h"
+#include "../monitor/monitor-internal.h"
 
 int monitor_fdset_dup_fd_add(int64_t fdset_id, int flags)
 {
@@ -15,3 +17,7 @@ int64_t monitor_fdset_dup_fd_find(int dup_fd)
 void monitor_fdset_dup_fd_remove(int dupfd)
 {
 }
+
+void monitor_fdsets_cleanup(void)
+{
+}
diff --git a/stubs/hotplug-stubs.c b/stubs/hotplug-stubs.c
new file mode 100644
index 0000000000..7aadaa29bd
--- /dev/null
+++ b/stubs/hotplug-stubs.c
@@ -0,0 +1,34 @@
+/*
+ * Hotplug handler stubs
+ *
+ * Copyright (c) Red Hat
+ *
+ * Authors:
+ *  Philippe Mathieu-Daudé <philmd@redhat.com>,
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#include "qemu/osdep.h"
+#include "hw/qdev-core.h"
+
+HotplugHandler *qdev_get_hotplug_handler(DeviceState *dev)
+{
+    return NULL;
+}
+
+void hotplug_handler_pre_plug(HotplugHandler *plug_handler,
+                              DeviceState *plugged_dev,
+                              Error **errp)
+{
+    g_assert_not_reached();
+}
+
+void hotplug_handler_plug(HotplugHandler *plug_handler,
+                          DeviceState *plugged_dev,
+                          Error **errp)
+{
+    g_assert_not_reached();
+}
diff --git a/stubs/isa-bus.c b/stubs/isa-bus.c
deleted file mode 100644
index 522f448997..0000000000
--- a/stubs/isa-bus.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/isa/isa.h"
-
-ISADevice *isa_create_simple(ISABus *bus, const char *name)
-{
-    g_assert_not_reached();
-}
diff --git a/stubs/memory_device.c b/stubs/memory_device.c
deleted file mode 100644
index 15fd93ff67..0000000000
--- a/stubs/memory_device.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/mem/memory-device.h"
-
-MemoryDeviceInfoList *qmp_memory_device_list(void)
-{
-   return NULL;
-}
-
-uint64_t get_plugged_memory_size(void)
-{
-    return (uint64_t)-1;
-}
-
-unsigned int memory_devices_get_reserved_memslots(void)
-{
-    return 0;
-}
-
-bool memory_devices_memslot_auto_decision_active(void)
-{
-    return false;
-}
diff --git a/stubs/meson.build b/stubs/meson.build
index 0bf25e6ca5..8ee1fd5753 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -1,67 +1,86 @@
-stub_ss.add(files('bdrv-next-monitor-owned.c'))
-stub_ss.add(files('blk-commit-all.c'))
-stub_ss.add(files('blk-exp-close-all.c'))
-stub_ss.add(files('blockdev-close-all-bdrv-states.c'))
-stub_ss.add(files('change-state-handler.c'))
-stub_ss.add(files('cmos.c'))
+# If possible, add new files to other directories, by using "if_false".
+# If you need them here, try to add them under one of the if statements
+# below, so that it is clear who needs the stubbed functionality.
+
 stub_ss.add(files('cpu-get-clock.c'))
-stub_ss.add(files('cpus-get-virtual-clock.c'))
-stub_ss.add(files('qemu-timer-notify-cb.c'))
-stub_ss.add(files('icount.c'))
-stub_ss.add(files('dump.c'))
-stub_ss.add(files('error-printf.c'))
 stub_ss.add(files('fdset.c'))
-stub_ss.add(files('gdbstub.c'))
-stub_ss.add(files('get-vm-name.c'))
-stub_ss.add(files('graph-lock.c'))
-if linux_io_uring.found()
-  stub_ss.add(files('io_uring.c'))
-endif
 stub_ss.add(files('iothread-lock.c'))
-if have_block
-  stub_ss.add(files('iothread-lock-block.c'))
-endif
-stub_ss.add(files('isa-bus.c'))
 stub_ss.add(files('is-daemonized.c'))
-if libaio.found()
-  stub_ss.add(files('linux-aio.c'))
-endif
-stub_ss.add(files('migr-blocker.c'))
-stub_ss.add(files('module-opts.c'))
-stub_ss.add(files('monitor.c'))
 stub_ss.add(files('monitor-core.c'))
-stub_ss.add(files('physmem.c'))
-stub_ss.add(files('qemu-timer-notify-cb.c'))
-stub_ss.add(files('memory_device.c'))
-stub_ss.add(files('qmp-command-available.c'))
-stub_ss.add(files('qmp-quit.c'))
-stub_ss.add(files('qtest.c'))
-stub_ss.add(files('ram-block.c'))
-stub_ss.add(files('ramfb.c'))
-stub_ss.add(files('replay.c'))
-stub_ss.add(files('runstate-check.c'))
-stub_ss.add(files('sysbus.c'))
-stub_ss.add(files('target-get-monitor-def.c'))
-stub_ss.add(files('target-monitor-defs.c'))
+stub_ss.add(files('replay-mode.c'))
 stub_ss.add(files('trace-control.c'))
-stub_ss.add(files('uuid.c'))
-stub_ss.add(files('colo.c'))
-stub_ss.add(files('colo-compare.c'))
-stub_ss.add(files('vmstate.c'))
-stub_ss.add(files('vm-stop.c'))
-stub_ss.add(files('win32-kbd-hook.c'))
-stub_ss.add(files('cpu-synchronize-state.c'))
-if have_block or have_ga
+
+if have_block
+  stub_ss.add(files('bdrv-next-monitor-owned.c'))
+  stub_ss.add(files('blk-commit-all.c'))
+  stub_ss.add(files('blk-exp-close-all.c'))
+  stub_ss.add(files('blockdev-close-all-bdrv-states.c'))
+  stub_ss.add(files('change-state-handler.c'))
+  stub_ss.add(files('get-vm-name.c'))
+  stub_ss.add(files('iothread-lock-block.c'))
+  stub_ss.add(files('migr-blocker.c'))
+  stub_ss.add(files('physmem.c'))
+  stub_ss.add(files('ram-block.c'))
   stub_ss.add(files('replay-tools.c'))
+  stub_ss.add(files('runstate-check.c'))
+  stub_ss.add(files('uuid.c'))
 endif
+
+if have_block or have_ga
+  # stubs for hooks in util/main-loop.c, util/async.c etc.
+  stub_ss.add(files('cpus-get-virtual-clock.c'))
+  stub_ss.add(files('icount.c'))
+  stub_ss.add(files('graph-lock.c'))
+  if linux_io_uring.found()
+    stub_ss.add(files('io_uring.c'))
+  endif
+  if libaio.found()
+    stub_ss.add(files('linux-aio.c'))
+  endif
+  stub_ss.add(files('qemu-timer-notify-cb.c'))
+
+  # stubs for monitor
+  stub_ss.add(files('monitor-internal.c'))
+  stub_ss.add(files('qmp-command-available.c'))
+  stub_ss.add(files('qmp-quit.c'))
+endif
+
+if have_block or have_user
+  stub_ss.add(files('qtest.c'))
+  stub_ss.add(files('vm-stop.c'))
+  stub_ss.add(files('vmstate.c'))
+
+  # more symbols provided by the monitor
+  stub_ss.add(files('error-printf.c'))
+endif
+
+if have_user
+  # Symbols that are used by hw/core.
+  stub_ss.add(files('cpu-synchronize-state.c'))
+  stub_ss.add(files('qdev.c'))
+endif
+
 if have_system
+  # Symbols that are only needed in some configurations.  Try not
+  # adding more of these.  If the symbol is used in specific_ss,
+  # in particular, consider defining a preprocessor macro via
+  # Kconfig or configs/targets/.
+  stub_ss.add(files('dump.c'))
+  stub_ss.add(files('cmos.c'))
   stub_ss.add(files('fw_cfg.c'))
-  stub_ss.add(files('pci-bus.c'))
-  stub_ss.add(files('semihost.c'))
-  stub_ss.add(files('usb-dev-stub.c'))
+  stub_ss.add(files('target-get-monitor-def.c'))
+  stub_ss.add(files('target-monitor-defs.c'))
+  stub_ss.add(files('win32-kbd-hook.c'))
   stub_ss.add(files('xen-hw-stub.c'))
-  stub_ss.add(files('virtio-md-pci.c'))
-else
-  stub_ss.add(files('qdev.c'))
 endif
-stub_ss.add(files('semihost-all.c'))
+
+if have_system or have_user
+  stub_ss.add(files('gdbstub.c'))
+
+  # Also included in have_system for --disable-tcg builds
+  stub_ss.add(files('replay.c'))
+
+  # Also included in have_system for tests/unit/test-qdev-global-props
+  stub_ss.add(files('hotplug-stubs.c'))
+  stub_ss.add(files('sysbus.c'))
+endif
diff --git a/stubs/module-opts.c b/stubs/module-opts.c
deleted file mode 100644
index 5412429ea8..0000000000
--- a/stubs/module-opts.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include "qemu/osdep.h"
-#include "qemu/config-file.h"
diff --git a/stubs/monitor-core.c b/stubs/monitor-core.c
index afa477aae6..1894cdfe1f 100644
--- a/stubs/monitor-core.c
+++ b/stubs/monitor-core.c
@@ -12,10 +12,6 @@ Monitor *monitor_set_cur(Coroutine *co, Monitor *mon)
     return NULL;
 }
 
-void monitor_init_qmp(Chardev *chr, bool pretty, Error **errp)
-{
-}
-
 void qapi_event_emit(QAPIEvent event, QDict *qdict)
 {
 }
@@ -24,5 +20,3 @@ int monitor_vprintf(Monitor *mon, const char *fmt, va_list ap)
 {
     abort();
 }
-
-
diff --git a/stubs/monitor.c b/stubs/monitor-internal.c
index 20786ac4ff..4fece49d53 100644
--- a/stubs/monitor.c
+++ b/stubs/monitor-internal.c
@@ -1,7 +1,6 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "monitor/monitor.h"
-#include "../monitor/monitor-internal.h"
 
 int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 {
@@ -12,7 +11,3 @@ int monitor_get_fd(Monitor *mon, const char *name, Error **errp)
 void monitor_init_hmp(Chardev *chr, bool use_readline, Error **errp)
 {
 }
-
-void monitor_fdsets_cleanup(void)
-{
-}
diff --git a/stubs/pci-bus.c b/stubs/pci-bus.c
deleted file mode 100644
index a8932fa932..0000000000
--- a/stubs/pci-bus.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "qemu/osdep.h"
-#include "hw/pci/pci.h"
-
-PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)
-{
-    g_assert_not_reached();
-}
diff --git a/stubs/qdev.c b/stubs/qdev.c
index 6869f6f90a..7e957b3e52 100644
--- a/stubs/qdev.c
+++ b/stubs/qdev.c
@@ -20,9 +20,3 @@ void qapi_event_send_device_deleted(const char *device,
 {
     /* Nothing to do. */
 }
-
-void qapi_event_send_device_unplug_guest_error(const char *device,
-                                               const char *path)
-{
-    /* Nothing to do. */
-}
diff --git a/stubs/qtest.c b/stubs/qtest.c
index 4666a49d7d..39e376eb67 100644
--- a/stubs/qtest.c
+++ b/stubs/qtest.c
@@ -13,13 +13,3 @@
 
 /* Needed for qtest_allowed() */
 bool qtest_allowed;
-
-bool qtest_driver(void)
-{
-    return false;
-}
-
-int64_t qtest_get_virtual_clock(void)
-{
-    return 0;
-}
diff --git a/stubs/ramfb.c b/stubs/ramfb.c
deleted file mode 100644
index cf64733b10..0000000000
--- a/stubs/ramfb.c
+++ /dev/null
@@ -1,15 +0,0 @@
-#include "qemu/osdep.h"
-#include "qapi/error.h"
-#include "hw/display/ramfb.h"
-
-const VMStateDescription ramfb_vmstate = {};
-
-void ramfb_display_update(QemuConsole *con, RAMFBState *s)
-{
-}
-
-RAMFBState *ramfb_setup(Error **errp)
-{
-    error_setg(errp, "ramfb support not available");
-    return NULL;
-}
diff --git a/stubs/replay-mode.c b/stubs/replay-mode.c
new file mode 100644
index 0000000000..264be9d96c
--- /dev/null
+++ b/stubs/replay-mode.c
@@ -0,0 +1,4 @@
+#include "qemu/osdep.h"
+#include "sysemu/replay.h"
+
+ReplayMode replay_mode;
diff --git a/stubs/replay.c b/stubs/replay.c
index 42c92e4acb..b4dd6a566e 100644
--- a/stubs/replay.c
+++ b/stubs/replay.c
@@ -1,8 +1,6 @@
 #include "qemu/osdep.h"
 #include "exec/replay-core.h"
 
-ReplayMode replay_mode;
-
 void replay_finish(void)
 {
 }
diff --git a/stubs/semihost-all.c b/stubs/semihost-all.c
deleted file mode 100644
index a2a1fc9c6f..0000000000
--- a/stubs/semihost-all.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Semihosting Stubs for all targets
- *
- * Copyright (c) 2023 Linaro Ltd
- *
- * Stubs for all targets that don't actually do semihosting.
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "qemu/osdep.h"
-#include "semihosting/semihost.h"
-
-SemihostingTarget semihosting_get_target(void)
-{
-    return SEMIHOSTING_TARGET_AUTO;
-}
diff --git a/stubs/semihost.c b/stubs/semihost.c
deleted file mode 100644
index f26cbb7c25..0000000000
--- a/stubs/semihost.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Semihosting Stubs for system emulation
- *
- * Copyright (c) 2019 Linaro Ltd
- *
- * Stubs for system targets that don't actually do semihosting.
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "qemu/osdep.h"
-#include "qemu/option.h"
-#include "qemu/error-report.h"
-#include "semihosting/semihost.h"
-
-/* Empty config */
-QemuOptsList qemu_semihosting_config_opts = {
-    .name = "",
-    .head = QTAILQ_HEAD_INITIALIZER(qemu_semihosting_config_opts.head),
-    .desc = {
-        { /* end of list */ }
-    },
-};
-
-/* Queries to config status default to off */
-bool semihosting_enabled(bool is_user)
-{
-    return false;
-}
-
-/*
- * All the rest are empty subs. We could g_assert_not_reached() but
- * that adds extra weight to the final binary. Waste not want not.
- */
-void qemu_semihosting_enable(void)
-{
-}
-
-int qemu_semihosting_config_options(const char *optstr)
-{
-    return 1;
-}
-
-const char *semihosting_get_arg(int i)
-{
-    return NULL;
-}
-
-int semihosting_get_argc(void)
-{
-    return 0;
-}
-
-const char *semihosting_get_cmdline(void)
-{
-    return NULL;
-}
-
-void semihosting_arg_fallback(const char *file, const char *cmd)
-{
-}
-
-void qemu_semihosting_chardev_init(void)
-{
-}
diff --git a/stubs/usb-dev-stub.c b/stubs/usb-dev-stub.c
deleted file mode 100644
index aa557692b7..0000000000
--- a/stubs/usb-dev-stub.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * QEMU USB device emulation stubs
- *
- * Copyright (C) 2021 Philippe Mathieu-Daudé <f4bug@amsat.org>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "qemu/osdep.h"
-#include "qemu/error-report.h"
-#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
-#include "sysemu/sysemu.h"
-#include "monitor/monitor.h"
-#include "hw/usb.h"
-
-USBDevice *usbdevice_create(const char *driver)
-{
-    error_report("Support for USB devices not built-in");
-
-    return NULL;
-}
-
-HumanReadableText *qmp_x_query_usb(Error **errp)
-{
-    error_setg(errp, "Support for USB devices not built-in");
-    return NULL;
-}
-
-void hmp_info_usb(Monitor *mon, const QDict *qdict)
-{
-    monitor_printf(mon, "Support for USB devices not built-in\n");
-}
diff --git a/stubs/virtio-md-pci.c b/stubs/virtio-md-pci.c
deleted file mode 100644
index ce5bba0c9d..0000000000
--- a/stubs/virtio-md-pci.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include "qemu/osdep.h"
-#include "qapi/error.h"
-#include "hw/virtio/virtio-md-pci.h"
-
-void virtio_md_pci_pre_plug(VirtIOMDPCI *vmd, MachineState *ms, Error **errp)
-{
-    error_setg(errp, "virtio based memory devices not supported");
-}
-
-void virtio_md_pci_plug(VirtIOMDPCI *vmd, MachineState *ms, Error **errp)
-{
-    error_setg(errp, "virtio based memory devices not supported");
-}
-
-void virtio_md_pci_unplug_request(VirtIOMDPCI *vmd, MachineState *ms,
-                                  Error **errp)
-{
-    error_setg(errp, "virtio based memory devices not supported");
-}
-
-void virtio_md_pci_unplug(VirtIOMDPCI *vmd, MachineState *ms, Error **errp)
-{
-    error_setg(errp, "virtio based memory devices not supported");
-}