From owner-freebsd-emulation@FreeBSD.ORG Thu Sep 6 21:35:08 2012 Return-Path: Delivered-To: emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7A3D6106566B; Thu, 6 Sep 2012 21:35:08 +0000 (UTC) (envelope-from gperez@entel.upc.edu) Received: from violet.upc.es (violet.upc.es [147.83.2.51]) by mx1.freebsd.org (Postfix) with ESMTP id A73048FC08; Thu, 6 Sep 2012 21:35:07 +0000 (UTC) Received: from ackerman2.upc.es (ackerman2.upc.es [147.83.2.244]) by violet.upc.es (8.14.1/8.13.1) with ESMTP id q86LYxt5007452 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 6 Sep 2012 23:34:59 +0200 Received: from portgus.lan (51.Red-79-159-211.staticIP.rima-tde.net [79.159.211.51]) (authenticated bits=0) by ackerman2.upc.es (8.14.4/8.14.4) with ESMTP id q86LYvbD005198 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 6 Sep 2012 23:34:58 +0200 Message-ID: <504916C5.7070302@entel.upc.edu> Date: Thu, 06 Sep 2012 23:33:57 +0200 From: =?ISO-8859-1?Q?Gustau_P=E9rez_i_Querol?= User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:15.0) Gecko/20120831 Thunderbird/15.0 MIME-Version: 1.0 To: emulation@freebsd.org References: <50449030.1010206@entel.upc.edu> In-Reply-To: <50449030.1010206@entel.upc.edu> X-Scanned-By: MIMEDefang 2.70 on 147.83.2.244 X-Mail-Scanned: Criba 2.0 + Clamd X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (violet.upc.es [147.83.2.51]); Thu, 06 Sep 2012 23:35:00 +0200 (CEST) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Fix ich9 bios to correctly configure pci bridge1 and pci bridge2 X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Sep 2012 21:35:08 -0000 On 03/09/2012 13:10, Gustau Pérez i Querol wrote: > > The upcoming 4.2.0 release of virtualbox allows to plug more than 8 > network adapter to a guest. > > When testing that kind of setup I noticed FreeBSD (stable or head, > it doesn't matter) is unable to map more than 8 cards. It appears that > the ninth (and so on) get connected to the pci bus 1. > > The output of a guest FreeBSD machine shows this: > > ************* > pcib1: at device 24.0 on pci0 > pcib1: domain 0 > pcib1: secondary bus 1 > pcib1: subordinate bus 2 > pcib1: no prefetched decode > pcib1: Subtractively decoded bridge. > pci1: on pcib1 > pci1: domain=0, physical bus=1 > pcib2: at device 25.0 on pci0 > pcib0: allocated type 4 (0xe000-0xefff) for rid 1c of pcib2 > pcib0: allocated type 3 (0xf0a00000-0xf0afffff) for rid 20 of pcib2 > pcib2: domain 0 > pcib2: secondary bus 2 > pcib2: subordinate bus 3 > pcib2: I/O decode 0xe000-0xefff > pcib2: memory decode 0xf0a00000-0xf0afffff > pcib2: no prefetched decode > pcib2: Subtractively decoded bridge. > pci2: on pcib2 > pci2: domain=0, physical bus=2 > ********************* > > The topology the developers of vbox try to build is this: > > > ----------------------------------------------------------- pci bus 0 > | | > ___ |______ _____|____ > | | | | > | Bridge1 | | Bridge2 | > |_________| |_________| > | | > ----------- pci bus 1 ------------ pci bus 2 > > > > The problem is that the pci bridge1 connects the bus0 to the bus1 > and thus the primary bus would 0; the secondary would the 1 because > the bus 1 doesn't > connect any other bus through any other bridge then its subordinate > must be also 1. The pci bridge1 connects the pci bus 0 with the pci > bus 2; the primary must be 0 and the secondary and subordinate must be 2: > > The vbox programmers set the subordinate bus of bridge1 to 2 and > the subordinate of bridge2 to 3 (which is incorrect). At pci_pci.c we > can add quirks to circumvent this (we can't change real hardware) but > in this case we can change the hardware. > > I'm attaching the patch that changes the behavior of vbox. The > output of FreeBSD virtual machine with the modified 'hardware' is this: > > ************* > pcib1: at device 24.0 on pci0 > pcib1: domain 0 > pcib1: secondary bus 1 > pcib1: subordinate bus 1 > pcib1: no prefetched decode > pcib1: Subtractively decoded bridge. > pci1: on pcib1 > pci1: domain=0, physical bus=1 > pcib2: at device 25.0 on pci0 > pcib0: allocated type 4 (0xe000-0xefff) for rid 1c of pcib2 > pcib0: allocated type 3 (0xf0a00000-0xf0afffff) for rid 20 of pcib2 > pcib2: domain 0 > pcib2: secondary bus 2 > pcib2: subordinate bus 2 > pcib2: I/O decode 0xe000-0xefff > pcib2: memory decode 0xf0a00000-0xf0afffff > pcib2: no prefetched decode > pcib2: Subtractively decoded bridge. > pci2: on pcib2 > pci2: domain=0, physical bus=2 > ********************* > > Which is what should be according to the simple topology of the > buses and bridges. It works as it should. I hope I did not say > anything wrong. Looks like the mailing list ate the attachment. I can be downloaded here: http://www-entel.upc.edu/gus/patch-src-VBox-Devices-Bus-DevPciIch9.cpp Best, Gustau -- --------------------------------------------------------------------------- Prou top-posting : http://ca.wikipedia.org/wiki/Top-posting Stop top-posting : http://en.wikipedia.org/wiki/Posting_style O O O Gustau Pérez i Querol O O O Departament d'Enginyeria Telemàtica O O O Universitat Politècnica de Catalunya Edifici C3 - Despatx S101-B UPC Campus Nord UPC C/ Jordi Girona, 1-3 08034 - Barcelona