[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 1/2] xen/swiotlb: add alignment check for dma buffers
On Mon, 16 Sep 2024, Juergen Gross wrote: > On 16.09.24 08:56, Juergen Gross wrote: > > On 16.09.24 08:50, Jan Beulich wrote: > > > On 16.09.2024 08:47, Juergen Gross wrote: > > > > --- a/drivers/xen/swiotlb-xen.c > > > > +++ b/drivers/xen/swiotlb-xen.c > > > > @@ -78,9 +78,15 @@ static inline int > > > > range_straddles_page_boundary(phys_addr_t p, size_t size) > > > > { > > > > unsigned long next_bfn, xen_pfn = XEN_PFN_DOWN(p); > > > > unsigned int i, nr_pages = XEN_PFN_UP(xen_offset_in_page(p) + > > > > size); > > > > + phys_addr_t algn = 1ULL << (get_order(size) + PAGE_SHIFT); > > > > next_bfn = pfn_to_bfn(xen_pfn); > > > > + /* If buffer is physically aligned, ensure DMA alignment. */ > > > > + if (IS_ALIGNED(p, algn) && > > > > + !IS_ALIGNED(next_bfn << XEN_PAGE_SHIFT, algn)) > > > > > > And this shift is not at risk of losing bits on Arm LPAE? > > > > For alignment check this just doesn't matter (assuming XEN_PAGE_SIZE is > > smaller than 4G). > > Wait, that was nonsense. > > I'll change the check to: > > !IS_ALIGNED((phys_addr_t)next_bfn << XEN_PAGE_SHIFT, algn) With this change: Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |