From owner-svn-src-all@FreeBSD.ORG Sat Jun 23 22:16:29 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DC677106566B; Sat, 23 Jun 2012 22:16:28 +0000 (UTC) (envelope-from marius@alchemy.franken.de) Received: from alchemy.franken.de (alchemy.franken.de [194.94.249.214]) by mx1.freebsd.org (Postfix) with ESMTP id 62C888FC0A; Sat, 23 Jun 2012 22:16:28 +0000 (UTC) Received: from alchemy.franken.de (localhost [127.0.0.1]) by alchemy.franken.de (8.14.4/8.14.4/ALCHEMY.FRANKEN.DE) with ESMTP id q5NMGQKn045015; Sun, 24 Jun 2012 00:16:27 +0200 (CEST) (envelope-from marius@alchemy.franken.de) Received: (from marius@localhost) by alchemy.franken.de (8.14.4/8.14.4/Submit) id q5NMGQGg045014; Sun, 24 Jun 2012 00:16:26 +0200 (CEST) (envelope-from marius) Date: Sun, 24 Jun 2012 00:16:26 +0200 From: Marius Strobl To: John Baldwin Message-ID: <20120623221626.GH69382@alchemy.franken.de> References: <201206131504.q5DF4opt031336@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201206131504.q5DF4opt031336@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r237008 - head/sys/dev/pci X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jun 2012 22:16:29 -0000 On Wed, Jun 13, 2012 at 03:04:50PM +0000, John Baldwin wrote: > Author: jhb > Date: Wed Jun 13 15:04:50 2012 > New Revision: 237008 > URL: http://svn.freebsd.org/changeset/base/237008 > > Log: > Fix a couple of bugs that prevented windows in PCI-PCI bridges from > growing "downward" (moving the start address down). First, an off by > one error caused the end address to be moved down an extra alignment > chunk unnecessarily. Second, when aligning the new candidate starting > address, the wrong bits were masked off. > Unfortunately, this now panics a sparc64 machine on the first attempt to use a grown resource via bus_space(9) for me: pcib3: at device 0.0 on pci2 pcib2: allocated I/O port range (0x1000-0x1fff) for rid 1c of pcib3 pcib2: allocated memory range (0x200000-0x3ffffff) for rid 20 of pcib3 pcib3: domain 0 pcib3: secondary bus 5 pcib3: subordinate bus 5 pcib3: I/O decode 0x1000-0x1fff pcib3: memory decode 0x200000-0x3ffffff pcib3: no prefetched decode pcib3: Subtractively decoded bridge. <...> pci3: on pcib3 <...> isab0: at device 30.0 on pci3 isa0: on isab0 <...> rtc0: at port 0x70-0x73 on isa0 pcib3: attempting to grow I/O port window for (0x70-0x73,0x4) front candidate range: 0x70-0x73 pcib3: grew I/O port window to 0x70-0x1fff panic: start address is not aligned Alternatively, this may also be a data access trap, which also indicates that some invalid address being used for the access. before: rtc0: at port 0x70-0x73 on isa0 pcib3: attempting to grow I/O port window for (0x70-0x73,0x4) pcib2: allocated I/O port range (0x70-0x73) for rid 0 of rtc0 Shouldn't a subtractively decoded resource actually be outside of the window of the parent PCI-PCI bridge, i.e. it seems we shouldn't try to grow the window in that case? The below patch fixes this for me, I'm not sure whether that actually is the right approach though. Marius Index: pci_pci.c =================================================================== --- pci_pci.c (revision 237511) +++ pci_pci.c (working copy) @@ -1038,7 +1038,7 @@ pcib_alloc_resource(device_t dev, device_t child, case SYS_RES_IOPORT: r = pcib_suballoc_resource(sc, &sc->io, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (pcib_grow_window(sc, &sc->io, type, start, end, count, flags) == 0) @@ -1062,7 +1062,7 @@ pcib_alloc_resource(device_t dev, device_t child, } r = pcib_suballoc_resource(sc, &sc->mem, child, type, rid, start, end, count, flags); - if (r != NULL) + if (r != NULL || (sc->flags & PCIB_SUBTRACTIVE) != 0) break; if (flags & RF_PREFETCHABLE) { if (pcib_grow_window(sc, &sc->pmem, type, start, end,