From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=59261 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OGdq2-0007tS-IS for qemu-devel@nongnu.org; Mon, 24 May 2010 16:01:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OGdpb-0006e8-93 for qemu-devel@nongnu.org; Mon, 24 May 2010 16:01:26 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:41661) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OGdpW-0006dI-UH for qemu-devel@nongnu.org; Mon, 24 May 2010 16:00:56 -0400 Received: by pvg16 with SMTP id 16so139179pvg.4 for ; Mon, 24 May 2010 13:00:53 -0700 (PDT) Message-ID: <4BFADAF1.5000108@codemonkey.ws> Date: Mon, 24 May 2010 15:00:49 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH, RFC 2/4] Convert PCI devices to use pci_register_memory() References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: qemu-devel On 05/23/2010 03:34 PM, Blue Swirl wrote: > Signed-off-by: Blue Swirl > --- > hw/cirrus_vga.c | 12 ++++++------ > hw/e1000.c | 2 +- > hw/eepro100.c | 2 +- > hw/isa.h | 1 + > hw/isa_mmio.c | 18 ++++++++++++++++-- > hw/lsi53c895a.c | 4 ++-- > hw/macio.c | 24 ++++++++++++------------ > hw/msix.c | 4 ++-- > hw/openpic.c | 6 +++--- > hw/pcnet.c | 3 ++- > hw/rtl8139.c | 2 +- > hw/sun4u.c | 7 +++++-- > hw/usb-ohci.c | 2 +- > hw/vga-pci.c | 4 ++-- > hw/vmware_vga.c | 7 +++---- > hw/wdt_i6300esb.c | 2 +- > 16 files changed, 59 insertions(+), 41 deletions(-) > > diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c > index ba48289..52e51e0 100644 > --- a/hw/cirrus_vga.c > +++ b/hw/cirrus_vga.c > @@ -3145,10 +3145,10 @@ static void cirrus_pci_lfb_map(PCIDevice *d, > int region_num, > CirrusVGAState *s =&DO_UPCAST(PCICirrusVGAState, dev, d)->cirrus_vga; > > /* XXX: add byte swapping apertures */ > - cpu_register_physical_memory(addr, s->vga.vram_size, > - s->cirrus_linear_io_addr); > - cpu_register_physical_memory(addr + 0x1000000, 0x400000, > - s->cirrus_linear_bitblt_io_addr); > + pci_register_memory(d->bus, addr, s->vga.vram_size, > + s->cirrus_linear_io_addr); > + pci_register_memory(d->bus, addr + 0x1000000, 0x400000, > + s->cirrus_linear_bitblt_io_addr); > It would probably be better to pass the PCIDevice instead of the bus. That would allow a per-device PCI IOMMU to be used (such as emulated VT-d). Ultimately, I don't think devices should be handling their IO region mappings but I think this could be a reasonable intermediate solution. Regards, Anthony Liguori