linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] PCI/iommu: Fix DMA alias problems
@ 2014-05-01 16:27 Alex Williamson
  2014-05-01 16:27 ` [PATCH 01/13] PCI: Add DMA alias iterator Alex Williamson
                   ` (12 more replies)
  0 siblings, 13 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

This series attempts to fix a couple issues we've had outstanding in
the PCI/IOMMU code for a while.  The first issue is with devices that
use the wrong requester ID for DMA transactions.  We already have a
sort of half-baked attempt to fix this for several Ricoh devices, but
the fix only helps them be useful through IOMMU groups, not the
general DMA case.  There are also several Marvell devices which use
use a different wrong requester ID and don't even fit into the DMA
source idea.  This series creates a DMA alias iterator that will
step through each possible alias of a device, allowing IOMMUs to
insert mappings for both the device and its aliases.

Hand-in-hand with this is our broken pci_find_upstream_pcie_bridge()
function, which is known to blowup when it finds itself suddenly at
a PCIe device without crossing a PCIe-to-PCI bridge (as identified by
the PCIe capability).  It also likes to make the invalid assumption
that a PCIe device never has its requester ID masked by any usptream
bus.  We can fix this using the above new DMA alias iterator, since
that's effectively what this function was meant to do.

Finally, with all these helpers, it makes sense to consolidate code
for determining IOMMU groups.  The first step in finding the root
of a group is finding the final upstream DMA alias for the device,
then applying additional ACS rules and incorporating device specific
aliases.  As this is all common to PCI, create a single implementation
and remove piles of code from the individual IOMMU drivers.

This series allows devices like the Marvell 88SE9123 to finally work
on Linux with either AMD-Vi or VT-d enabled on the box.  I've
collected device IDs from various bugs to support as many SKUs of
these devices as possible, but I'm sure there are others that I've
missed.

This should also enable motherboards with an onboard ASmedia
ASM1083/1085 PCIe-to-PCI bridge to work with VT-d enabled.  I've
acquired an adapter board with this chip, but it actually exposes
a PCIe capability, unlike most of the onboard controllers.  Therefore
I expect this series will fix the WARN_ON currently hit during boot,
but there's a 50/50 chance whether the device behaves like a PCI
bridge or a PCIe bridge with regard to the requester ID that it uses
to take ownership of the transaction.  If it turns out to use the
PCIe bridge model, I expect we can quirk it using a dev_flags bit
to identify a PCI bridge that takes ownership as if it was a PCIe
bridge.

Please test and provide feedback.  I expect IOMMU group topology
should not change from this series, but if a case is found where it
does, please share.  Also, if there are additional quirks we need
to add, please either file new or add to the existing bugs.  Thanks,

Alex

---

Alex Williamson (13):
      PCI: Add DMA alias iterator
      PCI: quirk pci_for_each_dma_alias()
      PCI: quirk dma_func_alias for Ricoh devices
      PCI: quirk dma_func_alias for Marvell devices
      PCI: Consolidate isolation domain code
      iommu/amd: Use pci_find_dma_isolation_root() for IOMMU groups
      iommu/amd: Update to use PCI DMA aliases
      iommu/intel: Use pci_find_dma_isolation_root() for IOMMU groups
      iommu/intel: Update to use PCI DMA aliases
      iommu/fsl: Use pci_find_dma_isolation_root() for IOMMU groups
      iommu: Remove pci.h
      PCI: Remove pci_find_upstream_pcie_bridge()
      PCI: Remove pci_get_dma_source()


 drivers/iommu/amd_iommu.c           |  185 ++++------------------
 drivers/iommu/amd_iommu_types.h     |    1 
 drivers/iommu/fsl_pamu_domain.c     |   67 --------
 drivers/iommu/intel-iommu.c         |  293 +++++++++++++----------------------
 drivers/iommu/intel_irq_remapping.c |   55 +++++--
 drivers/iommu/pci.h                 |   29 ---
 drivers/pci/quirks.c                |   73 ++++-----
 drivers/pci/search.c                |  234 +++++++++++++++++++++++++---
 include/linux/pci.h                 |   21 +--
 9 files changed, 430 insertions(+), 528 deletions(-)
 delete mode 100644 drivers/iommu/pci.h

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 01/13] PCI: Add DMA alias iterator
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 02/13] PCI: quirk pci_for_each_dma_alias() Alex Williamson
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

In a mixed PCI/PCI-X/PCI-e topology, bridges can take ownership of
transactions, replacing the original requester ID with their own.
Sometimes we just want to know the resulting device or resulting
alias, sometimes we want each step in the chain.  This iterator
allows either usage.  When an endpoint is connected via an unbroken
chain of PCIe switches and root ports, it has no alias and its
requester ID is visible to the root bus.  When PCI/X get in the way,
we pick up aliases for bridges.

The reason why we potentially care about each step in the path is
because of PCI-X.  PCI-X has the concept of a requester ID, but
bridges may or may not take ownership of various types of
transactions.  We therefore leave it to the consumer of this function
to prune out what they don't care about rather than attempt to flatten
the alias ourselves.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/search.c |   70 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h  |    4 +++
 2 files changed, 74 insertions(+)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 4a1b972..5601cdb 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -18,6 +18,76 @@ DECLARE_RWSEM(pci_bus_sem);
 EXPORT_SYMBOL_GPL(pci_bus_sem);
 
 /*
+ * pci_for_each_dma_alias - Iterate over DMA aliases for a device
+ * @pdev: starting downstream device
+ * @fn: function to call for each alias
+ * @data: opaque data to pass to @fn
+ *
+ * Starting @pdev, walk up the bus calling @fn for each possible alias
+ * of @pdev at the root bus.
+ */
+int pci_for_each_dma_alias(struct pci_dev *pdev,
+			   int (*fn)(struct pci_dev *pdev,
+				     u16 alias, void *data), void *data)
+{
+	struct pci_bus *bus;
+	int ret;
+
+	ret = fn(pdev, PCI_DEVID(pdev->bus->number, pdev->devfn), data);
+	if (ret)
+		return ret;
+
+	for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
+		struct pci_dev *tmp;
+
+		/* Skip virtual buses */
+		if (!bus->self)
+			continue;
+
+		tmp = bus->self;
+
+		/*
+		 * PCIe-to-PCI/X bridges alias transactions from downstream
+		 * devices using the subordinate bus number (PCI Express to
+		 * PCI/PCI-X Bridge Spec, rev 1.0, sec 2.3).  For all cases
+		 * where the upstream bus is PCI/X we alias to the bridge
+		 * (there are various conditions in the previous reference
+		 * where the bridge may take ownership of transactions, even
+		 * when the secondary interface is PCI-X).
+		 */
+		if (pci_is_pcie(tmp)) {
+			switch (pci_pcie_type(tmp)) {
+			case PCI_EXP_TYPE_ROOT_PORT:
+			case PCI_EXP_TYPE_UPSTREAM:
+			case PCI_EXP_TYPE_DOWNSTREAM:
+				continue;
+			case PCI_EXP_TYPE_PCI_BRIDGE:
+				ret = fn(tmp,
+					 PCI_DEVID(tmp->subordinate->number,
+						   PCI_DEVFN(0, 0)), data);
+				if (ret)
+					return ret;
+				continue;
+			case PCI_EXP_TYPE_PCIE_BRIDGE:
+				ret = fn(tmp,
+					 PCI_DEVID(tmp->bus->number,
+						   tmp->devfn), data);
+				if (ret)
+					return ret;
+				continue;
+			}
+		} else {
+			ret = fn(tmp, PCI_DEVID(tmp->bus->number, tmp->devfn),
+				 data);
+			if (ret)
+				return ret;
+		}
+	}
+
+	return ret;
+}
+
+/*
  * find the upstream PCIe-to-PCI bridge of a PCI device
  * if the device is PCIE, return NULL
  * if the device isn't connected to a PCIe bridge (that is its parent is a
diff --git a/include/linux/pci.h b/include/linux/pci.h
index aab57b4..14b074b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1795,6 +1795,10 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
 }
 #endif
 
+int pci_for_each_dma_alias(struct pci_dev *pdev,
+			   int (*fn)(struct pci_dev *pdev,
+				     u16 alias, void *data), void *data);
+
 /**
  * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
  * @pdev: the PCI device


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 02/13] PCI: quirk pci_for_each_dma_alias()
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
  2014-05-01 16:27 ` [PATCH 01/13] PCI: Add DMA alias iterator Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices Alex Williamson
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

There are a few broken devices that use the requester ID of a different
function in the slot for their DMA.  To handle these, add a bitmap to
struct pci_dev (using an alignment gap) that quirks can populate.  As
we iterate over the device and bus DMA aliases, also iterate over any
bits in the map.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/search.c |   21 +++++++++++++++++++++
 include/linux/pci.h  |    2 ++
 2 files changed, 23 insertions(+)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 5601cdb..ad698b2 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -37,6 +37,27 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
 	if (ret)
 		return ret;
 
+	/*
+	 * dma_func_alias provides a bitmap of other function numbers on
+	 * this same PCI slot to use as DMA aliases.
+	 */
+	if (unlikely(pdev->dma_func_alias)) {
+		u8 map = pdev->dma_func_alias & ~(1 << PCI_FUNC(pdev->devfn));
+		int func;
+
+		for (func = 0; map && func < 8; func++, map >>= 1) {
+			if (!(map & 1))
+				continue;
+
+			ret = fn(pdev,
+				 PCI_DEVID(pdev->bus->number,
+					   PCI_DEVFN(PCI_SLOT(pdev->devfn),
+					   func)), data);
+			if (ret)
+				return ret;
+		}
+	}
+
 	for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
 		struct pci_dev *tmp;
 
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 14b074b..b4c97d2 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -268,6 +268,8 @@ struct pci_dev {
 	u8		rom_base_reg;	/* which config register controls the ROM */
 	u8		pin;		/* which interrupt pin this device uses */
 	u16		pcie_flags_reg;	/* cached PCIe Capabilities Register */
+	u8		dma_func_alias;	/* bitmap of functions used as DMA
+					   aliases for this device */
 
 	struct pci_driver *driver;	/* which driver has allocated this device */
 	u64		dma_mask;	/* Mask of the bits of bus address this


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
  2014-05-01 16:27 ` [PATCH 01/13] PCI: Add DMA alias iterator Alex Williamson
  2014-05-01 16:27 ` [PATCH 02/13] PCI: quirk pci_for_each_dma_alias() Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-03  2:29   ` Andrew Cooks
  2014-05-01 16:27 ` [PATCH 04/13] PCI: quirk dma_func_alias for Marvell devices Alex Williamson
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

The existing quirk for these devices doesn't really solve the problem,
re-implement it using the DMA alias iterator.  We'll come back later
and remove the existing quirk and dma_source interface.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/quirks.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index e729206..a458c6b 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
 	return -ENOTTY;
 }
 
+static void quirk_dma_func0_alias(struct pci_dev *dev)
+{
+	if (PCI_SLOT(dev->devfn) != 0)
+		dev->dma_func_alias |= (1 << 0);
+}
+
+/*
+ * https://bugzilla.redhat.com/show_bug.cgi?id=605888
+ *
+ * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
+ */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe822, quirk_dma_func0_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
+
 static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
 {
 	if (!PCI_FUNC(dev->devfn))


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 04/13] PCI: quirk dma_func_alias for Marvell devices
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (2 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 05/13] PCI: Consolidate isolation domain code Alex Williamson
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

Several Marvell devices and a JMicron device have a similar DMA
requester ID problem to Ricoh, except they use function 1 as the
PCIe requester ID.  Add a quirk for these to populate the DMA
function alias bitmap.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/quirks.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a458c6b..82b2733 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3349,6 +3349,28 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
 
+static void quirk_dma_func1_alias(struct pci_dev *dev)
+{
+	if (PCI_SLOT(dev->devfn) != 1)
+		dev->dma_func_alias |= (1 << 1);
+}
+
+/*
+ * Marvell 88SE9123 uses function 1 as the requester ID for DMA.  In some
+ * SKUs function 1 is present and is a legacy IDE controller, in other
+ * SKUs this function is not present, making this a ghost requester.
+ * https://bugzilla.kernel.org/show_bug.cgi?id=42679
+ */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9123,
+			 quirk_dma_func1_alias);
+/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c14 */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9130,
+			 quirk_dma_func1_alias);
+/* https://bugs.gentoo.org/show_bug.cgi?id=497630 */
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
+			 PCI_DEVICE_ID_JMICRON_JMB388_ESD,
+			 quirk_dma_func1_alias);
+
 static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
 {
 	if (!PCI_FUNC(dev->devfn))


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 05/13] PCI: Consolidate isolation domain code
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (3 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 04/13] PCI: quirk dma_func_alias for Marvell devices Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 06/13] iommu/amd: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

Each of the IOMMU drivers supporting IOMMU groups has their own
implementation of an algorithm to find the base device for an IOMMU
group.  This N:1 function takes into account visibility of a PCI
device on the bus using DMA aliases, as well as the isolation of
devices using ACS.  Since these are all generic PCI properties,
provide this helper in PCI code to create a single, standard
implementation.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/search.c |  130 ++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/pci.h  |    1 
 2 files changed, 131 insertions(+)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index ad698b2..1eab231 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -109,6 +109,136 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
 }
 
 /*
+ * last_dma_alias_dev - Isolation root helper to record the last DMA alias pdev
+ */
+static int last_dma_alias_dev(struct pci_dev *pdev, u16 alias, void *data)
+{
+	*(struct pci_dev **)data = pdev;
+	return 0;
+}
+
+/*
+ * To consider a device isolated, we require ACS to support Source Validation,
+ * Request Redirection, Completer Redirection, and Upstream Forwarding.  This
+ * effectively means that devices cannot spoof their requester ID, requests
+ * and commpletions cannot be redirected, and all transactions are forwarded
+ * upstream, even as it passes through a bridge where the target device is
+ * downstream.
+ */
+#define REQ_ACS_FLAGS   (PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)
+
+/*
+ * pci_find_dma_isolation_root - Given a PCI device, find the root device for
+ *				 an isolation domain.
+ * @pdev: target device
+ *
+ * This function takes DMA alias quirks, bus topology, and PCI ACS into
+ * account to find the root device for an isolation domain.  The root device
+ * is a consistent and representative device within the isolation domain.
+ * Passing any device within a given isolation domain results in the same
+ * returned root device, allowing this root device to be used for lookup
+ * for structures like IOMMU groups.  Note that the root device is not
+ * necessarily a bridge, in the case of a multifunction device without
+ * DMA isolation between functions, the root device is the lowest function
+ * without isolation.
+ */
+struct pci_dev *pci_find_dma_isolation_root(struct pci_dev *pdev)
+{
+	struct pci_bus *bus;
+
+	/*
+	 * Step 1: Find the upstream DMA alias device
+	 *
+	 * A device can be aliased by bridges or DMA alias quirks.  Being able
+	 * to differentiate devices is a minimum requirement for isolation.
+	 */
+	pci_for_each_dma_alias(pdev, &last_dma_alias_dev, &pdev);
+
+	/*
+	 * Step 2: Find the upstream ACS device
+	 *
+	 * Beyond differentiation, ACS prevents uncontrolled peer-to-peer
+	 * transactions.  Therefore the next step is to find the upstream
+	 * ACS device.
+	 */
+	for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
+		if (!bus->self)
+			continue;
+
+		if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
+			break;
+
+		pdev = bus->self;
+	}
+
+	/*
+	 * Step 3: Handle DMA function aliases
+	 *
+	 * PCI functions are sometimes broken and use the wrong requester
+	 * ID for DMA transactions.  The requester ID for this device may
+	 * actually be used by another function in this slot.  If such a
+	 * function exists, use it.
+	 */
+	if (pdev->multifunction) {
+		u8 func, func_mask = 1 << PCI_FUNC(pdev->devfn);
+
+		for (func = 0; func < 8; func++) {
+			struct pci_dev *tmp;
+
+			if (func == PCI_FUNC(pdev->devfn))
+				continue;
+
+			tmp = pci_get_slot(pdev->bus,
+					   PCI_DEVFN(PCI_SLOT(pdev->devfn),
+						     func));
+			if (!tmp)
+				continue;
+
+			pci_dev_put(tmp);
+			/*
+			 * If this device has a DMA alias to us, it becomes
+			 * the base device regardless of ACS.
+			 */
+			if (tmp->dma_func_alias & func_mask) {
+				pdev = tmp;
+				break;
+			}
+		}
+	}
+
+	/*
+	 * Step 4: Handle multifunction ACS
+	 *
+	 * If the resulting device is multifunction and does not itself
+	 * support ACS then we cannot assume isolation between functions.
+	 * The root device needs to be consistent, therefore we return the
+	 * lowest numbered function that also lacks ACS support.
+	 */
+	if (pdev->multifunction && !pci_acs_enabled(pdev, REQ_ACS_FLAGS)) {
+		u8 func;
+
+		for (func = 0; func < PCI_FUNC(pdev->devfn); func++) {
+			struct pci_dev *tmp;
+
+			tmp = pci_get_slot(pdev->bus,
+					   PCI_DEVFN(PCI_SLOT(pdev->devfn),
+						     func));
+			if (!tmp)
+				continue;
+
+			pci_dev_put(tmp);
+
+			if (!pci_acs_enabled(tmp, REQ_ACS_FLAGS)) {
+				pdev = tmp;
+				break;
+			}
+		}
+	}
+
+	return pdev;
+}
+
+/*
  * find the upstream PCIe-to-PCI bridge of a PCI device
  * if the device is PCIE, return NULL
  * if the device isn't connected to a PCIe bridge (that is its parent is a
diff --git a/include/linux/pci.h b/include/linux/pci.h
index b4c97d2..0d50064 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1800,6 +1800,7 @@ static inline struct eeh_dev *pci_dev_to_eeh_dev(struct pci_dev *pdev)
 int pci_for_each_dma_alias(struct pci_dev *pdev,
 			   int (*fn)(struct pci_dev *pdev,
 				     u16 alias, void *data), void *data);
+struct pci_dev *pci_find_dma_isolation_root(struct pci_dev *pdev);
 
 /**
  * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 06/13] iommu/amd: Use pci_find_dma_isolation_root() for IOMMU groups
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (4 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 05/13] PCI: Consolidate isolation domain code Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 07/13] iommu/amd: Update to use PCI DMA aliases Alex Williamson
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, Joerg Roedel, acooks, linux-kernel

The IVRS tables provides aliases, but not to the extent now provided
by PCI core with DMA alias support and pci_find_dma_isolation_root().
The expectation is that the kernel and IVRS will produce the same
result for topology based aliases while the kernel will also include
device specific DMA quirks.  We therefore drop the AMD-specific IOMMU
group discovery in favor of the common code.  This also allows us to
drop tracking of the IOMMU group on the alias dev_data structure.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
---
 drivers/iommu/amd_iommu.c       |  158 ++-------------------------------------
 drivers/iommu/amd_iommu_types.h |    1 
 2 files changed, 10 insertions(+), 149 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index c949520..3d58de4 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -46,7 +46,6 @@
 #include "amd_iommu_proto.h"
 #include "amd_iommu_types.h"
 #include "irq_remapping.h"
-#include "pci.h"
 
 #define CMD_SET_TYPE(cmd, t) ((cmd)->data[1] |= ((t) << 28))
 
@@ -133,9 +132,6 @@ static void free_dev_data(struct iommu_dev_data *dev_data)
 	list_del(&dev_data->dev_data_list);
 	spin_unlock_irqrestore(&dev_data_list_lock, flags);
 
-	if (dev_data->group)
-		iommu_group_put(dev_data->group);
-
 	kfree(dev_data);
 }
 
@@ -264,107 +260,10 @@ static bool check_device(struct device *dev)
 	return true;
 }
 
-static struct pci_bus *find_hosted_bus(struct pci_bus *bus)
-{
-	while (!bus->self) {
-		if (!pci_is_root_bus(bus))
-			bus = bus->parent;
-		else
-			return ERR_PTR(-ENODEV);
-	}
-
-	return bus;
-}
-
-#define REQ_ACS_FLAGS	(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)
-
-static struct pci_dev *get_isolation_root(struct pci_dev *pdev)
-{
-	struct pci_dev *dma_pdev = pdev;
-
-	/* Account for quirked devices */
-	swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));
-
-	/*
-	 * If it's a multifunction device that does not support our
-	 * required ACS flags, add to the same group as lowest numbered
-	 * function that also does not suport the required ACS flags.
-	 */
-	if (dma_pdev->multifunction &&
-	    !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)) {
-		u8 i, slot = PCI_SLOT(dma_pdev->devfn);
-
-		for (i = 0; i < 8; i++) {
-			struct pci_dev *tmp;
-
-			tmp = pci_get_slot(dma_pdev->bus, PCI_DEVFN(slot, i));
-			if (!tmp)
-				continue;
-
-			if (!pci_acs_enabled(tmp, REQ_ACS_FLAGS)) {
-				swap_pci_ref(&dma_pdev, tmp);
-				break;
-			}
-			pci_dev_put(tmp);
-		}
-	}
-
-	/*
-	 * Devices on the root bus go through the iommu.  If that's not us,
-	 * find the next upstream device and test ACS up to the root bus.
-	 * Finding the next device may require skipping virtual buses.
-	 */
-	while (!pci_is_root_bus(dma_pdev->bus)) {
-		struct pci_bus *bus = find_hosted_bus(dma_pdev->bus);
-		if (IS_ERR(bus))
-			break;
-
-		if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
-			break;
-
-		swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
-	}
-
-	return dma_pdev;
-}
-
-static int use_pdev_iommu_group(struct pci_dev *pdev, struct device *dev)
-{
-	struct iommu_group *group = iommu_group_get(&pdev->dev);
-	int ret;
-
-	if (!group) {
-		group = iommu_group_alloc();
-		if (IS_ERR(group))
-			return PTR_ERR(group);
-
-		WARN_ON(&pdev->dev != dev);
-	}
-
-	ret = iommu_group_add_device(group, dev);
-	iommu_group_put(group);
-	return ret;
-}
-
-static int use_dev_data_iommu_group(struct iommu_dev_data *dev_data,
-				    struct device *dev)
-{
-	if (!dev_data->group) {
-		struct iommu_group *group = iommu_group_alloc();
-		if (IS_ERR(group))
-			return PTR_ERR(group);
-
-		dev_data->group = group;
-	}
-
-	return iommu_group_add_device(dev_data->group, dev);
-}
-
 static int init_iommu_group(struct device *dev)
 {
-	struct iommu_dev_data *dev_data;
 	struct iommu_group *group;
-	struct pci_dev *dma_pdev;
+	struct pci_dev *pdev;
 	int ret;
 
 	group = iommu_group_get(dev);
@@ -373,58 +272,21 @@ static int init_iommu_group(struct device *dev)
 		return 0;
 	}
 
-	dev_data = find_dev_data(get_device_id(dev));
-	if (!dev_data)
-		return -ENOMEM;
-
-	if (dev_data->alias_data) {
-		u16 alias;
-		struct pci_bus *bus;
+	pdev = pci_find_dma_isolation_root(to_pci_dev(dev));
 
-		if (dev_data->alias_data->group)
-			goto use_group;
-
-		/*
-		 * If the alias device exists, it's effectively just a first
-		 * level quirk for finding the DMA source.
-		 */
-		alias = amd_iommu_alias_table[dev_data->devid];
-		dma_pdev = pci_get_bus_and_slot(alias >> 8, alias & 0xff);
-		if (dma_pdev) {
-			dma_pdev = get_isolation_root(dma_pdev);
-			goto use_pdev;
-		}
-
-		/*
-		 * If the alias is virtual, try to find a parent device
-		 * and test whether the IOMMU group is actualy rooted above
-		 * the alias.  Be careful to also test the parent device if
-		 * we think the alias is the root of the group.
-		 */
-		bus = pci_find_bus(0, alias >> 8);
-		if (!bus)
-			goto use_group;
+	group = iommu_group_get(&pdev->dev);
 
-		bus = find_hosted_bus(bus);
-		if (IS_ERR(bus) || !bus->self)
-			goto use_group;
+	if (!group) {
+		group = iommu_group_alloc();
+		if (IS_ERR(group))
+			return PTR_ERR(group);
+	}
 
-		dma_pdev = get_isolation_root(pci_dev_get(bus->self));
-		if (dma_pdev != bus->self || (dma_pdev->multifunction &&
-		    !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)))
-			goto use_pdev;
+	ret = iommu_group_add_device(group, dev);
 
-		pci_dev_put(dma_pdev);
-		goto use_group;
-	}
+	iommu_group_put(group);
 
-	dma_pdev = get_isolation_root(pci_dev_get(to_pci_dev(dev)));
-use_pdev:
-	ret = use_pdev_iommu_group(dma_pdev, dev);
-	pci_dev_put(dma_pdev);
 	return ret;
-use_group:
-	return use_dev_data_iommu_group(dev_data->alias_data, dev);
 }
 
 static int iommu_init_device(struct device *dev)
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h
index f1a5abf..7277a20 100644
--- a/drivers/iommu/amd_iommu_types.h
+++ b/drivers/iommu/amd_iommu_types.h
@@ -432,7 +432,6 @@ struct iommu_dev_data {
 	struct iommu_dev_data *alias_data;/* The alias dev_data */
 	struct protection_domain *domain; /* Domain the device is bound to */
 	atomic_t bind;			  /* Domain attach reference count */
-	struct iommu_group *group;	  /* IOMMU group for virtual aliases */
 	u16 devid;			  /* PCI Device ID */
 	bool iommu_v2;			  /* Device can make use of IOMMUv2 */
 	bool passthrough;		  /* Default for device is pt_domain */


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 07/13] iommu/amd: Update to use PCI DMA aliases
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (5 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 06/13] iommu/amd: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:27 ` [PATCH 08/13] iommu/intel: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, Joerg Roedel, acooks, linux-kernel

AMD-Vi already has a concept of an alias provided via the IVRS table.
This alias only handles topology based aliases, such as PCIe-to-PCI
bridges.  When such an alias is present, we continue to use it.  When
a platform alias is not present, we can now add a check of the device
dma_func_alias to create our own.  Note that the current code can
only handle a single alias of a device, and we don't attempt to change
that here.  It would only become a factor for the requester ID seen by
the IOMMU if PCI-X were involved anway.

Since the alias is now potentially device specific rather than the
topology based alias provided by the platform, we need to clear it
when the device goes away.

With the DMA alias and isolation infrastructure now in PCI-core, we
could opt to ignore IVRS provided aliases.  We now do this for IOMMU
groups.  However, for this more common use case, the "don't fix what
isn't broken" mantra seems like the safer route.

This should allow AMD-Vi to work with devices like Marvell and Ricoh
with DMA function alias quirks.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
---
 drivers/iommu/amd_iommu.c |   27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 3d58de4..4621692 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -294,6 +294,7 @@ static int iommu_init_device(struct device *dev)
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct iommu_dev_data *dev_data;
 	u16 alias;
+	u8 func_alias;
 	int ret;
 
 	if (dev->archdata.iommu)
@@ -304,6 +305,19 @@ static int iommu_init_device(struct device *dev)
 		return -ENOMEM;
 
 	alias = amd_iommu_alias_table[dev_data->devid];
+
+	/*
+	 * If there is no platform provided alias (topology-based) check
+	 * if we have a device quirk based alias.
+	 */
+	func_alias = pdev->dma_func_alias & ~(1 << PCI_SLOT(pdev->devfn));
+	if (func_alias && alias == dev_data->devid) {
+		WARN_ON(hweight8(func_alias) > 1);
+		alias = PCI_DEVID(pdev->bus->number,
+				  PCI_DEVFN(PCI_SLOT(pdev->devfn),
+					    ffs(func_alias) - 1));
+	}
+
 	if (alias != dev_data->devid) {
 		struct iommu_dev_data *alias_data;
 
@@ -351,12 +365,19 @@ static void iommu_ignore_device(struct device *dev)
 
 static void iommu_uninit_device(struct device *dev)
 {
+	struct iommu_dev_data *dev_data = search_dev_data(get_device_id(dev));
+
+	if (!dev_data)
+		return;
+
 	iommu_group_remove_device(dev);
 
+	/* Unlink from alias, it may change if another device is re-plugged */
+	dev_data->alias_data = NULL;
+
 	/*
-	 * Nothing to do here - we keep dev_data around for unplugged devices
-	 * and reuse it when the device is re-plugged - not doing so would
-	 * introduce a ton of races.
+	 * We keep dev_data around for unplugged devices and reuse it when the
+	 * device is re-plugged - not doing so would introduce a ton of races.
 	 */
 }
 


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 08/13] iommu/intel: Use pci_find_dma_isolation_root() for IOMMU groups
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (6 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 07/13] iommu/amd: Update to use PCI DMA aliases Alex Williamson
@ 2014-05-01 16:27 ` Alex Williamson
  2014-05-01 16:28 ` [PATCH 09/13] iommu/intel: Update to use PCI DMA aliases Alex Williamson
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:27 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, David Woodhouse, linux-kernel

Drop custom code that attempts to do the exact same thing and use
PCI provided isolation root support.  Existing IOMMU group laytout
should not change.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
---
 drivers/iommu/intel-iommu.c |   71 +++++--------------------------------------
 1 file changed, 8 insertions(+), 63 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f256ffc..f0e50f1 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -44,7 +44,6 @@
 #include <asm/iommu.h>
 
 #include "irq_remapping.h"
-#include "pci.h"
 
 #define ROOT_SIZE		VTD_PAGE_SIZE
 #define CONTEXT_SIZE		VTD_PAGE_SIZE
@@ -4359,12 +4358,9 @@ static int intel_iommu_domain_has_cap(struct iommu_domain *domain,
 	return 0;
 }
 
-#define REQ_ACS_FLAGS	(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)
-
 static int intel_iommu_add_device(struct device *dev)
 {
-	struct pci_dev *pdev = to_pci_dev(dev);
-	struct pci_dev *bridge, *dma_pdev = NULL;
+	struct pci_dev *pdev;
 	struct iommu_group *group;
 	int ret;
 	u8 bus, devfn;
@@ -4372,68 +4368,16 @@ static int intel_iommu_add_device(struct device *dev)
 	if (!device_to_iommu(dev, &bus, &devfn))
 		return -ENODEV;
 
-	bridge = pci_find_upstream_pcie_bridge(pdev);
-	if (bridge) {
-		if (pci_is_pcie(bridge))
-			dma_pdev = pci_get_domain_bus_and_slot(
-						pci_domain_nr(pdev->bus),
-						bridge->subordinate->number, 0);
-		if (!dma_pdev)
-			dma_pdev = pci_dev_get(bridge);
-	} else
-		dma_pdev = pci_dev_get(pdev);
-
-	/* Account for quirked devices */
-	swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));
-
-	/*
-	 * If it's a multifunction device that does not support our
-	 * required ACS flags, add to the same group as lowest numbered
-	 * function that also does not suport the required ACS flags.
-	 */
-	if (dma_pdev->multifunction &&
-	    !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)) {
-		u8 i, slot = PCI_SLOT(dma_pdev->devfn);
-
-		for (i = 0; i < 8; i++) {
-			struct pci_dev *tmp;
-
-			tmp = pci_get_slot(dma_pdev->bus, PCI_DEVFN(slot, i));
-			if (!tmp)
-				continue;
-
-			if (!pci_acs_enabled(tmp, REQ_ACS_FLAGS)) {
-				swap_pci_ref(&dma_pdev, tmp);
-				break;
-			}
-			pci_dev_put(tmp);
-		}
+	group = iommu_group_get(dev);
+	if (group) {
+		iommu_group_put(group);
+		return 0;
 	}
 
-	/*
-	 * Devices on the root bus go through the iommu.  If that's not us,
-	 * find the next upstream device and test ACS up to the root bus.
-	 * Finding the next device may require skipping virtual buses.
-	 */
-	while (!pci_is_root_bus(dma_pdev->bus)) {
-		struct pci_bus *bus = dma_pdev->bus;
+	pdev = pci_find_dma_isolation_root(to_pci_dev(dev));
 
-		while (!bus->self) {
-			if (!pci_is_root_bus(bus))
-				bus = bus->parent;
-			else
-				goto root_bus;
-		}
+	group = iommu_group_get(&pdev->dev);
 
-		if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
-			break;
-
-		swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
-	}
-
-root_bus:
-	group = iommu_group_get(&dma_pdev->dev);
-	pci_dev_put(dma_pdev);
 	if (!group) {
 		group = iommu_group_alloc();
 		if (IS_ERR(group))
@@ -4443,6 +4387,7 @@ root_bus:
 	ret = iommu_group_add_device(group, dev);
 
 	iommu_group_put(group);
+
 	return ret;
 }
 


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 09/13] iommu/intel: Update to use PCI DMA aliases
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (7 preceding siblings ...)
  2014-05-01 16:27 ` [PATCH 08/13] iommu/intel: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
@ 2014-05-01 16:28 ` Alex Williamson
  2014-05-01 16:28 ` [PATCH 10/13] iommu/fsl: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:28 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, David Woodhouse, linux-kernel

VT-d code currently makes use of pci_find_upstream_pcie_bridge() in
order to find the topology based alias of a device.  This function has
a few problems.  First, it doesn't check the entire alias path of the
device to the root bus, therefore if a PCIe device is masked upstream,
the wrong result is produced.  Also, it's known to get confused and
give up when it crosses a bridge from a conventional PCI bus to a PCIe
bus that lacks a PCIe capability.  The PCI-core provided DMA alias
support solves both of these problems and additionally adds support
for DMA function quirks allowing VT-d to work with devices like
Marvell and Ricoh with known broken requester IDs.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
---
 drivers/iommu/intel-iommu.c         |  222 ++++++++++++++++-------------------
 drivers/iommu/intel_irq_remapping.c |   55 ++++++---
 2 files changed, 139 insertions(+), 138 deletions(-)

diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index f0e50f1..d87b3c9 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1840,54 +1840,56 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
 	return 0;
 }
 
+struct domain_context_mapping_data {
+	struct dmar_domain *domain;
+	struct intel_iommu *iommu;
+	int translation;
+};
+
+static int domain_context_mapping_cb(struct pci_dev *pdev,
+				     u16 alias, void *opaque)
+{
+	struct domain_context_mapping_data *data = opaque;
+
+	return domain_context_mapping_one(data->domain, data->iommu,
+					  PCI_BUS_NUM(alias), alias & 0xff,
+					  data->translation);
+}
+
 static int
 domain_context_mapping(struct dmar_domain *domain, struct device *dev,
 		       int translation)
 {
-	int ret;
-	struct pci_dev *pdev, *tmp, *parent;
 	struct intel_iommu *iommu;
 	u8 bus, devfn;
+	struct domain_context_mapping_data data;
 
 	iommu = device_to_iommu(dev, &bus, &devfn);
 	if (!iommu)
 		return -ENODEV;
 
-	ret = domain_context_mapping_one(domain, iommu, bus, devfn,
-					 translation);
-	if (ret || !dev_is_pci(dev))
-		return ret;
-
-	/* dependent device mapping */
-	pdev = to_pci_dev(dev);
-	tmp = pci_find_upstream_pcie_bridge(pdev);
-	if (!tmp)
-		return 0;
-	/* Secondary interface's bus number and devfn 0 */
-	parent = pdev->bus->self;
-	while (parent != tmp) {
-		ret = domain_context_mapping_one(domain, iommu,
-						 parent->bus->number,
-						 parent->devfn, translation);
-		if (ret)
-			return ret;
-		parent = parent->bus->self;
-	}
-	if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
-		return domain_context_mapping_one(domain, iommu,
-					tmp->subordinate->number, 0,
-					translation);
-	else /* this is a legacy PCI bridge */
-		return domain_context_mapping_one(domain, iommu,
-						  tmp->bus->number,
-						  tmp->devfn,
+	if (!dev_is_pci(dev))
+		return domain_context_mapping_one(domain, iommu, bus, devfn,
 						  translation);
+
+	data.domain = domain;
+	data.iommu = iommu;
+	data.translation = translation;
+
+	return pci_for_each_dma_alias(to_pci_dev(dev),
+				      &domain_context_mapping_cb, &data);
+}
+
+static int domain_context_mapped_cb(struct pci_dev *pdev,
+				    u16 alias, void *opaque)
+{
+	struct intel_iommu *iommu = opaque;
+
+	return !device_context_mapped(iommu, PCI_BUS_NUM(alias), alias & 0xff);
 }
 
 static int domain_context_mapped(struct device *dev)
 {
-	int ret;
-	struct pci_dev *pdev, *tmp, *parent;
 	struct intel_iommu *iommu;
 	u8 bus, devfn;
 
@@ -1895,30 +1897,11 @@ static int domain_context_mapped(struct device *dev)
 	if (!iommu)
 		return -ENODEV;
 
-	ret = device_context_mapped(iommu, bus, devfn);
-	if (!ret || !dev_is_pci(dev))
-		return ret;
+	if (dev_is_pci(dev))
+		return device_context_mapped(iommu, bus, devfn);
 
-	/* dependent device mapping */
-	pdev = to_pci_dev(dev);
-	tmp = pci_find_upstream_pcie_bridge(pdev);
-	if (!tmp)
-		return ret;
-	/* Secondary interface's bus number and devfn 0 */
-	parent = pdev->bus->self;
-	while (parent != tmp) {
-		ret = device_context_mapped(iommu, parent->bus->number,
-					    parent->devfn);
-		if (!ret)
-			return ret;
-		parent = parent->bus->self;
-	}
-	if (pci_is_pcie(tmp))
-		return device_context_mapped(iommu, tmp->subordinate->number,
-					     0);
-	else
-		return device_context_mapped(iommu, tmp->bus->number,
-					     tmp->devfn);
+	return !pci_for_each_dma_alias(to_pci_dev(dev),
+				       domain_context_mapped_cb, iommu);
 }
 
 /* Returns a number of VTD pages, but aligned to MM page size */
@@ -2207,79 +2190,86 @@ static struct dmar_domain *dmar_insert_dev_info(struct intel_iommu *iommu,
 	return domain;
 }
 
+static int get_last_alias(struct pci_dev *pdev, u16 alias, void *opaque)
+{
+	*(u16 *)opaque = alias;
+	return 0;
+}
+
 /* domain is initialized */
 static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
 {
-	struct dmar_domain *domain, *free = NULL;
-	struct intel_iommu *iommu = NULL;
+	struct dmar_domain *domain, *tmp;
+	struct intel_iommu *iommu;
 	struct device_domain_info *info;
-	struct pci_dev *dev_tmp = NULL;
+	u16 dma_alias;
 	unsigned long flags;
-	u8 bus, devfn, bridge_bus, bridge_devfn;
+	u8 bus, devfn;
 
 	domain = find_domain(dev);
 	if (domain)
 		return domain;
 
+	iommu = device_to_iommu(dev, &bus, &devfn);
+	if (!iommu)
+		return NULL;
+
 	if (dev_is_pci(dev)) {
 		struct pci_dev *pdev = to_pci_dev(dev);
-		u16 segment;
 
-		segment = pci_domain_nr(pdev->bus);
-		dev_tmp = pci_find_upstream_pcie_bridge(pdev);
-		if (dev_tmp) {
-			if (pci_is_pcie(dev_tmp)) {
-				bridge_bus = dev_tmp->subordinate->number;
-				bridge_devfn = 0;
-			} else {
-				bridge_bus = dev_tmp->bus->number;
-				bridge_devfn = dev_tmp->devfn;
-			}
-			spin_lock_irqsave(&device_domain_lock, flags);
-			info = dmar_search_domain_by_dev_info(segment,
-							      bridge_bus,
-							      bridge_devfn);
-			if (info) {
-				iommu = info->iommu;
-				domain = info->domain;
-			}
-			spin_unlock_irqrestore(&device_domain_lock, flags);
-			/* pcie-pci bridge already has a domain, uses it */
-			if (info)
-				goto found_domain;
+		pci_for_each_dma_alias(pdev, get_last_alias, &dma_alias);
+
+		spin_lock_irqsave(&device_domain_lock, flags);
+		info = dmar_search_domain_by_dev_info(pci_domain_nr(pdev->bus),
+						      PCI_BUS_NUM(dma_alias),
+						      dma_alias & 0xff);
+		if (info) {
+			iommu = info->iommu;
+			domain = info->domain;
 		}
-	}
+		spin_unlock_irqrestore(&device_domain_lock, flags);
 
-	iommu = device_to_iommu(dev, &bus, &devfn);
-	if (!iommu)
-		goto error;
+		/* DMA alias already has a domain, uses it */
+		if (info)
+			goto found_domain;
+	}
 
 	/* Allocate and initialize new domain for the device */
 	domain = alloc_domain(false);
 	if (!domain)
-		goto error;
+		return NULL;
+
 	if (iommu_attach_domain(domain, iommu)) {
 		free_domain_mem(domain);
-		domain = NULL;
-		goto error;
+		return NULL;
 	}
-	free = domain;
-	if (domain_init(domain, gaw))
-		goto error;
 
-	/* register pcie-to-pci device */
-	if (dev_tmp) {
-		domain = dmar_insert_dev_info(iommu, bridge_bus, bridge_devfn,
-					      NULL, domain);
+	if (domain_init(domain, gaw)) {
+		domain_exit(domain);
+		return NULL;
+	}
+
+	/* register PCI DMA alias device */
+	if (dev_is_pci(dev)) {
+		tmp = dmar_insert_dev_info(iommu, PCI_BUS_NUM(dma_alias),
+					   dma_alias & 0xff, NULL, domain);
+
+		if (!tmp || tmp != domain) {
+			domain_exit(domain);
+			domain = tmp;
+		}
+
 		if (!domain)
-			goto error;
+			return NULL;
 	}
 
 found_domain:
-	domain = dmar_insert_dev_info(iommu, bus, devfn, dev, domain);
-error:
-	if (free != domain)
-		domain_exit(free);
+	tmp = dmar_insert_dev_info(iommu, bus, devfn, dev, domain);
+
+	if (!tmp || tmp != domain) {
+		domain_exit(domain);
+		domain = tmp;
+	}
 
 	return domain;
 }
@@ -4029,33 +4019,21 @@ out_free_dmar:
 	return ret;
 }
 
+static int iommu_detach_dev_cb(struct pci_dev *pdev, u16 alias, void *opaque)
+{
+	struct intel_iommu *iommu = opaque;
+
+	iommu_detach_dev(iommu, PCI_BUS_NUM(alias), alias & 0xff);
+	return 0;
+}
+
 static void iommu_detach_dependent_devices(struct intel_iommu *iommu,
 					   struct device *dev)
 {
-	struct pci_dev *tmp, *parent, *pdev;
-
 	if (!iommu || !dev || !dev_is_pci(dev))
 		return;
 
-	pdev = to_pci_dev(dev);
-
-	/* dependent device detach */
-	tmp = pci_find_upstream_pcie_bridge(pdev);
-	/* Secondary interface's bus number and devfn 0 */
-	if (tmp) {
-		parent = pdev->bus->self;
-		while (parent != tmp) {
-			iommu_detach_dev(iommu, parent->bus->number,
-					 parent->devfn);
-			parent = parent->bus->self;
-		}
-		if (pci_is_pcie(tmp)) /* this is a PCIe-to-PCI bridge */
-			iommu_detach_dev(iommu,
-				tmp->subordinate->number, 0);
-		else /* this is a legacy PCI bridge */
-			iommu_detach_dev(iommu, tmp->bus->number,
-					 tmp->devfn);
-	}
+	pci_for_each_dma_alias(to_pci_dev(dev), &iommu_detach_dev_cb, iommu);
 }
 
 static void domain_remove_one_dev_info(struct dmar_domain *domain,
diff --git a/drivers/iommu/intel_irq_remapping.c b/drivers/iommu/intel_irq_remapping.c
index 9b17489..29ded8f 100644
--- a/drivers/iommu/intel_irq_remapping.c
+++ b/drivers/iommu/intel_irq_remapping.c
@@ -369,29 +369,52 @@ static int set_hpet_sid(struct irte *irte, u8 id)
 	return 0;
 }
 
+struct set_msi_sid_data {
+	struct pci_dev *pdev;
+	u16 alias;
+};
+
+static int set_msi_sid_cb(struct pci_dev *pdev, u16 alias, void *opaque)
+{
+	struct set_msi_sid_data *data = opaque;
+
+	data->pdev = pdev;
+	data->alias = alias;
+
+	return 0;
+}
+
 static int set_msi_sid(struct irte *irte, struct pci_dev *dev)
 {
-	struct pci_dev *bridge;
+	struct set_msi_sid_data data;
 
 	if (!irte || !dev)
 		return -1;
 
-	/* PCIe device or Root Complex integrated PCI device */
-	if (pci_is_pcie(dev) || !dev->bus->parent) {
-		set_irte_sid(irte, SVT_VERIFY_SID_SQ, SQ_ALL_16,
-			     (dev->bus->number << 8) | dev->devfn);
-		return 0;
-	}
+	pci_for_each_dma_alias(dev, set_msi_sid_cb, &data);
 
-	bridge = pci_find_upstream_pcie_bridge(dev);
-	if (bridge) {
-		if (pci_is_pcie(bridge))/* this is a PCIe-to-PCI/PCIX bridge */
-			set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16,
-				(bridge->bus->number << 8) | dev->bus->number);
-		else /* this is a legacy PCI bridge */
-			set_irte_sid(irte, SVT_VERIFY_SID_SQ, SQ_ALL_16,
-				(bridge->bus->number << 8) | bridge->devfn);
-	}
+	/*
+	 * DMA alias provides us with a PCI device and alias.  The only case
+	 * where the it will return an alias on a different bus than the
+	 * device is the case of a PCIe-to-PCI bridge, where the alias is for
+	 * the subordinate bus.  In this case we can only verify the bus.
+	 *
+	 * If the alias device is on a different bus than our source device
+	 * then we have a topology based alias, use it.
+	 *
+	 * Otherwise, the alias is for a device DMA quirk and we cannot
+	 * assume that MSI uses the same requester ID.  Therefore use the
+	 * original device.
+	 */
+	if (PCI_BUS_NUM(data.alias) != data.pdev->bus->number)
+		set_irte_sid(irte, SVT_VERIFY_BUS, SQ_ALL_16,
+			     PCI_DEVID(PCI_BUS_NUM(data.alias),
+				       PCI_BUS_NUM(data.alias)));
+	else if (data.pdev->bus->number != dev->bus->number)
+		set_irte_sid(irte, SVT_VERIFY_SID_SQ, SQ_ALL_16, data.alias);
+	else
+		set_irte_sid(irte, SVT_VERIFY_SID_SQ, SQ_ALL_16,
+			     PCI_DEVID(dev->bus->number, dev->devfn));
 
 	return 0;
 }


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 10/13] iommu/fsl: Use pci_find_dma_isolation_root() for IOMMU groups
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (8 preceding siblings ...)
  2014-05-01 16:28 ` [PATCH 09/13] iommu/intel: Update to use PCI DMA aliases Alex Williamson
@ 2014-05-01 16:28 ` Alex Williamson
  2014-05-01 16:28 ` [PATCH 11/13] iommu: Remove pci.h Alex Williamson
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:28 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, Varun Sethi, acooks, linux-kernel

Drop custom code and use PCI provided isolation root support.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Varun Sethi <varun.sethi@freescale.com>
---
 drivers/iommu/fsl_pamu_domain.c |   67 ++-------------------------------------
 1 file changed, 3 insertions(+), 64 deletions(-)

diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index 93072ba..83e3e7c 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -38,7 +38,6 @@
 #include <sysdev/fsl_pci.h>
 
 #include "fsl_pamu_domain.h"
-#include "pci.h"
 
 /*
  * Global spinlock that needs to be held while
@@ -892,8 +891,6 @@ static int fsl_pamu_get_domain_attr(struct iommu_domain *domain,
 	return ret;
 }
 
-#define REQ_ACS_FLAGS	(PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)
-
 static struct iommu_group *get_device_iommu_group(struct device *dev)
 {
 	struct iommu_group *group;
@@ -950,74 +947,16 @@ static struct iommu_group *get_pci_device_group(struct pci_dev *pdev)
 	struct pci_controller *pci_ctl;
 	bool pci_endpt_partioning;
 	struct iommu_group *group = NULL;
-	struct pci_dev *bridge, *dma_pdev = NULL;
+	struct pci_dev *dma_pdev;
 
 	pci_ctl = pci_bus_to_host(pdev->bus);
 	pci_endpt_partioning = check_pci_ctl_endpt_part(pci_ctl);
 	/* We can partition PCIe devices so assign device group to the device */
 	if (pci_endpt_partioning) {
-		bridge = pci_find_upstream_pcie_bridge(pdev);
-		if (bridge) {
-			if (pci_is_pcie(bridge))
-				dma_pdev = pci_get_domain_bus_and_slot(
-						pci_domain_nr(pdev->bus),
-						bridge->subordinate->number, 0);
-			if (!dma_pdev)
-				dma_pdev = pci_dev_get(bridge);
-		} else
-			dma_pdev = pci_dev_get(pdev);
-
-		/* Account for quirked devices */
-		swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));
-
-		/*
-		 * If it's a multifunction device that does not support our
-		 * required ACS flags, add to the same group as lowest numbered
-		 * function that also does not suport the required ACS flags.
-		 */
-		if (dma_pdev->multifunction &&
-		    !pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS)) {
-			u8 i, slot = PCI_SLOT(dma_pdev->devfn);
+		dma_pdev = pci_find_dma_isolation_root(pdev);
 
-			for (i = 0; i < 8; i++) {
-				struct pci_dev *tmp;
-
-				tmp = pci_get_slot(dma_pdev->bus, PCI_DEVFN(slot, i));
-				if (!tmp)
-					continue;
-
-				if (!pci_acs_enabled(tmp, REQ_ACS_FLAGS)) {
-					swap_pci_ref(&dma_pdev, tmp);
-					break;
-				}
-				pci_dev_put(tmp);
-			}
-		}
-
-		/*
-		 * Devices on the root bus go through the iommu.  If that's not us,
-		 * find the next upstream device and test ACS up to the root bus.
-		 * Finding the next device may require skipping virtual buses.
-		 */
-		while (!pci_is_root_bus(dma_pdev->bus)) {
-			struct pci_bus *bus = dma_pdev->bus;
-
-			while (!bus->self) {
-				if (!pci_is_root_bus(bus))
-					bus = bus->parent;
-				else
-					goto root_bus;
-			}
-
-			if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
-				break;
-
-			swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
-		}
-
-root_bus:
 		group = get_device_iommu_group(&dma_pdev->dev);
-		pci_dev_put(dma_pdev);
+
 		/*
 		 * PCIe controller is not a paritionable entity
 		 * free the controller device iommu_group.


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 11/13] iommu: Remove pci.h
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (9 preceding siblings ...)
  2014-05-01 16:28 ` [PATCH 10/13] iommu/fsl: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
@ 2014-05-01 16:28 ` Alex Williamson
  2014-05-01 16:28 ` [PATCH 12/13] PCI: Remove pci_find_upstream_pcie_bridge() Alex Williamson
  2014-05-01 16:28 ` [PATCH 13/13] PCI: Remove pci_get_dma_source() Alex Williamson
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:28 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, Joerg Roedel, acooks, linux-kernel

The single helper here no longer has any users.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Cc: Joerg Roedel <joro@8bytes.org>
---
 drivers/iommu/pci.h |   29 -----------------------------
 1 file changed, 29 deletions(-)
 delete mode 100644 drivers/iommu/pci.h

diff --git a/drivers/iommu/pci.h b/drivers/iommu/pci.h
deleted file mode 100644
index 352d80a..0000000
--- a/drivers/iommu/pci.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- * Copyright (C) 2013 Red Hat, Inc.
- * Copyright (C) 2013 Freescale Semiconductor, Inc.
- *
- */
-#ifndef __IOMMU_PCI_H
-#define __IOMMU_PCI_H
-
-/* Helper function for swapping pci device reference */
-static inline void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
-{
-	pci_dev_put(*from);
-	*from = to;
-}
-
-#endif  /* __IOMMU_PCI_H */


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 12/13] PCI: Remove pci_find_upstream_pcie_bridge()
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (10 preceding siblings ...)
  2014-05-01 16:28 ` [PATCH 11/13] iommu: Remove pci.h Alex Williamson
@ 2014-05-01 16:28 ` Alex Williamson
  2014-05-01 16:28 ` [PATCH 13/13] PCI: Remove pci_get_dma_source() Alex Williamson
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:28 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

It's broken and has no users.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/search.c |   35 -----------------------------------
 include/linux/pci.h  |   11 -----------
 2 files changed, 46 deletions(-)

diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index 1eab231..6d3b9be 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -238,41 +238,6 @@ struct pci_dev *pci_find_dma_isolation_root(struct pci_dev *pdev)
 	return pdev;
 }
 
-/*
- * find the upstream PCIe-to-PCI bridge of a PCI device
- * if the device is PCIE, return NULL
- * if the device isn't connected to a PCIe bridge (that is its parent is a
- * legacy PCI bridge and the bridge is directly connected to bus 0), return its
- * parent
- */
-struct pci_dev *
-pci_find_upstream_pcie_bridge(struct pci_dev *pdev)
-{
-	struct pci_dev *tmp = NULL;
-
-	if (pci_is_pcie(pdev))
-		return NULL;
-	while (1) {
-		if (pci_is_root_bus(pdev->bus))
-			break;
-		pdev = pdev->bus->self;
-		/* a p2p bridge */
-		if (!pci_is_pcie(pdev)) {
-			tmp = pdev;
-			continue;
-		}
-		/* PCI device should connect to a PCIe bridge */
-		if (pci_pcie_type(pdev) != PCI_EXP_TYPE_PCI_BRIDGE) {
-			/* Busted hardware? */
-			WARN_ON_ONCE(1);
-			return NULL;
-		}
-		return pdev;
-	}
-
-	return tmp;
-}
-
 static struct pci_bus *pci_do_find_bus(struct pci_bus *bus, unsigned char busnr)
 {
 	struct pci_bus *child;
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0d50064..bf4b0e9 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1802,15 +1802,4 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
 				     u16 alias, void *data), void *data);
 struct pci_dev *pci_find_dma_isolation_root(struct pci_dev *pdev);
 
-/**
- * pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device
- * @pdev: the PCI device
- *
- * if the device is PCIE, return NULL
- * if the device isn't connected to a PCIe bridge (that is its parent is a
- * legacy PCI bridge and the bridge is directly connected to bus 0), return its
- * parent
- */
-struct pci_dev *pci_find_upstream_pcie_bridge(struct pci_dev *pdev);
-
 #endif /* LINUX_PCI_H */


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 13/13] PCI: Remove pci_get_dma_source()
  2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
                   ` (11 preceding siblings ...)
  2014-05-01 16:28 ` [PATCH 12/13] PCI: Remove pci_find_upstream_pcie_bridge() Alex Williamson
@ 2014-05-01 16:28 ` Alex Williamson
  12 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-01 16:28 UTC (permalink / raw)
  To: linux-pci, iommu; +Cc: bhelgaas, acooks, linux-kernel

It has no users; replaced by dma_func_alias.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 drivers/pci/quirks.c |   51 --------------------------------------------------
 include/linux/pci.h  |    5 -----
 2 files changed, 56 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 82b2733..ea55b0f 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3371,57 +3371,6 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_JMICRON,
 			 PCI_DEVICE_ID_JMICRON_JMB388_ESD,
 			 quirk_dma_func1_alias);
 
-static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
-{
-	if (!PCI_FUNC(dev->devfn))
-		return pci_dev_get(dev);
-
-	return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
-}
-
-static const struct pci_dev_dma_source {
-	u16 vendor;
-	u16 device;
-	struct pci_dev *(*dma_source)(struct pci_dev *dev);
-} pci_dev_dma_source[] = {
-	/*
-	 * https://bugzilla.redhat.com/show_bug.cgi?id=605888
-	 *
-	 * Some Ricoh devices use the function 0 source ID for DMA on
-	 * other functions of a multifunction device.  The DMA devices
-	 * is therefore function 0, which will have implications of the
-	 * iommu grouping of these devices.
-	 */
-	{ PCI_VENDOR_ID_RICOH, 0xe822, pci_func_0_dma_source },
-	{ PCI_VENDOR_ID_RICOH, 0xe230, pci_func_0_dma_source },
-	{ PCI_VENDOR_ID_RICOH, 0xe832, pci_func_0_dma_source },
-	{ PCI_VENDOR_ID_RICOH, 0xe476, pci_func_0_dma_source },
-	{ 0 }
-};
-
-/*
- * IOMMUs with isolation capabilities need to be programmed with the
- * correct source ID of a device.  In most cases, the source ID matches
- * the device doing the DMA, but sometimes hardware is broken and will
- * tag the DMA as being sourced from a different device.  This function
- * allows that translation.  Note that the reference count of the
- * returned device is incremented on all paths.
- */
-struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
-{
-	const struct pci_dev_dma_source *i;
-
-	for (i = pci_dev_dma_source; i->dma_source; i++) {
-		if ((i->vendor == dev->vendor ||
-		     i->vendor == (u16)PCI_ANY_ID) &&
-		    (i->device == dev->device ||
-		     i->device == (u16)PCI_ANY_ID))
-			return i->dma_source(dev);
-	}
-
-	return pci_dev_get(dev);
-}
-
 /*
  * AMD has indicated that the devices below do not support peer-to-peer
  * in any system where they are found in the southbridge with an AMD
diff --git a/include/linux/pci.h b/include/linux/pci.h
index bf4b0e9..65bdcfd 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1530,16 +1530,11 @@ enum pci_fixup_pass {
 
 #ifdef CONFIG_PCI_QUIRKS
 void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
-struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
 int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
 void pci_dev_specific_enable_acs(struct pci_dev *dev);
 #else
 static inline void pci_fixup_device(enum pci_fixup_pass pass,
 				    struct pci_dev *dev) { }
-static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
-{
-	return pci_dev_get(dev);
-}
 static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
 					       u16 acs_flags)
 {


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices
  2014-05-01 16:27 ` [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices Alex Williamson
@ 2014-05-03  2:29   ` Andrew Cooks
  2014-05-03  5:15     ` Alex Williamson
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Cooks @ 2014-05-03  2:29 UTC (permalink / raw)
  To: Alex Williamson
  Cc: open list:PCI SUBSYSTEM, open list:INTEL IOMMU (VT-d),
	Bjorn Helgaas, open list

[-- Attachment #1: Type: text/plain, Size: 2387 bytes --]

Hi Alex

On Fri, May 2, 2014 at 12:27 AM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> The existing quirk for these devices doesn't really solve the problem,
> re-implement it using the DMA alias iterator.  We'll come back later
> and remove the existing quirk and dma_source interface.
>
> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> ---
>  drivers/pci/quirks.c |   16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index e729206..a458c6b 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
>         return -ENOTTY;
>  }
>
> +static void quirk_dma_func0_alias(struct pci_dev *dev)
> +{
> +       if (PCI_SLOT(dev->devfn) != 0)
> +               dev->dma_func_alias |= (1 << 0);
> +}
> +
> +/*
> + * https://bugzilla.redhat.com/show_bug.cgi?id=605888
> + *
> + * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
> + */
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe822, quirk_dma_func0_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
> +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);

0xe832 is listed twice.

Previously only 0xe832 needed the dma alias on my thinkpad T410, which
has all three devices.

> +
>  static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
>  {
>         if (!PCI_FUNC(dev->devfn))
>

Unfortunately, this quirk doesn't work for me. I tried it without
modification, as well as with each alias individually. I get:

Set context mapping for 0d:00.3
firewire_ohci 0000:0d:00.3: added OHCI v1.10 device as card 0, 4 IR +
4 IT contexts, quirks 0x11
dmar: DRHD: handling fault status reg 2
dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000
DMAR:[fault reason 02] Present bit in context entry is clear

I think I need to see
Set context mapping for 0d:00.0
before
Set context mapping for 0d:00.3
in the log, but it's not there. I'd love to look into this and
understand it properly, but I don't have time for the next four weeks.

The devices are attached as follows:
BDF, device ID
0d:00.0, e822
0d:00.1, e230
0d:00.3, e832

The kernel log is attached.

Regards,

a.

[-- Attachment #2: ricoh_dmar_capture2.txt --]
[-- Type: text/plain, Size: 57456 bytes --]

\0early console in setup code
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.15.0-rc3-00013-ga9181ae (andrew@localhost.localdomain) (gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) ) #106 SMP PREEMPT Sat May 3 08:02:39 WST 2014
[    0.000000] Command line: root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root LANG=en_US.UTF-8 dyndbg="file intel-iommu.c +p ; file iommu.c +p; func intel_unmap_page =_" debug ignore_loglevel loglevel=8 log_buf_len=10M maxcpus=1 intel_iommu=on earlyprintk=serial,0x1808,115200n8,keep initrd=../initramfs-3.15.0-rc3-00013-ga9181ae.img BOOT_IMAGE=../vmlinuz-3.15.0-rc3-00013-ga9181ae 
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009dc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000d2000-0x00000000000d3fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000bb27bfff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb27c000-0x00000000bb281fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb282000-0x00000000bb35dfff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb35e000-0x00000000bb370fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb371000-0x00000000bb3f1fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb3f2000-0x00000000bb40efff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb40f000-0x00000000bb46efff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb46f000-0x00000000bb667fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb668000-0x00000000bb6e7fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb6e8000-0x00000000bb70efff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb70f000-0x00000000bb716fff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb717000-0x00000000bb71efff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000bb71f000-0x00000000bb76afff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb76b000-0x00000000bb776fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb777000-0x00000000bb779fff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000bb77a000-0x00000000bb780fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb781000-0x00000000bb781fff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000bb782000-0x00000000bb78afff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb78b000-0x00000000bb78bfff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000bb78c000-0x00000000bb79efff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000bb79f000-0x00000000bb7fefff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000bb7ff000-0x00000000bb7fffff] usable
[    0.000000] BIOS-e820: [mem 0x00000000bb800000-0x00000000bfffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000e0000000-0x00000000efffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000feaff000-0x00000000feafffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed00000-0x00000000fed003ff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fed1c000-0x00000000fed8ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x0000000137ffffff] usable
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] console [earlyser0] enabled
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.6 present.
[    0.000000] DMI: LENOVO 25373R7/25373R7, BIOS 6IET85WW (1.45 ) 02/14/2013
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] No AGP bridge found
[    0.000000] e820: last_pfn = 0x138000 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-D3FFF write-protect
[    0.000000]   D4000-DBFFF uncachable
[    0.000000]   DC000-FFFFF write-protect
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 disabled
[    0.000000]   1 base 000000000 mask F80000000 write-back
[    0.000000]   2 base 080000000 mask FC0000000 write-back
[    0.000000]   3 base 100000000 mask FC0000000 write-back
[    0.000000]   4 base 138000000 mask FF8000000 uncachable
[    0.000000]   5 base 0BC000000 mask FFC000000 uncachable
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    0.000000] original variable MTRRs
[    0.000000] reg 1, base: 0GB, range: 2GB, type WB
[    0.000000] reg 2, base: 2GB, range: 1GB, type WB
[    0.000000] reg 3, base: 4GB, range: 1GB, type WB
[    0.000000] reg 4, base: 4992MB, range: 128MB, type UC
[    0.000000] reg 5, base: 3008MB, range: 64MB, type UC
[    0.000000] total RAM covered: 3904M
[    0.000000] Found optimal setting for mtrr clean up
[    0.000000]  gran_size: 64K 	chunk_size: 256M 	num_reg: 5  	lose cover RAM: 0G
[    0.000000] New variable MTRRs
[    0.000000] reg 0, base: 0GB, range: 2GB, type WB
[    0.000000] reg 1, base: 2GB, range: 1GB, type WB
[    0.000000] reg 2, base: 3008MB, range: 64MB, type UC
[    0.000000] reg 3, base: 4GB, range: 1GB, type WB
[    0.000000] reg 4, base: 4992MB, range: 128MB, type UC
[    0.000000] e820: update [mem 0xbc000000-0xffffffff] usable ==> reserved
[    0.000000] e820: last_pfn = 0xbb800 max_arch_pfn = 0x400000000
[    0.000000] found SMP MP-table at [mem 0x000f6890-0x000f689f] mapped at [ffff8800000f6890]
[    0.000000] Base memory trampoline at [ffff880000097000] 97000 size 24576
[    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[    0.000000]  [mem 0x00000000-0x000fffff] page 4k
[    0.000000] BRK [0x01f45000, 0x01f45fff] PGTABLE
[    0.000000] BRK [0x01f46000, 0x01f46fff] PGTABLE
[    0.000000] BRK [0x01f47000, 0x01f47fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x137e00000-0x137ffffff]
[    0.000000]  [mem 0x137e00000-0x137ffffff] page 2M
[    0.000000] BRK [0x01f48000, 0x01f48fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x134000000-0x137dfffff]
[    0.000000]  [mem 0x134000000-0x137dfffff] page 2M
[    0.000000] init_memory_mapping: [mem 0x100000000-0x133ffffff]
[    0.000000]  [mem 0x100000000-0x133ffffff] page 2M
[    0.000000] init_memory_mapping: [mem 0x00100000-0xbb27bfff]
[    0.000000]  [mem 0x00100000-0x001fffff] page 4k
[    0.000000]  [mem 0x00200000-0xbb1fffff] page 2M
[    0.000000]  [mem 0xbb200000-0xbb27bfff] page 4k
[    0.000000] init_memory_mapping: [mem 0xbb282000-0xbb35dfff]
[    0.000000]  [mem 0xbb282000-0xbb35dfff] page 4k
[    0.000000] init_memory_mapping: [mem 0xbb40f000-0xbb46efff]
[    0.000000]  [mem 0xbb40f000-0xbb46efff] page 4k
[    0.000000] BRK [0x01f49000, 0x01f49fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0xbb70f000-0xbb716fff]
[    0.000000]  [mem 0xbb70f000-0xbb716fff] page 4k
[    0.000000] BRK [0x01f4a000, 0x01f4afff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0xbb71f000-0xbb76afff]
[    0.000000]  [mem 0xbb71f000-0xbb76afff] page 4k
[    0.000000] init_memory_mapping: [mem 0xbb7ff000-0xbb7fffff]
[    0.000000]  [mem 0xbb7ff000-0xbb7fffff] page 4k
[    0.000000] log_buf_len: 16777216
[    0.000000] early log buf free: 254460(97%)
[    0.000000] RAMDISK: [mem 0x7ee4c000-0x7fffefff]
[    0.000000] ACPI: RSDP 0x00000000000F6850 000024 (v02 LENOVO)
[    0.000000] ACPI: XSDT 0x00000000BB7EF0C6 00009C (v01 LENOVO TP-6I    00001450  LTP 00000000)
[    0.000000] ACPI: FACP 0x00000000BB7EF200 0000F4 (v04 LENOVO TP-6I    00001450 LNVO 00000001)
[    0.000000] ACPI BIOS Warning (bug): 32/64X length mismatch in FADT/Pm1aControlBlock: 16/32 (20140214/tbfadt-603)
[    0.000000] ACPI BIOS Warning (bug): Invalid length for FADT/Pm1aControlBlock: 32, using default 16 (20140214/tbfadt-684)
[    0.000000] ACPI: DSDT 0x00000000BB7EF5D1 00F56A (v01 LENOVO TP-6I    00001450 MSFT 03000001)
[    0.000000] ACPI: FACS 0x00000000BB6E7000 000040
[    0.000000] ACPI: SSDT 0x00000000BB7EF3B4 00021D (v01 LENOVO TP-6I    00001450 MSFT 03000001)
[    0.000000] ACPI: ECDT 0x00000000BB7FEB3B 000052 (v01 LENOVO TP-6I    00001450 LNVO 00000001)
[    0.000000] ACPI: APIC 0x00000000BB7FEB8D 000084 (v01 LENOVO TP-6I    00001450 LNVO 00000001)
[    0.000000] ACPI: MCFG 0x00000000BB7FEC49 00003C (v01 LENOVO TP-6I    00001450 LNVO 00000001)
[    0.000000] ACPI: HPET 0x00000000BB7FEC85 000038 (v01 LENOVO TP-6I    00001450 LNVO 00000001)
[    0.000000] ACPI: ASF! 0x00000000BB7FEDBE 0000A4 (v16 LENOVO TP-6I    00001450 PTL  00000001)
[    0.000000] ACPI: SLIC 0x00000000BB7FEE62 000176 (v01 LENOVO TP-6I    00001450  LTP 00000000)
[    0.000000] ACPI: BOOT 0x00000000BB7FEFD8 000028 (v01 LENOVO TP-6I    00001450  LTP 00000001)
[    0.000000] ACPI: SSDT 0x00000000BB6E591A 00084B (v01 LENOVO TP-6I    00001450 INTL 20050513)
[    0.000000] ACPI: TCPA 0x00000000BB78B000 000032 (v02 PTL     CRESTLN 06040000      00005A52)
[    0.000000] ACPI: DMAR 0x00000000BB781000 0000B8 (v01 INTEL  CP_DALE  00000001 INTL 00000001)
[    0.000000] ACPI: SSDT 0x00000000BB779000 0009F1 (v01 PmRef  CpuPm    00003000 INTL 20061109)
[    0.000000] ACPI: SSDT 0x00000000BB778000 000259 (v01 PmRef  Cpu0Tst  00003000 INTL 20061109)
[    0.000000] ACPI: SSDT 0x00000000BB777000 00049F (v01 PmRef  ApTst    00003000 INTL 20061109)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000]  [ffffea0000000000-ffffea0004dfffff] PMD -> [ffff880132800000-ffff8801365fffff] on node 0
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   DMA32    [mem 0x01000000-0xffffffff]
[    0.000000]   Normal   [mem 0x100000000-0x137ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00001000-0x0009cfff]
[    0.000000]   node   0: [mem 0x00100000-0xbb27bfff]
[    0.000000]   node   0: [mem 0xbb282000-0xbb35dfff]
[    0.000000]   node   0: [mem 0xbb40f000-0xbb46efff]
[    0.000000]   node   0: [mem 0xbb70f000-0xbb716fff]
[    0.000000]   node   0: [mem 0xbb71f000-0xbb76afff]
[    0.000000]   node   0: [mem 0xbb7ff000-0xbb7fffff]
[    0.000000]   node   0: [mem 0x100000000-0x137ffffff]
[    0.000000] On node 0 totalpages: 996265
[    0.000000]   DMA zone: 64 pages used for memmap
[    0.000000]   DMA zone: 21 pages reserved
[    0.000000]   DMA zone: 3996 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 11921 pages used for memmap
[    0.000000]   DMA32 zone: 762893 pages, LIFO batch:31
[    0.000000]   Normal zone: 3584 pages used for memmap
[    0.000000]   Normal zone: 229376 pages, LIFO batch:31
[    0.000000] Reserving Intel graphics stolen memory at 0xbe000000-0xbfffffff
[    0.000000] ACPI: PM-Timer IO Port: 0x1008
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x04] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x05] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x02] high edge lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x03] high edge lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x01] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 1, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a701 base: 0xfed00000
[    0.000000] smpboot: Allowing 4 CPUs, 0 hotplug CPUs
[    0.000000] nr_irqs_gsi: 40
[    0.000000] PM: Registered nosave memory: [mem 0x0009d000-0x0009dfff]
[    0.000000] PM: Registered nosave memory: [mem 0x0009e000-0x0009ffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000a0000-0x000d1fff]
[    0.000000] PM: Registered nosave memory: [mem 0x000d2000-0x000d3fff]
[    0.000000] PM: Registered nosave memory: [mem 0x000d4000-0x000dffff]
[    0.000000] PM: Registered nosave memory: [mem 0x000e0000-0x000fffff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb27c000-0xbb281fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb35e000-0xbb370fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb371000-0xbb3f1fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb3f2000-0xbb40efff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb46f000-0xbb667fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb668000-0xbb6e7fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb6e8000-0xbb70efff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb717000-0xbb71efff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb76b000-0xbb776fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb777000-0xbb779fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb77a000-0xbb780fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb781000-0xbb781fff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb782000-0xbb78afff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb78b000-0xbb78bfff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb78c000-0xbb79efff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb79f000-0xbb7fefff]
[    0.000000] PM: Registered nosave memory: [mem 0xbb800000-0xbfffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xc0000000-0xdfffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xe0000000-0xefffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xf0000000-0xfeafefff]
[    0.000000] PM: Registered nosave memory: [mem 0xfeaff000-0xfeafffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfeb00000-0xfebfffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfec00000-0xfec0ffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfec10000-0xfecfffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed00000-0xfed1bfff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed1c000-0xfed8ffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfed90000-0xfedfffff]
[    0.000000] PM: Registered nosave memory: [mem 0xfee00000-0xfee00fff]
[    0.000000] PM: Registered nosave memory: [mem 0xfee01000-0xfeffffff]
[    0.000000] PM: Registered nosave memory: [mem 0xff000000-0xffffffff]
[    0.000000] e820: [mem 0xc0000000-0xdfffffff] available for PCI devices
[    0.000000] setup_percpu: NR_CPUS:128 nr_cpumask_bits:128 nr_cpu_ids:4 nr_node_ids:1
[    0.000000] PERCPU: Embedded 27 pages/cpu @ffff880136c00000 s81728 r8192 d20672 u524288
[    0.000000] pcpu-alloc: s81728 r8192 d20672 u524288 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 0 1 2 3 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 980675
[    0.000000] Kernel command line: root=/dev/mapper/fedora-root ro rd.lvm.lv=fedora/swap rd.lvm.lv=fedora/root LANG=en_US.UTF-8 dyndbg="file intel-iommu.c +p ; file iommu.c +p; func intel_unmap_page =_" debug ignore_loglevel loglevel=8 log_buf_len=10M maxcpus=1 intel_iommu=on earlyprintk=serial,0x1808,115200n8,keep initrd=../initramfs-3.15.0-rc3-00013-ga9181ae.img BOOT_IMAGE=../vmlinuz-3.15.0-rc3-00013-ga9181ae 
[    0.000000] Intel-IOMMU: enabled
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes)
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Memory: 3798592K/3985060K available (7606K kernel code, 1055K rwdata, 3428K rodata, 1236K init, 1020K bss, 186468K reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	RCU restricting CPUs from NR_CPUS=128 to nr_cpu_ids=4.
[    0.000000] 	Offload RCU callbacks from all CPUs
[    0.000000] 	Offload RCU callbacks from CPUs: 0-3.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NO_HZ: Full dynticks CPUs: 1-127.
[    0.000000] NR_IRQS:8448 nr_irqs:712 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [tty0] enabled
[    0.000000] allocated 16252928 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[    0.000000] hpet clockevent registered
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] tsc: Detected 2660.182 MHz processor
[    0.000059] Calibrating delay loop (skipped), value calculated using timer frequency.. 5320.36 BogoMIPS (lpj=2660182)
[    0.002278] pid_max: default: 32768 minimum: 301
[    0.003357] ACPI: Core revision 20140214
[    0.036673] ACPI: All ACPI Tables successfully acquired
[    0.046973] Security Framework initialized
[    0.047872] SELinux:  Initializing.
[    0.048710] SELinux:  Starting in permissive mode
[    0.049732] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.051109] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes)
[    0.052928] Initializing cgroup subsys memory
[    0.053947] Initializing cgroup subsys devices
[    0.054893] Initializing cgroup subsys freezer
[    0.055837] Initializing cgroup subsys net_cls
[    0.056780] Initializing cgroup subsys blkio
[    0.057692] Initializing cgroup subsys perf_event
[    0.058781] Initializing cgroup subsys net_prio
[    0.059774] CPU: Physical Processor ID: 0
[    0.060634] CPU: Processor Core ID: 0
[    0.061434] mce: CPU supports 9 MCE banks
[    0.062304] CPU0: Thermal monitoring enabled (TM1)
[    0.063373] Last level iTLB entries: 4KB 512, 2MB 7, 4MB 7
[    0.063373] Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32, 1GB 0
[    0.063373] tlb_flushall_shift: 6
[    0.076512] ftrace: allocating 26957 entries in 106 pages
[    0.105222] dmar: Host address width 36
[    0.106043] dmar: DRHD base: 0x000000fed90000 flags: 0x0
[    0.107173] dmar: IOMMU 0: reg_base_addr fed90000 ver 1:0 cap c9008020e30272 ecap 1000
[    0.109016] dmar: DRHD base: 0x000000fed91000 flags: 0x0
[    0.110162] dmar: IOMMU 1: reg_base_addr fed91000 ver 1:0 cap c0000020230272 ecap 1000
[    0.111829] dmar: DRHD base: 0x000000fed93000 flags: 0x1
[    0.112950] dmar: IOMMU 2: reg_base_addr fed93000 ver 1:0 cap c9008020630272 ecap 1000
[    0.114652] dmar: RMRR base: 0x000000bb6e9000 end: 0x000000bb6fffff
[    0.115961] dmar: RMRR base: 0x000000bdc00000 end: 0x000000bfffffff
[    0.117896] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.129187] smpboot: CPU0: Intel(R) Core(TM) i5 CPU       M 560  @ 2.67GHz (fam: 06, model: 25, stepping: 05)
[    0.233177] Performance Events: PEBS fmt1+, 16-deep LBR, Westmere events, Intel PMU driver.
[    0.235284] perf_event_intel: CPUID marked event: 'bus cycles' unavailable
[    0.236688] ... version:                3
[    0.237543] ... bit width:              48
[    0.238504] ... generic registers:      4
[    0.239356] ... value mask:             0000ffffffffffff
[    0.240464] ... max period:             000000007fffffff
[    0.241561] ... fixed-purpose events:   3
[    0.242410] ... event mask:             000000070000000f
[    0.253205] x86: Booted up 1 node, 1 CPUs
[    0.254052] smpboot: Total of 1 processors activated (5320.36 BogoMIPS)
[    0.256102] NMI watchdog: enabled on all CPUs, permanently consumes one hw-PMU counter.
[    0.258110] devtmpfs: initialized
[    0.259277] evm: security.selinux
[    0.259989] evm: security.capability
[    0.260949] PM: Registering ACPI NVS region [mem 0xbb371000-0xbb3f1fff] (528384 bytes)
[    0.262618] PM: Registering ACPI NVS region [mem 0xbb668000-0xbb6e7fff] (524288 bytes)
[    0.264943] PM: Registering ACPI NVS region [mem 0xbb76b000-0xbb776fff] (49152 bytes)
[    0.266567] PM: Registering ACPI NVS region [mem 0xbb77a000-0xbb780fff] (28672 bytes)
[    0.268237] PM: Registering ACPI NVS region [mem 0xbb782000-0xbb78afff] (36864 bytes)
[    0.269862] PM: Registering ACPI NVS region [mem 0xbb78c000-0xbb79efff] (77824 bytes)
[    0.273459] atomic64 test passed for x86-64 platform with CX8 and with SSE
[    0.274897] RTC time:  1:06:06, date: 05/03/14
[    0.276524] NET: Registered protocol family 16
[    0.277700] cpuidle: using governor ladder
[    0.278660] cpuidle: using governor menu
[    0.279644] ACPI FADT declares the system doesn't support PCIe ASPM, so disable it
[    0.281301] ACPI: bus type PCI registered
[    0.282148] acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
[    0.283658] PCI: MMCONFIG for domain 0000 [bus 00-ff] at [mem 0xe0000000-0xefffffff] (base 0xe0000000)
[    0.286556] PCI: MMCONFIG at [mem 0xe0000000-0xefffffff] reserved in E820
[    0.371472] PCI: Using configuration type 1 for base access
[    0.376251] ACPI: Added _OSI(Module Device)
[    0.377132] ACPI: Added _OSI(Processor Device)
[    0.378148] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.379132] ACPI: Added _OSI(Processor Aggregator Device)
[    0.385177] ACPI : EC: EC description table is found, configuring boot EC
[    0.400766] [Firmware Bug]: ACPI: BIOS _OSI(Linux) query ignored
[    0.482096] ACPI: SSDT 0x00000000BB71A598 0004F3 (v01 PmRef  Cpu0Ist  00003000 INTL 20061109)
[    0.485392] ACPI: Dynamic OEM Table Load:
[    0.486842] ACPI: SSDT 0x0000000000000000 0004F3 (v01 PmRef  Cpu0Ist  00003000 INTL 20061109)
[    0.489351] ACPI: SSDT 0x00000000BB718718 0006B2 (v01 PmRef  Cpu0Cst  00003001 INTL 20061109)
[    0.492700] ACPI: Dynamic OEM Table Load:
[    0.493685] ACPI: SSDT 0x0000000000000000 0006B2 (v01 PmRef  Cpu0Cst  00003001 INTL 20061109)
[    0.497736] ACPI: SSDT 0x00000000BB719A98 000303 (v01 PmRef  ApIst    00003000 INTL 20061109)
[    0.501055] ACPI: Dynamic OEM Table Load:
[    0.501978] ACPI: SSDT 0x0000000000000000 000303 (v01 PmRef  ApIst    00003000 INTL 20061109)
[    0.504361] ACPI: SSDT 0x00000000BB717D98 000119 (v01 PmRef  ApCst    00003000 INTL 20061109)
[    0.507504] ACPI: Dynamic OEM Table Load:
[    0.508636] ACPI: SSDT 0x0000000000000000 000119 (v01 PmRef  ApCst    00003000 INTL 20061109)
[    0.513810] ACPI: Interpreter enabled
[    0.514610] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140214/hwxface-580)
[    0.516607] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140214/hwxface-580)
[    0.519197] ACPI: (supports S0 S3 S4 S5)
[    0.520033] ACPI: Using IOAPIC for interrupt routing
[    0.521114] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.534751] ACPI: Power Resource [PUBS] (on)
[    0.536732] acpi PNP0C0A:01: ACPI dock station (docks/bays count: 1)
[    0.542833] acpi LNXIOBAY:00: ACPI dock station (docks/bays count: 2)
[    0.548214] ACPI: \_PR_.CPU4: failed to get CPU APIC ID.
[    0.549328] ACPI: \_PR_.CPU5: failed to get CPU APIC ID.
[    0.550438] ACPI: \_PR_.CPU6: failed to get CPU APIC ID.
[    0.551545] ACPI: \_PR_.CPU7: failed to get CPU APIC ID.
[    0.552855] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11)
[    0.554750] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 *11)
[    0.556584] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 9 10 11) *0, disabled.
[    0.558862] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 10 *11)
[    0.561199] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11)
[    0.563190] ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 *11)
[    0.565021] ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 11) *0, disabled.
[    0.567251] ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 10 *11)
[    0.569022] ACPI: PCI Root Bridge [UNCR] (domain 0000 [bus ff])
[    0.570245] acpi PNP0A03:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
[    0.571962] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.573488] PCI host bridge to bus 0000:ff
[    0.574359] pci_bus 0000:ff: root bus resource [bus ff]
[    0.575451] pci 0000:ff:00.0: [8086:2c62] type 00 class 0x060000
[    0.576799] pci 0000:ff:00.1: [8086:2d01] type 00 class 0x060000
[    0.578242] pci 0000:ff:02.0: [8086:2d10] type 00 class 0x060000
[    0.579583] pci 0000:ff:02.1: [8086:2d11] type 00 class 0x060000
[    0.580912] pci 0000:ff:02.2: [8086:2d12] type 00 class 0x060000
[    0.582637] pci 0000:ff:02.3: [8086:2d13] type 00 class 0x060000
[    0.583985] pci_bus 0000:ff: on NUMA node 0
[    0.584903] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-fe])
[    0.586175] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI]
[    0.588430] acpi PNP0A08:00: _OSC: platform does not support [PCIeCapability]
[    0.590110] acpi PNP0A08:00: _OSC: not requesting control; platform does not support [PCIeCapability]
[    0.592010] acpi PNP0A08:00: _OSC: OS requested [PCIeHotplug PME AER PCIeCapability]
[    0.593709] acpi PNP0A08:00: _OSC: platform willing to grant [PCIeHotplug PME AER]
[    0.595289] acpi PNP0A08:00: _OSC failed (AE_SUPPORT); disabling ASPM
[    0.597023] PCI host bridge to bus 0000:00
[    0.597963] pci_bus 0000:00: root bus resource [bus 00-fe]
[    0.599100] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7]
[    0.600366] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff]
[    0.602209] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[    0.603904] pci_bus 0000:00: root bus resource [mem 0x000d4000-0x000d7fff]
[    0.605308] pci_bus 0000:00: root bus resource [mem 0x000d8000-0x000dbfff]
[    0.606702] pci_bus 0000:00: root bus resource [mem 0x000dc000-0x000dffff]
[    0.608565] pci_bus 0000:00: root bus resource [mem 0xc0000000-0xfebfffff]
[    0.609976] pci 0000:00:00.0: [8086:0044] type 00 class 0x060000
[    0.611236] DMAR: Disabling batched IOTLB flush on Ironlake
[    0.612549] pci 0000:00:02.0: [8086:0046] type 00 class 0x030000
[    0.613810] pci 0000:00:02.0: reg 0x10: [mem 0xf2000000-0xf23fffff 64bit]
[    0.615208] pci 0000:00:02.0: reg 0x18: [mem 0xd0000000-0xdfffffff 64bit pref]
[    0.616725] pci 0000:00:02.0: reg 0x20: [io  0x1800-0x1807]
[    0.618141] pci 0000:00:16.0: [8086:3b64] type 00 class 0x078000
[    0.619421] pci 0000:00:16.0: reg 0x10: [mem 0xf2827800-0xf282780f 64bit]
[    0.621426] pci 0000:00:16.0: PME# supported from D0 D3hot D3cold
[    0.623363] pci 0000:00:16.3: [8086:3b67] type 00 class 0x070002
[    0.624649] pci 0000:00:16.3: reg 0x10: [io  0x1808-0x180f]
[    0.625809] pci 0000:00:16.3: reg 0x14: [mem 0xf2624000-0xf2624fff]
[    0.627385] pci 0000:00:19.0: [8086:10ea] type 00 class 0x020000
[    0.628740] pci 0000:00:19.0: reg 0x10: [mem 0xf2600000-0xf261ffff]
[    0.630036] pci 0000:00:19.0: reg 0x14: [mem 0xf2625000-0xf2625fff]
[    0.631346] pci 0000:00:19.0: reg 0x18: [io  0x1820-0x183f]
[    0.632641] pci 0000:00:19.0: PME# supported from D0 D3hot D3cold
[    0.633986] pci 0000:00:19.0: System wakeup disabled by ACPI
[    0.635258] pci 0000:00:1a.0: [8086:3b3c] type 00 class 0x0c0320
[    0.636535] pci 0000:00:1a.0: reg 0x10: [mem 0xf2828000-0xf28283ff]
[    0.638082] pci 0000:00:1a.0: PME# supported from D0 D3hot D3cold
[    0.639425] pci 0000:00:1a.0: System wakeup disabled by ACPI
[    0.640696] pci 0000:00:1b.0: [8086:3b56] type 00 class 0x040300
[    0.642454] pci 0000:00:1b.0: reg 0x10: [mem 0xf2620000-0xf2623fff 64bit]
[    0.644091] pci 0000:00:1b.0: PME# supported from D0 D3hot D3cold
[    0.645462] pci 0000:00:1b.0: System wakeup disabled by ACPI
[    0.646717] pci 0000:00:1c.0: [8086:3b42] type 01 class 0x060400
[    0.648186] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.649475] pci 0000:00:1c.0: Enabling MPC IRBNCE
[    0.650456] pci 0000:00:1c.0: Intel PCH root port ACS workaround enabled
[    0.651886] pci 0000:00:1c.0: System wakeup disabled by ACPI
[    0.653235] pci 0000:00:1c.1: [8086:3b44] type 01 class 0x060400
[    0.654628] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold
[    0.655922] pci 0000:00:1c.1: Enabling MPC IRBNCE
[    0.656908] pci 0000:00:1c.1: Intel PCH root port ACS workaround enabled
[    0.658437] pci 0000:00:1c.1: System wakeup disabled by ACPI
[    0.659703] pci 0000:00:1c.4: [8086:3b4a] type 01 class 0x060400
[    0.661098] pci 0000:00:1c.4: PME# supported from D0 D3hot D3cold
[    0.662916] pci 0000:00:1c.4: Enabling MPC IRBNCE
[    0.663918] pci 0000:00:1c.4: Intel PCH root port ACS workaround enabled
[    0.665352] pci 0000:00:1c.4: System wakeup disabled by ACPI
[    0.666619] pci 0000:00:1d.0: [8086:3b34] type 00 class 0x0c0320
[    0.667935] pci 0000:00:1d.0: reg 0x10: [mem 0xf2828400-0xf28287ff]
[    0.669390] pci 0000:00:1d.0: PME# supported from D0 D3hot D3cold
[    0.670730] pci 0000:00:1d.0: System wakeup disabled by ACPI
[    0.671994] pci 0000:00:1e.0: [8086:2448] type 01 class 0x060401
[    0.673542] pci 0000:00:1f.0: [8086:3b07] type 00 class 0x060100
[    0.675087] pci 0000:00:1f.2: [8086:3b2f] type 00 class 0x010601
[    0.676386] pci 0000:00:1f.2: reg 0x10: [io  0x1860-0x1867]
[    0.677638] pci 0000:00:1f.2: reg 0x14: [io  0x1814-0x1817]
[    0.678806] pci 0000:00:1f.2: reg 0x18: [io  0x1818-0x181f]
[    0.679970] pci 0000:00:1f.2: reg 0x1c: [io  0x1810-0x1813]
[    0.681140] pci 0000:00:1f.2: reg 0x20: [io  0x1840-0x185f]
[    0.682788] pci 0000:00:1f.2: reg 0x24: [mem 0xf2827000-0xf28277ff]
[    0.684171] pci 0000:00:1f.2: PME# supported from D3hot
[    0.685418] pci 0000:00:1f.3: [8086:3b30] type 00 class 0x0c0500
[    0.686685] pci 0000:00:1f.3: reg 0x10: [mem 0xf2828800-0xf28288ff 64bit]
[    0.688215] pci 0000:00:1f.3: reg 0x20: [io  0x1880-0x189f]
[    0.689552] pci 0000:00:1f.6: [8086:3b32] type 00 class 0x118000
[    0.690828] pci 0000:00:1f.6: reg 0x10: [mem 0xf2626000-0xf2626fff 64bit]
[    0.692579] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.693786] pci 0000:03:00.0: [8086:4239] type 00 class 0x028000
[    0.695079] pci 0000:03:00.0: reg 0x10: [mem 0xf2400000-0xf2401fff 64bit]
[    0.696715] pci 0000:03:00.0: PME# supported from D0 D3hot D3cold
[    0.699217] pci 0000:00:1c.1: PCI bridge to [bus 03]
[    0.700265] pci 0000:00:1c.1:   bridge window [mem 0xf2400000-0xf24fffff]
[    0.701867] pci 0000:0d:00.0: [1180:e822] type 00 class 0x080500
[    0.703638] pci 0000:0d:00.0: MMC controller base frequency changed to 50Mhz.
[    0.705193] pci 0000:0d:00.0: reg 0x10: [mem 0xf2500000-0xf25000ff]
[    0.706766] pci 0000:0d:00.0: supports D1 D2
[    0.707943] pci 0000:0d:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.709566] pci 0000:0d:00.1: [1180:e230] type 00 class 0x088000
[    0.710899] pci 0000:0d:00.1: reg 0x10: [mem 0xf2500400-0xf25004ff]
[    0.712451] pci 0000:0d:00.1: supports D1 D2
[    0.713362] pci 0000:0d:00.1: PME# supported from D0 D1 D2 D3hot D3cold
[    0.714979] pci 0000:0d:00.3: [1180:e832] type 00 class 0x0c0010
[    0.716295] pci 0000:0d:00.3: reg 0x10: [mem 0xf2500800-0xf2500fff]
[    0.717892] pci 0000:0d:00.3: supports D1 D2
[    0.718796] pci 0000:0d:00.3: PME# supported from D0 D1 D2 D3hot D3cold
[    0.722275] pci 0000:00:1c.4: PCI bridge to [bus 0d]
[    0.723400] pci 0000:00:1c.4:   bridge window [mem 0xf2500000-0xf25fffff]
[    0.724934] pci 0000:00:1e.0: PCI bridge to [bus 0e] (subtractive decode)
[    0.726895] pci 0000:00:1e.0:   bridge window [io  0x0000-0x0cf7] (subtractive decode)
[    0.729141] pci 0000:00:1e.0:   bridge window [io  0x0d00-0xffff] (subtractive decode)
[    0.730780] pci 0000:00:1e.0:   bridge window [mem 0x000a0000-0x000bffff] (subtractive decode)
[    0.732664] pci 0000:00:1e.0:   bridge window [mem 0x000d4000-0x000d7fff] (subtractive decode)
[    0.734435] pci 0000:00:1e.0:   bridge window [mem 0x000d8000-0x000dbfff] (subtractive decode)
[    0.736213] pci 0000:00:1e.0:   bridge window [mem 0x000dc000-0x000dffff] (subtractive decode)
[    0.738075] pci 0000:00:1e.0:   bridge window [mem 0xc0000000-0xfebfffff] (subtractive decode)
[    0.739985] pci_bus 0000:00: on NUMA node 0
[    0.743049] ACPI: Enabled 3 GPEs in block 00 to 3F
[    0.744297] ACPI : EC: GPE = 0x11, I/O: command/status = 0x66, data = 0x62
[    0.745850] vgaarb: device added: PCI:0000:00:02.0,decodes=io+mem,owns=io+mem,locks=none
[    0.747605] vgaarb: loaded
[    0.748621] vgaarb: bridge control possible 0000:00:02.0
[    0.749928] SCSI subsystem initialized
[    0.750806] libata version 3.00 loaded.
[    0.751645] ACPI: bus type USB registered
[    0.752632] usbcore: registered new interface driver usbfs
[    0.753784] usbcore: registered new interface driver hub
[    0.754931] usbcore: registered new device driver usb
[    0.756018] pps_core: LinuxPPS API ver. 1 registered
[    0.757053] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.759041] PTP clock support registered
[    0.759969] PCI: Using ACPI for IRQ routing
[    0.773069] PCI: pci_cache_line_size set to 64 bytes
[    0.774313] e820: reserve RAM buffer [mem 0x0009dc00-0x0009ffff]
[    0.775545] e820: reserve RAM buffer [mem 0xbb27c000-0xbbffffff]
[    0.776779] e820: reserve RAM buffer [mem 0xbb35e000-0xbbffffff]
[    0.778105] e820: reserve RAM buffer [mem 0xbb46f000-0xbbffffff]
[    0.779343] e820: reserve RAM buffer [mem 0xbb717000-0xbbffffff]
[    0.781005] e820: reserve RAM buffer [mem 0xbb76b000-0xbbffffff]
[    0.782244] e820: reserve RAM buffer [mem 0xbb800000-0xbbffffff]
[    0.783889] NetLabel: Initializing
[    0.784630] NetLabel:  domain hash size = 128
[    0.785539] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.786585] cfg80211: Calling CRDA to update world regulatory domain
[    0.788021] NetLabel:  unlabeled traffic allowed by default
[    0.789383] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0, 0, 0, 0, 0, 0
[    0.790984] hpet0: 8 comparators, 64-bit 14.318180 MHz counter
[    0.794232] Switched to clocksource hpet
[    0.816098] pnp: PnP ACPI init
[    0.816814] ACPI: bus type PNP registered
[    0.819882] system 00:00: [mem 0x00000000-0x0009ffff] could not be reserved
[    0.821319] system 00:00: [mem 0x000c0000-0x000c3fff] could not be reserved
[    0.822815] system 00:00: [mem 0x000c4000-0x000c7fff] could not be reserved
[    0.824246] system 00:00: [mem 0x000c8000-0x000cbfff] has been reserved
[    0.826103] system 00:00: [mem 0x000cc000-0x000cffff] has been reserved
[    0.827827] system 00:00: [mem 0x000d0000-0x000d3fff] could not be reserved
[    0.829248] system 00:00: [mem 0x000e0000-0x000e3fff] could not be reserved
[    0.830670] system 00:00: [mem 0x000e4000-0x000e7fff] could not be reserved
[    0.832093] system 00:00: [mem 0x000e8000-0x000ebfff] could not be reserved
[    0.833599] system 00:00: [mem 0x000ec000-0x000effff] could not be reserved
[    0.835026] system 00:00: [mem 0x000f0000-0x000fffff] could not be reserved
[    0.836485] system 00:00: [mem 0x00100000-0xbfffffff] could not be reserved
[    0.837997] system 00:00: [mem 0xfec00000-0xfed3ffff] could not be reserved
[    0.839434] system 00:00: [mem 0xfed4c000-0xffffffff] could not be reserved
[    0.840863] system 00:00: Plug and Play ACPI device, IDs PNP0c01 (active)
[    0.842956] system 00:01: [io  0x164e-0x164f] has been reserved
[    0.844721] system 00:01: [io  0x1000-0x107f] could not be reserved
[    0.846043] system 00:01: [io  0x1180-0x11ff] has been reserved
[    0.847351] system 00:01: [io  0x0800-0x080f] has been reserved
[    0.848582] system 00:01: [io  0x15e0-0x15ef] has been reserved
[    0.849804] system 00:01: [io  0x1600-0x1641] has been reserved
[    0.851029] system 00:01: [io  0x1644-0x167f] could not be reserved
[    0.852407] system 00:01: [mem 0xe0000000-0xefffffff] has been reserved
[    0.853768] system 00:01: [mem 0xfeaff000-0xfeafffff] has been reserved
[    0.855129] system 00:01: [mem 0xfed1c000-0xfed1ffff] has been reserved
[    0.856487] system 00:01: [mem 0xfed10000-0xfed13fff] has been reserved
[    0.857946] system 00:01: [mem 0xfed18000-0xfed18fff] has been reserved
[    0.859309] system 00:01: [mem 0xfed19000-0xfed19fff] has been reserved
[    0.860666] system 00:01: [mem 0xfed45000-0xfed4bfff] has been reserved
[    0.862024] system 00:01: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.864071] pnp 00:02: Plug and Play ACPI device, IDs PNP0103 (active)
[    0.865793] pnp 00:03: [dma 4]
[    0.866508] pnp 00:03: Plug and Play ACPI device, IDs PNP0200 (active)
[    0.867965] pnp 00:04: Plug and Play ACPI device, IDs PNP0800 (active)
[    0.869397] pnp 00:05: Plug and Play ACPI device, IDs PNP0c04 (active)
[    0.870806] pnp 00:06: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.872317] pnp 00:07: Plug and Play ACPI device, IDs PNP0303 (active)
[    0.873729] pnp 00:08: Plug and Play ACPI device, IDs LEN0015 PNP0f13 (active)
[    0.875783] pnp 00:09: Plug and Play ACPI device, IDs SMO1200 PNP0c31 (active)
[    0.878771] pnp: PnP ACPI: found 10 devices
[    0.879670] ACPI: bus type PNP unregistered
[    0.888920] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.889986] pci 0000:00:1c.1: PCI bridge to [bus 03]
[    0.891029] pci 0000:00:1c.1:   bridge window [mem 0xf2400000-0xf24fffff]
[    0.892528] pci 0000:00:1c.4: PCI bridge to [bus 0d]
[    0.893987] pci 0000:00:1c.4:   bridge window [mem 0xf2500000-0xf25fffff]
[    0.895404] pci 0000:00:1e.0: PCI bridge to [bus 0e]
[    0.896473] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7]
[    0.897703] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff]
[    0.898862] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff]
[    0.900164] pci_bus 0000:00: resource 7 [mem 0x000d4000-0x000d7fff]
[    0.901446] pci_bus 0000:00: resource 8 [mem 0x000d8000-0x000dbfff]
[    0.902819] pci_bus 0000:00: resource 9 [mem 0x000dc000-0x000dffff]
[    0.904118] pci_bus 0000:00: resource 10 [mem 0xc0000000-0xfebfffff]
[    0.905425] pci_bus 0000:03: resource 1 [mem 0xf2400000-0xf24fffff]
[    0.906714] pci_bus 0000:0d: resource 1 [mem 0xf2500000-0xf25fffff]
[    0.908268] pci_bus 0000:0e: resource 4 [io  0x0000-0x0cf7]
[    0.909430] pci_bus 0000:0e: resource 5 [io  0x0d00-0xffff]
[    0.910606] pci_bus 0000:0e: resource 6 [mem 0x000a0000-0x000bffff]
[    0.911914] pci_bus 0000:0e: resource 7 [mem 0x000d4000-0x000d7fff]
[    0.913782] pci_bus 0000:0e: resource 8 [mem 0x000d8000-0x000dbfff]
[    0.915074] pci_bus 0000:0e: resource 9 [mem 0x000dc000-0x000dffff]
[    0.916369] pci_bus 0000:0e: resource 10 [mem 0xc0000000-0xfebfffff]
[    0.917807] NET: Registered protocol family 2
[    0.919056] TCP established hash table entries: 32768 (order: 6, 262144 bytes)
[    0.920695] TCP bind hash table entries: 32768 (order: 7, 524288 bytes)
[    0.922313] TCP: Hash tables configured (established 32768 bind 32768)
[    0.923685] TCP: reno registered
[    0.924390] UDP hash table entries: 2048 (order: 4, 65536 bytes)
[    0.925650] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes)
[    0.927089] NET: Registered protocol family 1
[    0.928054] pci 0000:00:02.0: Boot video device
[    0.929789] PCI: CLS 64 bytes, default 64
[    0.930769] Unpacking initramfs...
[    1.602293] Freeing initrd memory: 18124K (ffff88007ee4c000 - ffff88007ffff000)
[    1.604037] DMAR: No ATSR found
[    1.604766] IOMMU1: Number of Domains supported <256>
[    1.606039] IOMMU0: Number of Domains supported <256>
[    1.607342] IOMMU2: Number of Domains supported <256>
[    1.608420] IOMMU 1 0xfed91000: using Register based invalidation
[    1.609679] IOMMU 0 0xfed90000: using Register based invalidation
[    1.610981] IOMMU 2 0xfed93000: using Register based invalidation
[    1.612246] IOMMU: Setting RMRR:
[    1.612976] IOMMU: Setting identity map for device 0000:00:02.0 [0xbdc00000 - 0xbfffffff]
[    1.614671] Mapping reserved region bdc00000-bfffffff for domain 0
[    1.616672] Set context mapping for 00:02.0
[    1.617592] IOMMU: Setting identity map for device 0000:00:1a.0 [0xbb6e9000 - 0xbb6fffff]
[    1.619290] Mapping reserved region bb6e9000-bb6fffff for domain 0
[    1.620592] Set context mapping for 00:1a.0
[    1.621585] IOMMU: Setting identity map for device 0000:00:1d.0 [0xbb6e9000 - 0xbb6fffff]
[    1.623877] Mapping reserved region bb6e9000-bb6fffff for domain 1
[    1.625495] Set context mapping for 00:1d.0
[    1.626500] IOMMU: Prepare 0-16MiB unity mapping for LPC
[    1.627642] IOMMU: Setting identity map for device 0000:00:1f.0 [0x0 - 0xffffff]
[    1.629199] Mapping reserved region 0-ffffff for domain 2
[    1.630636] Set context mapping for 00:1f.0
[    1.707763] dmar: DRHD: handling fault status reg 3
[    1.708888] dmar: DMAR:[DMA Write] Request device [00:02.0] fault addr b3f90000 
[    1.708888] DMAR:[fault reason 05] PTE Write access is not set
[    1.711710] PCI-DMA: Intel(R) Virtualization Technology for Directed I/O
[    1.719673] Simple Boot Flag at 0x35 set to 0x1
[    1.720881] microcode: CPU0 sig=0x20655, pf=0x10, revision=0x3
[    1.722211] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[    1.724990] SSE version of gcm_enc/dec engaged.
[    1.730188] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
[    1.732279] futex hash table entries: 1024 (order: 4, 65536 bytes)
[    1.733624] Initialise system trusted keyring
[    1.734614] audit: initializing netlink subsys (disabled)
[    1.735892] audit: type=2000 audit(1399079166.472:1): initialized
[    1.796755] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    1.801545] zbud: loaded
[    1.802497] VFS: Disk quotas dquot_6.5.2
[    1.803421] Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    1.805688] msgmni has been set to 7583
[    1.806636] SELinux:  Registering netfilter hooks
[    1.808955] alg: No test for stdrng (krng)
[    1.809873] NET: Registered protocol family 38
[    1.810860] Key type asymmetric registered
[    1.811734] Asymmetric key parser 'x509' registered
[    1.812874] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 250)
[    1.815683] io scheduler noop registered
[    1.816543] io scheduler deadline registered
[    1.817555] io scheduler cfq registered (default)
[    1.819575] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    1.820854] pciehp: PCI Express Hot Plug Controller Driver version: 0.4
[    1.822292] intel_idle: MWAIT substates: 0x1120
[    1.823247] intel_idle: v0.4 model 0x25
[    1.824066] intel_idle: lapic_timer_reliable_states 0xffffffff
[    1.825374] ipmi message handler version 39.2
[    1.826295] ipmi device interface
[    1.827039] IPMI System Interface driver.
[    1.827962] ipmi_si: Unable to find any System Interface(s)
[    1.832036] ACPI: AC Adapter [AC] (off-line)
[    1.833281] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
[    1.835170] ACPI: Lid Switch [LID]
[    1.836099] input: Sleep Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input1
[    1.837842] ACPI: Sleep Button [SLPB]
[    1.839012] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input2
[    1.840663] ACPI: Power Button [PWRF]
[    1.846300] thermal LNXTHERM:00: registered as thermal_zone0
[    1.847472] ACPI: Thermal Zone [THM0] (51 C)
[    1.848635] GHES: HEST is not enabled!
[    1.849807] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    1.873635] 0000:00:16.3: ttyS0 at I/O 0x1808 (irq = 17, base_baud = 115200) is a 16550A
[    1.876325] Non-volatile memory driver v1.3
[    1.877264] Linux agpgart interface v0.103
[    1.878809] agpgart-intel 0000:00:00.0: Intel HD Graphics Chipset
[    1.880505] agpgart-intel 0000:00:00.0: detected gtt size: 2097152K total, 262144K mappable
[    1.883867] agpgart-intel 0000:00:00.0: detected 32768K stolen memory
[    1.885776] agpgart-intel 0000:00:00.0: AGP aperture is 256M @ 0xd0000000
[    1.890150] loop: module loaded
[    1.891542] mei_me 0000:00:16.0: irq 43 for MSI/MSI-X
[    1.894863] ahci 0000:00:1f.2: version 3.0
[    1.896412] ahci 0000:00:1f.2: irq 44 for MSI/MSI-X
[    1.898044] ahci 0000:00:1f.2: SSS flag set, parallel bus scan disabled
[    1.899889] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 6 ports 3 Gbps 0x33 impl SATA mode
[    1.901931] ahci 0000:00:1f.2: flags: 64bit ncq sntf ilck stag pm led clo pio slum part ems sxs apst 
[    1.904023] Set context mapping for 00:1f.2
[    1.905678] ACPI: Battery Slot [BAT0] (battery present)
[    1.911635] scsi0 : ahci
[    1.912465] scsi1 : ahci
[    1.913186] scsi2 : ahci
[    1.913924] scsi3 : ahci
[    1.914664] scsi4 : ahci
[    1.915449] scsi5 : ahci
[    1.916110] ata1: SATA max UDMA/133 abar m2048@0xf2827000 port 0xf2827100 irq 44
[    1.917665] ata2: SATA max UDMA/133 abar m2048@0xf2827000 port 0xf2827180 irq 44
[    1.919224] ata3: DUMMY
[    1.919779] ata4: DUMMY
[    1.920403] ata5: SATA max UDMA/133 abar m2048@0xf2827000 port 0xf2827300 irq 44
[    1.921961] ata6: SATA max UDMA/133 abar m2048@0xf2827000 port 0xf2827380 irq 44
[    1.924243] Intel(R) Wireless WiFi driver for Linux, in-tree:d
[    1.925716] Copyright(c) 2003- 2014 Intel Corporation
[    1.926931] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[    1.928575] iwlwifi 0000:03:00.0: irq 45 for MSI/MSI-X
[    1.929809] Set context mapping for 03:00.0
[    1.931021] iwlwifi 0000:03:00.0: Direct firmware load failed with error -2
[    1.932457] iwlwifi 0000:03:00.0: Falling back to user helper
[    1.933794] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.935211] ehci-pci: EHCI PCI platform driver
[    1.936391] ehci-pci 0000:00:1a.0: EHCI Host Controller
[    1.937586] ehci-pci 0000:00:1a.0: new USB bus registered, assigned bus number 1
[    1.939166] ehci-pci 0000:00:1a.0: debug port 2
[    1.944082] ehci-pci 0000:00:1a.0: cache line size of 64 is not supported
[    1.945567] ehci-pci 0000:00:1a.0: irq 23, io mem 0xf2828000
[    1.952365] ehci-pci 0000:00:1a.0: USB 2.0 started, EHCI 1.00
[    1.954062] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[    1.955563] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.957071] usb usb1: Product: EHCI Host Controller
[    1.958093] usb usb1: Manufacturer: Linux 3.15.0-rc3-00013-ga9181ae ehci_hcd
[    1.959540] usb usb1: SerialNumber: 0000:00:1a.0
[    1.960806] hub 1-0:1.0: USB hub found
[    1.961647] hub 1-0:1.0: 3 ports detected
[    1.962973] ehci-pci 0000:00:1d.0: EHCI Host Controller
[    1.964158] ehci-pci 0000:00:1d.0: new USB bus registered, assigned bus number 2
[    1.965776] ehci-pci 0000:00:1d.0: debug port 2
[    1.970695] ehci-pci 0000:00:1d.0: cache line size of 64 is not supported
[    1.972114] ehci-pci 0000:00:1d.0: irq 19, io mem 0xf2828400
[    1.978366] ehci-pci 0000:00:1d.0: USB 2.0 started, EHCI 1.00
[    1.979673] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[    1.981160] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.983149] usb usb2: Product: EHCI Host Controller
[    1.984177] usb usb2: Manufacturer: Linux 3.15.0-rc3-00013-ga9181ae ehci_hcd
[    1.985905] usb usb2: SerialNumber: 0000:00:1d.0
[    1.987114] hub 2-0:1.0: USB hub found
[    1.987948] hub 2-0:1.0: 3 ports detected
[    1.989077] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.990455] uhci_hcd: USB Universal Host Controller Interface driver
[    1.991890] usbcore: registered new interface driver usbserial
[    1.993113] usbcore: registered new interface driver usbserial_generic
[    1.994464] usbserial: USB Serial support registered for generic
[    1.995838] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    2.000512] serio: i8042 KBD port at 0x60,0x64 irq 1
[    2.001602] serio: i8042 AUX port at 0x60,0x64 irq 12
[    2.002769] mousedev: PS/2 mouse device common for all mice
[    2.004388] rtc_cmos 00:06: RTC can wake from S4
[    2.006539] rtc_cmos 00:06: rtc core: registered rtc_cmos as rtc0
[    2.008247] rtc_cmos 00:06: alarms up to one month, y3k, 114 bytes nvram, hpet irqs
[    2.010935] device-mapper: uevent: version 1.0.3
[    2.012099] device-mapper: ioctl: 4.27.0-ioctl (2013-10-30) initialised: dm-devel@redhat.com
[    2.014840] hidraw: raw HID events driver (C) Jiri Kosina
[    2.016226] usbcore: registered new interface driver usbhid
[    2.017440] usbhid: USB HID core driver
[    2.018367] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input3
[    2.020509] drop_monitor: Initializing network drop monitor service
[    2.021929] ip_tables: (C) 2000-2006 Netfilter Core Team
[    2.023073] TCP: cubic registered
[    2.023816] Initializing XFRM netlink socket
[    2.025007] NET: Registered protocol family 10
[    2.027400] mip6: Mobile IPv6
[    2.028047] NET: Registered protocol family 17
[    2.029473] Loading compiled-in X.509 certificates
[    2.033484] Loaded X.509 cert 'Magrathea: Glacier signing key: 3d43bf061eb83083590d33bbc59a16a11f4db9ab'
[    2.035555] registered taskstats version 1
[    2.040335] Key type encrypted registered
[    2.045667]   Magic number: 14:384:103
[    2.046617] rtc_cmos 00:06: setting system clock to 2014-05-03 01:06:07 UTC (1399079167)
[    2.048672] PM: Hibernation image not present or could not be loaded.
[    2.228405] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    2.230334] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded
[    2.231766] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[    2.233405] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[    2.235249] ata1.00: ATA-7: INTEL SSDSA1M160G2LE, 2CV102L1, max UDMA/133
[    2.236623] ata1.00: 312581808 sectors, multi 16: LBA48 NCQ (depth 31/32)
[    2.238459] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded
[    2.239986] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[    2.241658] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[    2.243401] ata1.00: configured for UDMA/133
[    2.254534] scsi 0:0:0:0: Direct-Access     ATA      INTEL SSDSA1M160 2CV1 PQ: 0 ANSI: 5
[    2.256622] sd 0:0:0:0: [sda] 312581808 512-byte logical blocks: (160 GB/149 GiB)
[    2.258309] sd 0:0:0:0: [sda] Write Protect is off
[    2.259928] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    2.261185] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    2.262498] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.264409] usb 1-1: new high-speed USB device number 2 using ehci-pci
[    2.266446]  sda: sda1 sda2 sda3
[    2.267744] sd 0:0:0:0: [sda] Attached SCSI disk
[    2.379720] usb 1-1: New USB device found, idVendor=8087, idProduct=0020
[    2.381121] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.382905] hub 1-1:1.0: USB hub found
[    2.383844] hub 1-1:1.0: 6 ports detected
[    2.487425] usb 2-1: new high-speed USB device number 2 using ehci-pci
[    2.567437] ata2: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    2.571271] ata2.00: ACPI cmd e3/00:10:00:00:00:a0 (IDLE) succeeded
[    2.573252] ata2.00: ACPI cmd e3/00:03:00:00:00:a0 (IDLE) succeeded
[    2.576206] ata2.00: ATAPI: MATSHITADVD-RAM UJ892, SB01, max UDMA/100
[    2.580274] ata2.00: ACPI cmd e3/00:10:00:00:00:a0 (IDLE) succeeded
[    2.582258] ata2.00: ACPI cmd e3/00:03:00:00:00:a0 (IDLE) succeeded
[    2.585242] ata2.00: configured for UDMA/100
[    2.600106] scsi 1:0:0:0: CD-ROM            MATSHITA DVD-RAM UJ892    SB01 PQ: 0 ANSI: 5
[    2.602865] usb 2-1: New USB device found, idVendor=8087, idProduct=0020
[    2.604422] usb 2-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[    2.606175] hub 2-1:1.0: USB hub found
[    2.607115] hub 2-1:1.0: 8 ports detected
[    2.625984] sr0: scsi3-mmc drive: 24x/24x writer dvd-ram cd/rw xa/form2 cdda tray
[    2.627531] cdrom: Uniform CD-ROM driver Revision: 3.20
[    2.628958] sr 1:0:0:0: Attached scsi CD-ROM sr0
[    2.630160] sr 1:0:0:0: Attached scsi generic sg1 type 5
[    2.683497] usb 1-1.3: new full-speed USB device number 3 using ehci-pci
[    2.722437] tsc: Refined TSC clocksource calibration: 2659.999 MHz
[    2.770508] usb 1-1.3: New USB device found, idVendor=147e, idProduct=2016
[    2.771909] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.773443] usb 1-1.3: Product: Biometric Coprocessor
[    2.774646] usb 1-1.3: Manufacturer: UPEK
[    2.848764] usb 1-1.6: new high-speed USB device number 4 using ehci-pci
[    2.936471] ata5: SATA link down (SStatus 0 SControl 300)
[    2.938184] psmouse serio1: synaptics: Touchpad model: 1, fw: 7.2, id: 0x1c0b1, caps: 0xd047b3/0xb40000/0xa0000, board id: 71, fw id: 578367
[    2.940850] psmouse serio1: synaptics: serio: Synaptics pass-through port at isa0060/serio1/input0
[    2.943772] usb 1-1.6: New USB device found, idVendor=17ef, idProduct=480f
[    2.945172] usb 1-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.946703] usb 1-1.6: Product: Integrated Camera
[    2.947754] usb 1-1.6: Manufacturer: Chicony Electronics Co., Ltd.
[    3.003716] input: SynPS/2 Synaptics TouchPad as /devices/platform/i8042/serio1/input/input5
[    3.254502] ata6: SATA link down (SStatus 0 SControl 300)
[    3.268250] Freeing unused kernel memory: 1236K (ffffffff81d09000 - ffffffff81e3e000)
[    3.269987] Write protecting the kernel read-only data: 12288k
[    3.274395] Freeing unused kernel memory: 576K (ffff880001770000 - ffff880001800000)
[    3.279568] Freeing unused kernel memory: 668K (ffff880001b59000 - ffff880001c00000)
[    3.289064] systemd[1]: systemd 204 running in system mode. (+PAM +LIBWRAP +AUDIT +SELINUX +IMA +SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ)
[    3.291962] systemd[1]: Running in initial RAM disk.
[    3.293954] systemd[1]: Set hostname to <localhost.localdomain>.
[    3.296725] random: systemd urandom read with 27 bits of entropy available
[    3.311004] systemd[1]: Expecting device dev-mapper-fedora\x2dswap.device...
[    3.312920] systemd[1]: Expecting device dev-mapper-fedora\x2droot.device...
[    3.314795] systemd[1]: Expecting device dev-disk-by\x2duuid-ce8e0940\x2d05cc\x2d4d96\x2d83fa\x2d4c37c206799c.device...
[    3.317999] systemd[1]: Starting Timers.
[    3.319351] systemd[1]: Reached target Timers.
[    3.320428] systemd[1]: Starting Journal Socket.
[    3.322042] systemd[1]: Listening on Journal Socket.
[    3.323700] systemd[1]: Starting dracut cmdline hook...
[    3.326062] systemd[1]: Starting Journal Service...
[    3.335564] systemd[1]: Started Journal Service.
[    3.340348] systemd[1]: Started Load Kernel Modules.
[    3.341932] systemd[1]: Starting udev Kernel Socket.
[    3.345375] systemd[1]: Listening on udev Kernel Socket.
[    3.348740] systemd[1]: Starting udev Control Socket.
[    3.351710] systemd[1]: Listening on udev Control Socket.
[    3.354531] systemd[1]: Starting Sockets.
[    3.356980] systemd-journald[122]: Vacuuming done, freed 0 bytes
[    3.358409] systemd[1]: Reached target Sockets.
[    3.359552] systemd[1]: Starting Swap.
[    3.362542] systemd[1]: Reached target Swap.
[    3.364639] systemd[1]: Starting Local File Systems.
[    3.368545] systemd[1]: Reached target Local File Systems.
[    3.727570] Switched to clocksource tsc
[    3.808623] systemd-udevd[208]: starting version 204
[    4.455847] Set context mapping for 0d:00.3
[    4.509656] firewire_ohci 0000:0d:00.3: added OHCI v1.10 device as card 0, 4 IR + 4 IT contexts, quirks 0x11
[    4.511889] dmar: DRHD: handling fault status reg 2
[    4.512927] dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000 
[    4.512927] DMAR:[fault reason 02] Present bit in context entry is clear
[    4.515736] dmar: DRHD: handling fault status reg 3
[    4.516730] dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000 
[    4.516730] DMAR:[fault reason 02] Present bit in context entry is clear
[    4.519599] dmar: DRHD: handling fault status reg 3
[    4.520594] dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000 
[    4.520594] DMAR:[fault reason 02] Present bit in context entry is clear

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices
  2014-05-03  2:29   ` Andrew Cooks
@ 2014-05-03  5:15     ` Alex Williamson
  2014-05-10  4:46       ` Andrew Cooks
  0 siblings, 1 reply; 18+ messages in thread
From: Alex Williamson @ 2014-05-03  5:15 UTC (permalink / raw)
  To: Andrew Cooks
  Cc: open list:PCI SUBSYSTEM, open list:INTEL IOMMU (VT-d),
	Bjorn Helgaas, open list

On Sat, 2014-05-03 at 10:29 +0800, Andrew Cooks wrote:
> Hi Alex
> 
> On Fri, May 2, 2014 at 12:27 AM, Alex Williamson
> <alex.williamson@redhat.com> wrote:
> > The existing quirk for these devices doesn't really solve the problem,
> > re-implement it using the DMA alias iterator.  We'll come back later
> > and remove the existing quirk and dma_source interface.
> >
> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> > ---
> >  drivers/pci/quirks.c |   16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> > index e729206..a458c6b 100644
> > --- a/drivers/pci/quirks.c
> > +++ b/drivers/pci/quirks.c
> > @@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
> >         return -ENOTTY;
> >  }
> >
> > +static void quirk_dma_func0_alias(struct pci_dev *dev)
> > +{
> > +       if (PCI_SLOT(dev->devfn) != 0)
> > +               dev->dma_func_alias |= (1 << 0);
> > +}
> > +
> > +/*
> > + * https://bugzilla.redhat.com/show_bug.cgi?id=605888
> > + *
> > + * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
> > + */
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe822, quirk_dma_func0_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
> 
> 0xe832 is listed twice.

oops, copy-paste error

> Previously only 0xe832 needed the dma alias on my thinkpad T410, which
> has all three devices.
> 
> > +
> >  static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
> >  {
> >         if (!PCI_FUNC(dev->devfn))
> >
> 
> Unfortunately, this quirk doesn't work for me. I tried it without
> modification, as well as with each alias individually. I get:
> 
> Set context mapping for 0d:00.3
> firewire_ohci 0000:0d:00.3: added OHCI v1.10 device as card 0, 4 IR +
> 4 IT contexts, quirks 0x11
> dmar: DRHD: handling fault status reg 2
> dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000
> DMAR:[fault reason 02] Present bit in context entry is clear
> 
> I think I need to see
> Set context mapping for 0d:00.0
> before
> Set context mapping for 0d:00.3

It would actually be the reverse, we always set the device, then the
alias for the device.

> in the log, but it's not there. I'd love to look into this and
> understand it properly, but I don't have time for the next four weeks.
> 
> The devices are attached as follows:
> BDF, device ID
> 0d:00.0, e822
> 0d:00.1, e230
> 0d:00.3, e832
> 
> The kernel log is attached.

Hmm, there are only a few reasons why you'd never see 0d:00.3 followed
by 0d:00.0...

1) dma_func_alias bit 0 isn't getting set on 0d:00.3; we are building
with CONFIG_PCI_QUIRKS=y, right?
2) domain_context_mapping_one called from domain_context_mapping_cb
returns !0; there's only one possible non-zero return for a non-vm,
non-si domain
3) something is broken in the first loop of pci_for_each_dma_alias; I'm
not seeing anything obvious

Anyway, appreciate an debugging you're able to fit in, my only ricoh
device has only function 0.  Thanks,

Alex



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices
  2014-05-03  5:15     ` Alex Williamson
@ 2014-05-10  4:46       ` Andrew Cooks
  2014-05-10  5:19         ` Alex Williamson
  0 siblings, 1 reply; 18+ messages in thread
From: Andrew Cooks @ 2014-05-10  4:46 UTC (permalink / raw)
  To: Alex Williamson
  Cc: open list:PCI SUBSYSTEM, open list:INTEL IOMMU (VT-d),
	Bjorn Helgaas, open list

Hi Alex

On Sat, May 3, 2014 at 1:15 PM, Alex Williamson
<alex.williamson@redhat.com> wrote:
> On Sat, 2014-05-03 at 10:29 +0800, Andrew Cooks wrote:
>> Hi Alex
>>
>> On Fri, May 2, 2014 at 12:27 AM, Alex Williamson
>> <alex.williamson@redhat.com> wrote:
>> > The existing quirk for these devices doesn't really solve the problem,
>> > re-implement it using the DMA alias iterator.  We'll come back later
>> > and remove the existing quirk and dma_source interface.
>> >
>> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
>> > ---
>> >  drivers/pci/quirks.c |   16 ++++++++++++++++
>> >  1 file changed, 16 insertions(+)
>> >
>> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> > index e729206..a458c6b 100644
>> > --- a/drivers/pci/quirks.c
>> > +++ b/drivers/pci/quirks.c
>> > @@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
>> >         return -ENOTTY;
>> >  }
>> >
>> > +static void quirk_dma_func0_alias(struct pci_dev *dev)
>> > +{
>> > +       if (PCI_SLOT(dev->devfn) != 0)
>> > +               dev->dma_func_alias |= (1 << 0);
>> > +}
>> > +
>> > +/*
>> > + * https://bugzilla.redhat.com/show_bug.cgi?id=605888
>> > + *
>> > + * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
>> > + */
>> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe822, quirk_dma_func0_alias);
>> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
>> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
>> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
>>
>> 0xe832 is listed twice.
>
> oops, copy-paste error
>
>> Previously only 0xe832 needed the dma alias on my thinkpad T410, which
>> has all three devices.
>>
>> > +
>> >  static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
>> >  {
>> >         if (!PCI_FUNC(dev->devfn))
>> >
>>
>> Unfortunately, this quirk doesn't work for me. I tried it without
>> modification, as well as with each alias individually. I get:
>>
>> Set context mapping for 0d:00.3
>> firewire_ohci 0000:0d:00.3: added OHCI v1.10 device as card 0, 4 IR +
>> 4 IT contexts, quirks 0x11
>> dmar: DRHD: handling fault status reg 2
>> dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000
>> DMAR:[fault reason 02] Present bit in context entry is clear
>>
>> I think I need to see
>> Set context mapping for 0d:00.0
>> before
>> Set context mapping for 0d:00.3
>
> It would actually be the reverse, we always set the device, then the
> alias for the device.

Ok, excuse my ignorance, but is there a window where the driver can
start doing DMA, before the alias is registered?

>
>> in the log, but it's not there. I'd love to look into this and
>> understand it properly, but I don't have time for the next four weeks.
>>
>> The devices are attached as follows:
>> BDF, device ID
>> 0d:00.0, e822
>> 0d:00.1, e230
>> 0d:00.3, e832
>>
>> The kernel log is attached.
>
> Hmm, there are only a few reasons why you'd never see 0d:00.3 followed
> by 0d:00.0...
>
> 1) dma_func_alias bit 0 isn't getting set on 0d:00.3; we are building
> with CONFIG_PCI_QUIRKS=y, right?

Yes.

> 2) domain_context_mapping_one called from domain_context_mapping_cb
> returns !0; there's only one possible non-zero return for a non-vm,
> non-si domain

domain_context_mapping_one returns 0 - I've checked.

> 3) something is broken in the first loop of pci_for_each_dma_alias; I'm
> not seeing anything obvious
>
> Anyway, appreciate an debugging you're able to fit in, my only ricoh
> device has only function 0.  Thanks,
>

Please note that this device works with the patch I attached to
https://bugzilla.kernel.org/show_bug.cgi?id=42679 (despite its many
faults).

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices
  2014-05-10  4:46       ` Andrew Cooks
@ 2014-05-10  5:19         ` Alex Williamson
  0 siblings, 0 replies; 18+ messages in thread
From: Alex Williamson @ 2014-05-10  5:19 UTC (permalink / raw)
  To: Andrew Cooks
  Cc: open list:PCI SUBSYSTEM, open list:INTEL IOMMU (VT-d),
	Bjorn Helgaas, open list

On Sat, 2014-05-10 at 12:46 +0800, Andrew Cooks wrote:
> Hi Alex
> 
> On Sat, May 3, 2014 at 1:15 PM, Alex Williamson
> <alex.williamson@redhat.com> wrote:
> > On Sat, 2014-05-03 at 10:29 +0800, Andrew Cooks wrote:
> >> Hi Alex
> >>
> >> On Fri, May 2, 2014 at 12:27 AM, Alex Williamson
> >> <alex.williamson@redhat.com> wrote:
> >> > The existing quirk for these devices doesn't really solve the problem,
> >> > re-implement it using the DMA alias iterator.  We'll come back later
> >> > and remove the existing quirk and dma_source interface.
> >> >
> >> > Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
> >> > ---
> >> >  drivers/pci/quirks.c |   16 ++++++++++++++++
> >> >  1 file changed, 16 insertions(+)
> >> >
> >> > diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> >> > index e729206..a458c6b 100644
> >> > --- a/drivers/pci/quirks.c
> >> > +++ b/drivers/pci/quirks.c
> >> > @@ -3333,6 +3333,22 @@ int pci_dev_specific_reset(struct pci_dev *dev, int probe)
> >> >         return -ENOTTY;
> >> >  }
> >> >
> >> > +static void quirk_dma_func0_alias(struct pci_dev *dev)
> >> > +{
> >> > +       if (PCI_SLOT(dev->devfn) != 0)
> >> > +               dev->dma_func_alias |= (1 << 0);
> >> > +}
> >> > +
> >> > +/*
> >> > + * https://bugzilla.redhat.com/show_bug.cgi?id=605888
> >> > + *
> >> > + * Some Ricoh devices use function 0 as the PCIe requester ID for DMA.
> >> > + */
> >> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe822, quirk_dma_func0_alias);
> >> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe230, quirk_dma_func0_alias);
> >> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
> >> > +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_RICOH, 0xe832, quirk_dma_func0_alias);
> >>
> >> 0xe832 is listed twice.
> >
> > oops, copy-paste error
> >
> >> Previously only 0xe832 needed the dma alias on my thinkpad T410, which
> >> has all three devices.
> >>
> >> > +
> >> >  static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
> >> >  {
> >> >         if (!PCI_FUNC(dev->devfn))
> >> >
> >>
> >> Unfortunately, this quirk doesn't work for me. I tried it without
> >> modification, as well as with each alias individually. I get:
> >>
> >> Set context mapping for 0d:00.3
> >> firewire_ohci 0000:0d:00.3: added OHCI v1.10 device as card 0, 4 IR +
> >> 4 IT contexts, quirks 0x11
> >> dmar: DRHD: handling fault status reg 2
> >> dmar: DMAR:[DMA Read] Request device [0d:00.0] fault addr fffff000
> >> DMAR:[fault reason 02] Present bit in context entry is clear
> >>
> >> I think I need to see
> >> Set context mapping for 0d:00.0
> >> before
> >> Set context mapping for 0d:00.3
> >
> > It would actually be the reverse, we always set the device, then the
> > alias for the device.
> 
> Ok, excuse my ignorance, but is there a window where the driver can
> start doing DMA, before the alias is registered?
> 
> >
> >> in the log, but it's not there. I'd love to look into this and
> >> understand it properly, but I don't have time for the next four weeks.
> >>
> >> The devices are attached as follows:
> >> BDF, device ID
> >> 0d:00.0, e822
> >> 0d:00.1, e230
> >> 0d:00.3, e832
> >>
> >> The kernel log is attached.
> >
> > Hmm, there are only a few reasons why you'd never see 0d:00.3 followed
> > by 0d:00.0...
> >
> > 1) dma_func_alias bit 0 isn't getting set on 0d:00.3; we are building
> > with CONFIG_PCI_QUIRKS=y, right?
> 
> Yes.
> 
> > 2) domain_context_mapping_one called from domain_context_mapping_cb
> > returns !0; there's only one possible non-zero return for a non-vm,
> > non-si domain
> 
> domain_context_mapping_one returns 0 - I've checked.
> 
> > 3) something is broken in the first loop of pci_for_each_dma_alias; I'm
> > not seeing anything obvious
> >
> > Anyway, appreciate an debugging you're able to fit in, my only ricoh
> > device has only function 0.  Thanks,
> >
> 
> Please note that this device works with the patch I attached to
> https://bugzilla.kernel.org/show_bug.cgi?id=42679 (despite its many
> faults).

Is it by chance this:

drivers/iommu/intel-iommu.c:
static int domain_context_mapped(struct device *dev)
{
        struct intel_iommu *iommu;
        u8 bus, devfn;

        iommu = device_to_iommu(dev, &bus, &devfn);
        if (!iommu)
                return -ENODEV;

        if (dev_is_pci(dev))

// Should be !dev_is_pci

                return device_context_mapped(iommu, bus, devfn);

        return !pci_for_each_dma_alias(to_pci_dev(dev),
                                       domain_context_mapped_cb, iommu);
}



^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-05-10  5:19 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-01 16:27 [PATCH 00/13] PCI/iommu: Fix DMA alias problems Alex Williamson
2014-05-01 16:27 ` [PATCH 01/13] PCI: Add DMA alias iterator Alex Williamson
2014-05-01 16:27 ` [PATCH 02/13] PCI: quirk pci_for_each_dma_alias() Alex Williamson
2014-05-01 16:27 ` [PATCH 03/13] PCI: quirk dma_func_alias for Ricoh devices Alex Williamson
2014-05-03  2:29   ` Andrew Cooks
2014-05-03  5:15     ` Alex Williamson
2014-05-10  4:46       ` Andrew Cooks
2014-05-10  5:19         ` Alex Williamson
2014-05-01 16:27 ` [PATCH 04/13] PCI: quirk dma_func_alias for Marvell devices Alex Williamson
2014-05-01 16:27 ` [PATCH 05/13] PCI: Consolidate isolation domain code Alex Williamson
2014-05-01 16:27 ` [PATCH 06/13] iommu/amd: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
2014-05-01 16:27 ` [PATCH 07/13] iommu/amd: Update to use PCI DMA aliases Alex Williamson
2014-05-01 16:27 ` [PATCH 08/13] iommu/intel: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
2014-05-01 16:28 ` [PATCH 09/13] iommu/intel: Update to use PCI DMA aliases Alex Williamson
2014-05-01 16:28 ` [PATCH 10/13] iommu/fsl: Use pci_find_dma_isolation_root() for IOMMU groups Alex Williamson
2014-05-01 16:28 ` [PATCH 11/13] iommu: Remove pci.h Alex Williamson
2014-05-01 16:28 ` [PATCH 12/13] PCI: Remove pci_find_upstream_pcie_bridge() Alex Williamson
2014-05-01 16:28 ` [PATCH 13/13] PCI: Remove pci_get_dma_source() Alex Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).