From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KxRMZ-00055a-Vl for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:14:52 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KxRMY-00054q-Q5 for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:14:51 -0500 Received: from [199.232.76.173] (port=51082 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KxRMY-00054f-KO for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:14:50 -0500 Received: from yw-out-1718.google.com ([74.125.46.153]:64834) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KxRMX-0008MG-Ln for qemu-devel@nongnu.org; Tue, 04 Nov 2008 14:14:50 -0500 Received: by yw-out-1718.google.com with SMTP id 6so1155142ywa.82 for ; Tue, 04 Nov 2008 11:14:48 -0800 (PST) Message-ID: Date: Tue, 4 Nov 2008 21:14:47 +0200 From: "Blue Swirl" In-Reply-To: <200811041527.mA4FRPo2005575@smtp12.dti.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <490D0C8F.9010601@juno.dti.ne.jp> <200811041527.mA4FRPo2005575@smtp12.dti.ne.jp> Subject: [Qemu-devel] Re: When should I use qemu_ram_alloc(), and how? Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "takasi-y@ops.dti.ne.jp" Cc: qemu-devel@nongnu.org On 11/4/08, takasi-y@ops.dti.ne.jp wrote: > Hi, > # Reusing thread, to video memory allocation related question. > Could you please give me answer to my question ? > > Attached diff is for adding cirrus_vga onto r2d, for explanatin. > The point is here. > - cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, 0); > + r = qemu_ram_alloc(SDRAM_SIZE); > + cpu_register_physical_memory(SDRAM_BASE, SDRAM_SIZE, r); Well, I haven't been using qemu_ram_alloc on Sparc but instead used direct offsets. Maybe I should convert. Also, all ram allocation should be done using qemu_ram_alloc (especially system RAM), not just some devices. > Apparently, r2d had not used qemu_ram_alloc() (it is working, though). > I added it here without knowing well about qemu memory system > (this one is working fine, too). > > Maybe, allocation is needed always(even when without VGA), isn't it? I don't think so, unallocated memory will be just unused. > Are there any restriction between alloced address and register address? > I am worried about it because PC seems to make them equal. There are some code that assumes that CPU address for RAM can be converted to host address using phys_ram_base + CPU address. > - pci_register_io_region((PCIDevice *)d, 0, 0x2000000, > + pci_register_io_region((PCIDevice *)d, 0, vga_ram_size, To me this change looks OK, but I think it should be separate and the PC folks should consider if it breaks something.