xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig
@ 2021-02-01 11:28 Philippe Mathieu-Daudé
  2021-02-01 11:28 ` [PATCH v3 1/7] meson: Do not build Xen x86_64-softmmu on Aarch64 Philippe Mathieu-Daudé
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:28 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

Sort the Xen buildsys glue a bit.

The first patches are probably ready now.

Since v2:
- Addressed some of Paolo's comments
- More fixes
- XEN_PV still not buildable alone -> postponed

v2: Considered Paolo's comments from v1

Philippe Mathieu-Daudé (7):
  meson: Do not build Xen x86_64-softmmu on Aarch64
  hw/xen: Relax dependency on FSDEV_9P
  accel/xen: Incorporate xen-mapcache.c
  hw/i386/xen: Introduce XEN_FV Kconfig
  hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM
  hw/xen: Make qmp_xen_set_global_dirty_log() available out of X86 HVM
  NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config

 meson.build                           |  8 ++++++--
 accel/xen/trace.h                     |  1 +
 {hw/i386 => accel}/xen/xen-mapcache.c |  0
 hw/i386/xen/xen-hvm.c                 | 24 ------------------------
 hw/xen/xen-legacy-backend.c           |  3 ++-
 hw/xen/xen-migration.c                | 22 ++++++++++++++++++++++
 hw/xen/xen-utils.c                    | 25 +++++++++++++++++++++++++
 accel/Kconfig                         |  2 +-
 accel/xen/meson.build                 |  5 ++++-
 accel/xen/trace-events                | 10 ++++++++++
 hw/Kconfig                            |  1 +
 hw/i386/Kconfig                       |  2 ++
 hw/i386/xen/Kconfig                   |  5 +++++
 hw/i386/xen/meson.build               |  3 +--
 hw/i386/xen/trace-events              |  6 ------
 hw/xen/Kconfig                        |  7 +++++++
 hw/xen/meson.build                    |  4 +++-
 17 files changed, 90 insertions(+), 38 deletions(-)
 create mode 100644 accel/xen/trace.h
 rename {hw/i386 => accel}/xen/xen-mapcache.c (100%)
 create mode 100644 hw/xen/xen-migration.c
 create mode 100644 hw/xen/xen-utils.c
 create mode 100644 accel/xen/trace-events
 create mode 100644 hw/i386/xen/Kconfig
 create mode 100644 hw/xen/Kconfig

-- 
2.26.2



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/7] meson: Do not build Xen x86_64-softmmu on Aarch64
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
@ 2021-02-01 11:28 ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 2/7] hw/xen: Relax dependency on FSDEV_9P Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:28 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

The Xen on ARM documentation only mentions the i386-softmmu
target. As the x86_64-softmmu doesn't seem used, remove it
to avoid wasting cpu cycles building it.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 meson.build | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index f00b7754fd4..97a577a7743 100644
--- a/meson.build
+++ b/meson.build
@@ -74,10 +74,10 @@
 endif
 
 accelerator_targets = { 'CONFIG_KVM': kvm_targets }
-if cpu in ['x86', 'x86_64', 'arm', 'aarch64']
+if cpu in ['arm', 'aarch64']
   # i368 emulator provides xenpv machine type for multiple architectures
   accelerator_targets += {
-    'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
+    'CONFIG_XEN': ['i386-softmmu'],
   }
 endif
 if cpu in ['x86', 'x86_64']
@@ -85,6 +85,7 @@
     'CONFIG_HAX': ['i386-softmmu', 'x86_64-softmmu'],
     'CONFIG_HVF': ['x86_64-softmmu'],
     'CONFIG_WHPX': ['i386-softmmu', 'x86_64-softmmu'],
+    'CONFIG_XEN': ['i386-softmmu', 'x86_64-softmmu'],
   }
 endif
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/7] hw/xen: Relax dependency on FSDEV_9P
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
  2021-02-01 11:28 ` [PATCH v3 1/7] meson: Do not build Xen x86_64-softmmu on Aarch64 Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

Relax the dependency on 9pfs by using the 'imply' Kconfig rule.
This fixes when XEN_PV without XEN_FV:

  /usr/bin/ld: libcommon.fa.p/hw_xen_xen-legacy-backend.c.o: in function
  `xen_be_register_common':
  hw/xen/xen-legacy-backend.c:754: undefined reference to `xen_9pfs_ops'

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/xen/xen-legacy-backend.c | 3 ++-
 accel/Kconfig               | 2 +-
 hw/xen/meson.build          | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/xen/xen-legacy-backend.c b/hw/xen/xen-legacy-backend.c
index b61a4855b7b..338d443a5c0 100644
--- a/hw/xen/xen-legacy-backend.c
+++ b/hw/xen/xen-legacy-backend.c
@@ -33,6 +33,7 @@
 #include "hw/xen/xen-legacy-backend.h"
 #include "hw/xen/xen_pvdev.h"
 #include "monitor/qdev.h"
+#include CONFIG_DEVICES
 
 DeviceState *xen_sysdev;
 BusState *xen_sysbus;
@@ -750,7 +751,7 @@ void xen_be_register_common(void)
 
     xen_be_register("console", &xen_console_ops);
     xen_be_register("vkbd", &xen_kbdmouse_ops);
-#ifdef CONFIG_VIRTFS
+#ifdef CONFIG_FSDEV_9P
     xen_be_register("9pfs", &xen_9pfs_ops);
 #endif
 #ifdef CONFIG_USB_LIBUSB
diff --git a/accel/Kconfig b/accel/Kconfig
index 461104c7715..7565ccf69e6 100644
--- a/accel/Kconfig
+++ b/accel/Kconfig
@@ -15,4 +15,4 @@ config KVM
 
 config XEN
     bool
-    select FSDEV_9P if VIRTFS
+    imply FSDEV_9P
diff --git a/hw/xen/meson.build b/hw/xen/meson.build
index 076954b89ca..3c2062b9b3e 100644
--- a/hw/xen/meson.build
+++ b/hw/xen/meson.build
@@ -2,12 +2,12 @@
   'xen-backend.c',
   'xen-bus-helper.c',
   'xen-bus.c',
-  'xen-legacy-backend.c',
   'xen_devconfig.c',
   'xen_pvdev.c',
 ))
 
 xen_specific_ss = ss.source_set()
+xen_specific_ss.add(files('xen-legacy-backend.c'))
 xen_specific_ss.add(when: 'CONFIG_XEN_PCI_PASSTHROUGH', if_true: files(
   'xen-host-pci-device.c',
   'xen_pt.c',
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
  2021-02-01 11:28 ` [PATCH v3 1/7] meson: Do not build Xen x86_64-softmmu on Aarch64 Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 2/7] hw/xen: Relax dependency on FSDEV_9P Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  2021-02-01 13:08   ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 4/7] hw/i386/xen: Introduce XEN_FV Kconfig Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

xen-mapcache.c contains accelerator related routines,
not particular to the X86 HVM machine. Move this file
to accel/xen/ (adapting the buildsys machinery).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 meson.build                           |  3 +++
 accel/xen/trace.h                     |  1 +
 {hw/i386 => accel}/xen/xen-mapcache.c |  0
 hw/i386/xen/xen-hvm.c                 |  1 -
 accel/xen/meson.build                 |  5 ++++-
 accel/xen/trace-events                | 10 ++++++++++
 hw/i386/xen/meson.build               |  1 -
 hw/i386/xen/trace-events              |  6 ------
 8 files changed, 18 insertions(+), 9 deletions(-)
 create mode 100644 accel/xen/trace.h
 rename {hw/i386 => accel}/xen/xen-mapcache.c (100%)
 create mode 100644 accel/xen/trace-events

diff --git a/meson.build b/meson.build
index 97a577a7743..f2e778f22cd 100644
--- a/meson.build
+++ b/meson.build
@@ -1706,6 +1706,9 @@
   'crypto',
   'monitor',
 ]
+if 'CONFIG_XEN' in accelerators
+  trace_events_subdirs += [ 'accel/xen' ]
+endif
 if have_user
   trace_events_subdirs += [ 'linux-user' ]
 endif
diff --git a/accel/xen/trace.h b/accel/xen/trace.h
new file mode 100644
index 00000000000..f6be599b187
--- /dev/null
+++ b/accel/xen/trace.h
@@ -0,0 +1 @@
+#include "trace/trace-accel_xen.h"
diff --git a/hw/i386/xen/xen-mapcache.c b/accel/xen/xen-mapcache.c
similarity index 100%
rename from hw/i386/xen/xen-mapcache.c
rename to accel/xen/xen-mapcache.c
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 68821d90f52..7156ab13329 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -31,7 +31,6 @@
 #include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/xen.h"
-#include "sysemu/xen-mapcache.h"
 #include "trace.h"
 #include "exec/address-spaces.h"
 
diff --git a/accel/xen/meson.build b/accel/xen/meson.build
index 002bdb03c62..45671e4bdbf 100644
--- a/accel/xen/meson.build
+++ b/accel/xen/meson.build
@@ -1 +1,4 @@
-specific_ss.add(when: 'CONFIG_XEN', if_true: files('xen-all.c'))
+specific_ss.add(when: 'CONFIG_XEN', if_true: files(
+  'xen-all.c',
+  'xen-mapcache.c',
+))
diff --git a/accel/xen/trace-events b/accel/xen/trace-events
new file mode 100644
index 00000000000..30bf4f42283
--- /dev/null
+++ b/accel/xen/trace-events
@@ -0,0 +1,10 @@
+# See docs/devel/tracing.txt for syntax documentation.
+
+# xen-hvm.c
+xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx"
+
+# xen-mapcache.c
+xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64
+xen_remap_bucket(uint64_t index) "index 0x%"PRIx64
+xen_map_cache_return(void* ptr) "%p"
+
diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build
index be84130300c..2fcc46e6ca1 100644
--- a/hw/i386/xen/meson.build
+++ b/hw/i386/xen/meson.build
@@ -1,6 +1,5 @@
 i386_ss.add(when: 'CONFIG_XEN', if_true: files(
   'xen-hvm.c',
-  'xen-mapcache.c',
   'xen_apic.c',
   'xen_platform.c',
   'xen_pvdevice.c',
diff --git a/hw/i386/xen/trace-events b/hw/i386/xen/trace-events
index ca3a4948baa..f1b36d164d9 100644
--- a/hw/i386/xen/trace-events
+++ b/hw/i386/xen/trace-events
@@ -20,9 +20,3 @@ cpu_ioreq_move(void *req, uint32_t dir, uint32_t df, uint32_t data_is_ptr, uint6
 xen_map_resource_ioreq(uint32_t id, void *addr) "id: %u addr: %p"
 cpu_ioreq_config_read(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x"
 cpu_ioreq_config_write(void *req, uint32_t sbdf, uint32_t reg, uint32_t size, uint32_t data) "I/O=%p sbdf=0x%x reg=%u size=%u data=0x%x"
-
-# xen-mapcache.c
-xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64
-xen_remap_bucket(uint64_t index) "index 0x%"PRIx64
-xen_map_cache_return(void* ptr) "%p"
-
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 4/7] hw/i386/xen: Introduce XEN_FV Kconfig
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2021-02-01 11:29 ` [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

Introduce XEN_FV to differency the machine from the accelerator.

Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/i386/Kconfig         | 2 ++
 hw/i386/xen/Kconfig     | 5 +++++
 hw/i386/xen/meson.build | 2 +-
 3 files changed, 8 insertions(+), 1 deletion(-)
 create mode 100644 hw/i386/xen/Kconfig

diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index 7f91f30877f..b4c8aa5c242 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -1,3 +1,5 @@
+source xen/Kconfig
+
 config SEV
     bool
     depends on KVM
diff --git a/hw/i386/xen/Kconfig b/hw/i386/xen/Kconfig
new file mode 100644
index 00000000000..ad9d774b9ea
--- /dev/null
+++ b/hw/i386/xen/Kconfig
@@ -0,0 +1,5 @@
+config XEN_FV
+    bool
+    default y if XEN
+    depends on XEN
+    select I440FX
diff --git a/hw/i386/xen/meson.build b/hw/i386/xen/meson.build
index 2fcc46e6ca1..37716b42673 100644
--- a/hw/i386/xen/meson.build
+++ b/hw/i386/xen/meson.build
@@ -1,4 +1,4 @@
-i386_ss.add(when: 'CONFIG_XEN', if_true: files(
+i386_ss.add(when: 'CONFIG_XEN_FV', if_true: files(
   'xen-hvm.c',
   'xen_apic.c',
   'xen_platform.c',
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2021-02-01 11:29 ` [PATCH v3 4/7] hw/i386/xen: Introduce XEN_FV Kconfig Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  2021-02-01 13:09   ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 6/7] hw/xen: Make qmp_xen_set_global_dirty_log() " Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 7/7] NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config Philippe Mathieu-Daudé
  6 siblings, 1 reply; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

xen_shutdown_fatal_error() is also used by XEN_PV.

This fixes when XEN_PV without XEN_FV:

  /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt_config_init.c.o: in function `xen_pt_status_reg_init':
  hw/xen/xen_pt_config_init.c:281: undefined reference to `xen_shutdown_fatal_error'
  /usr/bin/ld: hw/xen/xen_pt_config_init.c:275: undefined reference to `xen_shutdown_fatal_error'
  /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_read_config':
  hw/xen/xen_pt.c:220: undefined reference to `xen_shutdown_fatal_error'
  /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_write_config':
  hw/xen/xen_pt.c:369: undefined reference to `xen_shutdown_fatal_error'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/i386/xen/xen-hvm.c | 13 -------------
 hw/xen/xen-utils.c    | 25 +++++++++++++++++++++++++
 hw/xen/meson.build    |  1 +
 3 files changed, 26 insertions(+), 13 deletions(-)
 create mode 100644 hw/xen/xen-utils.c

diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 7156ab13329..69196754a30 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -28,7 +28,6 @@
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/range.h"
-#include "sysemu/runstate.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/xen.h"
 #include "trace.h"
@@ -1570,18 +1569,6 @@ void xen_register_framebuffer(MemoryRegion *mr)
     framebuffer = mr;
 }
 
-void xen_shutdown_fatal_error(const char *fmt, ...)
-{
-    va_list ap;
-
-    va_start(ap, fmt);
-    vfprintf(stderr, fmt, ap);
-    va_end(ap);
-    fprintf(stderr, "Will destroy the domain.\n");
-    /* destroy the domain */
-    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
-}
-
 void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
 {
     if (unlikely(xen_in_migration)) {
diff --git a/hw/xen/xen-utils.c b/hw/xen/xen-utils.c
new file mode 100644
index 00000000000..d6003782420
--- /dev/null
+++ b/hw/xen/xen-utils.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2010       Citrix Ltd.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "sysemu/runstate.h"
+#include "hw/xen/xen_common.h"
+
+void xen_shutdown_fatal_error(const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    vfprintf(stderr, fmt, ap);
+    va_end(ap);
+    fprintf(stderr, "Will destroy the domain.\n");
+    /* destroy the domain */
+    qemu_system_shutdown_request(SHUTDOWN_CAUSE_HOST_ERROR);
+}
diff --git a/hw/xen/meson.build b/hw/xen/meson.build
index 3c2062b9b3e..6c836ae06e4 100644
--- a/hw/xen/meson.build
+++ b/hw/xen/meson.build
@@ -4,6 +4,7 @@
   'xen-bus.c',
   'xen_devconfig.c',
   'xen_pvdev.c',
+  'xen-utils.c',
 ))
 
 xen_specific_ss = ss.source_set()
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 6/7] hw/xen: Make qmp_xen_set_global_dirty_log() available out of X86 HVM
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2021-02-01 11:29 ` [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  2021-02-01 11:29 ` [PATCH v3 7/7] NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config Philippe Mathieu-Daudé
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

qmp_xen_set_global_dirty_log() is also used by XEN_PV.

This fixes when XEN_PV without XEN_FV:

  /usr/bin/ld: libqemuutil.a(meson-generated_.._qapi_qapi-commands-migration.c.o): in function `qmp_marshal_xen_set_global_dirty_log':
  qapi/qapi-commands-migration.c:626: undefined reference to `qmp_xen_set_global_dirty_log'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/i386/xen/xen-hvm.c  | 10 ----------
 hw/xen/xen-migration.c | 22 ++++++++++++++++++++++
 hw/xen/meson.build     |  1 +
 3 files changed, 23 insertions(+), 10 deletions(-)
 create mode 100644 hw/xen/xen-migration.c

diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 69196754a30..85859ea0ba3 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -24,7 +24,6 @@
 #include "hw/xen/xen-bus.h"
 #include "hw/xen/xen-x86.h"
 #include "qapi/error.h"
-#include "qapi/qapi-commands-migration.h"
 #include "qemu/error-report.h"
 #include "qemu/main-loop.h"
 #include "qemu/range.h"
@@ -1591,12 +1590,3 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t length)
         }
     }
 }
-
-void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
-{
-    if (enable) {
-        memory_global_dirty_log_start();
-    } else {
-        memory_global_dirty_log_stop();
-    }
-}
diff --git a/hw/xen/xen-migration.c b/hw/xen/xen-migration.c
new file mode 100644
index 00000000000..1c53f1af08d
--- /dev/null
+++ b/hw/xen/xen-migration.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2010       Citrix Ltd.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "exec/memory.h"
+#include "qapi/qapi-commands-migration.h"
+
+void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
+{
+    if (enable) {
+        memory_global_dirty_log_start();
+    } else {
+        memory_global_dirty_log_stop();
+    }
+}
diff --git a/hw/xen/meson.build b/hw/xen/meson.build
index 6c836ae06e4..21f94625dc7 100644
--- a/hw/xen/meson.build
+++ b/hw/xen/meson.build
@@ -4,6 +4,7 @@
   'xen-bus.c',
   'xen_devconfig.c',
   'xen_pvdev.c',
+  'xen-migration.c',
   'xen-utils.c',
 ))
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 7/7] NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config
  2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2021-02-01 11:29 ` [PATCH v3 6/7] hw/xen: Make qmp_xen_set_global_dirty_log() " Philippe Mathieu-Daudé
@ 2021-02-01 11:29 ` Philippe Mathieu-Daudé
  6 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 11:29 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Paolo Bonzini, Eduardo Habkost, Marcel Apfelbaum,
	Stefano Stabellini, Anthony Perard, Paul Durrant, xen-devel,
	Richard Henderson, Michael S. Tsirkin,
	Philippe Mathieu-Daudé

xenpv machine requires USB, IDE_PIIX and PCI:

  /usr/bin/ld:
  libcommon.fa.p/hw_xen_xen-legacy-backend.c.o: in function `xen_be_register_common':
  hw/xen/xen-legacy-backend.c:757: undefined reference to `xen_usb_ops'
  libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function `unplug_disks':
  hw/i386/xen/xen_platform.c:153: undefined reference to `pci_piix3_xen_ide_unplug'
  libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function `pci_unplug_nics':
  hw/i386/xen/xen_platform.c:137: undefined reference to `pci_for_each_device'
  libqemu-i386-softmmu.fa.p/hw_i386_xen_xen_platform.c.o: in function `xen_platform_realize':
  hw/i386/xen/xen_platform.c:483: undefined reference to `pci_register_bar'

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Unfinished:

/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in
function `cpu_physical_memory_set_dirty_range':
include/exec/ram_addr.h:333: undefined reference to
`xen_hvm_modified_memory'
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in
function `ram_block_add':
softmmu/physmem.c:1873: undefined reference to `xen_ram_alloc'
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_physmem.c.o: in
function `cpu_physical_memory_set_dirty_range':
include/exec/ram_addr.h:333: undefined reference to
`xen_hvm_modified_memory'
/usr/bin/ld: include/exec/ram_addr.h:333: undefined reference to
`xen_hvm_modified_memory'
/usr/bin/ld: libqemu-x86_64-softmmu.fa.p/softmmu_memory.c.o: in function
`cpu_physical_memory_set_dirty_range':
include/exec/ram_addr.h:333: undefined reference to
`xen_hvm_modified_memory'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

TODO another day: Paolo's suggestion:
"modify xen_hvm_modified_memory to become a virtual function in AccelClass."
---
 hw/Kconfig     | 1 +
 hw/xen/Kconfig | 7 +++++++
 2 files changed, 8 insertions(+)
 create mode 100644 hw/xen/Kconfig

diff --git a/hw/Kconfig b/hw/Kconfig
index 5ad3c6b5a4b..f2a95591d94 100644
--- a/hw/Kconfig
+++ b/hw/Kconfig
@@ -39,6 +39,7 @@ source usb/Kconfig
 source virtio/Kconfig
 source vfio/Kconfig
 source watchdog/Kconfig
+source xen/Kconfig
 
 # arch Kconfig
 source arm/Kconfig
diff --git a/hw/xen/Kconfig b/hw/xen/Kconfig
new file mode 100644
index 00000000000..0b8427d6bd1
--- /dev/null
+++ b/hw/xen/Kconfig
@@ -0,0 +1,7 @@
+config XEN_PV
+    bool
+    default y if XEN
+    depends on XEN
+    select PCI
+    select USB
+    select IDE_PIIX
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c
  2021-02-01 11:29 ` [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c Philippe Mathieu-Daudé
@ 2021-02-01 13:08   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 13:08 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Stefano Stabellini, Eduardo Habkost, Paul Durrant,
	Michael S. Tsirkin, Richard Henderson, xen-devel, Anthony Perard,
	Paolo Bonzini

On 2/1/21 12:29 PM, Philippe Mathieu-Daudé wrote:
> xen-mapcache.c contains accelerator related routines,
> not particular to the X86 HVM machine. Move this file
> to accel/xen/ (adapting the buildsys machinery).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  meson.build                           |  3 +++
>  accel/xen/trace.h                     |  1 +
>  {hw/i386 => accel}/xen/xen-mapcache.c |  0
>  hw/i386/xen/xen-hvm.c                 |  1 -
>  accel/xen/meson.build                 |  5 ++++-
>  accel/xen/trace-events                | 10 ++++++++++
>  hw/i386/xen/meson.build               |  1 -
>  hw/i386/xen/trace-events              |  6 ------
>  8 files changed, 18 insertions(+), 9 deletions(-)
>  create mode 100644 accel/xen/trace.h
>  rename {hw/i386 => accel}/xen/xen-mapcache.c (100%)
>  create mode 100644 accel/xen/trace-events
...
> diff --git a/accel/xen/trace-events b/accel/xen/trace-events
> new file mode 100644
> index 00000000000..30bf4f42283
> --- /dev/null
> +++ b/accel/xen/trace-events
> @@ -0,0 +1,10 @@
> +# See docs/devel/tracing.txt for syntax documentation.
> +
> +# xen-hvm.c
> +xen_ram_alloc(unsigned long ram_addr, unsigned long size) "requested: 0x%lx, size 0x%lx"

Self-Nack, this should not be here ^

> +
> +# xen-mapcache.c
> +xen_map_cache(uint64_t phys_addr) "want 0x%"PRIx64
> +xen_remap_bucket(uint64_t index) "index 0x%"PRIx64
> +xen_map_cache_return(void* ptr) "%p"


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM
  2021-02-01 11:29 ` [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM Philippe Mathieu-Daudé
@ 2021-02-01 13:09   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 10+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-01 13:09 UTC (permalink / raw)
  To: Alex Bennée, qemu-devel
  Cc: Stefano Stabellini, Eduardo Habkost, Paul Durrant,
	Michael S. Tsirkin, Richard Henderson, xen-devel, Anthony Perard,
	Paolo Bonzini

On 2/1/21 12:29 PM, Philippe Mathieu-Daudé wrote:
> xen_shutdown_fatal_error() is also used by XEN_PV.
> 
> This fixes when XEN_PV without XEN_FV:
> 
>   /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt_config_init.c.o: in function `xen_pt_status_reg_init':
>   hw/xen/xen_pt_config_init.c:281: undefined reference to `xen_shutdown_fatal_error'
>   /usr/bin/ld: hw/xen/xen_pt_config_init.c:275: undefined reference to `xen_shutdown_fatal_error'
>   /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_read_config':
>   hw/xen/xen_pt.c:220: undefined reference to `xen_shutdown_fatal_error'
>   /usr/bin/ld: libqemu-x86_64-softmmu.fa.p/hw_xen_xen_pt.c.o: in function `xen_pt_pci_write_config':
>   hw/xen/xen_pt.c:369: undefined reference to `xen_shutdown_fatal_error'
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  hw/i386/xen/xen-hvm.c | 13 -------------
>  hw/xen/xen-utils.c    | 25 +++++++++++++++++++++++++
>  hw/xen/meson.build    |  1 +
>  3 files changed, 26 insertions(+), 13 deletions(-)
>  create mode 100644 hw/xen/xen-utils.c
> 
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 7156ab13329..69196754a30 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -28,7 +28,6 @@
>  #include "qemu/error-report.h"
>  #include "qemu/main-loop.h"
>  #include "qemu/range.h"
> -#include "sysemu/runstate.h"

^ self-nack, was not supposed to remove this.

>  #include "sysemu/sysemu.h"
>  #include "sysemu/xen.h"
>  #include "trace.h"
> @@ -1570,18 +1569,6 @@ void xen_register_framebuffer(MemoryRegion *mr)
>      framebuffer = mr;
>  }


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-01 13:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 11:28 [PATCH v3 0/7] hw/xen: Introduce XEN_FV/XEN_PV Kconfig Philippe Mathieu-Daudé
2021-02-01 11:28 ` [PATCH v3 1/7] meson: Do not build Xen x86_64-softmmu on Aarch64 Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 2/7] hw/xen: Relax dependency on FSDEV_9P Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 3/7] accel/xen: Incorporate xen-mapcache.c Philippe Mathieu-Daudé
2021-02-01 13:08   ` Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 4/7] hw/i386/xen: Introduce XEN_FV Kconfig Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 5/7] hw/xen: Make xen_shutdown_fatal_error() available out of X86 HVM Philippe Mathieu-Daudé
2021-02-01 13:09   ` Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 6/7] hw/xen: Make qmp_xen_set_global_dirty_log() " Philippe Mathieu-Daudé
2021-02-01 11:29 ` [PATCH v3 7/7] NOTFORMERGE hw/xen/Kconfig: Introduce XEN_PV config Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).