Merge remote-tracking branch 'sstabellini/xen-20130625' into staging

# By Paul Durrant (2) and Stefano Stabellini (1)
# Via Stefano Stabellini
* sstabellini/xen-20130625:
  Move hardcoded initialization of xen-platform device.
  Allow use of pc machine type (accel=xen) for Xen HVM domains.
  Revert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"

Message-id: alpine.DEB.2.02.1306251323220.4782@kaball.uk.xensource.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2013-06-25 14:14:00 -05:00
commit 1e5b86804c
4 changed files with 26 additions and 18 deletions

View File

@ -91,6 +91,11 @@ static void pc_init1(MemoryRegion *system_memory,
DeviceState *icc_bridge;
FWCfgState *fw_cfg = NULL;
if (xen_enabled() && xen_hvm_init() != 0) {
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
exit(1);
}
icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
object_property_add_child(qdev_get_machine(), "icc-bridge",
OBJECT(icc_bridge), NULL);
@ -102,9 +107,9 @@ static void pc_init1(MemoryRegion *system_memory,
kvmclock_create();
}
if (ram_size >= QEMU_BELOW_4G_RAM_END ) {
above_4g_mem_size = ram_size - QEMU_BELOW_4G_RAM_END;
below_4g_mem_size = QEMU_BELOW_4G_RAM_END;
if (ram_size >= 0xe0000000 ) {
above_4g_mem_size = ram_size - 0xe0000000;
below_4g_mem_size = 0xe0000000;
} else {
above_4g_mem_size = 0;
below_4g_mem_size = ram_size;
@ -174,9 +179,6 @@ static void pc_init1(MemoryRegion *system_memory,
pc_register_ferr_irq(gsi[13]);
pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
if (xen_enabled()) {
pci_create_simple(pci_bus, -1, "xen-platform");
}
/* init basic PC hardware */
pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled());
@ -320,10 +322,14 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
#ifdef CONFIG_XEN
static void pc_xen_hvm_init(QEMUMachineInitArgs *args)
{
if (xen_hvm_init() != 0) {
hw_error("xen hardware virtual machine initialisation failed");
}
PCIBus *bus;
pc_init_pci(args);
bus = pci_find_root_bus(0);
if (bus != NULL) {
pci_create_simple(bus, -1, "xen-platform");
}
}
#endif

View File

@ -79,9 +79,6 @@ extern int fd_bootchk;
void pc_register_ferr_irq(qemu_irq irq);
void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
#define QEMU_BELOW_4G_RAM_END 0xe0000000
#define QEMU_BELOW_4G_MMIO_LENGTH ((1ULL << 32) - QEMU_BELOW_4G_RAM_END)
void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge);
void pc_hot_add_cpu(const int64_t id, Error **errp);
void pc_acpi_init(const char *default_dsdt);

View File

@ -161,18 +161,18 @@ static void xen_ram_init(ram_addr_t ram_size)
ram_addr_t block_len;
block_len = ram_size;
if (ram_size >= QEMU_BELOW_4G_RAM_END) {
if (ram_size >= HVM_BELOW_4G_RAM_END) {
/* Xen does not allocate the memory continuously, and keep a hole at
* QEMU_BELOW_4G_RAM_END of QEMU_BELOW_4G_MMIO_LENGTH
* HVM_BELOW_4G_MMIO_START of HVM_BELOW_4G_MMIO_LENGTH
*/
block_len += QEMU_BELOW_4G_MMIO_LENGTH;
block_len += HVM_BELOW_4G_MMIO_LENGTH;
}
memory_region_init_ram(&ram_memory, "xen.ram", block_len);
vmstate_register_ram_global(&ram_memory);
if (ram_size >= QEMU_BELOW_4G_RAM_END) {
above_4g_mem_size = ram_size - QEMU_BELOW_4G_RAM_END;
below_4g_mem_size = QEMU_BELOW_4G_RAM_END;
if (ram_size >= HVM_BELOW_4G_RAM_END) {
above_4g_mem_size = ram_size - HVM_BELOW_4G_RAM_END;
below_4g_mem_size = HVM_BELOW_4G_RAM_END;
} else {
below_4g_mem_size = ram_size;
}

View File

@ -63,3 +63,8 @@ void qmp_xen_set_global_dirty_log(bool enable, Error **errp)
void xen_modified_memory(ram_addr_t start, ram_addr_t length)
{
}
int xen_hvm_init(void)
{
return 0;
}