Message ID | 20190816130013.31154-9-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance | expand |
Hi Christoph, On 8/16/19 2:00 PM, Christoph Hellwig wrote: > xen_dma_map_page uses a different and more complicated check for > foreign pages than the other three cache maintainance helpers. > Switch it to the simpler pfn_vali method a well. NIT: s/pfn_vali/pfn_valid/ > > Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Julien Grall <julien.grall@arm.com> Cheers,
diff --git a/include/xen/page-coherent.h b/include/xen/page-coherent.h index 7c32944de051..0f4d468e7a89 100644 --- a/include/xen/page-coherent.h +++ b/include/xen/page-coherent.h @@ -43,14 +43,9 @@ static inline void xen_dma_map_page(struct device *hwdev, struct page *page, dma_addr_t dev_addr, unsigned long offset, size_t size, enum dma_data_direction dir, unsigned long attrs) { - unsigned long page_pfn = page_to_xen_pfn(page); - unsigned long dev_pfn = XEN_PFN_DOWN(dev_addr); - unsigned long compound_pages = - (1<<compound_order(page)) * XEN_PFN_PER_PAGE; - bool local = (page_pfn <= dev_pfn) && - (dev_pfn - page_pfn < compound_pages); + unsigned long pfn = PFN_DOWN(dev_addr); - if (local) + if (pfn_valid(pfn)) dma_direct_map_page(hwdev, page, offset, size, dir, attrs); else __xen_dma_map_page(hwdev, page, dev_addr, offset, size, dir, attrs);
xen_dma_map_page uses a different and more complicated check for foreign pages than the other three cache maintainance helpers. Switch it to the simpler pfn_vali method a well. Signed-off-by: Christoph Hellwig <hch@lst.de> --- include/xen/page-coherent.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)