diff options
Diffstat (limited to 'arch/powerpc/kernel/iommu.c')
-rw-r--r-- | arch/powerpc/kernel/iommu.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 3857d7e2af0c..1bfa706b96e7 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/dma-mapping.h> | 32 | #include <linux/dma-mapping.h> |
33 | #include <linux/bitops.h> | 33 | #include <linux/bitops.h> |
34 | #include <linux/iommu-helper.h> | 34 | #include <linux/iommu-helper.h> |
35 | #include <linux/crash_dump.h> | ||
35 | #include <asm/io.h> | 36 | #include <asm/io.h> |
36 | #include <asm/prom.h> | 37 | #include <asm/prom.h> |
37 | #include <asm/iommu.h> | 38 | #include <asm/iommu.h> |
@@ -460,7 +461,7 @@ void iommu_unmap_sg(struct iommu_table *tbl, struct scatterlist *sglist, | |||
460 | 461 | ||
461 | static void iommu_table_clear(struct iommu_table *tbl) | 462 | static void iommu_table_clear(struct iommu_table *tbl) |
462 | { | 463 | { |
463 | if (!__kdump_flag) { | 464 | if (!is_kdump_kernel()) { |
464 | /* Clear the table in case firmware left allocations in it */ | 465 | /* Clear the table in case firmware left allocations in it */ |
465 | ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); | 466 | ppc_md.tce_free(tbl, tbl->it_offset, tbl->it_size); |
466 | return; | 467 | return; |
@@ -564,21 +565,23 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name) | |||
564 | } | 565 | } |
565 | 566 | ||
566 | /* Creates TCEs for a user provided buffer. The user buffer must be | 567 | /* Creates TCEs for a user provided buffer. The user buffer must be |
567 | * contiguous real kernel storage (not vmalloc). The address of the buffer | 568 | * contiguous real kernel storage (not vmalloc). The address passed here |
568 | * passed here is the kernel (virtual) address of the buffer. The buffer | 569 | * comprises a page address and offset into that page. The dma_addr_t |
569 | * need not be page aligned, the dma_addr_t returned will point to the same | 570 | * returned will point to the same byte within the page as was passed in. |
570 | * byte within the page as vaddr. | ||
571 | */ | 571 | */ |
572 | dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, | 572 | dma_addr_t iommu_map_page(struct device *dev, struct iommu_table *tbl, |
573 | void *vaddr, size_t size, unsigned long mask, | 573 | struct page *page, unsigned long offset, size_t size, |
574 | enum dma_data_direction direction, struct dma_attrs *attrs) | 574 | unsigned long mask, enum dma_data_direction direction, |
575 | struct dma_attrs *attrs) | ||
575 | { | 576 | { |
576 | dma_addr_t dma_handle = DMA_ERROR_CODE; | 577 | dma_addr_t dma_handle = DMA_ERROR_CODE; |
578 | void *vaddr; | ||
577 | unsigned long uaddr; | 579 | unsigned long uaddr; |
578 | unsigned int npages, align; | 580 | unsigned int npages, align; |
579 | 581 | ||
580 | BUG_ON(direction == DMA_NONE); | 582 | BUG_ON(direction == DMA_NONE); |
581 | 583 | ||
584 | vaddr = page_address(page) + offset; | ||
582 | uaddr = (unsigned long)vaddr; | 585 | uaddr = (unsigned long)vaddr; |
583 | npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE); | 586 | npages = iommu_num_pages(uaddr, size, IOMMU_PAGE_SIZE); |
584 | 587 | ||
@@ -604,9 +607,9 @@ dma_addr_t iommu_map_single(struct device *dev, struct iommu_table *tbl, | |||
604 | return dma_handle; | 607 | return dma_handle; |
605 | } | 608 | } |
606 | 609 | ||
607 | void iommu_unmap_single(struct iommu_table *tbl, dma_addr_t dma_handle, | 610 | void iommu_unmap_page(struct iommu_table *tbl, dma_addr_t dma_handle, |
608 | size_t size, enum dma_data_direction direction, | 611 | size_t size, enum dma_data_direction direction, |
609 | struct dma_attrs *attrs) | 612 | struct dma_attrs *attrs) |
610 | { | 613 | { |
611 | unsigned int npages; | 614 | unsigned int npages; |
612 | 615 | ||