From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MAjYW-0001gj-8F for qemu-devel@nongnu.org; Sun, 31 May 2009 07:50:24 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MAjYR-0001e2-E5 for qemu-devel@nongnu.org; Sun, 31 May 2009 07:50:23 -0400 Received: from [199.232.76.173] (port=37666 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MAjYR-0001do-9w for qemu-devel@nongnu.org; Sun, 31 May 2009 07:50:19 -0400 Received: from mx2.redhat.com ([66.187.237.31]:53299) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MAjYQ-0003kX-Ov for qemu-devel@nongnu.org; Sun, 31 May 2009 07:50:19 -0400 Message-ID: <4A226EF2.7040405@redhat.com> Date: Sun, 31 May 2009 14:50:10 +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> <4A1D5604.60003@redhat.com> <4A1D5837.3010705@us.ibm.com> <4A1D5B44.3040207@redhat.com> <4A1DBFC1.6060603@codemonkey.ws> <20090531110253.GA13812@lst.de> In-Reply-To: <20090531110253.GA13812@lst.de> 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: Christoph Hellwig Cc: Anthony Liguori , qemu-devel@nongnu.org Christoph Hellwig wrote: > On Wed, May 27, 2009 at 05:33:37PM -0500, Anthony Liguori wrote: > >> pci_register_io_region(&d->dev, 0, 0x100, >> PCI_ADDRESS_SPACE_IO, rtl8139_ioport_read, >> rtl8139_ioport_write, s); >> >> pci_register_io_region(&d->dev, 1, 0x100, >> PCI_ADDRESS_SPACE_MEM, rtl8139_mmio_read, >> rtl8139_mmio_write, s); >> >> Moreover, you could probably drop the opaque parameter and and just use >> d->dev. I hope it's possible to get from one to the other. >> > > I also think this is a much more natural API, and would simplify drivers > a lot. As for the naming the PCI spec uses the term bar for these > PIO/MMIO regions, so maybe call it pci_register_bar or pci_setup_bar? > Note that this sets up an io region within a BAR, not a complete BAR. Currently PCI IO is a three stage setup process: - set up BAR - set up ram_addr - set up mapping between BAR and ram_addr We'll need to keep this flexibility. I agree that helpers that collapse all three changes will help the majority of devices. -- error compiling committee.c: too many arguments to function