lkml.org 
[lkml]   [2020]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2 08/11] swiotlb-xen: introduce phys_to_dma/dma_to_phys translations
From
Date
On 6/3/20 6:22 PM, Stefano Stabellini wrote:
>
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index 0a6cb67f0fc4..60ef07440905 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -64,16 +64,16 @@ static inline dma_addr_t xen_phys_to_bus(struct device *dev, phys_addr_t paddr)


Weren't you going to rename this to xen_phys_to_dma()? (And the the one
below to xen_dma_to_phys())?


-boris


>
> dma |= paddr & ~XEN_PAGE_MASK;
>
> - return dma;
> + return phys_to_dma(dev, dma);
> }
>
> -static inline phys_addr_t xen_bus_to_phys(struct device *dev, dma_addr_t baddr)
> +static inline phys_addr_t xen_bus_to_phys(struct device *dev,
> + dma_addr_t dma_addr)
> {
> + phys_addr_t baddr = dma_to_phys(dev, dma_addr);
> unsigned long xen_pfn = bfn_to_pfn(XEN_PFN_DOWN(baddr));
> - dma_addr_t dma = (dma_addr_t)xen_pfn << XEN_PAGE_SHIFT;
> - phys_addr_t paddr = dma;
> -
> - paddr |= baddr & ~XEN_PAGE_MASK;
> + phys_addr_t paddr = (xen_pfn << XEN_PAGE_SHIFT) |
> + (baddr & ~XEN_PAGE_MASK);
>


\
 
 \ /
  Last update: 2020-06-04 19:48    [W:0.179 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site