[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V13 06/17] xen: Add xenfv machine
From: |
anthony.perard |
Subject: |
[Qemu-devel] [PATCH V13 06/17] xen: Add xenfv machine |
Date: |
Mon, 18 Apr 2011 12:37:06 +0100 |
From: Anthony PERARD <address@hidden>
Introduce the Xen FV (Fully Virtualized) machine to Qemu, some more Xen
specific call will be added in further patches.
Signed-off-by: Anthony PERARD <address@hidden>
---
hw/pc_piix.c | 41 +++++++++++++++++++++++++++++++++++++++--
hw/xen.h | 6 ++++++
xen-all.c | 24 ++++++++++++++++++++++++
3 files changed, 69 insertions(+), 2 deletions(-)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index e487c38..9c757c4 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -38,6 +38,10 @@
#include "arch_init.h"
#include "blockdev.h"
#include "smbus.h"
+#include "xen.h"
+#ifdef CONFIG_XEN
+# include <xen/hvm/hvm_info_table.h>
+#endif
#define MAX_IDE_BUS 2
@@ -100,8 +104,10 @@ static void pc_init1(ram_addr_t ram_size,
}
/* allocate ram and load rom/bios */
- pc_memory_init(ram_size, kernel_filename, kernel_cmdline, initrd_filename,
- below_4g_mem_size, above_4g_mem_size);
+ if (!xen_enabled()) {
+ pc_memory_init(ram_size, kernel_filename, kernel_cmdline,
+ initrd_filename, below_4g_mem_size, above_4g_mem_size);
+ }
cpu_irq = pc_allocate_cpu_irq();
i8259 = i8259_init(cpu_irq[0]);
@@ -220,6 +226,24 @@ static void pc_init_isa(ram_addr_t ram_size,
initrd_filename, cpu_model, 0, 1);
}
+#ifdef CONFIG_XEN
+static void pc_xen_hvm_init(ram_addr_t ram_size,
+ const char *boot_device,
+ const char *kernel_filename,
+ const char *kernel_cmdline,
+ const char *initrd_filename,
+ const char *cpu_model)
+{
+ if (xen_hvm_init() != 0) {
+ hw_error("xen hardware virtual machine initialisation failed");
+ }
+ pc_init_pci_no_kvmclock(ram_size, boot_device,
+ kernel_filename, kernel_cmdline,
+ initrd_filename, cpu_model);
+ xen_vcpu_init();
+}
+#endif
+
static QEMUMachine pc_machine = {
.name = "pc-0.14",
.alias = "pc",
@@ -384,6 +408,16 @@ static QEMUMachine isapc_machine = {
.max_cpus = 1,
};
+#ifdef CONFIG_XEN
+static QEMUMachine xenfv_machine = {
+ .name = "xenfv",
+ .desc = "Xen Fully-virtualized PC",
+ .init = pc_xen_hvm_init,
+ .max_cpus = HVM_MAX_VCPUS,
+ .default_machine_opts = "accel=xen",
+};
+#endif
+
static void pc_machine_init(void)
{
qemu_register_machine(&pc_machine);
@@ -392,6 +426,9 @@ static void pc_machine_init(void)
qemu_register_machine(&pc_machine_v0_11);
qemu_register_machine(&pc_machine_v0_10);
qemu_register_machine(&isapc_machine);
+#ifdef CONFIG_XEN
+ qemu_register_machine(&xenfv_machine);
+#endif
}
machine_init(pc_machine_init);
diff --git a/hw/xen.h b/hw/xen.h
index 1fefe3a..bb4dcb5 100644
--- a/hw/xen.h
+++ b/hw/xen.h
@@ -30,5 +30,11 @@ static inline int xen_enabled(void)
}
int xen_init(void);
+int xen_hvm_init(void);
+void xen_vcpu_init(void);
+
+#if defined(CONFIG_XEN) && CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
+# define HVM_MAX_VCPUS 32
+#endif
#endif /* QEMU_HW_XEN_H */
diff --git a/xen-all.c b/xen-all.c
index e2872f9..0b984b2 100644
--- a/xen-all.c
+++ b/xen-all.c
@@ -9,6 +9,25 @@
#include "hw/xen_common.h"
#include "hw/xen_backend.h"
+/* VCPU Operations, MMIO, IO ring ... */
+
+static void xen_reset_vcpu(void *opaque)
+{
+ CPUState *env = opaque;
+
+ env->halted = 1;
+}
+
+void xen_vcpu_init(void)
+{
+ CPUState *first_cpu;
+
+ if ((first_cpu = qemu_get_cpu(0))) {
+ qemu_register_reset(xen_reset_vcpu, first_cpu);
+ xen_reset_vcpu(first_cpu);
+ }
+}
+
/* Initialise Xen */
int xen_init(void)
@@ -21,3 +40,8 @@ int xen_init(void)
return 0;
}
+
+int xen_hvm_init(void)
+{
+ return 0;
+}
--
1.7.2.3
- [Qemu-devel] [PATCH V13 00/17] Xen device model support, anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 02/17] xen: Make Xen build once., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 05/17] pc_memory_init: Move memory calculation to the caller., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 06/17] xen: Add xenfv machine,
anthony.perard <=
- [Qemu-devel] [PATCH V13 01/17] xen: Replace some tab-indents with spaces (clean-up)., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 03/17] xen: Support new libxc calls from xen unstable., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 04/17] xen: Add initialisation of Xen, anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 08/17] xen: Introduce Xen Interrupt Controller, anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 07/17] piix_pci: Introduces Xen specific call for irq., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 09/17] xen: Introduce the Xen mapcache, anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 10/17] xen: Adds a cap to the number of map cache entries., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 11/17] Introduce qemu_put_ram_ptr, anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 13/17] pci: Use of qemu_put_ram_ptr in pci_add_option_rom., anthony.perard, 2011/04/18
- [Qemu-devel] [PATCH V13 17/17] xen: Add Xen hypercall for sleep state in the cmos_s3 callback., anthony.perard, 2011/04/18