Received: from [140.186.70.92] (port=38419 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OOiI5-0002mU-6i for qemu-devel@nongnu.org; Tue, 15 Jun 2010 22:23:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OOiI3-0005Lr-SZ for qemu-devel@nongnu.org; Tue, 15 Jun 2010 22:23:45 -0400 Received: from mail.valinux.co.jp ([210.128.90.3]:47065) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OOiI3-0005LK-Kc for qemu-devel@nongnu.org; Tue, 15 Jun 2010 22:23:43 -0400 Date: Wed, 16 Jun 2010 11:20:02 +0900 From: Isaku Yamahata Message-ID: <20100616022002.GB7932@valinux.co.jp> References: <20100615091207.GA1365@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100615091207.GA1365@redhat.com> Subject: [Qemu-devel] Re: [PATCH 2/2] pci: don't overwrite pci header type. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: blauwirbel@gmail.com, qemu-devel@nongnu.org On Tue, Jun 15, 2010 at 12:12:07PM +0300, Michael S. Tsirkin wrote: > On Tue, Jun 15, 2010 at 02:06:46PM +0900, Isaku Yamahata wrote: > > Don't overwrite pci header type. > > Otherwise, multi function bit which pci_init_header_type() sets > > appropriately is lost. > > Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero > > which is already zero cleared. > > > > Signed-off-by: Isaku Yamahata > > ... > > > diff --git a/hw/apb_pci.c b/hw/apb_pci.c > > index 31c8d70..cdf3bc2 100644 > > --- a/hw/apb_pci.c > > +++ b/hw/apb_pci.c > > @@ -428,7 +428,8 @@ static int pbm_pci_host_init(PCIDevice *d) > > PCI_STATUS_DEVSEL_MEDIUM); > > pci_config_set_class(d->config, PCI_CLASS_BRIDGE_HOST); > > pci_set_byte(d->config + PCI_HEADER_TYPE, > > - PCI_HEADER_TYPE_NORMAL); > > + (pci_get_byte(d->config + PCI_HEADER_TYPE) & > > + PCI_HEADER_TYPE_MULTI_FUNCTION) | PCI_HEADER_TYPE_NORMAL); > > what is this doing? It changes the header type to normal device(bit 1-7) without overwriting multi function bit(bit 8). Apb host bridge specifies PCI_HEADER_TYPE_BRIDGE in PCIDeviceInfo, on the other hand pbc_pci_host_init() sets the register to PCI_HEADER_TYPE_NORMAL. To be honest I don't know why it does so, but that is what Blue wants. So I touch only multi function bit(bit 8) and leave other bit (bit 1-7) unchanged. If you don't like this hunk, I'll drop this hunk and leave it to Blue. What do you think? static PCIDeviceInfo pbm_pci_host_info = { .qdev.name = "pbm", .qdev.size = sizeof(PCIDevice), .init = pbm_pci_host_init, .header_type = PCI_HEADER_TYPE_BRIDGE, <<<<< Here }; -- yamahata