Re: [PATCH] arm/mm: add option to prefer IOMMU ops for DMA on Xen

2023-11-14 Thread Robin Murphy
On 11/11/2023 6:45 pm, Chuck Zmudzinski wrote: Enabling the new option, ARM_DMA_USE_IOMMU_XEN, fixes this error when attaching the Exynos mixer in Linux dom0 on Xen on the Chromebook Snow (and probably on other devices that use the Exynos mixer): [drm] Exynos DRM: using 1440.fimd device for

Re: [PATCH v3 1/7] swiotlb: make io_tlb_default_mem local to swiotlb.c

2023-06-27 Thread Robin Murphy
On 27/06/2023 11:24 am, Greg Kroah-Hartman wrote: On Tue, Jun 27, 2023 at 11:54:23AM +0200, Petr Tesarik wrote: +/** + * is_swiotlb_active() - check if the software IO TLB is initialized + * @dev: Device to check, or %NULL for the default IO TLB. + */ bool is_swiotlb_active(struct

Re: [PATCH] arm/acpi: don't expose the ACPI IORT SMMUv3 entry to dom0

2022-05-09 Thread Robin Murphy
On 2022-04-27 17:12, Rahul Singh wrote: Xen should control the SMMUv3 devices therefore, don't expose the SMMUv3 devices to dom0. Deny iomem access to SMMUv3 address space for dom0 and also make ACPI IORT SMMUv3 node type to 0xff. ...making the resulting IORT technically useless to consumers.

Re: [PATCH v3 1/2] dt-bindings: arm: xen: document Xen iommu device

2022-01-26 Thread Robin Murphy
On 2022-01-26 15:09, Sergiy Kibrik wrote: Hi Robin, This could break Linux guests, since depending on the deferred probe timeout setting it could lead to drivers never probing because the "IOMMU" never becomes available. I've noticed no deferred probe timeouts when booting with this patch.

Re: [PATCH v3 1/2] dt-bindings: arm: xen: document Xen iommu device

2022-01-17 Thread Robin Murphy
On 2022-01-17 12:32, Sergiy Kibrik wrote: In IOMMU-capable system hypervisor usually takes over IOMMU control. Generally guest domains don't need to care about IOMMU management and take any extra actions. Yet in some cases a knowledge about which device is protected may be useful for privileged

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

2021-09-17 Thread Robin Murphy
On 2021-09-17 10:36, Roman Skakun wrote: Hi, Christoph I use Xen PV display. In my case, PV display backend(Dom0) allocates contiguous buffer via DMA-API to to implement zero-copy between Dom0 and DomU. Well, something's gone badly wrong there - if you have to shadow the entire thing in a

Re: [PATCH v1 16/16] dma-mapping: Disallow .map_sg operations from returning zero on error

2021-07-16 Thread Robin Murphy
On 2021-07-16 07:33, Christoph Hellwig wrote: On Thu, Jul 15, 2021 at 10:45:44AM -0600, Logan Gunthorpe wrote: @@ -194,6 +194,8 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, else ents = ops->map_sg(dev, sg, nents, dir, attrs); +

Re: [PATCH v1 14/16] x86/amd_gart: return error code from gart_map_sg()

2021-07-16 Thread Robin Murphy
On 2021-07-16 07:32, Christoph Hellwig wrote: On Thu, Jul 15, 2021 at 10:45:42AM -0600, Logan Gunthorpe wrote: @@ -458,7 +460,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, iommu_full(dev, pages << PAGE_SHIFT, dir); for_each_sg(sg, s, nents,

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

2021-07-06 Thread Robin Murphy
On 2021-07-06 15:05, Christoph Hellwig wrote: On Tue, Jul 06, 2021 at 03:01:04PM +0100, Robin Murphy wrote: FWIW I was pondering the question of whether to do something along those lines or just scrap the default assignment entirely, so since I hadn't got round to saying that I've gone ahead

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

2021-07-06 Thread Robin Murphy
On 2021-07-06 14:24, Will Deacon wrote: On Tue, Jul 06, 2021 at 06:48:48AM +0200, Christoph Hellwig wrote: On Mon, Jul 05, 2021 at 08:03:52PM +0100, Will Deacon wrote: So at this point, the AMD IOMMU driver does: swiotlb= (iommu_default_passthrough() || sme_me_mask) ? 1 : 0;

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

2021-07-02 Thread Robin Murphy
On 2021-07-02 14:58, Will Deacon wrote: Hi Nathan, On Thu, Jul 01, 2021 at 12:52:20AM -0700, Nathan Chancellor wrote: On 7/1/2021 12:40 AM, Will Deacon wrote: On Wed, Jun 30, 2021 at 08:56:51AM -0700, Nathan Chancellor wrote: On Wed, Jun 30, 2021 at 12:43:48PM +0100, Will Deacon wrote: On

Re: [PATCH v15 12/12] of: Add plumbing for restricted DMA pool

2021-07-02 Thread Robin Murphy
On 2021-07-02 04:08, Guenter Roeck wrote: Hi, On Thu, Jun 24, 2021 at 11:55:26PM +0800, Claire Chang wrote: If a device is not behind an IOMMU, we look up the device node and set up the restricted DMA when the restricted-dma-pool is presented. Signed-off-by: Claire Chang Tested-by: Stefano

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

2021-06-24 Thread Robin Murphy
On 2021-06-24 12:18, Will Deacon wrote: On Thu, Jun 24, 2021 at 12:14:39PM +0100, Robin Murphy wrote: On 2021-06-24 07:05, Claire Chang wrote: On Thu, Jun 24, 2021 at 1:43 PM Christoph Hellwig wrote: On Wed, Jun 23, 2021 at 02:44:34PM -0400, Qian Cai wrote: is_swiotlb_force_bounce at /usr

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

2021-06-24 Thread Robin Murphy
On 2021-06-24 07:05, Claire Chang wrote: On Thu, Jun 24, 2021 at 1:43 PM Christoph Hellwig wrote: On Wed, Jun 23, 2021 at 02:44:34PM -0400, Qian Cai wrote: is_swiotlb_force_bounce at /usr/src/linux-next/./include/linux/swiotlb.h:119 is_swiotlb_force_bounce() was the new function introduced

Re: [RFC PATCH V3 08/11] swiotlb: Add bounce buffer remap address setting function

2021-06-14 Thread Robin Murphy
On 2021-06-07 07:43, Christoph Hellwig wrote: On Sun, May 30, 2021 at 11:06:25AM -0400, Tianyu Lan wrote: From: Tianyu Lan For Hyper-V isolation VM with AMD SEV SNP, the bounce buffer(shared memory) needs to be accessed via extra address space(e.g address above bit39). Hyper-V code may remap

Re: Regression in at least 5.10.y and mainline: Firewire audio interface fails to work properly (when booted under Xen)

2021-06-14 Thread Robin Murphy
On 2021-06-13 07:29, Salvatore Bonaccorso wrote: A user in Debian reported the above issue, which was reproducible with 5.13-rc5 and 5.10.y as packaged in Debian and found that 85a5a6875ca9 ("swiotlb: don't modify orig_addr in swiotlb_tbl_sync_single") that introduced the issue. Sounds like

Re: [PATCH v5 14/16] dma-direct: Allocate memory from restricted DMA pool if available

2021-04-23 Thread Robin Murphy
On 2021-04-22 09:15, Claire Chang wrote: The restricted DMA pool is preferred if available. The restricted DMA pools provide a basic level of protection against the DMA overwriting buffer contents at unexpected times. However, to protect against general data leakage and system memory

Re: [PATCH v5 16/16] of: Add plumbing for restricted DMA pool

2021-04-23 Thread Robin Murphy
On 2021-04-22 09:15, Claire Chang wrote: If a device is not behind an IOMMU, we look up the device node and set up the restricted DMA when the restricted-dma-pool is presented. Signed-off-by: Claire Chang --- drivers/of/address.c| 25 + drivers/of/device.c |

Re: [PATCH v5 08/16] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-04-23 Thread Robin Murphy
On 2021-04-22 09:15, Claire Chang wrote: Update is_swiotlb_active to add a struct device argument. This will be useful later to allow for restricted DMA pool. Signed-off-by: Claire Chang --- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c|

Re: [PATCH RFC v1 2/6] swiotlb: convert variables to arrays

2021-02-04 Thread Robin Murphy
On 2021-02-04 07:29, Christoph Hellwig wrote: On Wed, Feb 03, 2021 at 03:37:05PM -0800, Dongli Zhang wrote: This patch converts several swiotlb related variables to arrays, in order to maintain stat/status for different swiotlb buffers. Here are variables involved: - io_tlb_start and

Re: [RFC PATCH v3 5/6] dt-bindings: of: Add restricted DMA pool

2021-01-21 Thread Robin Murphy
On 2021-01-21 15:48, Rob Herring wrote: On Wed, Jan 20, 2021 at 7:10 PM Robin Murphy wrote: On 2021-01-20 21:31, Rob Herring wrote: On Wed, Jan 20, 2021 at 11:30 AM Robin Murphy wrote: On 2021-01-20 16:53, Rob Herring wrote: On Wed, Jan 06, 2021 at 11:41:23AM +0800, Claire Chang wrote

Re: [RFC PATCH v3 5/6] dt-bindings: of: Add restricted DMA pool

2021-01-20 Thread Robin Murphy
On 2021-01-20 21:31, Rob Herring wrote: On Wed, Jan 20, 2021 at 11:30 AM Robin Murphy wrote: On 2021-01-20 16:53, Rob Herring wrote: On Wed, Jan 06, 2021 at 11:41:23AM +0800, Claire Chang wrote: Introduce the new compatible string, restricted-dma-pool, for restricted DMA. One can specify

Re: [RFC PATCH v3 5/6] dt-bindings: of: Add restricted DMA pool

2021-01-20 Thread Robin Murphy
On 2021-01-20 16:53, Rob Herring wrote: On Wed, Jan 06, 2021 at 11:41:23AM +0800, 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 device

Re: [RFC PATCH v3 4/6] swiotlb: Add restricted DMA alloc/free support.

2021-01-13 Thread Robin Murphy
On 2021-01-13 12:48, Christoph Hellwig wrote: +#ifdef CONFIG_SWIOTLB + if (unlikely(dev->dma_io_tlb_mem)) + return swiotlb_alloc(dev, size, dma_handle, attrs); +#endif Another place where the dma_io_tlb_mem is useful to avoid the ifdef. -phys_addr_t

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Robin Murphy
On 2021-01-13 17:43, Florian Fainelli wrote: On 1/13/21 7:27 AM, Robin Murphy wrote: On 2021-01-13 13:59, Nicolas Saenz Julienne wrote: Hi All, On Tue, 2021-01-12 at 16:03 -0800, Florian Fainelli wrote: On 1/5/21 7:41 PM, Claire Chang wrote: Add the initialization function to create

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Robin Murphy
On 2021-01-13 13:59, Nicolas Saenz Julienne wrote: Hi All, On Tue, 2021-01-12 at 16:03 -0800, Florian Fainelli wrote: On 1/5/21 7:41 PM, Claire Chang wrote: Add the initialization function to create restricted DMA pools from matching reserved-memory nodes in the device tree. Signed-off-by:

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-12 Thread Robin Murphy
On 2021-01-07 17:57, Konrad Rzeszutek Wilk wrote: On Fri, Jan 08, 2021 at 01:39:18AM +0800, Claire Chang wrote: Hi Greg and Konrad, This change is intended to be non-arch specific. Any arch that lacks DMA access control and has devices not behind an IOMMU can make use of it. Could you share

Re: [Xen-devel] [PATCH 00/11] of: Fix DMA configuration for non-DT masters

2019-09-26 Thread Robin Murphy
On 2019-09-26 11:44 am, Nicolas Saenz Julienne wrote: Robin, have you looked into supporting multiple dma-ranges? It's the next thing we need for BCM STB's PCIe. I'll have a go at it myself if nothing is in the works already. Multiple dma-ranges as far as configuring inbound windows should

Re: [Xen-devel] [RFC PATCH] xen/gntdev: Stop abusing DT of_dma_configure API

2019-09-26 Thread Robin Murphy
On 2019-09-26 11:17 am, Oleksandr Andrushchenko wrote: On 9/26/19 12:49 PM, Julien Grall wrote: Hi Rob, On 9/25/19 10:50 PM, Rob Herring wrote: As the comment says, this isn't a DT based device. of_dma_configure() is going to stop allowing a NULL DT node, so this needs to be fixed. And

Re: [Xen-devel] [PATCH 00/11] of: Fix DMA configuration for non-DT masters

2019-09-25 Thread Robin Murphy
On 25/09/2019 17:16, Rob Herring wrote: On Wed, Sep 25, 2019 at 10:30 AM Nicolas Saenz Julienne wrote: On Wed, 2019-09-25 at 16:09 +0100, Robin Murphy wrote: On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: On Tue, Sep 24, 2019 at 1

Re: [Xen-devel] [PATCH 00/11] of: Fix DMA configuration for non-DT masters

2019-09-25 Thread Robin Murphy
On 25/09/2019 15:52, Nicolas Saenz Julienne wrote: On Tue, 2019-09-24 at 16:59 -0500, Rob Herring wrote: On Tue, Sep 24, 2019 at 1:12 PM Nicolas Saenz Julienne wrote: Hi All, this series tries to address one of the issues blocking us from upstreaming Broadcom's STB PCIe controller[1]. Namely,

Re: [Xen-devel] [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64

2019-08-27 Thread Robin Murphy
On 09/07/2019 09:22, Peng Fan wrote: arm64 shares some code under arch/arm/xen, including mm.c. However ZONE_DMA is removed by commit ad67f5a6545("arm64: replace ZONE_DMA with ZONE_DMA32"). So to ARM64, need use __GFP_DMA32. Signed-off-by: Peng Fan --- arch/arm/xen/mm.c | 2 +- 1 file

Re: [Xen-devel] [PATCH 03/11] xen/arm: pass one less argument to dma_cache_maint

2019-08-16 Thread Robin Murphy
On 16/08/2019 14:00, Christoph Hellwig wrote: Instead of taking apart the dma address in both callers do it inside dma_cache_maint itself. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/xen/mm.c

Re: [Xen-devel] [PATCH RFC 3/4] Arm64: further speed-up to hweight{32, 64}()

2019-06-04 Thread Robin Murphy
On 04/06/2019 17:11, Julien Grall wrote: Hi Jan, On 5/31/19 10:53 AM, Jan Beulich wrote: According to Linux commit e75bef2a4f ("arm64: Select ARCH_HAS_FAST_MULTIPLIER") this is a further improvement over the variant using only bitwise operations on at least some hardware, and no worse on

Re: [Xen-devel] [PATCH] Revert "swiotlb: remove SWIOTLB_MAP_ERROR"

2019-03-04 Thread Robin Murphy
Hi Arnd, On 2019-03-04 7:59 pm, Arnd Bergmann wrote: This reverts commit b907e20508d0 ("swiotlb: remove SWIOTLB_MAP_ERROR"), which introduced an overflow warning in configurations that have a larger dma_addr_t than phys_addr_t: In file included from include/linux/dma-direct.h:5,

Re: [Xen-devel] [PATCH v3 1/9] mm: Introduce new vm_insert_range API

2018-12-07 Thread Robin Murphy
On 2018-12-07 7:28 pm, Souptick Joarder wrote: On Fri, Dec 7, 2018 at 10:41 PM Matthew Wilcox wrote: On Fri, Dec 07, 2018 at 03:34:56PM +, Robin Murphy wrote: +int vm_insert_range(struct vm_area_struct *vma, unsigned long addr, + struct page **pages, unsigned long

Re: [Xen-devel] [PATCH v3 1/9] mm: Introduce new vm_insert_range API

2018-12-07 Thread Robin Murphy
On 06/12/2018 18:39, Souptick Joarder wrote: Previouly drivers have their own way of mapping range of kernel pages/memory into user vma and this was done by invoking vm_insert_page() within a loop. As this pattern is common across different drivers, it can be generalized by creating a new

Re: [Xen-devel] [PATCH 01/23] dma-mapping: provide a generic DMA_MAPPING_ERROR

2018-12-04 Thread Robin Murphy
gh, so either way, Reviewed-by: Robin Murphy ___ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel

Re: [Xen-devel] remove the ->mapping_error method from dma_map_ops V2

2018-11-22 Thread Robin Murphy
On 22/11/2018 17:09, Linus Torvalds wrote: On Thu, Nov 22, 2018 at 9:07 AM Russell King - ARM Linux wrote: I'm afraid that won't work very well - 32 bit platforms with 64-bit addresses (LPAE) would have dma_addr_t as a 64-bit value, which wouldn't fit into an unsigned long. Good point. So