qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 4/4] hw/core: Restrict hotplug to system emulation


From: wangyanan (Y)
Subject: Re: [PATCH 4/4] hw/core: Restrict hotplug to system emulation
Date: Sun, 31 Oct 2021 19:56:16 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0

Hi Philippe,

On 2021/10/28 23:05, Philippe Mathieu-Daudé wrote:
Restrict hotplug to system emulation, add stubs for the other uses.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
  hw/core/hotplug-stubs.c | 34 ++++++++++++++++++++++++++++++++++
  hw/core/meson.build     | 12 ++++++++++--
  2 files changed, 44 insertions(+), 2 deletions(-)
  create mode 100644 hw/core/hotplug-stubs.c

diff --git a/hw/core/hotplug-stubs.c b/hw/core/hotplug-stubs.c
new file mode 100644
index 00000000000..7aadaa29bd5
--- /dev/null
+++ b/hw/core/hotplug-stubs.c
@@ -0,0 +1,34 @@
+/*
+ * Hotplug handler stubs
+ *
+ * Copyright (c) Red Hat
Same as patch #3.
+ *
+ * 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/hw/core/meson.build b/hw/core/meson.build
index 85f2ad1374b..afc5ed2c906 100644
--- a/hw/core/meson.build
+++ b/hw/core/meson.build
@@ -1,7 +1,6 @@
  # core qdev-related obj files, also used by *-user and unit tests
  hwcore_ss.add(files(
    'bus.c',
-  'hotplug.c',
    'qdev-properties.c',
    'qdev.c',
    'reset.c',
@@ -11,8 +10,17 @@
    'irq.c',
    'clock.c',
    'qdev-clock.c',
-  'qdev-hotplug.c',
  ))
+if have_system
+  hwcore_ss.add(files(
+    'hotplug.c',
+    'qdev-hotplug.c',
+  ))
+else
+  hwcore_ss.add(files(
+    'hotplug-stubs.c',
+  ))
+endif
common_ss.add(files('cpu-common.c'))
  softmmu_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
Besides,
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>

Thanks,
Yanan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]