From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:33873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0EqR-0003P3-J2 for qemu-devel@nongnu.org; Sun, 04 Sep 2011 11:42:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0EqQ-0005md-Eu for qemu-devel@nongnu.org; Sun, 04 Sep 2011 11:42:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57856) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0EqQ-0005mV-39 for qemu-devel@nongnu.org; Sun, 04 Sep 2011 11:42:50 -0400 Message-ID: <4E639C72.4020803@redhat.com> Date: Sun, 04 Sep 2011 18:42:42 +0300 From: Avi Kivity MIME-Version: 1.0 References: <20110828134203.GA6751@redhat.com> <4E5A485D.1020904@redhat.com> <20110904123006.GA23500@redhat.com> <4E6371DA.7070304@redhat.com> <20110904130159.GB23500@redhat.com> <4E63778A.6050002@redhat.com> <20110904134101.GA27239@redhat.com> <4E638355.8030903@redhat.com> <20110904142152.GB27239@redhat.com> <4E638D08.10307@redhat.com> <20110904152621.GA30431@redhat.com> In-Reply-To: <20110904152621.GA30431@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] pci: add standard bridge device List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: Kevin Wolf , Isaku Yamahata , qemu-devel@nongnu.org On 09/04/2011 06:26 PM, Michael S. Tsirkin wrote: > On Sun, Sep 04, 2011 at 05:36:56PM +0300, Avi Kivity wrote: > > So long as we're nitpicking ... > > +static void pci_bridge_init_alias(PCIBridge *bridge, MemoryRegion *alias, > + uint8_t type, const char *name, > + MemoryRegion *space, > + MemoryRegion *parent_space) > +{ > + pcibus_t base = pci_bridge_get_base(&bridge->dev, type); > + pcibus_t limit = pci_bridge_get_limit(&bridge->dev, type); > + /* TODO: this doesn't handle base = 0 limit = 2^64 - 1 correctly. > + * Apparent_spacely no way to do this with existing memory APIs. */ Spelling out spaces is a new fashion? > + pcibus_t size = limit>= base ? limit + 1 - base : 0; > + > + memory_region_init_alias(alias, name, space, base, size); > + memory_region_add_subregion_overlap(parent_space, base, alias, 1); > +} > + > > @@ -246,10 +312,14 @@ int pci_bridge_initfn(PCIDevice *dev) > br->bus_name); > sec_bus->parent_dev = dev; > sec_bus->map_irq = br->map_irq; > - /* TODO: use memory API to perform memory filtering. */ > - sec_bus->address_space_mem = parent->address_space_mem; > - sec_bus->address_space_io = parent->address_space_io; > - > + sec_bus->address_space_mem = g_new(MemoryRegion, 1); > + memory_region_init(sec_bus->address_space_mem, "pci_pridge_pci", INT64_MAX); > + sec_bus->address_space_io = g_new(MemoryRegion, 1); > + memory_region_init(sec_bus->address_space_io, "pci_bridge_io", 65536); > + sec_bus->alias_pref_mem = g_new(MemoryRegion, 1); > + sec_bus->alias_mem = g_new(MemoryRegion, 1); > + sec_bus->alias_io = g_new(MemoryRegion, 1); Why pointers? Regular fields require less upkeep. -- error compiling committee.c: too many arguments to function