Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NevBa-0002uB-CE for qemu-devel@nongnu.org; Tue, 09 Feb 2010 13:51:46 -0500 Received: from [199.232.76.173] (port=43388 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NevBa-0002u3-0V for qemu-devel@nongnu.org; Tue, 09 Feb 2010 13:51:46 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NevBZ-0005px-4w for qemu-devel@nongnu.org; Tue, 09 Feb 2010 13:51:45 -0500 Received: from mail-pz0-f187.google.com ([209.85.222.187]:33208) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NevBY-0005pi-PQ for qemu-devel@nongnu.org; Tue, 09 Feb 2010 13:51:45 -0500 Received: by pzk17 with SMTP id 17so205419pzk.4 for ; Tue, 09 Feb 2010 10:51:43 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20100209030215.GH22624@valinux.co.jp> References: <20100208064038.GC22624@valinux.co.jp> <20100208103709.GA15957@redhat.com> <20100209030215.GH22624@valinux.co.jp> From: Blue Swirl Date: Tue, 9 Feb 2010 20:51:20 +0200 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: [PATCH] pci: fix info pci with host bridge. List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Isaku Yamahata Cc: qemu-devel@nongnu.org, "Michael S. Tsirkin" On Tue, Feb 9, 2010 at 5:02 AM, Isaku Yamahata wro= te: > On Mon, Feb 08, 2010 at 07:23:34PM +0200, Blue Swirl wrote: >> On Mon, Feb 8, 2010 at 12:37 PM, Michael S. Tsirkin wro= te: >> > On Mon, Feb 08, 2010 at 03:40:38PM +0900, Isaku Yamahata wrote: >> >> This patch fixes 525e05147d5a3bdc08caa422d108c1ef71b584b5. >> >> pci host bridge doesn't have header type of bridge. >> >> The check should be by header type, instead of pci class device. >> >> >> >> Cc: Blue Swirl >> >> Cc: "Michael S. Tsirkin" >> >> Signed-off-by: Isaku Yamahata >> > >> > So the effect of this will be that info pci won't report >> > host bridge, right? IOW, it kind of reverts >> > 525e05147d5a3bdc08caa422d108c1ef71b584b5, or am I >> > missing something? >> >> Yes, it breaks info pci. PBM/APB does not use PCI_HEADER_TYPE_BRIDGE. > > Devices of pci host bridge class (!=3D PCI-PCI bridge) don't have > header type PCI_HEADER_TYPE_BRIDGE (=3D 1), but PCI_HEADER_TYPE_NORMAL (= =3D 0). > In fact, i440fx pci host bridge is of PCI_HEADER_TYPE_NORMAL. > You can see it in piix_pci.c. > Registers of offset 0x10-0x3F in configuration space are used > differently depending on header type. > For example, PCI_HEADER_TYPE_NORMAL device don't have primary bus registe= r, > secondary bus register and so on. Those registers are used as BAR2. > It doesn't make senses to show BAR2 as bus numbers. > > Having said that, I'm confused. So I downloaded > "UltraSPARC IIi User's Manual", 805-0087.pdf. > Page 301, table 19-12, section 19l.3.1 says that its header type is 0x0. > (=3D PCI_HEADER_TYPE_Normal). > > cited from table 19-12. > > offset > 0x10-0x27 =C2=A0 =C2=A0 =C2=A0 Base Address > 0x28-0x2F =C2=A0 =C2=A0 =C2=A0 Reserved > 0x30-0x34 =C2=A0 =C2=A0 =C2=A0 Expansion ROM > 0x34-0x3b =C2=A0 =C2=A0 =C2=A0 Reserved > 0x3e =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MIN_GNT > 0x3f =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MAX_LAT > ... > > So it doesn't make sense to access those registers as > primary bus number, etc... > However the manual also says that those shaded registers aren't implement= ed. > Maybe it would make sense to use those unused/unimplemented registers > for registers of header type 1 in PBM emulation. > This is what you want to do, Right? > > Probably what you want in pci_info_device() is something like > "if (type =3D=3D PCI_HEADER_TYPE_BRIDGE || > =C2=A0 =C2=A0(vendorid =3D=3D PCI_VENDOR_ID_SUN && deviceid =3D=3D PCI_DE= VICE_ID_SUN_SABRE))" > > This is ugly, so introducing device specific info callback? Or maybe header should be of normal type and the secondary/subordinate registers should not be used like they would be with a PCI-PCI bridge. In that case maybe the bus number checks are not correct, or perhaps OpenBIOS PCI code is wrong.