Skip to contentSkip to conversation

Xen: introduce Xen PV target

RFC PATCH In review Wei Liu 2 participants 15 messages Jan 27, 2014 – Jul 9, 2014 Kbuild

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

v2 cover Xen: introduce Xen PV target

This is a prototype based on QEMU's master branch. In fact it's more or less the same as the last version.

The first 3 patches refactor some code to disentangle Xen PV and HVM guest in QEMU. They are quite safe to go in.

The 4th patch has the real meat. It introduces Xen PV target, which contains basically a dummy CPU, then hooks up this Xen PV CPU to QEMU internal structures.

The last patch introduces xenpv-softmmu, which contains *no* emulation code. I know that in previous discussion people said that every device emulation should be included if the target architecture is called null. But since this target CPU is now called xenpv I don't feel obliged to include any device emulation in this prototype anymore. :-)

Please note that the existing Xen QEMU build is not affected at all. You can still use "--enable-xen --target-list=i386-softmmu" (or x86_64-softmmu") to build qemu-system-{i386,x86_64} and use it for both HVM and PV guest. This series adds another option to build QEMU with "--enable-xen --target-list=xenpv-softmmu" and get a QEMU binary tailored for Xen PV guest. The effect is that we reduce the binary size from 14MB to 7.3MB.

Wei.

Changes in RFC V2:
* more refactoring
* include Paolo's patch to factor out list of Xen / KVM targets

Paolo Bonzini (1):
configure: factor out list of supported Xen/KVM targets

Wei Liu (5):
xen: move Xen PV machine files to hw/xenpv
xen: move Xen HVM files under hw/i386/xen
xen: factor out common functions
xen: implement Xen PV target
xen: introduce xenpv-softmmu.mak

 Makefile.target                      |    6 +-
 arch_init.c                          |    2 +
 configure                            |   61 ++++++++++-------
 cpu-exec.c                           |    2 +
 default-configs/xenpv-softmmu.mak    |    2 +
 hw/i386/Makefile.objs                |    2 +-
 hw/i386/xen/Makefile.objs            |    1 +
 hw/{ => i386}/xen/xen_apic.c         |    0
 hw/{ => i386}/xen/xen_platform.c     |    0
 hw/{ => i386}/xen/xen_pvdevice.c     |    0
 hw/xen/Makefile.objs                 |    1 -
 hw/xenpv/Makefile.objs               |    2 +
 hw/{i386 => xenpv}/xen_domainbuild.c |    0
 hw/{i386 => xenpv}/xen_domainbuild.h |    0
 hw/{i386 => xenpv}/xen_machine_pv.c  |    0
 include/sysemu/arch_init.h           |    1 +
 target-xenpv/Makefile.objs           |    1 +
 target-xenpv/cpu-qom.h               |   64 ++++++++++++++++++
 target-xenpv/cpu.h                   |   66 ++++++++++++++++++
 target-xenpv/helper.c                |   32 +++++++++
 target-xenpv/translate.c             |   27 ++++++++
 xen-common-stub.c                    |   19 ++++++
 xen-common.c                         |  123 ++++++++++++++++++++++++++++++++++
 xen-stub.c => xen-hvm-stub.c         |   18 ++---
 xen-all.c => xen-hvm.c               |  121 +++------------------------------
 xen-mapcache-stub.c                  |   39 +++++++++++
 26 files changed, 442 insertions(+), 148 deletions(-)
 create mode 100644 default-configs/xenpv-softmmu.mak
 create mode 100644 hw/i386/xen/Makefile.objs
 rename hw/{ => i386}/xen/xen_apic.c (100%)
 rename hw/{ => i386}/xen/xen_platform.c (100%)
 rename hw/{ => i386}/xen/xen_pvdevice.c (100%)
 create mode 100644 hw/xenpv/Makefile.objs
 rename hw/{i386 => xenpv}/xen_domainbuild.c (100%)
 rename hw/{i386 => xenpv}/xen_domainbuild.h (100%)
 rename hw/{i386 => xenpv}/xen_machine_pv.c (100%)
 create mode 100644 target-xenpv/Makefile.objs
 create mode 100644 target-xenpv/cpu-qom.h
 create mode 100644 target-xenpv/cpu.h
 create mode 100644 target-xenpv/helper.c
 create mode 100644 target-xenpv/helper.h
 create mode 100644 target-xenpv/translate.c
 create mode 100644 xen-common-stub.c
 create mode 100644 xen-common.c
 rename xen-stub.c => xen-hvm-stub.c (91%)
 rename xen-all.c => xen-hvm.c (93%)
 create mode 100644 xen-mapcache-stub.c
Signature · 1 line
1.7.10.4
author
#1 lore raw

RFC PATCH v2 1/6 configure: factor out list of supported Xen/KVM targets

From: Paolo Bonzini <[email protected]>

---
 configure |   58 +++++++++++++++++++++++++++++++++++-----------------------
 1 file changed, 35 insertions(+), 23 deletions(-)
configure +35 -23
index 07b6be3..549b9cc 100755
@@ -4372,6 +4372,32 @@ if test "$linux" = "yes" ; then
     fi
 fi
 
+supported_kvm_target() {
+    test "$kvm" = "yes" || return 1
+    test "$target_softmmu" = "yes" || return 1
+    case "$target_name:$cpu" in
+        arm:arm | aarch64:aarch64 | \
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64 | \
+        ppc:ppc | ppcemb:ppc | ppc64:ppc | \
+        ppc:ppc64 | ppcemb:ppc64 | ppc64:ppc64 | \
+        s390x:s390x)
+            return 0
+        ;;
+    esac
+    return 1
+}
+
+supported_xen_target() {
+    test "$xen" = "yes" || return 1
+    test "$target_softmmu" = "yes" || return 1
+    case "$target_name:$cpu" in
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+            return 0
+        ;;
+    esac
+    return 1
+}
+
 for target in $target_list; do
 target_dir="$target"
 config_target_mak=$target_dir/config-target.mak
@@ -4538,34 +4564,20 @@ if [ "$TARGET_ABI_DIR" = "" ]; then
   TARGET_ABI_DIR=$TARGET_ARCH
 fi
 echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
-case "$target_name" in
-  i386|x86_64)
-    if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
-      echo "CONFIG_XEN=y" >> $config_target_mak
-      if test "$xen_pci_passthrough" = yes; then
+
+if supported_xen_target; then
+    echo "CONFIG_XEN=y" >> $config_target_mak
+    if test "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
-      fi
     fi
-    ;;
-  *)
-esac
-case "$target_name" in
-  aarch64|arm|i386|x86_64|ppcemb|ppc|ppc64|s390x)
+fi
+if supported_kvm_target; then
     # Make sure the target and host cpus are compatible
-    if test "$kvm" = "yes" -a "$target_softmmu" = "yes" -a \
-      \( "$target_name" = "$cpu" -o \
-      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc" \) -o \
-      \( "$target_name" = "ppc64"  -a "$cpu" = "ppc" \) -o \
-      \( "$target_name" = "ppc"    -a "$cpu" = "ppc64" \) -o \
-      \( "$target_name" = "ppcemb" -a "$cpu" = "ppc64" \) -o \
-      \( "$target_name" = "x86_64" -a "$cpu" = "i386"   \) -o \
-      \( "$target_name" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
-      echo "CONFIG_KVM=y" >> $config_target_mak
-      if test "$vhost_net" = "yes" ; then
+    echo "CONFIG_KVM=y" >> $config_target_mak
+    if test "$vhost_net" = "yes" ; then
         echo "CONFIG_VHOST_NET=y" >> $config_target_mak
-      fi
     fi
-esac
+fi
 if test "$target_bigendian" = "yes" ; then
   echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
 fi
Signature · 1 line
1.7.10.4
author
#2 lore raw

RFC PATCH v2 2/6 xen: move Xen PV machine files to hw/xenpv

In reply to Wei Liu
---
 hw/i386/Makefile.objs                |    2 +-
 hw/xenpv/Makefile.objs               |    2 ++
 hw/{i386 => xenpv}/xen_domainbuild.c |    0
 hw/{i386 => xenpv}/xen_domainbuild.h |    0
 hw/{i386 => xenpv}/xen_machine_pv.c  |    0
 5 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 hw/xenpv/Makefile.objs
 rename hw/{i386 => xenpv}/xen_domainbuild.c (100%)
 rename hw/{i386 => xenpv}/xen_domainbuild.h (100%)
 rename hw/{i386 => xenpv}/xen_machine_pv.c (100%)
hw/i386/Makefile.objs +1 -1
index 09ac433..0faccd7 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/
 obj-y += multiboot.o smbios.o
 obj-y += pc.o pc_piix.o pc_q35.o
 obj-y += pc_sysfw.o
-obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
+obj-$(CONFIG_XEN) += ../xenpv/
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
hw/xenpv/Makefile.objs new file +2 -0
new file mode 100644
index 0000000..49f6e9e
@@ -0,0 +1,2 @@
+# Xen PV machine support
+obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
hw/xenpv/xen_domainbuild.c renamed from hw/i386/xen_domainbuild.c +0 -0
similarity index 100%
rename from hw/i386/xen_domainbuild.c
rename to hw/xenpv/xen_domainbuild.c
hw/xenpv/xen_domainbuild.h renamed from hw/i386/xen_domainbuild.h +0 -0
similarity index 100%
rename from hw/i386/xen_domainbuild.h
rename to hw/xenpv/xen_domainbuild.h
hw/xenpv/xen_machine_pv.c renamed from hw/i386/xen_machine_pv.c +0 -0
similarity index 100%
rename from hw/i386/xen_machine_pv.c
rename to hw/xenpv/xen_machine_pv.c
Signature · 1 line
1.7.10.4
author
#3 lore raw

RFC PATCH v2 2/6 xen: move Xen PV machine files to hw/xenpv

In reply to Wei Liu
---
 hw/i386/Makefile.objs                |    2 +-
 hw/xenpv/Makefile.objs               |    2 ++
 hw/{i386 => xenpv}/xen_domainbuild.c |    0
 hw/{i386 => xenpv}/xen_domainbuild.h |    0
 hw/{i386 => xenpv}/xen_machine_pv.c  |    0
 5 files changed, 3 insertions(+), 1 deletion(-)
 create mode 100644 hw/xenpv/Makefile.objs
 rename hw/{i386 => xenpv}/xen_domainbuild.c (100%)
 rename hw/{i386 => xenpv}/xen_domainbuild.h (100%)
 rename hw/{i386 => xenpv}/xen_machine_pv.c (100%)
hw/i386/Makefile.objs +1 -1
index 09ac433..0faccd7 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/
 obj-y += multiboot.o smbios.o
 obj-y += pc.o pc_piix.o pc_q35.o
 obj-y += pc_sysfw.o
-obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
+obj-$(CONFIG_XEN) += ../xenpv/
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
hw/xenpv/Makefile.objs new file +2 -0
new file mode 100644
index 0000000..49f6e9e
@@ -0,0 +1,2 @@
+# Xen PV machine support
+obj-$(CONFIG_XEN) += xen_domainbuild.o xen_machine_pv.o
hw/xenpv/xen_domainbuild.c renamed from hw/i386/xen_domainbuild.c +0 -0
similarity index 100%
rename from hw/i386/xen_domainbuild.c
rename to hw/xenpv/xen_domainbuild.c
hw/xenpv/xen_domainbuild.h renamed from hw/i386/xen_domainbuild.h +0 -0
similarity index 100%
rename from hw/i386/xen_domainbuild.h
rename to hw/xenpv/xen_domainbuild.h
hw/xenpv/xen_machine_pv.c renamed from hw/i386/xen_machine_pv.c +0 -0
similarity index 100%
rename from hw/i386/xen_machine_pv.c
rename to hw/xenpv/xen_machine_pv.c
Signature · 1 line
1.7.10.4
author
#4 lore raw

RFC PATCH v2 3/6 xen: move Xen HVM files under hw/i386/xen

In reply to Wei Liu
---
 hw/i386/Makefile.objs            |    2 +-
 hw/i386/xen/Makefile.objs        |    1 +
 hw/{ => i386}/xen/xen_apic.c     |    0
 hw/{ => i386}/xen/xen_platform.c |    0
 hw/{ => i386}/xen/xen_pvdevice.c |    0
 hw/xen/Makefile.objs             |    1 -
 6 files changed, 2 insertions(+), 2 deletions(-)
 create mode 100644 hw/i386/xen/Makefile.objs
 rename hw/{ => i386}/xen/xen_apic.c (100%)
 rename hw/{ => i386}/xen/xen_platform.c (100%)
 rename hw/{ => i386}/xen/xen_pvdevice.c (100%)
hw/i386/Makefile.objs +1 -1
index 0faccd7..77dcf06 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/
 obj-y += multiboot.o smbios.o
 obj-y += pc.o pc_piix.o pc_q35.o
 obj-y += pc_sysfw.o
-obj-$(CONFIG_XEN) += ../xenpv/
+obj-$(CONFIG_XEN) += ../xenpv/ xen/
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
hw/i386/xen/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..801a68d
@@ -0,0 +1 @@
+obj-y += xen_platform.o xen_apic.o xen_pvdevice.o
hw/i386/xen/xen_apic.c renamed from hw/xen/xen_apic.c +0 -0
similarity index 100%
rename from hw/xen/xen_apic.c
rename to hw/i386/xen/xen_apic.c
hw/i386/xen/xen_platform.c renamed from hw/xen/xen_platform.c +0 -0
similarity index 100%
rename from hw/xen/xen_platform.c
rename to hw/i386/xen/xen_platform.c
hw/i386/xen/xen_pvdevice.c renamed from hw/xen/xen_pvdevice.c +0 -0
similarity index 100%
rename from hw/xen/xen_pvdevice.c
rename to hw/i386/xen/xen_pvdevice.c
hw/xen/Makefile.objs +0 -1
index ce640c6..a0ca0aa 100644
@@ -1,6 +1,5 @@
 # xen backend driver support
 common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o
 
-obj-$(CONFIG_XEN_I386) += xen_platform.o xen_apic.o xen_pvdevice.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
Signature · 1 line
1.7.10.4
author
#5 lore raw

RFC PATCH v2 3/6 xen: move Xen HVM files under hw/i386/xen

In reply to Wei Liu
---
 hw/i386/Makefile.objs            |    2 +-
 hw/i386/xen/Makefile.objs        |    1 +
 hw/{ => i386}/xen/xen_apic.c     |    0
 hw/{ => i386}/xen/xen_platform.c |    0
 hw/{ => i386}/xen/xen_pvdevice.c |    0
 hw/xen/Makefile.objs             |    1 -
 6 files changed, 2 insertions(+), 2 deletions(-)
 create mode 100644 hw/i386/xen/Makefile.objs
 rename hw/{ => i386}/xen/xen_apic.c (100%)
 rename hw/{ => i386}/xen/xen_platform.c (100%)
 rename hw/{ => i386}/xen/xen_pvdevice.c (100%)
hw/i386/Makefile.objs +1 -1
index 0faccd7..77dcf06 100644
@@ -2,7 +2,7 @@ obj-$(CONFIG_KVM) += kvm/
 obj-y += multiboot.o smbios.o
 obj-y += pc.o pc_piix.o pc_q35.o
 obj-y += pc_sysfw.o
-obj-$(CONFIG_XEN) += ../xenpv/
+obj-$(CONFIG_XEN) += ../xenpv/ xen/
 
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
hw/i386/xen/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..801a68d
@@ -0,0 +1 @@
+obj-y += xen_platform.o xen_apic.o xen_pvdevice.o
hw/i386/xen/xen_apic.c renamed from hw/xen/xen_apic.c +0 -0
similarity index 100%
rename from hw/xen/xen_apic.c
rename to hw/i386/xen/xen_apic.c
hw/i386/xen/xen_platform.c renamed from hw/xen/xen_platform.c +0 -0
similarity index 100%
rename from hw/xen/xen_platform.c
rename to hw/i386/xen/xen_platform.c
hw/i386/xen/xen_pvdevice.c renamed from hw/xen/xen_pvdevice.c +0 -0
similarity index 100%
rename from hw/xen/xen_pvdevice.c
rename to hw/i386/xen/xen_pvdevice.c
hw/xen/Makefile.objs +0 -1
index ce640c6..a0ca0aa 100644
@@ -1,6 +1,5 @@
 # xen backend driver support
 common-obj-$(CONFIG_XEN_BACKEND) += xen_backend.o xen_devconfig.o
 
-obj-$(CONFIG_XEN_I386) += xen_platform.o xen_apic.o xen_pvdevice.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen-host-pci-device.o
 obj-$(CONFIG_XEN_PCI_PASSTHROUGH) += xen_pt.o xen_pt_config_init.o xen_pt_msi.o
Signature · 1 line
1.7.10.4
author
#6 lore raw

RFC PATCH v2 4/6 xen: factor out common functions

In reply to Wei Liu

So common functions used by both HVM and PV are factored out from xen-all.c to xen-common.c.

Finally rename xen-all.c to xen-hvm.c, as those functions are only useful to HVM guest.

Create *-stub files and modify Makefile.target to reflect the changes.

---
 Makefile.target              |    6 ++-
 xen-common-stub.c            |   19 +++++++
 xen-common.c                 |  123 ++++++++++++++++++++++++++++++++++++++++++
 xen-stub.c => xen-hvm-stub.c |   18 +++----
 xen-all.c => xen-hvm.c       |  121 ++++-------------------------------------
 xen-mapcache-stub.c          |   39 ++++++++++++++
 6 files changed, 203 insertions(+), 123 deletions(-)
 create mode 100644 xen-common-stub.c
 create mode 100644 xen-common.c
 rename xen-stub.c => xen-hvm-stub.c (91%)
 rename xen-all.c => xen-hvm.c (93%)
 create mode 100644 xen-mapcache-stub.c
Makefile.target +4 -2
index af6ac7e..9c9e1c7 100644
@@ -120,8 +120,10 @@ obj-y += dump.o
 LIBS+=$(libs_softmmu)
 
 # xen support
-obj-$(CONFIG_XEN) += xen-all.o xen-mapcache.o
-obj-$(call lnot,$(CONFIG_XEN)) += xen-stub.o
+obj-$(CONFIG_XEN) += xen-common.o
+obj-$(CONFIG_XEN_I386) += xen-hvm.o xen-mapcache.o
+obj-$(call lnot,$(CONFIG_XEN)) += xen-common-stub.o
+obj-$(call lnot,$(CONFIG_XEN_I386)) += xen-hvm-stub.o xen-mapcache-stub.o
 
 # Hardware support
 ifeq ($(TARGET_NAME), sparc64)
xen-common-stub.c new file +19 -0
new file mode 100644
index 0000000..3152018
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2014       Citrix Systems UK Ltd.
+ *
+ * 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-common.h"
+#include "hw/xen/xen.h"
+
+void xenstore_store_pv_console_info(int i, CharDriverState *chr)
+{
+}
+
+int xen_init(void)
+{
+    return -ENOSYS;
+}
+
xen-common.c new file +123 -0

123 lines not on this page · raw message

xen-hvm-stub.c renamed from xen-stub.c +7 -11
similarity index 91%
rename from xen-stub.c
rename to xen-hvm-stub.c
index ad189a6..00fa9b3 100644
@@ -12,10 +12,7 @@
 #include "hw/xen/xen.h"
 #include "exec/memory.h"
 #include "qmp-commands.h"
-
-void xenstore_store_pv_console_info(int i, CharDriverState *chr)
-{
-}
+#include "hw/xen/xen_common.h"
 
 int xen_pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
 {
@@ -47,24 +44,23 @@ qemu_irq *xen_interrupt_controller_init(void)
     return NULL;
 }
 
-int xen_init(void)
+void xen_register_framebuffer(MemoryRegion *mr)
 {
-    return -ENOSYS;
 }
 
-void xen_register_framebuffer(MemoryRegion *mr)
+void xen_modified_memory(ram_addr_t start, ram_addr_t length)
 {
 }
 
-void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
+int xen_hvm_init(MemoryRegion **ram_memory)
 {
+    return 0;
 }
 
-void xen_modified_memory(ram_addr_t start, ram_addr_t length)
+void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
 {
 }
 
-int xen_hvm_init(MemoryRegion **ram_memory)
+void xen_shutdown_fatal_error(const char *fmt, ...)
 {
-    return 0;
 }
xen-hvm.c renamed from xen-all.c +11 -110

155 lines not on this page · raw message

xen-mapcache-stub.c new file +39 -0
new file mode 100644
index 0000000..f4ddf53
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2014       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 "config.h"
+
+#include <sys/resource.h>
+
+#include "hw/xen/xen_backend.h"
+
+#include <xen/hvm/params.h>
+
+#include "sysemu/xen-mapcache.h"
+#include "trace.h"
+
+uint8_t *xen_map_cache(hwaddr phys_addr, hwaddr size,
+                       uint8_t lock)
+{
+    abort();
+    return NULL;
+}
+
+ram_addr_t xen_ram_addr_from_mapcache(void *ptr)
+{
+    abort();
+    return 0;
+}
+
+void xen_invalidate_map_cache_entry(uint8_t *buffer)
+{
+    abort();
+}
+
Signature · 1 line
1.7.10.4
author
#7 lore raw

RFC PATCH v2 5/6 xen: implement Xen PV target

In reply to Wei Liu

Basically it's a dummy CPU that doens't do anything. This patch contains necessary hooks to make QEMU compile.

---
 arch_init.c                |    2 ++
 cpu-exec.c                 |    2 ++
 include/sysemu/arch_init.h |    1 +
 target-xenpv/Makefile.objs |    1 +
 target-xenpv/cpu-qom.h     |   64 ++++++++++++++++++++++++++++++++++++++++++
 target-xenpv/cpu.h         |   66 ++++++++++++++++++++++++++++++++++++++++++++
 target-xenpv/helper.c      |   32 +++++++++++++++++++++
 target-xenpv/translate.c   |   27 ++++++++++++++++++
 8 files changed, 195 insertions(+)
 create mode 100644 target-xenpv/Makefile.objs
 create mode 100644 target-xenpv/cpu-qom.h
 create mode 100644 target-xenpv/cpu.h
 create mode 100644 target-xenpv/helper.c
 create mode 100644 target-xenpv/helper.h
 create mode 100644 target-xenpv/translate.c
arch_init.c +2 -0
index e0acbc5..a15de61 100644
@@ -101,6 +101,8 @@ int graphic_depth = 32;
 #define QEMU_ARCH QEMU_ARCH_XTENSA
 #elif defined(TARGET_UNICORE32)
 #define QEMU_ARCH QEMU_ARCH_UNICORE32
+#elif defined(TARGET_XENPV)
+#define QEMU_ARCH QEMU_ARCH_XENPV
 #endif
 
 const uint32_t arch_type = QEMU_ARCH;
cpu-exec.c +2 -0
index 30cfa2a..531e92a 100644
@@ -258,6 +258,7 @@ int cpu_exec(CPUArchState *env)
 #elif defined(TARGET_CRIS)
 #elif defined(TARGET_S390X)
 #elif defined(TARGET_XTENSA)
+#elif defined(TARGET_XENPV)
     /* XXXXX */
 #else
 #error unsupported target CPU
@@ -713,6 +714,7 @@ int cpu_exec(CPUArchState *env)
 #elif defined(TARGET_CRIS)
 #elif defined(TARGET_S390X)
 #elif defined(TARGET_XTENSA)
+#elif defined(TARGET_XENPV)
     /* XXXXX */
 #else
 #error unsupported target CPU
include/sysemu/arch_init.h +1 -0
index be71bca..66ea63f 100644
@@ -22,6 +22,7 @@ enum {
     QEMU_ARCH_OPENRISC = 8192,
     QEMU_ARCH_UNICORE32 = 0x4000,
     QEMU_ARCH_MOXIE = 0x8000,
+    QEMU_ARCH_XENPV = 0x10000,
 };
 
 extern const uint32_t arch_type;
target-xenpv/Makefile.objs new file +1 -0
new file mode 100644
index 0000000..8a60866
@@ -0,0 +1 @@
+obj-y += helper.o translate.o
target-xenpv/cpu-qom.h new file +64 -0

64 lines not on this page · raw message

target-xenpv/cpu.h new file +66 -0

66 lines not on this page · raw message

target-xenpv/helper.c new file +32 -0
new file mode 100644
index 0000000..225a063
@@ -0,0 +1,32 @@
+#include "cpu.h"
+#include "helper.h"
+#if !defined(CONFIG_USER_ONLY)
+#include "exec/softmmu_exec.h"
+#endif
+
+#if !defined(CONFIG_USER_ONLY)
+
+#define MMUSUFFIX _mmu
+
+#define SHIFT 0
+#include "exec/softmmu_template.h"
+
+#define SHIFT 1
+#include "exec/softmmu_template.h"
+
+#define SHIFT 2
+#include "exec/softmmu_template.h"
+
+#define SHIFT 3
+#include "exec/softmmu_template.h"
+
+#endif
+
+#if !defined(CONFIG_USER_ONLY)
+void tlb_fill(CPUXenPVState *env, target_ulong addr, int is_write,
+              int mmu_idx, uintptr_t retaddr)
+{
+    abort();
+}
+#endif
+
target-xenpv/helper.h new file +0 -0
new file mode 100644
index 0000000..e69de29
target-xenpv/translate.c new file +27 -0
new file mode 100644
index 0000000..4bc84e5
@@ -0,0 +1,27 @@
+#include <inttypes.h>
+#include "qemu/host-utils.h"
+#include "cpu.h"
+#include "disas/disas.h"
+#include "tcg-op.h"
+
+#include "helper.h"
+#define GEN_HELPER 1
+#include "helper.h"
+
+void gen_intermediate_code(CPUXenPVState *env, TranslationBlock *tb)
+{
+    abort();
+}
+
+void gen_intermediate_code_pc(CPUXenPVState *env, TranslationBlock *tb)
+{
+    abort();
+}
+
+void restore_state_to_opc(CPUXenPVState *env, TranslationBlock *tb,
+                          int pc_pos)
+{
+    abort();
+}
+
+
Signature · 1 line
1.7.10.4
author
#8 lore raw

RFC PATCH v2 6/6 xen: introduce xenpv-softmmu.mak

In reply to Wei Liu
---
 configure                         |    7 +++++--
 default-configs/xenpv-softmmu.mak |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 default-configs/xenpv-softmmu.mak
configure +5 -2
index 549b9cc..b713d93 100755
@@ -4391,7 +4391,7 @@ supported_xen_target() {
     test "$xen" = "yes" || return 1
     test "$target_softmmu" = "yes" || return 1
     case "$target_name:$cpu" in
-        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64 | xenpv:*)
             return 0
         ;;
     esac
@@ -4538,6 +4538,9 @@ case "$target_name" in
   ;;
   unicore32)
   ;;
+  xenpv)
+    TARGET_ARCH=xenpv
+  ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
   ;;
@@ -4567,7 +4570,7 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
 
 if supported_xen_target; then
     echo "CONFIG_XEN=y" >> $config_target_mak
-    if test "$xen_pci_passthrough" = yes; then
+    if test "$target_name" != "xenpv" -a "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
     fi
 fi
default-configs/xenpv-softmmu.mak new file +2 -0
new file mode 100644
index 0000000..773f128
@@ -0,0 +1,2 @@
+# Default configuration for xenpv-softmmu
+# Yes it is empty as we don't need to include any device emulation code
Signature · 1 line
1.7.10.4
author
#9 lore raw

RFC PATCH v2 6/6 xen: introduce xenpv-softmmu.mak

In reply to Wei Liu
---
 configure                         |    7 +++++--
 default-configs/xenpv-softmmu.mak |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 default-configs/xenpv-softmmu.mak
configure +5 -2
index 549b9cc..b713d93 100755
@@ -4391,7 +4391,7 @@ supported_xen_target() {
     test "$xen" = "yes" || return 1
     test "$target_softmmu" = "yes" || return 1
     case "$target_name:$cpu" in
-        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64 | xenpv:*)
             return 0
         ;;
     esac
@@ -4538,6 +4538,9 @@ case "$target_name" in
   ;;
   unicore32)
   ;;
+  xenpv)
+    TARGET_ARCH=xenpv
+  ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
   ;;
@@ -4567,7 +4570,7 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
 
 if supported_xen_target; then
     echo "CONFIG_XEN=y" >> $config_target_mak
-    if test "$xen_pci_passthrough" = yes; then
+    if test "$target_name" != "xenpv" -a "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
     fi
 fi
default-configs/xenpv-softmmu.mak new file +2 -0
new file mode 100644
index 0000000..773f128
@@ -0,0 +1,2 @@
+# Default configuration for xenpv-softmmu
+# Yes it is empty as we don't need to include any device emulation code
Signature · 1 line
1.7.10.4
#10 lore raw

Re: [PATCH RFC V2 6/6] xen: introduce xenpv-softmmu.mak

I realize now that patch #5 and #6 of this series feel through the cracks. Could you please rebase and resend?

Quoted 50 lines · Wei Liu
---
 configure                         |    7 +++++--
 default-configs/xenpv-softmmu.mak |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 default-configs/xenpv-softmmu.mak
configure +5 -2
index 549b9cc..b713d93 100755
@@ -4391,7 +4391,7 @@ supported_xen_target() {
     test "$xen" = "yes" || return 1
     test "$target_softmmu" = "yes" || return 1
     case "$target_name:$cpu" in
-        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64 | xenpv:*)
             return 0
         ;;
     esac
@@ -4538,6 +4538,9 @@ case "$target_name" in
   ;;
   unicore32)
   ;;
+  xenpv)
+    TARGET_ARCH=xenpv
+  ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
   ;;
@@ -4567,7 +4570,7 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
 
 if supported_xen_target; then
     echo "CONFIG_XEN=y" >> $config_target_mak
-    if test "$xen_pci_passthrough" = yes; then
+    if test "$target_name" != "xenpv" -a "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
     fi
 fi
default-configs/xenpv-softmmu.mak new file +2 -0
new file mode 100644
index 0000000..773f128
@@ -0,0 +1,2 @@
+# Default configuration for xenpv-softmmu
+# Yes it is empty as we don't need to include any device emulation code
Signature · 1 line
1.7.10.4
#11 lore raw

Re: [Qemu-devel] [PATCH RFC V2 6/6] xen: introduce xenpv-softmmu.mak

In reply to Wei Liu

I realize now that patch #5 and #6 of this series feel through the cracks. Could you please rebase and resend?

Quoted 50 lines · Wei Liu
---
 configure                         |    7 +++++--
 default-configs/xenpv-softmmu.mak |    2 ++
 2 files changed, 7 insertions(+), 2 deletions(-)
 create mode 100644 default-configs/xenpv-softmmu.mak
configure +5 -2
index 549b9cc..b713d93 100755
@@ -4391,7 +4391,7 @@ supported_xen_target() {
     test "$xen" = "yes" || return 1
     test "$target_softmmu" = "yes" || return 1
     case "$target_name:$cpu" in
-        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64)
+        i386:i386 | i386:x86_64 | x86_64:i386 | x86_64:x86_64 | xenpv:*)
             return 0
         ;;
     esac
@@ -4538,6 +4538,9 @@ case "$target_name" in
   ;;
   unicore32)
   ;;
+  xenpv)
+    TARGET_ARCH=xenpv
+  ;;
   xtensa|xtensaeb)
     TARGET_ARCH=xtensa
   ;;
@@ -4567,7 +4570,7 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
 
 if supported_xen_target; then
     echo "CONFIG_XEN=y" >> $config_target_mak
-    if test "$xen_pci_passthrough" = yes; then
+    if test "$target_name" != "xenpv" -a "$xen_pci_passthrough" = yes; then
         echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
     fi
 fi
default-configs/xenpv-softmmu.mak new file +2 -0
new file mode 100644
index 0000000..773f128
@@ -0,0 +1,2 @@
+# Default configuration for xenpv-softmmu
+# Yes it is empty as we don't need to include any device emulation code
Signature · 1 line
1.7.10.4
author
#12 lore raw

Re: [Qemu-devel] [PATCH RFC V2 6/6] xen: introduce xenpv-softmmu.mak

Quoted 3 lines · Stefano Stabellini

I realize now that patch #5 and #6 of this series feel through the cracks. Could you please rebase and resend?

Hi Peter and Paolo

I would like to ask for your suggestion on how to move this forward.

The first few refactoring patches have been upstreamed. These two patches (and a dependency patch which is not included here) seem to be the last missing bits to have QEMU binary for Xen on ARM. We would really like to find a way to upstream these changes and avoid forking.

Wei.

#13 lore raw

Re: [PATCH RFC V2 6/6] xen: introduce xenpv-softmmu.mak

Quoted 5 lines · Wei Liu
Quoted 3 lines · Stefano Stabellini

I realize now that patch #5 and #6 of this series feel through the cracks. Could you please rebase and resend?

Quoted 8 lines

Hi Peter and Paolo

I would like to ask for your suggestion on how to move this forward.

The first few refactoring patches have been upstreamed. These two patches (and a dependency patch which is not included here) seem to be the last missing bits to have QEMU binary for Xen on ARM. We would really like to find a way to upstream these changes and avoid forking.

Actually I don't think that this could cause any forking (at least in upstream Xen) even if the patches are not accepted. But it would be nice to have a smaller and lighter QEMU for ARM with just the PV backend. Otherwise we'll have to run a big fat qemu-system-i386 even for ARM guests, a bit overkill given that we only need the backends.

#14 lore raw

Re: [Qemu-devel] [PATCH RFC V2 6/6] xen: introduce xenpv-softmmu.mak

In reply to Wei Liu
Quoted 5 lines · Wei Liu
Quoted 3 lines · Stefano Stabellini

I realize now that patch #5 and #6 of this series feel through the cracks. Could you please rebase and resend?

Quoted 8 lines

Hi Peter and Paolo

I would like to ask for your suggestion on how to move this forward.

The first few refactoring patches have been upstreamed. These two patches (and a dependency patch which is not included here) seem to be the last missing bits to have QEMU binary for Xen on ARM. We would really like to find a way to upstream these changes and avoid forking.

Actually I don't think that this could cause any forking (at least in upstream Xen) even if the patches are not accepted. But it would be nice to have a smaller and lighter QEMU for ARM with just the PV backend. Otherwise we'll have to run a big fat qemu-system-i386 even for ARM guests, a bit overkill given that we only need the backends.