From 60e4c6317b8773d987729401aeca9d8c6b61b05f Mon Sep 17 00:00:00 2001 From: Avi Kivity Date: Wed, 24 Feb 2010 18:11:19 -0300 Subject: Allocate memory below 4GB as one chunk Instead of allocating a separate chunk for the first 640KB and another for 1MB+, allocate one large chunk. This plays well in terms of alignment and size with large pages. Signed-off-by: Avi Kivity Signed-off-by: Marcelo Tosatti --- hw/pc.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'hw/pc.c') diff --git a/hw/pc.c b/hw/pc.c index 4f6a5228fd..bdc297f717 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -833,18 +833,11 @@ static void pc_init1(ram_addr_t ram_size, vmport_init(); /* allocate RAM */ - ram_addr = qemu_ram_alloc(0xa0000); + ram_addr = qemu_ram_alloc(below_4g_mem_size); cpu_register_physical_memory(0, 0xa0000, ram_addr); - - /* Allocate, even though we won't register, so we don't break the - * phys_ram_base + PA assumption. This range includes vga (0xa0000 - 0xc0000), - * and some bios areas, which will be registered later - */ - ram_addr = qemu_ram_alloc(0x100000 - 0xa0000); - ram_addr = qemu_ram_alloc(below_4g_mem_size - 0x100000); cpu_register_physical_memory(0x100000, below_4g_mem_size - 0x100000, - ram_addr); + ram_addr + 0x100000); /* above 4giga memory allocation */ if (above_4g_mem_size > 0) { -- cgit 1.4.1 From 6cb2996cef5e273ef370e690e84b5e1403f5c391 Mon Sep 17 00:00:00 2001 From: Jan Kiszka Date: Mon, 1 Mar 2010 19:10:32 +0100 Subject: x86: Extend validity of bsp_to_cpu As we hard-wire the BSP to CPU 0 anyway and cpuid_apic_id equals cpu_index, bsp_to_cpu can also be based on the latter directly. This will help an early user of it: KVM while initializing mp_state. Signed-off-by: Jan Kiszka Signed-off-by: Marcelo Tosatti --- hw/pc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'hw/pc.c') diff --git a/hw/pc.c b/hw/pc.c index bdc297f717..e50a48848d 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -760,7 +760,8 @@ static void pc_init_ne2k_isa(NICInfo *nd) int cpu_is_bsp(CPUState *env) { - return env->cpuid_apic_id == 0; + /* We hard-wire the BSP to the first CPU. */ + return env->cpu_index == 0; } static CPUState *pc_new_cpu(const char *cpu_model) -- cgit 1.4.1