From: Glauber Costa Subject: [PATCH] remove kernel memory allocation code from ipf.c Date: Mon, 8 Sep 2008 16:30:21 -0300 Message-ID: <1220902221-7536-13-git-send-email-gcosta@redhat.com> References: <1220902221-7536-1-git-send-email-gcosta@redhat.com> <1220902221-7536-2-git-send-email-gcosta@redhat.com> <1220902221-7536-3-git-send-email-gcosta@redhat.com> <1220902221-7536-4-git-send-email-gcosta@redhat.com> <1220902221-7536-5-git-send-email-gcosta@redhat.com> <1220902221-7536-6-git-send-email-gcosta@redhat.com> <1220902221-7536-7-git-send-email-gcosta@redhat.com> <1220902221-7536-8-git-send-email-gcosta@redhat.com> <1220902221-7536-9-git-send-email-gcosta@redhat.com> <1220902221-7536-10-git-send-email-gcosta@redhat.com> <1220902221-7536-11-git-send-email-gcosta@redhat.com> <1220902221-7536-12-git-send-email-gcosta@redhat.com> Cc: avi@qumranet.com, aliguori@us.ibm.com, Glauber Costa To: kvm@vger.kernel.org Return-path: Received: from mx2.redhat.com ([66.187.237.31]:58666 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753091AbYIHTfD (ORCPT ); Mon, 8 Sep 2008 15:35:03 -0400 In-Reply-To: <1220902221-7536-12-git-send-email-gcosta@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: From: Glauber Costa Signed-off-by: Glauber Costa --- qemu/hw/ipf.c | 25 +++++-------------------- 1 files changed, 5 insertions(+), 20 deletions(-) diff --git a/qemu/hw/ipf.c b/qemu/hw/ipf.c index 2f7054c..d979d4d 100644 --- a/qemu/hw/ipf.c +++ b/qemu/hw/ipf.c @@ -417,8 +417,7 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, } /* allocate RAM */ -#ifdef KVM_CAP_USER_MEMORY - if (kvm_enabled() && kvm_qemu_check_extension(KVM_CAP_USER_MEMORY)) { + if (kvm_enabled()) { ram_addr = qemu_ram_alloc(0xa0000); cpu_register_physical_memory(0, 0xa0000, ram_addr); kvm_cpu_register_physical_memory(0, 0xa0000, ram_addr); @@ -434,7 +433,6 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, kvm_cpu_register_physical_memory(0x100000, ram_size - 0x100000, ram_addr); } else -#endif { ram_addr = qemu_ram_alloc(ram_size); cpu_register_physical_memory(0, ram_size, ram_addr); @@ -469,23 +467,10 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, } fw_image_start = fw_start + GFW_SIZE - image_size; -#ifdef KVM_CAP_USER_MEMORY - r = kvm_qemu_check_extension(KVM_CAP_USER_MEMORY); - if (r) { - cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset); - kvm_cpu_register_physical_memory(GFW_START,GFW_SIZE, fw_offset); - memcpy(fw_image_start, image, image_size); - } - else -#endif - { - fw_start = kvm_create_phys_mem(kvm_context, (uint32_t)(-image_size), - image_size, 0, 1); - if (!fw_start) - exit(1); - fw_image_start = fw_start + GFW_SIZE - image_size; - memcpy(fw_image_start, image, image_size); - } + cpu_register_physical_memory(GFW_START, GFW_SIZE, fw_offset); + kvm_cpu_register_physical_memory(GFW_START,GFW_SIZE, fw_offset); + memcpy(fw_image_start, image, image_size); + free(image); flush_icache_range((unsigned long)fw_image_start, (unsigned long)fw_image_start + image_size); -- 1.5.5.1