diff --git a/projects/Allwinner/devices/H6/patches/linux/07-opi3.patch b/projects/Allwinner/devices/H6/patches/linux/07-opi3.patch index 4d148ac677..9bc168d747 100644 --- a/projects/Allwinner/devices/H6/patches/linux/07-opi3.patch +++ b/projects/Allwinner/devices/H6/patches/linux/07-opi3.patch @@ -327,7 +327,7 @@ index eb379cd402ac..b5dc419d92de 100644 +&emac { + pinctrl-names = "default"; + pinctrl-0 = <&ext_rgmii_pins>; -+ phy-mode = "rgmii"; ++ phy-mode = "rgmii-txid"; + phy-handle = <&ext_rgmii_phy>; + /* + * The board uses 2.5V RGMII signalling. Power sequence to enable diff --git a/projects/Allwinner/patches/linux/0109-drm-shme-helpers-Fix-dma_buf_mmap-forwarding-bug.patch b/projects/Allwinner/patches/linux/0109-drm-shme-helpers-Fix-dma_buf_mmap-forwarding-bug.patch new file mode 100644 index 0000000000..cb30feeae4 --- /dev/null +++ b/projects/Allwinner/patches/linux/0109-drm-shme-helpers-Fix-dma_buf_mmap-forwarding-bug.patch @@ -0,0 +1,82 @@ +commit 7dd307db3ce5c2de23eada9b8ba2272a470b27bd +Author: Daniel Vetter +Date: Tue Oct 27 22:17:48 2020 +0100 + + drm/shme-helpers: Fix dma_buf_mmap forwarding bug + + When we forward an mmap to the dma_buf exporter, they get to own + everything. Unfortunately drm_gem_mmap_obj() overwrote + vma->vm_private_data after the driver callback, wreaking the + exporter complete. This was noticed because vb2_common_vm_close blew + up on mali gpu with panfrost. + + Unfortunately drm_gem_mmap_obj also acquires a surplus reference that + we need to drop in shmem helpers, which is a bit of a mislayer + situation. Maybe the entire dma_buf_mmap forwarding should be pulled + into core gem code. + + Note that the only two other drivers which forward mmap in their own + code (etnaviv and exynos) get this somewhat right by overwriting the + gem mmap code. But they seem to still have the leak. This might be a + good excuse to move these drivers over to shmem helpers completely. + + Cc: Christian König + Cc: Sumit Semwal + Cc: Lucas Stach + Cc: Russell King + Cc: Christian Gmeiner + Cc: Inki Dae + Cc: Joonyoung Shim + Cc: Seung-Woo Kim + Cc: Kyungmin Park + Fixes: 26d3ac3cb04d ("drm/shmem-helpers: Redirect mmap for imported dma-buf") + Cc: Boris Brezillon + Cc: Thomas Zimmermann + Cc: Gerd Hoffmann + Cc: Rob Herring + Cc: dri-devel@lists.freedesktop.org + Cc: linux-media@vger.kernel.org + Cc: linaro-mm-sig@lists.linaro.org + Cc: # v5.9+ + Signed-off-by: Daniel Vetter + +diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c +index 1da67d34e55d..d586068f5509 100644 +--- a/drivers/gpu/drm/drm_gem.c ++++ b/drivers/gpu/drm/drm_gem.c +@@ -1076,6 +1076,8 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, + */ + drm_gem_object_get(obj); + ++ vma->vm_private_data = obj; ++ + if (obj->funcs && obj->funcs->mmap) { + ret = obj->funcs->mmap(obj, vma); + if (ret) { +@@ -1096,8 +1098,6 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, unsigned long obj_size, + vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot); + } + +- vma->vm_private_data = obj; +- + return 0; + } + EXPORT_SYMBOL(drm_gem_mmap_obj); +diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c +index fb11df7aced5..8233bda4692f 100644 +--- a/drivers/gpu/drm/drm_gem_shmem_helper.c ++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c +@@ -598,8 +598,13 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma) + /* Remove the fake offset */ + vma->vm_pgoff -= drm_vma_node_start(&obj->vma_node); + +- if (obj->import_attach) ++ if (obj->import_attach) { ++ /* Drop the reference drm_gem_mmap_obj() acquired.*/ ++ drm_gem_object_put(obj); ++ vma->vm_private_data = NULL; ++ + return dma_buf_mmap(obj->dma_buf, vma, 0); ++ } + + shmem = to_drm_gem_shmem_obj(obj);