Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eae460b6 authored by Mike Travis's avatar Mike Travis Committed by Ingo Molnar
Browse files

x86/iommu/intel: Fix identity mapping for sandy bridge



With SandyBridge, Intel has changed these Socket PCI devices to
have a class type of "System Peripheral" & "Performance
counter", rather than "HostBridge".

So instead of using a "special" case to detect which devices will
not be doing DMA, use the fact that a device that is not associated
with an IOMMU, will not need an identity map.

Signed-off-by: default avatarMike Travis <travis@sgi.com>
Signed-off-by: default avatarMike Habeck <habeck@sgi.com>
Cc: Jack Steiner <steiner@sgi.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Daniel Rahn <drahn@suse.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/n/tip-018fywmjs3lmzfyzjlktg8dx@git.kernel.org


Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 550cf00d
Loading
Loading
Loading
Loading
+9 −11
Original line number Diff line number Diff line
@@ -48,8 +48,6 @@
#define ROOT_SIZE		VTD_PAGE_SIZE
#define CONTEXT_SIZE		VTD_PAGE_SIZE

#define IS_BRIDGE_HOST_DEVICE(pdev) \
			    ((pdev->class >> 8) == PCI_CLASS_BRIDGE_HOST)
#define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY)
#define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA)
#define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e)
@@ -2369,19 +2367,19 @@ static int __init iommu_prepare_static_identity_mapping(int hw)
		return -EFAULT;

	for_each_pci_dev(pdev) {
		/* Skip Host/PCI Bridge devices */
		if (IS_BRIDGE_HOST_DEVICE(pdev))
			continue;
		if (iommu_should_identity_map(pdev, 1)) {
			printk(KERN_INFO "IOMMU: %s identity mapping for device %s\n",
			       hw ? "hardware" : "software", pci_name(pdev));

			ret = domain_add_dev_info(si_domain, pdev,
					     hw ? CONTEXT_TT_PASS_THROUGH :
						  CONTEXT_TT_MULTI_LEVEL);
			if (ret)
			if (ret) {
				/* device not associated with an iommu */
				if (ret == -ENODEV)
					continue;
				return ret;
			}
			pr_info("IOMMU: %s identity mapping for device %s\n",
				hw ? "hardware" : "software", pci_name(pdev));
		}
	}

	return 0;