[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 09/10] xen/arm: introduce phys/dma translations in xen_dma_sync_for_*
On Thu, 21 May 2020, Julien Grall wrote: > > @@ -97,8 +98,7 @@ bool xen_arch_need_swiotlb(struct device *dev, > > phys_addr_t phys, > > dma_addr_t dev_addr) > > { > > - unsigned int xen_pfn = XEN_PFN_DOWN(phys); > > - unsigned int bfn = XEN_PFN_DOWN(dev_addr); > > + unsigned int bfn = XEN_PFN_DOWN(dma_to_phys(dev, dev_addr)); > > /* > > * The swiotlb buffer should be used if > > @@ -115,7 +115,7 @@ bool xen_arch_need_swiotlb(struct device *dev, > > * require a bounce buffer because the device doesn't support coherent > > * memory and we are not able to flush the cache. > > */ > > - return (!hypercall_cflush && (xen_pfn != bfn) && > > + return (!hypercall_cflush && !pfn_valid(bfn) && > > I believe this change is incorrect. The bfn is a frame based on Xen page > granularity (always 4K) while pfn_valid() is expecting a frame based on the > Kernel page granularity. Given that kernel granularity >= xen granularity it looks like it would be safe to use PFN_DOWN instead of XEN_PFN_DOWN: unsigned int bfn = PFN_DOWN(dma_to_phys(dev, dev_addr)); return (!hypercall_cflush && !pfn_valid(bfn) &&
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |