This is a note to let you know that I've just added the patch titled

    x86/amd-iommu: Use only per-device dma_ops

to the 2.6.33-longterm tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/longterm/longterm-queue-2.6.33.git;a=summary

The filename of the patch is:
     x86-amd-iommu-use-only-per-device-dma_ops.patch
and it can be found in the queue-2.6.33 subdirectory.

If you, or anyone else, feels it should not be added to the 2.6.33 longterm 
tree,
please let <[email protected]> know about it.


>From 27c2127a15d340706c0aa84e311188a14468d841 Mon Sep 17 00:00:00 2001
From: Joerg Roedel <[email protected]>
Date: Mon, 30 May 2011 15:56:24 +0200
Subject: x86/amd-iommu: Use only per-device dma_ops

From: Joerg Roedel <[email protected]>

commit 27c2127a15d340706c0aa84e311188a14468d841 upstream.

Unfortunatly there are systems where the AMD IOMMU does not
cover all devices. This breaks with the current driver as it
initializes the global dma_ops variable. This patch limits
the AMD IOMMU to the devices listed in the IVRS table fixing
DMA for devices not covered by the IOMMU.

Signed-off-by: Joerg Roedel <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 arch/x86/kernel/amd_iommu.c |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -28,6 +28,7 @@
 #include <asm/proto.h>
 #include <asm/iommu.h>
 #include <asm/gart.h>
+#include <asm/dma.h>
 #include <asm/amd_iommu_proto.h>
 #include <asm/amd_iommu_types.h>
 #include <asm/amd_iommu.h>
@@ -2228,6 +2229,23 @@ static struct dma_map_ops amd_iommu_dma_
        .dma_supported = amd_iommu_dma_supported,
 };
 
+static unsigned device_dma_ops_init(void)
+{
+       struct pci_dev *pdev = NULL;
+       unsigned unhandled = 0;
+
+       for_each_pci_dev(pdev) {
+               if (!check_device(&pdev->dev)) {
+                       unhandled += 1;
+                       continue;
+               }
+
+               pdev->dev.archdata.dma_ops = &amd_iommu_dma_ops;
+       }
+
+       return unhandled;
+}
+
 /*
  * The function which clues the AMD IOMMU driver into dma_ops.
  */
@@ -2240,7 +2258,7 @@ void __init amd_iommu_init_api(void)
 int __init amd_iommu_init_dma_ops(void)
 {
        struct amd_iommu *iommu;
-       int ret;
+       int ret, unhandled;
 
        /*
         * first allocate a default protection domain for every IOMMU we
@@ -2266,7 +2284,11 @@ int __init amd_iommu_init_dma_ops(void)
        swiotlb = 0;
 
        /* Make the driver finally visible to the drivers */
-       dma_ops = &amd_iommu_dma_ops;
+       unhandled = device_dma_ops_init();
+       if (unhandled && max_pfn > MAX_DMA32_PFN) {
+               /* There are unhandled devices - initialize swiotlb for them */
+               swiotlb = 1;
+       }
 
        amd_iommu_stats_init();
 


Patches currently in longterm-queue-2.6.33 which might be from 
[email protected] are

/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/x86-amd-iommu-fix-3-possible-endless-loops.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/x86-amd-iommu-use-only-per-device-dma_ops.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/x86-amd-use-_safe-msr-access-for-garttlbwlk-disable-code.patch
/home/gregkh/linux/longterm/longterm-queue-2.6.33/queue-2.6.33/x86-amd-iommu-fix-boot-crash-with-hidden-pci-devices.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to