From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Date: Tue, 28 Apr 2009 09:49:48 +0000 Subject: Re: [PATCH 03/04] qemu-kvm: Remove the dependency for phys_ram_base Message-Id: <49F6D13C.1060908@redhat.com> List-Id: References: <706158FABBBA044BAD4FE898A02E4BC236A2BC04@pdsmsx503.ccr.corp.intel.com> In-Reply-To: <706158FABBBA044BAD4FE898A02E4BC236A2BC04@pdsmsx503.ccr.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: kvm-ia64@vger.kernel.org Zhang, Xiantao wrote: > From aaf97331da3d6cd34522441218c8c9ab3c1067f6 Mon Sep 17 00:00:00 2001 > From: Xiantao Zhang > Date: Tue, 28 Apr 2009 16:55:47 +0800 > Subject: [PATCH] qemu-kvm: Remove the dependency for phys_ram_base for ipf.c > > Upstream has dropped phys_ram_base, so ia64 also remove > the dependency for that. > > +++ b/hw/ipf.c > @@ -54,7 +54,8 @@ static fdctrl_t *floppy_controller; > static RTCState *rtc_state; > static PCIDevice *i440fx_state; > > -uint8_t *g_fw_start; > +ram_addr_t gfw_start; > + > static uint32_t ipf_to_legacy_io(target_phys_addr_t addr) > { > return (uint32_t)(((addr&0x3ffffff) >> 12 << 2)|((addr) & 0x3)); > @@ -454,15 +455,15 @@ static void ipf_init1(ram_addr_t ram_size, int vga_ram_size, > if (kvm_enabled()) { > unsigned long image_size; > char *image = NULL; > - uint8_t *fw_image_start; > + ram_addr_t fw_image_start; > unsigned long nvram_addr = 0; > unsigned long nvram_fd = 0; > unsigned long type = READ_FROM_NVRAM; > unsigned long i = 0; > - ram_addr_t fw_offset = qemu_ram_alloc(GFW_SIZE); > - uint8_t *fw_start = phys_ram_base + fw_offset; > > - g_fw_start = fw_start; > + ram_addr = qemu_ram_alloc(GFW_SIZE); > + gfw_start = (ram_addr_t)qemu_get_ram_ptr(ram_addr); > qemu_get_ram_ptr() returns a pointer. Don't cast it to a ram_addr_t, leave it a pointer. But why not use cpu_physical_memory_write() (or cpu_physical_memory_write_rom())? It's much simpler and cleaner. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.