lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2505131714100.368682@ubuntu-linux-20-04-desktop>
Date: Tue, 13 May 2025 17:14:22 -0700 (PDT)
From: Stefano Stabellini <sstabellini@...nel.org>
To: John Ernberg <john.ernberg@...ia.se>
cc: Juergen Gross <jgross@...e.com>, 
    Stefano Stabellini <sstabellini@...nel.org>, 
    Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>, 
    "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>, 
    "iommu@...ts.linux.dev" <iommu@...ts.linux.dev>, 
    "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, 
    Christoph Hellwig <hch@...radead.org>, 
    "imx@...ts.linux.dev" <imx@...ts.linux.dev>
Subject: Re: [PATCH v2] xen: swiotlb: Wire up map_resource callback

On Mon, 12 May 2025, John Ernberg wrote:
> When running Xen on iMX8QXP, an Arm SoC without IOMMU, DMA performed via
> its eDMA v3 DMA engine fail with a mapping error.
> 
> The eDMA performs DMA between RAM and MMIO space, and it's the MMIO side
> that cannot be mapped.
> 
> MMIO->RAM DMA access cannot be bounce buffered if it would straddle a page
> boundary and on Xen the MMIO space is 1:1 mapped for Arm, and x86 PV Dom0.
> Cases where MMIO space is not 1:1 mapped, such as x86 PVH Dom0, requires an
> IOMMU present to deal with the mapping.
> 
> Considering the above the map_resource callback can just be wired to the
> existing dma_direct_map_resource() function.
> 
> There is nothing to do for unmap so the unmap callback is not needed.
> 
> Signed-off-by: John Ernberg <john.ernberg@...ia.se>

Reviewed-by: Stefano Stabellini <sstabellini@...nel.org>


> ---
> 
> v2:
>  - Just use dma_direct_map_resource() directly (Stefano Stabellini)
>  - Incorporate some of the discussion and explanations from v1 into the
>     commit message (Stefano, Christoph)
>  - General English improvements in the commit message.
>  - Just this patch now, 1/2 in the previous set was applied
> 
> v1: (series) https://lore.kernel.org/xen-devel/20250502114043.1968976-1-john.ernberg@actia.se/
> ---
>  drivers/xen/swiotlb-xen.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
> index ef56a2500ed6..da1a7d3d377c 100644
> --- a/drivers/xen/swiotlb-xen.c
> +++ b/drivers/xen/swiotlb-xen.c
> @@ -426,4 +426,5 @@ const struct dma_map_ops xen_swiotlb_dma_ops = {
>  	.alloc_pages_op = dma_common_alloc_pages,
>  	.free_pages = dma_common_free_pages,
>  	.max_mapping_size = swiotlb_max_mapping_size,
> +	.map_resource = dma_direct_map_resource,
>  };
> -- 
> 2.49.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ