From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NeaHX-0001da-Om for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:32:31 -0500 Received: from [199.232.76.173] (port=52702 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NeaHX-0001dC-5x for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:32:31 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NeaHV-0002j5-Kw for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:32:30 -0500 Received: from mail-iw0-f185.google.com ([209.85.223.185]:61224) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NeaHV-0002ip-Bo for qemu-devel@nongnu.org; Mon, 08 Feb 2010 15:32:29 -0500 Received: by iwn15 with SMTP id 15so4256720iwn.19 for ; Mon, 08 Feb 2010 12:32:28 -0800 (PST) Message-ID: <4B7074DA.10408@codemonkey.ws> Date: Mon, 08 Feb 2010 14:32:26 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] Re: [PATCH] pci: initialize header type register. References: <20100208101753.GA14662@redhat.com> <4B6FF203.6010304@redhat.com> <20100208162753.GA28230@redhat.com> <4B7048E9.6000706@redhat.com> <20100208173204.GA10716@redhat.com> <4B704BE5.9010205@redhat.com> <20100208173741.GB10716@redhat.com> <20100208182624.GD10716@redhat.com> <4B706C4E.2010508@redhat.com> <20100208201919.GA17088@redhat.com> In-Reply-To: <20100208201919.GA17088@redhat.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: "Michael S. Tsirkin" Cc: Blue Swirl , Isaku Yamahata , Gerd Hoffmann , qemu-devel@nongnu.org On 02/08/2010 02:19 PM, Michael S. Tsirkin wrote: > On Mon, Feb 08, 2010 at 08:55:58PM +0100, Gerd Hoffmann wrote: > >> Hi, >> >> >>> This still means we have two copies of same data >>> and need to maintain code that keeps them in sync, >>> even if that is called just at init time. >>> >> No. There is nothing to keep in sync. And there is no extra copy of data. >> >> Today you have pci_set_*() calls somewhere in PCIDeviceInfo->init(). >> I'd like to see them replaced with PCIDeviceInfo->$field + setup in >> common code. The information that device $foo has vendor id 42 and >> device id 4711 (and other properties) just moves from code to data. >> > We still need it in config array which is read by guest. > So that is two places. > There's no reason that we couldn't make the config space read like all of the other spaces we support. IOW, instead of using an array to store the data, store each element in a structure, and have a big switch(). I'm not sure one's better than the other though TBH. I think just universally moving to a set of accessors that took a PCIDevice as an argument in the form of pci_device_set_vendor() would be a big improvement. Regards, Anthony Liguori