Improve workaround for do_image_wic race condition
[AGL/meta-agl.git] / meta-agl-bsp / meta-raspberrypi / recipes-kernel / linux / linux-raspberrypi / 0003-Fix-PCIe-in-dom0-for-RPi4.patch
1 From 77765c2a47ce43911b8fe7b09f037c9bc13008ca Mon Sep 17 00:00:00 2001
2 From: Jeff Kubascik <jeff.kubascik@dornerworks.com>
3 Date: Tue, 30 Jul 2019 08:49:56 -0400
4 Subject: [PATCH 3/4] Fix PCIe in dom0 for RPi4
5
6 There is an issue where the Broadcom PCIe driver and Xen swiotlb layer
7 invoke each other's dma alloc function recursively until the stack blows
8 up. The cause appears to be due to arch_setup_dma_ops being called
9 more than once for the device, possibly through of_dma_configure, and
10 screwing up the dma_ops pointers. This patch adds a check to make sure
11 that the xen_dma_ops are applied only once for a device.
12 ---
13  arch/arm64/mm/dma-mapping.c | 2 +-
14  1 file changed, 1 insertion(+), 1 deletion(-)
15
16 diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
17 index d3a5bb16f..243a3b9be 100644
18 --- a/arch/arm64/mm/dma-mapping.c
19 +++ b/arch/arm64/mm/dma-mapping.c
20 @@ -895,7 +895,7 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
21         __iommu_setup_dma_ops(dev, dma_base, size, iommu);
22  
23  #ifdef CONFIG_XEN
24 -       if (xen_initial_domain()) {
25 +       if (!dev->archdata.dev_dma_ops && xen_initial_domain()) {
26                 dev->archdata.dev_dma_ops = dev->dma_ops;
27                 dev->dma_ops = xen_dma_ops;
28         }
29 -- 
30 2.17.1
31