Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 212243
b: refs/heads/master
c: ee1f284
h: refs/heads/master
i:
  212241: b99c759
  212239: af56e4b
v: v3
  • Loading branch information
Konrad Rzeszutek Wilk authored and H. Peter Anvin committed Aug 26, 2010
1 parent 36e8085 commit 0faf2cd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 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: 4db77ff3237a88ea74f691dd776e92b2f86a8f3f
refs/heads/master: ee1f284f38c8dfcbc7b656915a039dde016de7d3
46 changes: 21 additions & 25 deletions trunk/arch/x86/kernel/pci-dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
#include <asm/iommu.h>
#include <asm/gart.h>
#include <asm/calgary.h>
#include <asm/amd_iommu.h>
#include <asm/x86_init.h>
#include <asm/xen/swiotlb-xen.h>
#include <asm/iommu_table.h>

static int forbid_dac __read_mostly;

Expand Down Expand Up @@ -45,6 +44,8 @@ int iommu_detected __read_mostly = 0;
*/
int iommu_pass_through __read_mostly;

extern struct iommu_table_entry __iommu_table[], __iommu_table_end[];

/* Dummy device used for NULL arguments (normally ISA). */
struct device x86_dma_fallback_dev = {
.init_name = "fallback device",
Expand Down Expand Up @@ -130,28 +131,24 @@ static void __init dma32_free_bootmem(void)

void __init pci_iommu_alloc(void)
{
struct iommu_table_entry *p;

/* free the range so iommu could get some range less than 4G */
dma32_free_bootmem();

if (pci_xen_swiotlb_detect() || pci_swiotlb_detect_override())
goto out;

pci_swiotlb_detect_4gb();

gart_iommu_hole_init();

detect_calgary();

detect_intel_iommu();
sort_iommu_table(__iommu_table, __iommu_table_end);
check_iommu_entries(__iommu_table, __iommu_table_end);

/* needs to be called after gart_iommu_hole_init */
amd_iommu_detect();
out:
pci_xen_swiotlb_init();

pci_swiotlb_init();
for (p = __iommu_table; p < __iommu_table_end; p++) {
if (p && p->detect && p->detect() > 0) {
p->flags |= IOMMU_DETECTED;
if (p->early_init)
p->early_init();
if (p->flags & IOMMU_FINISH_IF_DETECTED)
break;
}
}
}

void *dma_generic_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_addr, gfp_t flag)
{
Expand Down Expand Up @@ -294,19 +291,18 @@ EXPORT_SYMBOL(dma_supported);

static int __init pci_iommu_init(void)
{
struct iommu_table_entry *p;
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);

#ifdef CONFIG_PCI
dma_debug_add_bus(&pci_bus_type);
#endif
x86_init.iommu.iommu_init();

if (swiotlb || xen_swiotlb) {
printk(KERN_INFO "PCI-DMA: "
"Using software bounce buffering for IO (SWIOTLB)\n");
swiotlb_print_info();
} else
swiotlb_free();
for (p = __iommu_table; p < __iommu_table_end; p++) {
if (p && (p->flags & IOMMU_DETECTED) && p->late_init)
p->late_init();
}

return 0;
}
Expand Down

0 comments on commit 0faf2cd

Please sign in to comment.