From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M9KeO-0003rU-4y for qemu-devel@nongnu.org; Wed, 27 May 2009 11:02:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M9KeJ-0003pv-59 for qemu-devel@nongnu.org; Wed, 27 May 2009 11:02:39 -0400 Received: from [199.232.76.173] (port=48183 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M9KeI-0003pq-Rp for qemu-devel@nongnu.org; Wed, 27 May 2009 11:02:34 -0400 Received: from mx2.redhat.com ([66.187.237.31]:33940) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1M9KeI-0002gc-4f for qemu-devel@nongnu.org; Wed, 27 May 2009 11:02:34 -0400 Message-ID: <4A1D5604.60003@redhat.com> Date: Wed, 27 May 2009 18:02:28 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 2/3] Add PCI memory region registration References: <1243157375-14329-1-git-send-email-avi@redhat.com> <1243157375-14329-3-git-send-email-avi@redhat.com> <4A1D4961.1010903@us.ibm.com> In-Reply-To: <4A1D4961.1010903@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org Anthony Liguori wrote: >> >> +PCIIORegionComponent *pci_register_physical_memory(PCIDevice *pci_dev, >> + int region_num, >> + >> target_phys_addr_t size, >> + ram_addr_t >> ram_addr); >> > > PCI devices should not care about physical memory. They should only > care about IO regions. It ought to look something like: > > enum { > PCI_REGION_IO, > PCI_REGION_MEM, > }; > > typedef struct PCIIOFunction > { > uint32_t (*read)(void *opaque, uint64_t offset, int size); > void (*write)(void *opaque, uint64_t offset, int size, uint64_t value); > } PCIIOFunction; That doesn't work for direct-mapped memory like the cirrus framebuffer or host devices. I also don't think we need to add another layer of indirection here (for traditional callback based regions), where the physical memory layer calls one set of callbacks which calls the PCIIOFunction callbacks. > > pci_register_io_region(PCIDevice *pci_dev, > int region_num, > int region_type, > int order, > PCIIOFunction *io_func, > void *opaque); > > The current PCI map API goes away. At the end of the conversion, yes. > Devices don't have to know anything about that. Special handling for > PIO/MMIO for PCI devices also go away. Devices can register > PCI_REGION_IO regions and they'll be automatically mapped to MMIO for > non-x86 architectures. This means a lot of current PCI devices can be > built once instead of being built for each architecture. That too can be handled at the physical memory layer by allocating a dedicated ram address with callbacks to do the translation. That fixes non-pci too (ia64 does it in qemu-kvm.git). > If you want, we can setup a temporary branch in qemu to stage the > conversion. I'm willing to help do the conversion too. It's now memory-tracking in qemu-kvm.git (a rebasable branch, so don't branch off it). Patches welcome. -- error compiling committee.c: too many arguments to function