Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138890
b: refs/heads/master
c: 5149136
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Jan 6, 2009
1 parent 27ac412 commit 979631e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 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: 3991605c40b1059d0204d9fddfcf878429ab8948
refs/heads/master: 51491367c2541c51a9d435eec88b0e846223fb59
27 changes: 23 additions & 4 deletions trunk/arch/x86/kernel/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/bitops.h>
#include <linux/debugfs.h>
#include <linux/scatterlist.h>
#include <linux/dma-mapping.h>
#include <linux/iommu-helper.h>
#ifdef CONFIG_IOMMU_API
#include <linux/iommu.h>
Expand Down Expand Up @@ -1297,15 +1298,18 @@ static void __unmap_single(struct amd_iommu *iommu,
/*
* The exported map_single function for dma_ops.
*/
static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
size_t size, int dir)
static dma_addr_t map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction dir,
struct dma_attrs *attrs)
{
unsigned long flags;
struct amd_iommu *iommu;
struct protection_domain *domain;
u16 devid;
dma_addr_t addr;
u64 dma_mask;
phys_addr_t paddr = page_to_phys(page) + offset;

INC_STATS_COUNTER(cnt_map_single);

Expand Down Expand Up @@ -1337,11 +1341,18 @@ static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
return addr;
}

static dma_addr_t map_single(struct device *dev, phys_addr_t paddr,
size_t size, int dir)
{
return map_page(dev, pfn_to_page(paddr >> PAGE_SHIFT),
paddr & ~PAGE_MASK, size, dir, NULL);
}

/*
* The exported unmap_single function for dma_ops.
*/
static void unmap_single(struct device *dev, dma_addr_t dma_addr,
size_t size, int dir)
static void unmap_page(struct device *dev, dma_addr_t dma_addr, size_t size,
enum dma_data_direction dir, struct dma_attrs *attrs)
{
unsigned long flags;
struct amd_iommu *iommu;
Expand All @@ -1367,6 +1378,12 @@ static void unmap_single(struct device *dev, dma_addr_t dma_addr,
spin_unlock_irqrestore(&domain->lock, flags);
}

static void unmap_single(struct device *dev, dma_addr_t dma_addr,
size_t size, int dir)
{
return unmap_page(dev, dma_addr, size, dir, NULL);
}

/*
* This is a special map_sg function which is used if we should map a
* device which is not handled by an AMD IOMMU in the system.
Expand Down Expand Up @@ -1649,6 +1666,8 @@ static struct dma_mapping_ops amd_iommu_dma_ops = {
.free_coherent = free_coherent,
.map_single = map_single,
.unmap_single = unmap_single,
.map_page = map_page,
.unmap_page = unmap_page,
.map_sg = map_sg,
.unmap_sg = unmap_sg,
.dma_supported = amd_iommu_dma_supported,
Expand Down

0 comments on commit 979631e

Please sign in to comment.