Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lplw9-0003i0-RB for qemu-devel@nongnu.org; Fri, 03 Apr 2009 12:08:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lplw4-0003gU-QO for qemu-devel@nongnu.org; Fri, 03 Apr 2009 12:08:09 -0400 Received: from [199.232.76.173] (port=37627 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lplw4-0003gN-GW for qemu-devel@nongnu.org; Fri, 03 Apr 2009 12:08:04 -0400 Received: from belushi.uits.indiana.edu ([129.79.1.188]:50720) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lplw3-0004X6-GI for qemu-devel@nongnu.org; Fri, 03 Apr 2009 12:08:04 -0400 Subject: Re: [Qemu-devel] PATCH/RFC: PCI memory mapping From: Brian Wheeler In-Reply-To: <200904031628.45716.paul@codesourcery.com> References: <1238684238.18745.17.camel@nibbler.dlib.indiana.edu> <200904022340.35427.paul@codesourcery.com> <1238771149.28860.75.camel@nibbler.dlib.indiana.edu> <200904031628.45716.paul@codesourcery.com> Content-Type: text/plain Date: Fri, 03 Apr 2009 12:01:35 -0400 Message-Id: <1238774495.28860.91.camel@nibbler.dlib.indiana.edu> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paul Brook Cc: qemu-devel@nongnu.org On Fri, 2009-04-03 at 15:28 +0000, Paul Brook wrote: > > So, for example, a cirrus vga device on bus 1 when calling: > > > > cpu_register_physical_memory(addr, s->vram_size, > > s->cirrus_linear_io_addr); > > Ah, that's a different (but somewhat related) problem. This is for accesses > from the CPU to the device. Most current IOMMU effect device->CPU > accesses[1]. > Ok, so is there an official work around for this one? Right now we've hacked around it by just adding pci_mem_base to it during that call but that limits us to one bus and it requires patching all of the pci devices we use. Would a patch implementing this API be acceptable? -------------- typedef target_phys_addr_t (*pci_map_addr_fn)(void *opaque, PCIDevice *device, target_phys_addr_t addr, ram_addr_t len); void pci_register_address_mapper(PCIBus *bus, pci_map_addr_fn map_addr, void *opaque); static inline int pci_register_physical_memory(PCIDevice *device, target_phys_addr_t start_addr, ram_addr_t size, ram_addr_t phys_offset); ---------------- The pci_register_physical_memory would call the callback (if any) to generate the appropriate physical address. So, the cirrus example above would be changed to: pci_register_physical_memory(addr, s->vram_size, s->cirrus_linear_io_addr); which would (on the PC and others) just map addr to itself. On any architecture which registered an address mapper, the address actually mapped would be generated. Thanks! Brian > Paul > > [1] For practical purposes assume the the CPU and system ram are on the same > bus.