Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 253223
b: refs/heads/master
c: 27c2127
h: refs/heads/master
i:
  253221: 7395cec
  253219: 15cefea
  253215: 01075ed
v: v3
  • Loading branch information
Joerg Roedel committed Jun 6, 2011
1 parent 29c9811 commit 001d7db
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0de66d5b35ee148455e268b2782873204ffdef4b
refs/heads/master: 27c2127a15d340706c0aa84e311188a14468d841
26 changes: 24 additions & 2 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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>
Expand Down Expand Up @@ -2383,6 +2384,23 @@ static struct dma_map_ops amd_iommu_dma_ops = {
.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.
*/
Expand All @@ -2395,7 +2413,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
Expand All @@ -2421,7 +2439,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();

Expand Down

0 comments on commit 001d7db

Please sign in to comment.