Skip to content

Commit

Permalink
pc: Initializing ram_memory under Xen.
Browse files Browse the repository at this point in the history
Signed-off-by: Anthony PERARD <[email protected]>
Signed-off-by: Stefano Stabellini <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
CC: [email protected]
  • Loading branch information
anthonyper-ctx authored and Stefano Stabellini committed Sep 9, 2013
1 parent df71316 commit 04d7bad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion hw/i386/pc_piix.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
FWCfgState *fw_cfg = NULL;
PcGuestInfo *guest_info;

if (xen_enabled() && xen_hvm_init() != 0) {
if (xen_enabled() && xen_hvm_init(&ram_memory) != 0) {
fprintf(stderr, "xen hardware virtual machine initialisation failed\n");
exit(1);
}
Expand Down
4 changes: 1 addition & 3 deletions include/hw/xen/xen.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ void xen_cmos_set_s3_resume(void *opaque, int irq, int level);
qemu_irq *xen_interrupt_controller_init(void);

int xen_init(void);
int xen_hvm_init(void);
int xen_hvm_init(MemoryRegion **ram_memory);
void xenstore_store_pv_console_info(int i, struct CharDriverState *chr);

#if defined(NEED_CPU_H) && !defined(CONFIG_USER_ONLY)
struct MemoryRegion;
void xen_ram_alloc(ram_addr_t ram_addr, ram_addr_t size,
struct MemoryRegion *mr);
void xen_modified_memory(ram_addr_t start, ram_addr_t length);
#endif

struct MemoryRegion;
void xen_register_framebuffer(struct MemoryRegion *mr);

#if defined(CONFIG_XEN) && CONFIG_XEN_CTRL_INTERFACE_VERSION < 400
Expand Down
7 changes: 4 additions & 3 deletions xen-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ qemu_irq *xen_interrupt_controller_init(void)

/* Memory Ops */

static void xen_ram_init(ram_addr_t ram_size)
static void xen_ram_init(ram_addr_t ram_size, MemoryRegion **ram_memory_p)
{
MemoryRegion *sysmem = get_system_memory();
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
Expand All @@ -168,6 +168,7 @@ static void xen_ram_init(ram_addr_t ram_size)
block_len += HVM_BELOW_4G_MMIO_LENGTH;
}
memory_region_init_ram(&ram_memory, NULL, "xen.ram", block_len);
*ram_memory_p = &ram_memory;
vmstate_register_ram_global(&ram_memory);

if (ram_size >= HVM_BELOW_4G_RAM_END) {
Expand Down Expand Up @@ -1059,7 +1060,7 @@ static void xen_read_physmap(XenIOState *state)
free(entries);
}

int xen_hvm_init(void)
int xen_hvm_init(MemoryRegion **ram_memory)
{
int i, rc;
unsigned long ioreq_pfn;
Expand Down Expand Up @@ -1134,7 +1135,7 @@ int xen_hvm_init(void)

/* Init RAM management */
xen_map_cache_init(xen_phys_offset_to_gaddr, state);
xen_ram_init(ram_size);
xen_ram_init(ram_size, ram_memory);

qemu_add_vm_change_state_handler(xen_hvm_change_state_handler, state);

Expand Down
2 changes: 1 addition & 1 deletion xen-stub.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void xen_modified_memory(ram_addr_t start, ram_addr_t length)
{
}

int xen_hvm_init(void)
int xen_hvm_init(MemoryRegion **ram_memory)
{
return 0;
}

0 comments on commit 04d7bad

Please sign in to comment.