From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:45228) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0Dop-0007nQ-5e for qemu-devel@nongnu.org; Sun, 04 Sep 2011 10:37:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R0Doo-0002Lh-79 for qemu-devel@nongnu.org; Sun, 04 Sep 2011 10:37:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:8054) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R0Don-0002LQ-VA for qemu-devel@nongnu.org; Sun, 04 Sep 2011 10:37:06 -0400 Message-ID: <4E638D08.10307@redhat.com> Date: Sun, 04 Sep 2011 17:36:56 +0300 From: Avi Kivity MIME-Version: 1.0 References: <20110828114142.GC4875@redhat.com> <4E5A3E36.4010709@redhat.com> <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> In-Reply-To: <20110904142152.GB27239@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 05:21 PM, Michael S. Tsirkin wrote: > > > > > >+static pcibus_t pci_bridge_get_size(const PCIDevice *bridge, uint8_t type) > > >+{ > > >+ return pci_bridge_get_limit(bridge, type)>= > > >+ pci_bridge_get_base(bridge, type) ? > > >+ pci_bridge_get_limit(bridge, type) - > > >+ pci_bridge_get_base(bridge, type) + 1 : 0; > > >+} > > > > Correct > > To make sure: 0 size is ok? Yes. > > > but unreadable. > > variables will make it clearer. > > base = pci_bridge_get_base(bridge, type); > limit = pci_bridge_get_limit(bridge, type); > return limit>= bridge ? limit - base + 1 : 0; So long as we're nitpicking, limit + 1 - base. > > > > Doesn't work for limit == 2^64-1, is this a > > possible value? > > You mean when base == 0? Yes, but what can I do? > This seems to be an API limitation of the memory API: > memory_region_init(sec_bus->address_space_mem, "pci_pridge_pci", INT64_MAX); > and the same for aliases: max size seems to be INT64_MAX, > the last byte isn't covered. Right. > The only way to fix this would be to pass first/last instead > of offset/size. Too late for such an API change? Way too late. And also won't work, since often the offset is determined by one party and the size by another. > VGA I/O addresses (including ISA aliases address - AD[15::10] are not > decoded): > AD[9::0] = 3B0h through 3BBh and 3C0h through 3DFh These "not decoded" bits mean you need to instantiate tons of aliases to implement correctly. I plan to add core support for that eventually. -- error compiling committee.c: too many arguments to function