Re: [PATCH V3 5/8] dt-bindings: Add xen,grant-dma IOMMU description for xen-grant DMA ops

2022-05-31 Thread Stefano Stabellini
id: http://devicetree.org/schemas/iommu/xen,grant-dma.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Xen specific IOMMU for virtualized devices (e.g. virtio) > + > +maintainers: > + - Stefano Stabellini > + > +description: > + The r

Re: [PATCH 3/3] swiotlb: use the right nslabs-derived sizes in swiotlb_init_late

2022-05-12 Thread Stefano Stabellini
e originally requested size could not be allocated. > > Fixes: 6424e31b1c05 ("swiotlb: remove swiotlb_init_with_tbl and > swiotlb_init_late_with_tbl") > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > kernel/dma/swiotlb.c | 19 +++---

Re: [PATCH 2/3] swiotlb: use the right nslabs value in swiotlb_init_remap

2022-05-12 Thread Stefano Stabellini
wiotlb_init_with_tbl and > swiotlb_init_late_with_tbl") > Signed-off-by: Christoph Hellwig Reviewed-by: Stefano Stabellini > --- > kernel/dma/swiotlb.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb

Re: [PATCH 1/3] swiotlb: don't panic when the swiotlb buffer can't be allocated

2022-05-12 Thread Stefano Stabellini
ng it caused a boot failure on the Microchip RISC-V > PolarFire SoC Icicle kit. > > Fixes: 6424e31b1c05 ("swiotlb: remove swiotlb_init_with_tbl and > swiotlb_init_late_with_tbl") > Reported-by: Conor Dooley > Signed-off-by: Christoph Hellwig > Tested-by: Con

Re: [PATCH] swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm

2022-05-11 Thread Stefano Stabellini
On Wed, 11 May 2022, Christoph Hellwig wrote: > On Fri, Apr 29, 2022 at 04:15:38PM -0700, Stefano Stabellini wrote: > > Great! Christoph you can go ahead and pick it up in your tree if you are > > up for it. > > The patch is in the dma-mapping for-next brancch now: > &g

Re: [PATCH] swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm

2022-04-29 Thread Stefano Stabellini
On Fri, 29 Apr 2022, Boris Ostrovsky wrote: > On 4/28/22 6:49 PM, Stefano Stabellini wrote: > > On Thu, 28 Apr 2022, Boris Ostrovsky wrote: > > > On 4/28/22 5:49 PM, Stefano Stabellini wrote: > > > > On Thu, 28 Apr 2022, Christoph Hellwig wrote: > > > >

Re: [PATCH] swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm

2022-04-28 Thread Stefano Stabellini
On Thu, 28 Apr 2022, Boris Ostrovsky wrote: > On 4/28/22 5:49 PM, Stefano Stabellini wrote: > > On Thu, 28 Apr 2022, Christoph Hellwig wrote: > > > On Tue, Apr 26, 2022 at 04:07:45PM -0700, Stefano Stabellini wrote: > > > > > Reported-by: Rahul Singh > >

Re: [PATCH] swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm

2022-04-28 Thread Stefano Stabellini
On Thu, 28 Apr 2022, Christoph Hellwig wrote: > On Tue, Apr 26, 2022 at 04:07:45PM -0700, Stefano Stabellini wrote: > > > Reported-by: Rahul Singh > > > Signed-off-by: Christoph Hellwig > > > > Reviewed-by: Stefano Stabellini > > Do you want to take thi

Re: [PATCH] swiotlb-xen: fix DMA_ATTR_NO_KERNEL_MAPPING on arm

2022-04-26 Thread Stefano Stabellini
dma-direct allocator directly for arm, which works > perfectly fine because on arm swiotlb-xen is only used when the domain is > 1:1 mapped, and then simplifying the remaining code to only cater for the > x86 case with DMA coherent device. > > Reported-by: Rahul Singh > Sig

Re: [PATCH 13/15] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-03-14 Thread Stefano Stabellini
ristoph Hellwig For arch/arm/xen and drivers/xen/swiotlb-xen.c Reviewed-by: Stefano Stabellini ___ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu

Re: [PATCH 11/12] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-03-04 Thread Stefano Stabellini
On Fri, 4 Mar 2022, Christoph Hellwig wrote: > On Thu, Mar 03, 2022 at 02:49:29PM -0800, Stefano Stabellini wrote: > > On Thu, 3 Mar 2022, Christoph Hellwig wrote: > > > On Wed, Mar 02, 2022 at 05:25:10PM -0800, Stefano Stabellini wrote: > > > > Thinking more abo

Re: [PATCH 11/12] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-03-03 Thread Stefano Stabellini
On Thu, 3 Mar 2022, Christoph Hellwig wrote: > On Wed, Mar 02, 2022 at 05:25:10PM -0800, Stefano Stabellini wrote: > > Thinking more about it we actually need to drop the xen_initial_domain() > > check otherwise some cases won't be functional (Dom0 not 1:1 mapped, or > > DomU

Re: [PATCH 11/12] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-03-02 Thread Stefano Stabellini
On Wed, 2 Mar 2022, Christoph Hellwig wrote: > On Tue, Mar 01, 2022 at 06:55:47PM -0800, Stefano Stabellini wrote: > > Unrelated to this specific patch series: now that I think about it, if > > io_tlb_default_mem.nslabs is already allocated by the time xen_mm_init > > i

Re: [PATCH 11/12] swiotlb: merge swiotlb-xen initialization into swiotlb

2022-03-01 Thread Stefano Stabellini
rn 0; > > - rc = xen_swiotlb_init(); > /* we can work with the default swiotlb */ > - if (rc < 0 && rc != -EEXIST) > - return rc; > + if (!io_tlb_default_mem.nslabs) { > + if (!xen_initial_domain()) > + return -EINVAL; I don't thi

Re: [PATCH v2 1/4] swiotlb-xen: ensure to issue well-formed XENMEM_exchange requests

2021-09-17 Thread Stefano Stabellini
d hence easy to determine without being part > of the panic message. > > Signed-off-by: Jan Beulich Reviewed-by: Stefano Stabellini > --- > I question how useful it is to wrap "bytes" in PAGE_ALIGN(), when it is > a multiple of a segment's size anyway (or at least was

Re: [PATCH] swiotlb: set IO TLB segment size via cmdline

2021-09-14 Thread Stefano Stabellini
On Tue, 14 Sep 2021, Christoph Hellwig wrote: > On Tue, Sep 14, 2021 at 05:29:07PM +0200, Jan Beulich wrote: > > I'm not convinced the swiotlb use describe there falls under "intended > > use" - mapping a 1280x720 framebuffer in a single chunk? (As an aside, > > the bottom of this page is also

Re: [GIT PULL] dma-mapping fix for Linux 5.14

2021-07-26 Thread Stefano Stabellini
On Mon, 26 Jul 2021, Boris Ostrovsky wrote: > On 7/25/21 12:50 PM, Linus Torvalds wrote: > > On Sat, Jul 24, 2021 at 11:03 PM Christoph Hellwig > > wrote: > > > >> - handle vmalloc addresses in dma_common_{mmap,get_sgtable} > >> (Roman Skakun) > > I've pulled this, but my reaction is that

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-16 Thread Stefano Stabellini
On Fri, 16 Jul 2021, Roman Skakun wrote: > > Technically this looks good. But given that exposing a helper > > that does either vmalloc_to_page or virt_to_page is one of the > > never ending MM discussions I don't want to get into that discussion > > and just keep it local in the DMA code. > > >

Re: [PATCH v2] dma-mapping: use vmalloc_to_page for vmalloc addresses

2021-07-13 Thread Stefano Stabellini
On Tue, 22 Jun 2021, Roman Skakun wrote: > This commit is dedicated to fix incorrect conversion from > cpu_addr to page address in cases when we get virtual > address which allocated in the vmalloc range. > As the result, virt_to_page() cannot convert this address > properly and return incorrect

Re: [PATCH v14 01/12] swiotlb: Refactor swiotlb init functions

2021-06-22 Thread Stefano Stabellini
On Sat, 19 Jun 2021, Claire Chang wrote: > Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct > initialization to make the code reusable. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-21 Thread Stefano Stabellini
On Fri, 18 Jun 2021, Christoph Hellwig wrote: > On Fri, Jun 18, 2021 at 09:09:17AM -0500, Tom Lendacky wrote: > > > swiotlb_init_with_tbl uses memblock_alloc to allocate the io_tlb_mem > > > and memblock_alloc[1] will do memset in memblock_alloc_try_nid[2], so > > > swiotlb_init_with_tbl is also

Re: [PATCH v13 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-17 Thread Stefano Stabellini
g, one must set up > another device coherent pool by shared-dma-pool and use > dma_alloc_from_dev_coherent instead for atomic coherent allocation. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by: Wil

Re: [PATCH v13 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-17 Thread Stefano Stabellini
by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by: Will Deacon Acked-by: Stefano Stabellini > --- > drivers/xen/swiotlb-xen.c | 2 +- > include/linux/swiotlb.h | 11 +++ > kernel/dma/direct.c | 2 +- > kernel/dma/direct.h | 2 +- &

Re: [PATCH v13 05/12] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-06-17 Thread Stefano Stabellini
On Thu, 17 Jun 2021, Claire Chang wrote: > Update is_swiotlb_active to add a struct device argument. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by

Re: [PATCH v13 04/12] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-06-17 Thread Stefano Stabellini
On Thu, 17 Jun 2021, Claire Chang wrote: > Update is_swiotlb_buffer to add a struct device argument. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by

Re: [PATCH v13 03/12] swiotlb: Set dev->dma_io_tlb_mem to the swiotlb pool used

2021-06-17 Thread Stefano Stabellini
On Thu, 17 Jun 2021, Claire Chang wrote: > Always have the pointer to the swiotlb pool used in struct device. This > could help simplify the code for other pools. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > Tested-by

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-17 Thread Stefano Stabellini
On Thu, 17 Jun 2021, Claire Chang wrote: > Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct > initialization to make the code reusable. > > Signed-off-by: Claire Chang > Reviewed-by: Christoph Hellwig > Tested-by: Stefano Stabellini > T

Re: [PATCH v12 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-16 Thread Stefano Stabellini
On Wed, 16 Jun 2021, Claire Chang wrote: > Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and > use it to determine whether to bounce the data or not. This will be > useful later to allow for different pools. > > Signed-off-by: Claire Chang > --- > include/linux/swiotlb.h |

Re: [PATCH v12 11/12] dt-bindings: of: Add restricted DMA pool

2021-06-16 Thread Stefano Stabellini
On Wed, 16 Jun 2021, Claire Chang wrote: > Introduce the new compatible string, restricted-dma-pool, for restricted > DMA. One can specify the address and length of the restricted DMA memory > region by restricted-dma-pool in the reserved-memory node. > > Signed-off-by: Claire Chang > --- >

Re: Regression when booting 5.15 as dom0 on arm64 (WAS: Re: [linux-linus test] 161829: regressions - FAIL)]

2021-05-11 Thread Stefano Stabellini
On Tue, 11 May 2021, Christoph Hellwig wrote: > On Tue, May 11, 2021 at 09:47:33AM -0700, Stefano Stabellini wrote: > > That's a much better plan. It is also not super urgent, so maybe for now > > we could add an explicit check for io_tlb_default_mem != NULL at th

Re: Regression when booting 5.15 as dom0 on arm64 (WAS: Re: [linux-linus test] 161829: regressions - FAIL)]

2021-05-11 Thread Stefano Stabellini
On Tue, 11 May 2021, Christoph Hellwig wrote: > On Mon, May 10, 2021 at 06:46:34PM -0700, Stefano Stabellini wrote: > > On Mon, 10 May 2021, Christoph Hellwig wrote: > > > On Sat, May 08, 2021 at 12:32:37AM +0100, Julien Grall wrote: > > > > The pointer

Re: Regression when booting 5.15 as dom0 on arm64 (WAS: Re: [linux-linus test] 161829: regressions - FAIL)

2021-05-10 Thread Stefano Stabellini
On Mon, 10 May 2021, Christoph Hellwig wrote: > On Sat, May 08, 2021 at 12:32:37AM +0100, Julien Grall wrote: > > The pointer dereferenced seems to suggest that the swiotlb hasn't been > > allocated. From what I can tell, this may be because swiotlb_force is set > > to SWIOTLB_NO_FORCE, we will

Re: [PATCH] ARM: Qualify enabling of swiotlb_init()

2021-03-19 Thread Stefano Stabellini
On Fri, 19 Mar 2021, Konrad Rzeszutek Wilk wrote: > On Fri, Mar 19, 2021 at 02:07:31PM +0100, Christoph Hellwig wrote: > > On Thu, Mar 18, 2021 at 09:03:33PM -0700, Florian Fainelli wrote: > > > #ifdef CONFIG_ARM_LPAE > > > + if (swiotlb_force == SWIOTLB_FORCE || > > > + max_pfn >

Re: [PATCH RFC v1 5/6] xen-swiotlb: convert variables to arrays

2021-02-22 Thread Stefano Stabellini
On Fri, 19 Feb 2021, Konrad Rzeszutek Wilk wrote: > On Sun, Feb 07, 2021 at 04:56:01PM +0100, Christoph Hellwig wrote: > > On Thu, Feb 04, 2021 at 09:40:23AM +0100, Christoph Hellwig wrote: > > > So one thing that has been on my mind for a while: I'd really like > > > to kill the separate dma ops

Re: [PATCH] fix swiotlb panic on Xen

2020-10-27 Thread Stefano Stabellini
next later this week. Looks fine, thank you > >From a1eb2768bf5954d25aa0f0136b38f0aa5d92d984 Mon Sep 17 00:00:00 2001 > From: Stefano Stabellini > Date: Mon, 26 Oct 2020 17:02:14 -0700 > Subject: [PATCH] swiotlb: fix "x86: Don't panic if can not alloc buffer for > swiotlb&q

Re: [PATCH] fix swiotlb panic on Xen

2020-10-27 Thread Stefano Stabellini
On Tue, 27 Oct 2020, Konrad Rzeszutek Wilk wrote: > On Mon, Oct 26, 2020 at 05:02:14PM -0700, Stefano Stabellini wrote: > > From: Stefano Stabellini > > > > kernel/dma/swiotlb.c:swiotlb_init gets called first and tries to > > allocate a buffer for the swi

[PATCH] fix swiotlb panic on Xen

2020-10-26 Thread Stefano Stabellini
From: Stefano Stabellini kernel/dma/swiotlb.c:swiotlb_init gets called first and tries to allocate a buffer for the swiotlb. It does so by calling memblock_alloc_low(PAGE_ALIGN(bytes), PAGE_SIZE); If the allocation must fail, no_iotlb_memory is set. Later during initialization swiotlb-xen

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