Re: xen-swiotlb vs phys_to_dma

2020-10-07 Thread Stefano Stabellini
On Wed, 7 Oct 2020, Christoph Hellwig wrote: > On Tue, Oct 06, 2020 at 01:46:12PM -0700, Stefano Stabellini wrote: > > OK, this makes a lot of sense, and I like the patch because it makes the > > swiotlb interface clearer. > > > > Just one comment below.

Re: xen-swiotlb vs phys_to_dma

2020-10-06 Thread Stefano Stabellini
On Tue, 6 Oct 2020, Christoph Hellwig wrote: > On Fri, Oct 02, 2020 at 01:21:25PM -0700, Stefano Stabellini wrote: > > On Fri, 2 Oct 2020, Christoph Hellwig wrote: > > > Hi Stefano, > > > > > > I've looked over xen-swiotlb in linux-next, that is with your rece

Re: xen-swiotlb vs phys_to_dma

2020-10-02 Thread Stefano Stabellini
On Fri, 2 Oct 2020, Christoph Hellwig wrote: > Hi Stefano, > > I've looked over xen-swiotlb in linux-next, that is with your recent > changes to take dma offsets into account. One thing that puzzles me > is that xen_swiotlb_map_page passes virt_to_phys(xen_io_tlb_start) as > the tbl_dma_addr

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-07-15 Thread Stefano Stabellini
On Sat, 11 Jul 2020, Michael S. Tsirkin wrote: > On Fri, Jul 10, 2020 at 10:23:22AM -0700, Stefano Stabellini wrote: > > Sorry for the late reply -- a couple of conferences kept me busy. > > > > > > On Wed, 1 Jul 2020, Michael S. Tsirkin wrote: > > > On W

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-07-10 Thread Stefano Stabellini
Sorry for the late reply -- a couple of conferences kept me busy. On Wed, 1 Jul 2020, Michael S. Tsirkin wrote: > On Wed, Jul 01, 2020 at 10:34:53AM -0700, Stefano Stabellini wrote: > > Would you be in favor of a more flexible check along the lines of the > > one propos

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-07-01 Thread Stefano Stabellini
On Wed, 1 Jul 2020, Christoph Hellwig wrote: > On Mon, Jun 29, 2020 at 04:46:09PM -0700, Stefano Stabellini wrote: > > > I could imagine some future Xen hosts setting a flag somewhere in the > > > platform capability saying "no xen specific flag, rely on > > > &

RE: [PATCH] xen: introduce xen_vring_use_dma

2020-06-29 Thread Stefano Stabellini
On Mon, 29 Jun 2020, Peng Fan wrote: > > > If that is the case, how is it possible that virtio breaks on ARM > > > using the default dma_ops? The breakage is not Xen related (except > > > that Xen turns dma_ops on). The original message from Peng was: > > > > > > vring_map_one_sg ->

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-06-29 Thread Stefano Stabellini
On Fri, 26 Jun 2020, Michael S. Tsirkin wrote: > On Thu, Jun 25, 2020 at 10:31:27AM -0700, Stefano Stabellini wrote: > > On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > > > On Wed, Jun 24, 2020 at 02:53:54PM -0700, Stefano Stabellini wrote: > > > > On Wed, 24 Jun

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-06-25 Thread Stefano Stabellini
On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > On Wed, Jun 24, 2020 at 02:53:54PM -0700, Stefano Stabellini wrote: > > On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > > > On Wed, Jun 24, 2020 at 10:59:47AM -0700, Stefano Stabellini wrote: > > > > On Wed, 24 Jun

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-06-24 Thread Stefano Stabellini
On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > On Wed, Jun 24, 2020 at 10:59:47AM -0700, Stefano Stabellini wrote: > > On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > > > On Wed, Jun 24, 2020 at 05:17:32PM +0800, Peng Fan wrote: > > > > Export xen_swiotlb for a

Re: [PATCH] xen: introduce xen_vring_use_dma

2020-06-24 Thread Stefano Stabellini
On Wed, 24 Jun 2020, Michael S. Tsirkin wrote: > On Wed, Jun 24, 2020 at 05:17:32PM +0800, Peng Fan wrote: > > Export xen_swiotlb for all platforms using xen swiotlb > > > > Use xen_swiotlb to determine when vring should use dma APIs to map the > > ring: when xen_swiotlb is enabled the dma API is

Re: [PATCH 5/5] virtio: Add bounce DMA ops

2020-04-28 Thread Stefano Stabellini
On Tue, 28 Apr 2020, Michael S. Tsirkin wrote: > On Tue, Apr 28, 2020 at 11:19:52PM +0530, Srivatsa Vaddagiri wrote: > > * Michael S. Tsirkin [2020-04-28 12:17:57]: > > > > > Okay, but how is all this virtio specific? For example, why not allow > > > separate swiotlbs for any type of device? >

Re: [PATCH 5/5] virtio: Add bounce DMA ops

2020-04-28 Thread Stefano Stabellini
On Tue, 28 Apr 2020, Srivatsa Vaddagiri wrote: > For better security, its desirable that a guest VM's memory is > not accessible to any entity that executes outside the context of > guest VM. In case of virtio, backend drivers execute outside the > context of guest VM and in general will need

Re: [PATCH] xen/swiotlb: correct the check for xen_destroy_contiguous_region

2020-04-28 Thread Stefano Stabellini
On Tue, 28 Apr 2020, Jürgen Groß wrote: > On 28.04.20 09:33, peng@nxp.com wrote: > > From: Peng Fan > > > > When booting xen on i.MX8QM, met: > > " > > [3.602128] Unable to handle kernel paging request at virtual address > > 00272d40 > > [3.610804] Mem abort info: > > [

Re: [PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance

2019-09-09 Thread Stefano Stabellini
On Thu, 5 Sep 2019, Christoph Hellwig wrote: > Copy the arm64 code that uses the dma-direct/swiotlb helpers for DMA > on-coherent devices. > > Signed-off-by: Christoph Hellwig This is much better and much more readable. Reviewed-by: Stefano Stabellini > --- > arch/arm/in

Re: [PATCH 02/11] xen/arm: consolidate page-coherent.h

2019-09-09 Thread Stefano Stabellini
On Thu, 5 Sep 2019, Christoph Hellwig wrote: > Shared the duplicate arm/arm64 code in include/xen/arm/page-coherent.h. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > arch/arm/include/asm/xen/page-coherent.h | 75 > arch

Re: swiotlb-xen cleanups v2

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > Hi Xen maintainers and friends, > > please take a look at this series that cleans up the parts of swiotlb-xen > that deal with non-coherent caches. > > Changes since v1: > - rewrite dma_cache_maint to be much simpler > - improve various comments

Re: [PATCH 11/11] arm64: use asm-generic/dma-mapping.h

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > Now that the Xen special cases are gone nothing worth mentioning is > left in the arm64 file, so switch to use the > asm-generic version instead. > > Signed-off-by: Christoph Hellwig > Acked-by: Will Deacon Reviewed-by:

Re: [PATCH 03/11] xen/arm: simplify dma_cache_maint

2019-08-29 Thread Stefano Stabellini
e_op(GNTTABOP_cache_flush, , 1); > > - offset = 0; > - xen_pfn++; > - left -= len; > - } while (left); > + cflush.offset = 0; > + cflush.a.dev_bus_addr += cflush.length; > + size -= cflush.length; Y

Re: [PATCH 09/11] swiotlb-xen: remove page-coherent.h

2019-08-29 Thread Stefano Stabellini
en.h instead. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > arch/arm/include/asm/xen/page-coherent.h | 2 -- > arch/arm64/include/asm/xen/page-coherent.h | 2 -- > arch/x86/include/asm/xen/page-coherent.h | 11 --- > drivers/xen/sw

Re: [PATCH 10/11] swiotlb-xen: merge xen_unmap_single into xen_swiotlb_unmap_page

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > No need for a no-op wrapper. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 15 --- > 1 file changed, 4 insertions(+), 11 deletions(-) > > diff --g

Re: [PATCH 08/11] swiotlb-xen: simplify cache maintainance

2019-08-29 Thread Stefano Stabellini
rtions(+), 133 deletions(-) WOW nice! Now I really can see why this series was worth doing :-) Reviewed-by: Stefano Stabellini > diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c > index b7d53415532b..7096652f5a1e 100644 > --- a/arch/arm/xen/mm.c > +++ b/arch/arm/xen/mm.c

Re: [PATCH 06/11] swiotlb-xen: always use dma-direct helpers to alloc coherent pages

2019-08-29 Thread Stefano Stabellini
+ Boris, Juergen On Mon, 26 Aug 2019, Christoph Hellwig wrote: > x86 currently calls alloc_pages, but using dma-direct works as well > there, with the added benefit of using the CMA pool if available. > The biggest advantage is of course to remove a pointless bit of > architecture specific code.

Re: [PATCH 07/11] swiotlb-xen: use the same foreign page check everywhere

2019-08-29 Thread Stefano Stabellini
oved comment in xen_dma_map_page. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > include/xen/arm/page-coherent.h | 31 +-- > 1 file changed, 9 insertions(+), 22 deletions(-) > > diff --git a/include/xen/arm/page-coherent.h

Re: [PATCH 03/11] xen/arm: simplify dma_cache_maint

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > Calculate the required operation in the caller, and pass it directly > instead of recalculating it for each page, and use simple arithmetics > to get from the physical address to Xen page size aligned chunks. > > Signed-off-by: Christoph Hellwig >

Re: [PATCH 02/11] xen/arm: use dev_is_dma_coherent

2019-08-29 Thread Stefano Stabellini
n Grall Reviewed-by: Stefano Stabellini > --- > arch/arm/include/asm/dma-mapping.h | 6 -- > arch/arm/xen/mm.c| 12 ++-- > arch/arm64/include/asm/dma-mapping.h | 9 - > 3 files changed, 6 insertions(+), 21 deletions(-) > > diff --g

Re: [PATCH 01/11] xen/arm: use dma-noncoherent.h calls for xen-swiotlb cache maintainance

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > Reuse the arm64 code that uses the dma-direct/swiotlb helpers for DMA > non-coherent devices. This patch does a bunch of things not listed in the commit message, such as moving the static inline functions to include/xen/arm/page-coherent.h and

Re: [PATCH 05/11] xen: remove the exports for xen_{create,destroy}_contiguous_region

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > These routines are only used by swiotlb-xen, which cannot be modular. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > arch/arm/xen/mm.c | 2 -- > arch/x86/xen/mmu_pv.c | 2 -- > 2 files

Re: [PATCH 04/11] xen/arm: remove xen_dma_ops

2019-08-29 Thread Stefano Stabellini
On Mon, 26 Aug 2019, Christoph Hellwig wrote: > arm and arm64 can just use xen_swiotlb_dma_ops directly like x86, no > need for a pointer indirection. > > Signed-off-by: Christoph Hellwig > Reviewed-by: Julien Grall Reviewed-by: Stefano Stabellini > --- > arch/arm/mm

Re: swiotlb-xen cleanups

2019-08-26 Thread Stefano Stabellini
On Fri, 16 Aug 2019, Christoph Hellwig wrote: > Hi Xen maintainers and friends, > > please take a look at this series that cleans up the parts of swiotlb-xen > that deal with non-coherent caches. Hi Christoph, I just wanted to let you know that your series is on my radar, but I have been

Re: [PATCH] swiotlb: fix phys_addr_t overflow warning

2019-06-17 Thread Stefano Stabellini
gt; Use an explicit typecast here to convert it to the narrower type, > and use the same expression in the error handling later. > > Fixes: b907e20508d0 ("swiotlb: remove SWIOTLB_MAP_ERROR") > Signed-off-by: Arnd Bergmann Acked-by: Stefano Stabellini > --- > I still t

Re: [PATCH v1] xen/swiotlb: rework early repeat code

2019-05-24 Thread Stefano Stabellini
hing the same code to fix another unrelated bug, see: https://marc.info/?l=xen-devel=155856767022893 > --- > CC: Konrad Rzeszutek Wilk > CC: Boris Ostrovsky > CC: Juergen Gross > CC: Stefano Stabellini > CC: Paul Durrant > --- > drivers/xen/swiotlb-xen.c | 36 +

Re: [PATCH 3/3] xen/swiotlb: remember having called xen_create_contiguous_region()

2019-04-23 Thread Stefano Stabellini
On Tue, 23 Apr 2019, Juergen Gross wrote: > Instead of always calling xen_destroy_contiguous_region() in case the > memory is DMA-able for the used device, do so only in case it has been > made DMA-able via xen_create_contiguous_region() before. > > This will avoid a lot of

Re: [PATCH 4/4] swiotlb-xen: ensure we have a single callsite for xen_dma_map_page

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > Refactor the code a bit to make further changes easier. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 31 --- > 1 file changed, 16

Re: [PATCH 2/4] swiotlb-xen: use ->map_page to implement ->map_sg

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > We can simply loop over the segments and map them, removing lots of > duplicate code. Right, the only difference is the additional dma_capable check which is good to have. Reviewed-by: Stefano Stabellini > Signed-off-by: Christop

Re: [PATCH 1/4] swiotlb-xen: make instances match their method names

2019-04-15 Thread Stefano Stabellini
On Thu, 11 Apr 2019, Christoph Hellwig wrote: > Just drop two pointless _attrs prefixes to make the code a little > more grep-able. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 17 +++-- > 1 file

Re: [PATCH 3/4] swiotlb-xen: simplify the DMA sync method implementations

2019-04-15 Thread Stefano Stabellini
o highlevel DMA API > concepts, which have nothing to do with the swiotlb-xen implementation > details. > > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 84 +-- > 1 file cha

Re: [PATCH] arm64/xen: fix xen-swiotlb cache flushing

2019-01-21 Thread Stefano Stabellini
On Sat, 19 Jan 2019, Christoph Hellwig wrote: > [full quote deleted, please take a little more care when quoting] > > On Fri, Jan 18, 2019 at 04:44:23PM -0800, Stefano Stabellini wrote: > > > #ifdef CONFIG_XEN > > > - if (xen_initial_domain()) { > > > -

Re: [PATCH] arm64/xen: fix xen-swiotlb cache flushing

2019-01-18 Thread Stefano Stabellini
> index fb0908456a1f..78c0a72f822c 100644 > --- a/arch/arm64/mm/dma-mapping.c > +++ b/arch/arm64/mm/dma-mapping.c > @@ -466,9 +466,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, > u64 size, > __iommu_setup_dma_ops(dev, dma_base, size, iommu); > >

Re: Fail to boot Dom0 on Xen Arm64 after "dma-mapping: bypass indirect calls for dma-direct"

2019-01-18 Thread Stefano Stabellini
On Thu, 17 Jan 2019, Christoph Hellwig wrote: > On Thu, Jan 17, 2019 at 11:43:49AM +, Julien Grall wrote: > > Looking at the change for arm64, you will always call dma-direct API. In > > previous Linux version, xen-swiotlb will call dev->archdata.dev_dma_ops (a > > copy of dev->dma_ops before

Re: [PATCH] dma-mapping: remove unused attrs parameter to dma_common_get_sgtable

2019-01-03 Thread Stefano Stabellini
On Thu, 3 Jan 2019, Huaisheng Ye wrote: > From: Huaisheng Ye > > dma_common_get_sgtable has parameter attrs which is not used at all. > Remove it. > > Signed-off-by: Huaisheng Ye Acked-by: Stefano Stabellini FYI the patch doesn't apply cleanly to master. > --- > d

Re: [PATCH v2 2/2] swiotlb: Skip cache maintenance on map error

2018-11-27 Thread Stefano Stabellini
map and goes about as well as expected. > > Don't do that. > > Fixes: a4a4330db46a ("swiotlb: add support for non-coherent DMA") > Tested-by: John Stultz > Reviewed-by: Christoph Hellwig > Signed-off-by: Robin Murphy Acked-by: Stefano Stabellini > --- >

Re: [PATCH 0/2] SWIOTLB fixes for 4.20

2018-11-27 Thread Stefano Stabellini
On Tue, 27 Nov 2018, Stefano Stabellini wrote: > On Wed, 21 Nov 2018, Konrad Rzeszutek Wilk wrote: > > On Wed, Nov 21, 2018 at 02:03:31PM +0100, Christoph Hellwig wrote: > > > On Tue, Nov 20, 2018 at 11:34:41AM -0500, Konrad Rzeszutek Wilk wrote: > > > > > Konr

Re: [PATCH 0/2] SWIOTLB fixes for 4.20

2018-11-27 Thread Stefano Stabellini
On Wed, 21 Nov 2018, Konrad Rzeszutek Wilk wrote: > On Wed, Nov 21, 2018 at 02:03:31PM +0100, Christoph Hellwig wrote: > > On Tue, Nov 20, 2018 at 11:34:41AM -0500, Konrad Rzeszutek Wilk wrote: > > > > Konrad, are you ok with me picking up both through the dma-mapping > > > > tree? > > > > > >

Re: [RFC PATCH 0/5] arm64: IOMMU-backed DMA mapping

2015-01-13 Thread Stefano Stabellini
On Mon, 12 Jan 2015, Robin Murphy wrote: Hi all, Whilst it's a long way off perfect, this has reached the point of being functional and stable enough to be useful, so here it is. The core consists of the meat of the arch/arm implementation modified to remove the assumption of PAGE_SIZE

Re: [RFC] add a struct page* parameter to dma_map_ops.unmap_page

2014-11-21 Thread Stefano Stabellini
On Mon, 17 Nov 2014, Stefano Stabellini wrote: Hi all, I am writing this email to ask for your advice. On architectures where dma addresses are different from physical addresses, it can be difficult to retrieve the physical address of a page from its dma address. Specifically

[RFC] add a struct page* parameter to dma_map_ops.unmap_page

2014-11-17 Thread Stefano Stabellini
Hi all, I am writing this email to ask for your advice. On architectures where dma addresses are different from physical addresses, it can be difficult to retrieve the physical address of a page from its dma address. Specifically this is the case for Xen on arm and arm64 but I think that other