Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Jan 2012 02:04:15 GMT
From:      Garrett Cooper <yanegomi@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/163748: [patch] document NEW_PCIB option and disable on some legacy platforms
Message-ID:  <201201010204.q0124FZx053958@red.freebsd.org>
Resent-Message-ID: <201201010210.q012AE1r086834@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         163748
>Category:       kern
>Synopsis:       [patch] document NEW_PCIB option and disable on some legacy platforms
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jan 01 02:10:14 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Cooper
>Release:        9.0-RC2
>Organization:
iXsystems, Inc.
>Environment:
FreeBSD bayonetta.local 9.0-RC2 FreeBSD 9.0-RC2 #0: Sun Nov 13 21:17:31 PST 2011     gcooper@bayonetta.local:/usr/obj/store/freebsd/stable/9/sys/BAYONETTA  amd64
>Description:
1. The NEW_PCIB driver completely undocumented today (not in UPDATING, NOTES, or DEFAULT).
2. Users will run into issues in older x86 hardware as evidenced on multiple mailing list posts [1], [2], [3], [4] (my gmail inbox has ~10 threads and the threads of relevance that I'm subscribed to are current@ and hackers@).
3. We at iXsystems have seen issues with the mfi driver with the driver losing interrupts and thus drive I/O being lost with some more recent mfi controllers. More folks might see issues with random drivers as 9.x bakes more.

For now I'm just requesting that it's documented so people understand what they're buying into by upgrading to 9 (I'll submit a separate PR to document this as an errata item, because I'm almost positive that more people will run into it later on)...

1. http://lists.freebsd.org/pipermail/freebsd-current/2011-August/026208.html
2. http://freebsd.1045724.n5.nabble.com/NEW-PCIB-pcib1-failed-to-allocate-initial-I-O-port-window-0x4000-0x4fff-td4457466.html
3. http://markmail.org/message/z4daubczelgnfvtl
4. http://comments.gmane.org/gmane.os.freebsd.stable/78139
>How-To-Repeat:

>Fix:


Patch attached with submission follows:

Index: UPDATING
===================================================================
--- UPDATING	(revision 229165)
+++ UPDATING	(working copy)
@@ -130,6 +130,54 @@
 	handling, no longer can be merged verbatim to stable/8 and previous
 	branches.
 
+20110503:
+	Reimplement how PCI-PCI bridges manage their I/O windows.  Previously
+	the driver would verify that requests for child devices were confined
+	to any existing I/O windows, but the driver relied on the firmware to
+	initialize the windows and would never grow the windows for new
+	requests. Now the driver actively manages the I/O windows.
+
+	This is implemented by allocating a bus resource for each I/O window
+	from the parent PCI bus and suballocating that resource to child
+	devices. The suballocations are managed by creating an rman for each
+	I/O window. The suballocated resources are mapped by passing the
+	bus_activate_resource() call up to the parent PCI bus.  Windows are
+	grown when needed by using bus_adjust_resource() to adjust the
+	resource allocated from the parent PCI bus.  If the adjust request
+	succeeds, the window is adjusted and the suballocation request for
+	the child device is retried.
+
+	When growing a window, the rman_first_free_region() and
+	rman_last_free_region() routines are used to determine if the front
+	or end of the existing I/O window is free.  From using that, the
+	smallest ranges that need to be added to either the front or back of
+	the window are computed.  The driver will first try to grow the
+	window in whichever direction requires the smallest growth first
+	followed by the other direction if that fails.
+
+	Subtractive bridges will first attempt to satisfy requests for child
+	resources from I/O windows (including attempts to grow the windows).
+	If that fails, the request is passed up to the parent PCI bus directly
+	however.
+
+	The PCI-PCI bridge driver will try to use firmware-assigned ranges for
+	child BARs first and only allocate a "fresh" range if that specific
+	range cannot be accommodated in the I/O window.  This allows systems
+	where the firmware assigns resources during boot but later wipes the
+	I/O windows (some ACPI BIOSen are known to do this) to "rediscover"
+	the original I/O window ranges.
+
+	The ACPI Host-PCI bridge driver has been adjusted to correctly honor
+	hw.acpi.host_mem_start and the I/O port equivalent when a PCI-PCI
+	bridge makes a wildcard request for an I/O window range.
+
+	The new PCI-PCI bridge driver is only enabled if the NEW_PCIB kernel
+	option is enabled.  This is a transition aide to allow platforms that
+	do not yet support bus_activate_resource() and bus_adjust_resource()
+	in their Host-PCI bridge drivers (and possibly other drivers as needed)
+	to use the old driver for now.  Once all platforms support the new
+	driver, the kernel option and old driver will be removed.
+
 20110430:
 	Users of the Atheros AR71xx SoC code now need to add 'device ar71xx_pci'
 	into their kernel configurations along with 'device pci'.
Index: sys/amd64/conf/DEFAULTS
===================================================================
--- sys/amd64/conf/DEFAULTS	(revision 229165)
+++ sys/amd64/conf/DEFAULTS	(working copy)
@@ -21,6 +21,7 @@
 options 	GEOM_PART_EBR_COMPAT
 options 	GEOM_PART_MBR
 
+# New PCI-PCI bridge driver.
 options 	NEW_PCIB
 
 # Allow mounting non-MPSAFE filesystems
Index: sys/i386/conf/DEFAULTS
===================================================================
--- sys/i386/conf/DEFAULTS	(revision 229165)
+++ sys/i386/conf/DEFAULTS	(working copy)
@@ -29,6 +29,7 @@
 options 	NATIVE
 device		atpic
 
+# New PCI-PCI bridge driver.
 options 	NEW_PCIB
 
 # Allow mounting non-MPSAFE filesystems
Index: sys/ia64/conf/DEFAULTS
===================================================================
--- sys/ia64/conf/DEFAULTS	(revision 229165)
+++ sys/ia64/conf/DEFAULTS	(working copy)
@@ -19,6 +19,7 @@
 options 	GEOM_PART_GPT
 options 	GEOM_PART_MBR
 
+# New PCI-PCI bridge driver.
 options 	NEW_PCIB
 
 # Allow mounting non-MPSAFE filesystems
Index: sys/pc98/conf/DEFAULTS
===================================================================
--- sys/pc98/conf/DEFAULTS	(revision 229165)
+++ sys/pc98/conf/DEFAULTS	(working copy)
@@ -28,6 +28,7 @@
 # enable support for native hardware
 device		atpic
 
+# New PCI-PCI bridge driver.
 options 	NEW_PCIB
 
 # Allow mounting non-MPSAFE filesystems
Index: sys/sparc64/conf/DEFAULTS
===================================================================
--- sys/sparc64/conf/DEFAULTS	(revision 229165)
+++ sys/sparc64/conf/DEFAULTS	(working copy)
@@ -20,6 +20,7 @@
 # Let sunkbd emulate an AT keyboard by default.
 options 	SUNKBD_EMULATE_ATKBD
 
+# New PCI-PCI bridge driver.
 options 	NEW_PCIB
 
 # Allow mounting non-MPSAFE filesystems
Index: sys/conf/NOTES
===================================================================
--- sys/conf/NOTES	(revision 229165)
+++ sys/conf/NOTES	(working copy)
@@ -2972,3 +2972,6 @@
 options 	BROOKTREE_ALLOC_PAGES=(217*4+1)
 options 	MAXFILES=999
 
+# New PCI-PCI bridge driver.
+options 	NEW_PCIB
+


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201010204.q0124FZx053958>