diff options
author | Dan Williams <dan.j.williams@intel.com> | 2015-08-17 10:13:26 -0400 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2015-08-17 10:13:26 -0400 |
commit | db0fa0cb015794dd19f664933d49c6ce902ec1e1 (patch) | |
tree | 3c3dddb796ddb24b24de8081df7851495cfafc11 /drivers/iommu/intel-iommu.c | |
parent | 89e2a8404e4415da1edbac6ca4f7332b4a74fae2 (diff) |
scatterlist: use sg_phys()
Coccinelle cleanup to replace open coded sg to physical address
translations. This is in preparation for introducing scatterlists that
reference __pfn_t.
// sg_phys.cocci: convert usage page_to_phys(sg_page(sg)) to sg_phys(sg)
// usage: make coccicheck COCCI=sg_phys.cocci MODE=patch
virtual patch
@@
struct scatterlist *sg;
@@
- page_to_phys(sg_page(sg)) + sg->offset
+ sg_phys(sg)
@@
struct scatterlist *sg;
@@
- page_to_phys(sg_page(sg))
+ sg_phys(sg) & PAGE_MASK
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/iommu/intel-iommu.c')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index a98a7b27aca1..b261850a7694 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -2094,7 +2094,7 @@ static int __domain_mapping(struct dmar_domain *domain, unsigned long iov_pfn, | |||
2094 | sg_res = aligned_nrpages(sg->offset, sg->length); | 2094 | sg_res = aligned_nrpages(sg->offset, sg->length); |
2095 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; | 2095 | sg->dma_address = ((dma_addr_t)iov_pfn << VTD_PAGE_SHIFT) + sg->offset; |
2096 | sg->dma_length = sg->length; | 2096 | sg->dma_length = sg->length; |
2097 | pteval = page_to_phys(sg_page(sg)) | prot; | 2097 | pteval = (sg_phys(sg) & PAGE_MASK) | prot; |
2098 | phys_pfn = pteval >> VTD_PAGE_SHIFT; | 2098 | phys_pfn = pteval >> VTD_PAGE_SHIFT; |
2099 | } | 2099 | } |
2100 | 2100 | ||
@@ -3620,7 +3620,7 @@ static int intel_nontranslate_map_sg(struct device *hddev, | |||
3620 | 3620 | ||
3621 | for_each_sg(sglist, sg, nelems, i) { | 3621 | for_each_sg(sglist, sg, nelems, i) { |
3622 | BUG_ON(!sg_page(sg)); | 3622 | BUG_ON(!sg_page(sg)); |
3623 | sg->dma_address = page_to_phys(sg_page(sg)) + sg->offset; | 3623 | sg->dma_address = sg_phys(sg); |
3624 | sg->dma_length = sg->length; | 3624 | sg->dma_length = sg->length; |
3625 | } | 3625 | } |
3626 | return nelems; | 3626 | return nelems; |