drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
usb-gadget-f_tcm-fix-get-setinterface-return-value.patch
usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
+++ /dev/null
-From 33b751104d4541371d0f7f6045b02b5df8f30511 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 7 Oct 2023 15:03:12 +0800
-Subject: drm/etnaviv: Drop the 'len' parameter of etnaviv_iommu_map() function
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 9e2e8a5113bf452081cb1f6a13617e36f5298cbf ]
-
-The 'len' parameter is the 4th argument, because it is not get used, so
-drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 1d37b5bd86760..416ef736962f9 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -70,7 +70,7 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- }
-
- static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-- struct sg_table *sgt, unsigned len, int prot)
-+ struct sg_table *sgt, int prot)
- { struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
-@@ -267,7 +267,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt, etnaviv_obj->base.size,
-+ ret = etnaviv_iommu_map(context, node->start, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From dca8289dd2c186b9b30853971c1a8e6e9b873df5 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Nov 2024 20:32:44 +0800
-Subject: drm/etnaviv: Drop the offset in page manipulation
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ]
-
-The etnaviv driver, both kernel space and user space, assumes that GPU page
-size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time.
-If 'sg->offset != 0' is true, then the current implementation will map the
-IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1
-give the illustration, see below.
-
- PA start drifted
- |
- |<--- 'sg_dma_address(sg) - sg->offset'
- | .------ sg_dma_address(sg)
- | | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- V |<-->| Another one cpu page
- +----+----+----+----+ +----+----+----+----+
- |xxxx| |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- |<--- da_len --->| | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- | | +----+----+----+----+
- | | |||||||||||||||||||||
- | | +----+----+----+----+
- | |
- | '--------------. da_len = sg_dma_len(sg) + sg->offset, using
- | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA
- +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len)
- |xxxx| | will clamp it to correct size. But the IOVA will
- +----+ ~~~~~~~~~~~~~+ be redirect to wrong area.
- ^
- | Picture 0: Possibly wrong implementation.
-GPUVA (IOVA)
-
---------------------------------------------------------------------------
-
- .------- sg_dma_address(sg)
- | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- | |<-->| another one cpu page
- +----+----+----+----+ +----+----+----+----+
- | |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- | | | |
- .--------------' | | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- +----+ +----+----+----+----+
- |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K
- +----+ +----+----+----+----+
- ^
- | Picture 1: Perfectly correct implementation.
-GPUVA (IOVA)
-
-If sg->offset != 0 is true, IOVA will be mapped to wrong physical address.
-Either because there doesn't contain the data or there contains wrong data.
-Strictly speaking, the memory area that before sg_dma_address(sg) doesn't
-belong to us, and it's likely that the area is being used by other process.
-
-Because we don't want to introduce confusions about which part is visible
-to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This
-is very relaxed requirement, since we already made the decision that GPU
-page size is 4KiB (as a canonical decision). And softpin feature is landed,
-Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA
-to kernel with desired alignment ensured.
-
-With above statements agreed, drop the "offset in page" manipulation will
-return us a correct implementation at any case.
-
-Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 8fcedaec6c9ee..4e7342b3adcd7 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
- return -EINVAL;
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
-- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ phys_addr_t pa = sg_dma_address(sg);
-+ unsigned int da_len = sg_dma_len(sg);
- unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
- VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
---
-2.39.5
-
+++ /dev/null
-From c497c76a91d71022420bc2add2c1bb89ab4319e7 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 2 Oct 2023 19:12:03 +0800
-Subject: drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 4c6e6c01d82fc0edd8b47cb1ffbd05289029b005 ]
-
-The mentioned second parameter is the 'u32 size', but it is not get used by
-the etnaviv_gem_new_impl() function, so drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 1d04232293e58..8708fc42a7c9f 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -575,7 +575,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -624,8 +624,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
-
- size = PAGE_ALIGN(size);
-
-- ret = etnaviv_gem_new_impl(dev, size, flags,
-- &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
-@@ -660,7 +659,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
- if (ret)
- return ret;
-
---
-2.39.5
-
+++ /dev/null
-From ef68036bb6f34423a035e83dd44de289379f5e9a Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:55 +0800
-Subject: drm/etnaviv: Map and unmap GPUVA range with respect to the GPUVA size
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 68786b7f49873c69ec332a045a9bf4337d71ec20 ]
-
-Etnaviv assumes that GPU page size is 4KiB, however, GPUVA ranges collision
-when using softpin capable GPUs on a non 4KiB CPU page size configuration.
-The root cause is that kernel side BO takes up bigger address space than
-userspace expect, the size of backing memory of GEM buffer objects are
-required to align to the CPU PAGE_SIZE. Therefore, results in userspace
-allocated GPUVA range fails to be inserted to the specified hole exactly.
-
-To solve this problem, record the GPU visiable size of a BO firstly, then
-map and unmap the SG entry strictly with respect to the total GPUVA size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 38 +++++++++------------------
- 1 file changed, 13 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 416ef736962f9..8fcedaec6c9ee 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -69,9 +69,11 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- return ret;
- }
-
--static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-+static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
-+ u32 iova, unsigned int va_len,
- struct sg_table *sgt, int prot)
--{ struct scatterlist *sg;
-+{
-+ struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
- int ret;
-@@ -81,14 +83,16 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- size_t bytes = sg_dma_len(sg) + sg->offset;
-+ unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
-- VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes);
-+ VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
-
- ret = etnaviv_context_map(context, da, pa, bytes, prot);
- if (ret)
- goto fail;
-
-+ va_len -= bytes;
- da += bytes;
- }
-
-@@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
- static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
- struct sg_table *sgt, unsigned len)
- {
-- struct scatterlist *sg;
-- unsigned int da = iova;
-- int i;
--
-- for_each_sgtable_dma_sg(sgt, sg, i) {
-- size_t bytes = sg_dma_len(sg) + sg->offset;
--
-- etnaviv_context_unmap(context, da, bytes);
--
-- VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
--
-- BUG_ON(!PAGE_ALIGNED(bytes));
--
-- da += bytes;
-- }
-+ etnaviv_context_unmap(context, iova, len);
-
- context->flush_seq++;
- }
-@@ -131,7 +121,7 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
- lockdep_assert_held(&context->lock);
-
- etnaviv_iommu_unmap(context, mapping->vram_node.start,
-- etnaviv_obj->sgt, etnaviv_obj->base.size);
-+ etnaviv_obj->sgt, etnaviv_obj->size);
- drm_mm_remove_node(&mapping->vram_node);
- }
-
-@@ -258,16 +248,14 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- node = &mapping->vram_node;
-
- if (va)
-- ret = etnaviv_iommu_insert_exact(context, node,
-- etnaviv_obj->base.size, va);
-+ ret = etnaviv_iommu_insert_exact(context, node, etnaviv_obj->size, va);
- else
-- ret = etnaviv_iommu_find_iova(context, node,
-- etnaviv_obj->base.size);
-+ ret = etnaviv_iommu_find_iova(context, node, etnaviv_obj->size);
- if (ret < 0)
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt,
-+ ret = etnaviv_iommu_map(context, node->start, etnaviv_obj->size, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From 6e5106528a463124fb7dcfab32b0031f7b06abaf Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 23 Mar 2022 17:08:24 +0100
-Subject: drm/etnaviv: move flush_seq increment into etnaviv_iommu_map/unmap
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-From: Lucas Stach <l.stach@pengutronix.de>
-
-[ Upstream commit 9247fcca3982a29b04b002f0d30def9ff50740d5 ]
-
-The flush sequence is a marker that the page tables have been changed
-and any affected TLBs need to be flushed. Move the flush_seq increment
-a little further down the call stack to place it next to the actual
-page table manipulation. Not functional change.
-
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
-Tested-by: Guido Günther <agx@sigxcpu.org>
-Acked-by: Guido Günther <agx@sigxcpu.org>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 6 ++++--
- 1 file changed, 4 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 2de806173b3aa..1d37b5bd86760 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -92,6 +92,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
- da += bytes;
- }
-
-+ context->flush_seq++;
-+
- return 0;
-
- fail:
-@@ -117,6 +119,8 @@ static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
-
- da += bytes;
- }
-+
-+ context->flush_seq++;
- }
-
- static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
-@@ -272,7 +276,6 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- }
-
- list_add_tail(&mapping->mmu_node, &context->mappings);
-- context->flush_seq++;
- unlock:
- mutex_unlock(&context->lock);
-
-@@ -297,7 +300,6 @@ void etnaviv_iommu_unmap_gem(struct etnaviv_iommu_context *context,
- etnaviv_iommu_remove_mapping(context, mapping);
-
- list_del(&mapping->mmu_node);
-- context->flush_seq++;
- mutex_unlock(&context->lock);
- }
-
---
-2.39.5
-
+++ /dev/null
-From 742f8a782dae24c01a1f7def835017ff18db5132 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:54 +0800
-Subject: drm/etnaviv: Record GPU visible size of GEM BO separately
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit b5f1eed853c6ea6a99149fd97fe179f3ebd96a02 ]
-
-The GPU visible size of a GEM BO is not necessarily PAGE_SIZE aligned,
-which happens when CPU page size is not equal to GPU page size. Extra
-precious resources such as GPU page tables and GPU TLBs may being paid
-because of this but never get used.
-
-Track the size of GPU visible part of GEM BO separately, ensure no
-GPUVA range wasting by aligning that size to GPU page size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 11 +++++------
- drivers/gpu/drm/etnaviv/etnaviv_gem.h | 5 +++++
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 8708fc42a7c9f..70862a84a4137 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -575,7 +575,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -602,6 +602,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- if (!etnaviv_obj)
- return -ENOMEM;
-
-+ etnaviv_obj->size = ALIGN(size, SZ_4K);
- etnaviv_obj->flags = flags;
- etnaviv_obj->ops = ops;
-
-@@ -622,15 +623,13 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
- struct drm_gem_object *obj = NULL;
- int ret;
-
-- size = PAGE_ALIGN(size);
--
-- ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
- lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
-
-- ret = drm_gem_object_init(dev, obj, size);
-+ ret = drm_gem_object_init(dev, obj, PAGE_ALIGN(size));
- if (ret)
- goto fail;
-
-@@ -659,7 +658,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
- if (ret)
- return ret;
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-index 98e60df882b68..a923ba82e3363 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-@@ -36,6 +36,11 @@ struct etnaviv_gem_object {
- const struct etnaviv_gem_ops *ops;
- struct mutex lock;
-
-+ /*
-+ * The actual size that is visible to the GPU, not necessarily
-+ * PAGE_SIZE aligned, but should be aligned to GPU page size.
-+ */
-+ u32 size;
- u32 flags;
-
- struct list_head gem_node;
---
-2.39.5
-
sched-psi-use-task-psi_flags-to-clear-in-cpu-migrati.patch
sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch
drm-etnaviv-fix-page-property-being-used-for-non-wri.patch
-drm-etnaviv-move-flush_seq-increment-into-etnaviv_io.patch
-drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch
-drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch
-drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch
-drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch
-drm-etnaviv-drop-the-offset-in-page-manipulation.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
drm-amdgpu-fix-potential-null-pointer-dereference-in.patch
genirq-make-handle_enforce_irqctx-unconditionally-av.patch
ipmi-ipmb-add-check-devm_kasprintf-returned-value.patch
ktest.pl-check-kernelrelease-return-in-get_version.patch
drivers-card_reader-rtsx_usb-restore-interrupt-based-detection.patch
usb-typec-tcpm-set-src_send_capabilities-timeout-to-pd_t_sender_response.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
+++ /dev/null
-From 31e88acb9341f11a3e1b4c4162c1c3afb604a65d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 7 Oct 2023 15:03:12 +0800
-Subject: drm/etnaviv: Drop the 'len' parameter of etnaviv_iommu_map() function
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 9e2e8a5113bf452081cb1f6a13617e36f5298cbf ]
-
-The 'len' parameter is the 4th argument, because it is not get used, so
-drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 67bdce5326c6e..b55c599bd36a2 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -70,7 +70,7 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- }
-
- static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-- struct sg_table *sgt, unsigned len, int prot)
-+ struct sg_table *sgt, int prot)
- { struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
-@@ -314,7 +314,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt, etnaviv_obj->base.size,
-+ ret = etnaviv_iommu_map(context, node->start, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From ea5d1c2cbfb4f8cd51539edd92bb6ba272a7a02d Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Nov 2024 20:32:44 +0800
-Subject: drm/etnaviv: Drop the offset in page manipulation
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ]
-
-The etnaviv driver, both kernel space and user space, assumes that GPU page
-size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time.
-If 'sg->offset != 0' is true, then the current implementation will map the
-IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1
-give the illustration, see below.
-
- PA start drifted
- |
- |<--- 'sg_dma_address(sg) - sg->offset'
- | .------ sg_dma_address(sg)
- | | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- V |<-->| Another one cpu page
- +----+----+----+----+ +----+----+----+----+
- |xxxx| |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- |<--- da_len --->| | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- | | +----+----+----+----+
- | | |||||||||||||||||||||
- | | +----+----+----+----+
- | |
- | '--------------. da_len = sg_dma_len(sg) + sg->offset, using
- | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA
- +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len)
- |xxxx| | will clamp it to correct size. But the IOVA will
- +----+ ~~~~~~~~~~~~~+ be redirect to wrong area.
- ^
- | Picture 0: Possibly wrong implementation.
-GPUVA (IOVA)
-
---------------------------------------------------------------------------
-
- .------- sg_dma_address(sg)
- | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- | |<-->| another one cpu page
- +----+----+----+----+ +----+----+----+----+
- | |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- | | | |
- .--------------' | | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- +----+ +----+----+----+----+
- |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K
- +----+ +----+----+----+----+
- ^
- | Picture 1: Perfectly correct implementation.
-GPUVA (IOVA)
-
-If sg->offset != 0 is true, IOVA will be mapped to wrong physical address.
-Either because there doesn't contain the data or there contains wrong data.
-Strictly speaking, the memory area that before sg_dma_address(sg) doesn't
-belong to us, and it's likely that the area is being used by other process.
-
-Because we don't want to introduce confusions about which part is visible
-to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This
-is very relaxed requirement, since we already made the decision that GPU
-page size is 4KiB (as a canonical decision). And softpin feature is landed,
-Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA
-to kernel with desired alignment ensured.
-
-With above statements agreed, drop the "offset in page" manipulation will
-return us a correct implementation at any case.
-
-Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index aac24045bea59..20d86b8052574 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
- return -EINVAL;
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
-- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ phys_addr_t pa = sg_dma_address(sg);
-+ unsigned int da_len = sg_dma_len(sg);
- unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
- VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
---
-2.39.5
-
+++ /dev/null
-From 62c82dba8f17acae93c09380c314d59c9eccbe75 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 2 Oct 2023 19:12:03 +0800
-Subject: drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 4c6e6c01d82fc0edd8b47cb1ffbd05289029b005 ]
-
-The mentioned second parameter is the 'u32 size', but it is not get used by
-the etnaviv_gem_new_impl() function, so drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 740680205e8d6..2702ea7699ff9 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -605,8 +605,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
-
- size = PAGE_ALIGN(size);
-
-- ret = etnaviv_gem_new_impl(dev, size, flags,
-- &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
-@@ -641,7 +640,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
- if (ret)
- return ret;
-
---
-2.39.5
-
+++ /dev/null
-From 3f9ae03e5df51407fce552850abb325ea722b7b6 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:55 +0800
-Subject: drm/etnaviv: Map and unmap GPUVA range with respect to the GPUVA size
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 68786b7f49873c69ec332a045a9bf4337d71ec20 ]
-
-Etnaviv assumes that GPU page size is 4KiB, however, GPUVA ranges collision
-when using softpin capable GPUs on a non 4KiB CPU page size configuration.
-The root cause is that kernel side BO takes up bigger address space than
-userspace expect, the size of backing memory of GEM buffer objects are
-required to align to the CPU PAGE_SIZE. Therefore, results in userspace
-allocated GPUVA range fails to be inserted to the specified hole exactly.
-
-To solve this problem, record the GPU visiable size of a BO firstly, then
-map and unmap the SG entry strictly with respect to the total GPUVA size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 38 +++++++++------------------
- 1 file changed, 13 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index b55c599bd36a2..aac24045bea59 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -69,9 +69,11 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- return ret;
- }
-
--static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-+static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
-+ u32 iova, unsigned int va_len,
- struct sg_table *sgt, int prot)
--{ struct scatterlist *sg;
-+{
-+ struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
- int ret;
-@@ -81,14 +83,16 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- size_t bytes = sg_dma_len(sg) + sg->offset;
-+ unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
-- VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes);
-+ VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
-
- ret = etnaviv_context_map(context, da, pa, bytes, prot);
- if (ret)
- goto fail;
-
-+ va_len -= bytes;
- da += bytes;
- }
-
-@@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
- static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
- struct sg_table *sgt, unsigned len)
- {
-- struct scatterlist *sg;
-- unsigned int da = iova;
-- int i;
--
-- for_each_sgtable_dma_sg(sgt, sg, i) {
-- size_t bytes = sg_dma_len(sg) + sg->offset;
--
-- etnaviv_context_unmap(context, da, bytes);
--
-- VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
--
-- BUG_ON(!PAGE_ALIGNED(bytes));
--
-- da += bytes;
-- }
-+ etnaviv_context_unmap(context, iova, len);
-
- context->flush_seq++;
- }
-@@ -131,7 +121,7 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
- lockdep_assert_held(&context->lock);
-
- etnaviv_iommu_unmap(context, mapping->vram_node.start,
-- etnaviv_obj->sgt, etnaviv_obj->base.size);
-+ etnaviv_obj->sgt, etnaviv_obj->size);
- drm_mm_remove_node(&mapping->vram_node);
- }
-
-@@ -305,16 +295,14 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- node = &mapping->vram_node;
-
- if (va)
-- ret = etnaviv_iommu_insert_exact(context, node,
-- etnaviv_obj->base.size, va);
-+ ret = etnaviv_iommu_insert_exact(context, node, etnaviv_obj->size, va);
- else
-- ret = etnaviv_iommu_find_iova(context, node,
-- etnaviv_obj->base.size);
-+ ret = etnaviv_iommu_find_iova(context, node, etnaviv_obj->size);
- if (ret < 0)
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt,
-+ ret = etnaviv_iommu_map(context, node->start, etnaviv_obj->size, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From 49bd8c4d9b174fbc12f15b9df395c941cd7d2d17 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:54 +0800
-Subject: drm/etnaviv: Record GPU visible size of GEM BO separately
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit b5f1eed853c6ea6a99149fd97fe179f3ebd96a02 ]
-
-The GPU visible size of a GEM BO is not necessarily PAGE_SIZE aligned,
-which happens when CPU page size is not equal to GPU page size. Extra
-precious resources such as GPU page tables and GPU TLBs may being paid
-because of this but never get used.
-
-Track the size of GPU visible part of GEM BO separately, ensure no
-GPUVA range wasting by aligning that size to GPU page size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 11 +++++------
- drivers/gpu/drm/etnaviv/etnaviv_gem.h | 5 +++++
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 2702ea7699ff9..1d49f5b5ec7ef 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -583,6 +583,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- if (!etnaviv_obj)
- return -ENOMEM;
-
-+ etnaviv_obj->size = ALIGN(size, SZ_4K);
- etnaviv_obj->flags = flags;
- etnaviv_obj->ops = ops;
-
-@@ -603,15 +604,13 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
- struct drm_gem_object *obj = NULL;
- int ret;
-
-- size = PAGE_ALIGN(size);
--
-- ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
- lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
-
-- ret = drm_gem_object_init(dev, obj, size);
-+ ret = drm_gem_object_init(dev, obj, PAGE_ALIGN(size));
- if (ret)
- goto fail;
-
-@@ -640,7 +639,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
- if (ret)
- return ret;
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-index 63688e6e45804..cc247d5e54225 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-@@ -36,6 +36,11 @@ struct etnaviv_gem_object {
- const struct etnaviv_gem_ops *ops;
- struct mutex lock;
-
-+ /*
-+ * The actual size that is visible to the GPU, not necessarily
-+ * PAGE_SIZE aligned, but should be aligned to GPU page size.
-+ */
-+ u32 size;
- u32 flags;
-
- struct list_head gem_node;
---
-2.39.5
-
sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch
drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch
drm-etnaviv-fix-page-property-being-used-for-non-wri.patch
-drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch
-drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch
-drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch
-drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch
-drm-etnaviv-drop-the-offset-in-page-manipulation.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
drm-amdgpu-fix-potential-null-pointer-dereference-in.patch
drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch
drm-rockchip-vop2-fix-the-mixer-alpha-setup-for-laye.patch
+++ /dev/null
-From cc5b6c4868e20f34d46e359930f0ca45a1cab9e3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Nov 2024 20:32:44 +0800
-Subject: drm/etnaviv: Drop the offset in page manipulation
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ]
-
-The etnaviv driver, both kernel space and user space, assumes that GPU page
-size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time.
-If 'sg->offset != 0' is true, then the current implementation will map the
-IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1
-give the illustration, see below.
-
- PA start drifted
- |
- |<--- 'sg_dma_address(sg) - sg->offset'
- | .------ sg_dma_address(sg)
- | | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- V |<-->| Another one cpu page
- +----+----+----+----+ +----+----+----+----+
- |xxxx| |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- |<--- da_len --->| | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- | | +----+----+----+----+
- | | |||||||||||||||||||||
- | | +----+----+----+----+
- | |
- | '--------------. da_len = sg_dma_len(sg) + sg->offset, using
- | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA
- +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len)
- |xxxx| | will clamp it to correct size. But the IOVA will
- +----+ ~~~~~~~~~~~~~+ be redirect to wrong area.
- ^
- | Picture 0: Possibly wrong implementation.
-GPUVA (IOVA)
-
---------------------------------------------------------------------------
-
- .------- sg_dma_address(sg)
- | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- | |<-->| another one cpu page
- +----+----+----+----+ +----+----+----+----+
- | |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- | | | |
- .--------------' | | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- +----+ +----+----+----+----+
- |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K
- +----+ +----+----+----+----+
- ^
- | Picture 1: Perfectly correct implementation.
-GPUVA (IOVA)
-
-If sg->offset != 0 is true, IOVA will be mapped to wrong physical address.
-Either because there doesn't contain the data or there contains wrong data.
-Strictly speaking, the memory area that before sg_dma_address(sg) doesn't
-belong to us, and it's likely that the area is being used by other process.
-
-Because we don't want to introduce confusions about which part is visible
-to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This
-is very relaxed requirement, since we already made the decision that GPU
-page size is 4KiB (as a canonical decision). And softpin feature is landed,
-Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA
-to kernel with desired alignment ensured.
-
-With above statements agreed, drop the "offset in page" manipulation will
-return us a correct implementation at any case.
-
-Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index a382920ae2be0..b7c09fc86a2cc 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
- return -EINVAL;
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
-- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ phys_addr_t pa = sg_dma_address(sg);
-+ unsigned int da_len = sg_dma_len(sg);
- unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
- VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
---
-2.39.5
-
+++ /dev/null
-From bc12edee127f8517535382a81bfdf28bf27ca462 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:55 +0800
-Subject: drm/etnaviv: Map and unmap GPUVA range with respect to the GPUVA size
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 68786b7f49873c69ec332a045a9bf4337d71ec20 ]
-
-Etnaviv assumes that GPU page size is 4KiB, however, GPUVA ranges collision
-when using softpin capable GPUs on a non 4KiB CPU page size configuration.
-The root cause is that kernel side BO takes up bigger address space than
-userspace expect, the size of backing memory of GEM buffer objects are
-required to align to the CPU PAGE_SIZE. Therefore, results in userspace
-allocated GPUVA range fails to be inserted to the specified hole exactly.
-
-To solve this problem, record the GPU visiable size of a BO firstly, then
-map and unmap the SG entry strictly with respect to the total GPUVA size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 38 +++++++++------------------
- 1 file changed, 13 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 1661d589bf3e7..a382920ae2be0 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -69,9 +69,11 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- return ret;
- }
-
--static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-+static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
-+ u32 iova, unsigned int va_len,
- struct sg_table *sgt, int prot)
--{ struct scatterlist *sg;
-+{
-+ struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
- int ret;
-@@ -81,14 +83,16 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- size_t bytes = sg_dma_len(sg) + sg->offset;
-+ unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
-- VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes);
-+ VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
-
- ret = etnaviv_context_map(context, da, pa, bytes, prot);
- if (ret)
- goto fail;
-
-+ va_len -= bytes;
- da += bytes;
- }
-
-@@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
- static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
- struct sg_table *sgt, unsigned len)
- {
-- struct scatterlist *sg;
-- unsigned int da = iova;
-- int i;
--
-- for_each_sgtable_dma_sg(sgt, sg, i) {
-- size_t bytes = sg_dma_len(sg) + sg->offset;
--
-- etnaviv_context_unmap(context, da, bytes);
--
-- VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
--
-- BUG_ON(!PAGE_ALIGNED(bytes));
--
-- da += bytes;
-- }
-+ etnaviv_context_unmap(context, iova, len);
-
- context->flush_seq++;
- }
-@@ -131,7 +121,7 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
- lockdep_assert_held(&context->lock);
-
- etnaviv_iommu_unmap(context, mapping->vram_node.start,
-- etnaviv_obj->sgt, etnaviv_obj->base.size);
-+ etnaviv_obj->sgt, etnaviv_obj->size);
- drm_mm_remove_node(&mapping->vram_node);
- }
-
-@@ -305,16 +295,14 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- node = &mapping->vram_node;
-
- if (va)
-- ret = etnaviv_iommu_insert_exact(context, node,
-- etnaviv_obj->base.size, va);
-+ ret = etnaviv_iommu_insert_exact(context, node, etnaviv_obj->size, va);
- else
-- ret = etnaviv_iommu_find_iova(context, node,
-- etnaviv_obj->base.size);
-+ ret = etnaviv_iommu_find_iova(context, node, etnaviv_obj->size);
- if (ret < 0)
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt,
-+ ret = etnaviv_iommu_map(context, node->start, etnaviv_obj->size, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From b47caf15f7fbb030c59f6cd3fd144fa489e58708 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:54 +0800
-Subject: drm/etnaviv: Record GPU visible size of GEM BO separately
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit b5f1eed853c6ea6a99149fd97fe179f3ebd96a02 ]
-
-The GPU visible size of a GEM BO is not necessarily PAGE_SIZE aligned,
-which happens when CPU page size is not equal to GPU page size. Extra
-precious resources such as GPU page tables and GPU TLBs may being paid
-because of this but never get used.
-
-Track the size of GPU visible part of GEM BO separately, ensure no
-GPUVA range wasting by aligning that size to GPU page size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 11 +++++------
- drivers/gpu/drm/etnaviv/etnaviv_gem.h | 5 +++++
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index d3f6df047f5a2..7dce6385e5e33 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -555,7 +555,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -582,6 +582,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- if (!etnaviv_obj)
- return -ENOMEM;
-
-+ etnaviv_obj->size = ALIGN(size, SZ_4K);
- etnaviv_obj->flags = flags;
- etnaviv_obj->ops = ops;
-
-@@ -602,15 +603,13 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
- struct drm_gem_object *obj = NULL;
- int ret;
-
-- size = PAGE_ALIGN(size);
--
-- ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
- lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
-
-- ret = drm_gem_object_init(dev, obj, size);
-+ ret = drm_gem_object_init(dev, obj, PAGE_ALIGN(size));
- if (ret)
- goto fail;
-
-@@ -639,7 +638,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
- if (ret)
- return ret;
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-index a42d260cac2cf..687555aae8079 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-@@ -36,6 +36,11 @@ struct etnaviv_gem_object {
- const struct etnaviv_gem_ops *ops;
- struct mutex lock;
-
-+ /*
-+ * The actual size that is visible to the GPU, not necessarily
-+ * PAGE_SIZE aligned, but should be aligned to GPU page size.
-+ */
-+ u32 size;
- u32 flags;
-
- struct list_head gem_node;
---
-2.39.5
-
drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch
drm-msm-hdmi-simplify-code-in-pll_get_integloop_gain.patch
drm-etnaviv-fix-page-property-being-used-for-non-wri.patch
-drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch
-drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch
-drm-etnaviv-drop-the-offset-in-page-manipulation.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch
drm-amdgpu-fix-potential-null-pointer-dereference-in.patch
drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
- arch/arm64/boot/dts/qcom/sc7180.dtsi | 18 +++++++++---------
- 1 file changed, 9 insertions(+), 9 deletions(-)
-
-diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi
-index 76fe314d2ad50..e7773d215f34e 100644
---- a/arch/arm64/boot/dts/qcom/sc7180.dtsi
-+++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi
-@@ -580,55 +580,55 @@
- compatible = "arm,psci-1.0";
- method = "smc";
-
-- cpu_pd0: cpu0 {
-+ cpu_pd0: power-domain-cpu0 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd1: cpu1 {
-+ cpu_pd1: power-domain-cpu1 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd2: cpu2 {
-+ cpu_pd2: power-domain-cpu2 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd3: cpu3 {
-+ cpu_pd3: power-domain-cpu3 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd4: cpu4 {
-+ cpu_pd4: power-domain-cpu4 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd5: cpu5 {
-+ cpu_pd5: power-domain-cpu5 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>;
- };
-
-- cpu_pd6: cpu6 {
-+ cpu_pd6: power-domain-cpu6 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>;
- };
-
-- cpu_pd7: cpu7 {
-+ cpu_pd7: power-domain-cpu7 {
- #power-domain-cells = <0>;
- power-domains = <&cluster_pd>;
- domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>;
- };
-
-- cluster_pd: cpu-cluster0 {
-+ cluster_pd: power-domain-cluster {
- #power-domain-cells = <0>;
- domain-idle-states = <&cluster_sleep_pc
- &cluster_sleep_cx_ret
---
-2.39.5
+ 0 files changed
+++ /dev/null
-From 8b97006f8f8e19723c20f9e507c5eb765ecf6c25 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Nov 2024 20:32:44 +0800
-Subject: drm/etnaviv: Drop the offset in page manipulation
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ]
-
-The etnaviv driver, both kernel space and user space, assumes that GPU page
-size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time.
-If 'sg->offset != 0' is true, then the current implementation will map the
-IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1
-give the illustration, see below.
-
- PA start drifted
- |
- |<--- 'sg_dma_address(sg) - sg->offset'
- | .------ sg_dma_address(sg)
- | | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- V |<-->| Another one cpu page
- +----+----+----+----+ +----+----+----+----+
- |xxxx| |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- |<--- da_len --->| | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- | | +----+----+----+----+
- | | |||||||||||||||||||||
- | | +----+----+----+----+
- | |
- | '--------------. da_len = sg_dma_len(sg) + sg->offset, using
- | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA
- +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len)
- |xxxx| | will clamp it to correct size. But the IOVA will
- +----+ ~~~~~~~~~~~~~+ be redirect to wrong area.
- ^
- | Picture 0: Possibly wrong implementation.
-GPUVA (IOVA)
-
---------------------------------------------------------------------------
-
- .------- sg_dma_address(sg)
- | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- | |<-->| another one cpu page
- +----+----+----+----+ +----+----+----+----+
- | |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- | | | |
- .--------------' | | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- +----+ +----+----+----+----+
- |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K
- +----+ +----+----+----+----+
- ^
- | Picture 1: Perfectly correct implementation.
-GPUVA (IOVA)
-
-If sg->offset != 0 is true, IOVA will be mapped to wrong physical address.
-Either because there doesn't contain the data or there contains wrong data.
-Strictly speaking, the memory area that before sg_dma_address(sg) doesn't
-belong to us, and it's likely that the area is being used by other process.
-
-Because we don't want to introduce confusions about which part is visible
-to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This
-is very relaxed requirement, since we already made the decision that GPU
-page size is 4KiB (as a canonical decision). And softpin feature is landed,
-Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA
-to kernel with desired alignment ensured.
-
-With above statements agreed, drop the "offset in page" manipulation will
-return us a correct implementation at any case.
-
-Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 7e065b3723cff..c786df840a18f 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
- return -EINVAL;
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
-- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ phys_addr_t pa = sg_dma_address(sg);
-+ unsigned int da_len = sg_dma_len(sg);
- unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
- VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
---
-2.39.5
-
dt-bindings-display-msm-qcom-sa8775p-mdss-fix-the-ex.patch
drm-msm-hdmi-simplify-code-in-pll_get_integloop_gain.patch
drm-etnaviv-fix-page-property-being-used-for-non-wri.patch
-drm-etnaviv-drop-the-offset-in-page-manipulation.patch
drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch
drm-amdgpu-fix-potential-null-pointer-dereference-in.patch
drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch
arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-re.patch
arm64-dts-qcom-sc7180-trogdor-quackingstick-add-miss.patch
arm64-dts-qcom-sc7180-trogdor-pompom-rename-5v-choke.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
arm64-dts-qcom-sc7180-fix-psci-power-domain-node-nam.patch
arm64-dts-qcom-sm8150-microsoft-surface-duo-fix-typo.patch
arm64-dts-qcom-sc8280xp-fix-up-remoteproc-register-s.patch
+++ /dev/null
-From ead2e41a83d07ebd4c5126d73cd10f5425f97b31 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 7 Oct 2023 15:03:12 +0800
-Subject: drm/etnaviv: Drop the 'len' parameter of etnaviv_iommu_map() function
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 9e2e8a5113bf452081cb1f6a13617e36f5298cbf ]
-
-The 'len' parameter is the 4th argument, because it is not get used, so
-drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 4fa72567183a8..1661d589bf3e7 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -70,7 +70,7 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- }
-
- static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-- struct sg_table *sgt, unsigned len, int prot)
-+ struct sg_table *sgt, int prot)
- { struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
-@@ -314,7 +314,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt, etnaviv_obj->base.size,
-+ ret = etnaviv_iommu_map(context, node->start, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From c04a0d1506f784fcab46db7cf671b00977df0ac0 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Fri, 15 Nov 2024 20:32:44 +0800
-Subject: drm/etnaviv: Drop the offset in page manipulation
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ]
-
-The etnaviv driver, both kernel space and user space, assumes that GPU page
-size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time.
-If 'sg->offset != 0' is true, then the current implementation will map the
-IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1
-give the illustration, see below.
-
- PA start drifted
- |
- |<--- 'sg_dma_address(sg) - sg->offset'
- | .------ sg_dma_address(sg)
- | | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- V |<-->| Another one cpu page
- +----+----+----+----+ +----+----+----+----+
- |xxxx| |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- |<--- da_len --->| | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- | | +----+----+----+----+
- | | |||||||||||||||||||||
- | | +----+----+----+----+
- | |
- | '--------------. da_len = sg_dma_len(sg) + sg->offset, using
- | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA
- +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len)
- |xxxx| | will clamp it to correct size. But the IOVA will
- +----+ ~~~~~~~~~~~~~+ be redirect to wrong area.
- ^
- | Picture 0: Possibly wrong implementation.
-GPUVA (IOVA)
-
---------------------------------------------------------------------------
-
- .------- sg_dma_address(sg)
- | .---- sg_dma_len(sg)
- |<-sg->offset->| |
- | |<-->| another one cpu page
- +----+----+----+----+ +----+----+----+----+
- | |||||| |||||||||||||||||||||
- +----+----+----+----+ +----+----+----+----+
- ^ ^ ^ ^
- | | | |
- .--------------' | | |
- | | | |
- | .--------------' | |
- | | .----------------' |
- | | | .----------------'
- | | | |
- +----+ +----+----+----+----+
- |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K
- +----+ +----+----+----+----+
- ^
- | Picture 1: Perfectly correct implementation.
-GPUVA (IOVA)
-
-If sg->offset != 0 is true, IOVA will be mapped to wrong physical address.
-Either because there doesn't contain the data or there contains wrong data.
-Strictly speaking, the memory area that before sg_dma_address(sg) doesn't
-belong to us, and it's likely that the area is being used by other process.
-
-Because we don't want to introduce confusions about which part is visible
-to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This
-is very relaxed requirement, since we already made the decision that GPU
-page size is 4KiB (as a canonical decision). And softpin feature is landed,
-Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA
-to kernel with desired alignment ensured.
-
-With above statements agreed, drop the "offset in page" manipulation will
-return us a correct implementation at any case.
-
-Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver")
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index a382920ae2be0..b7c09fc86a2cc 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
- return -EINVAL;
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
-- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ phys_addr_t pa = sg_dma_address(sg);
-+ unsigned int da_len = sg_dma_len(sg);
- unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
- VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
---
-2.39.5
-
+++ /dev/null
-From abaf8ebffa6e1c8004e856f6b996a8e3cd6ee1ee Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 2 Oct 2023 19:12:03 +0800
-Subject: drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl()
-
-From: Sui Jingfeng <suijingfeng@loongson.cn>
-
-[ Upstream commit 4c6e6c01d82fc0edd8b47cb1ffbd05289029b005 ]
-
-The mentioned second parameter is the 'u32 size', but it is not get used by
-the etnaviv_gem_new_impl() function, so drop it. No functional change.
-
-Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 +++----
- 1 file changed, 3 insertions(+), 4 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 84b7789454962..814da8188f965 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -605,8 +605,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
-
- size = PAGE_ALIGN(size);
-
-- ret = etnaviv_gem_new_impl(dev, size, flags,
-- &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
-@@ -641,7 +640,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
- if (ret)
- return ret;
-
---
-2.39.5
-
+++ /dev/null
-From 68b553dc44a9da1ebfbb674feda69c6f4306bdc3 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:55 +0800
-Subject: drm/etnaviv: Map and unmap GPUVA range with respect to the GPUVA size
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit 68786b7f49873c69ec332a045a9bf4337d71ec20 ]
-
-Etnaviv assumes that GPU page size is 4KiB, however, GPUVA ranges collision
-when using softpin capable GPUs on a non 4KiB CPU page size configuration.
-The root cause is that kernel side BO takes up bigger address space than
-userspace expect, the size of backing memory of GEM buffer objects are
-required to align to the CPU PAGE_SIZE. Therefore, results in userspace
-allocated GPUVA range fails to be inserted to the specified hole exactly.
-
-To solve this problem, record the GPU visiable size of a BO firstly, then
-map and unmap the SG entry strictly with respect to the total GPUVA size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 38 +++++++++------------------
- 1 file changed, 13 insertions(+), 25 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-index 1661d589bf3e7..a382920ae2be0 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
-@@ -69,9 +69,11 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context,
- return ret;
- }
-
--static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-+static int etnaviv_iommu_map(struct etnaviv_iommu_context *context,
-+ u32 iova, unsigned int va_len,
- struct sg_table *sgt, int prot)
--{ struct scatterlist *sg;
-+{
-+ struct scatterlist *sg;
- unsigned int da = iova;
- unsigned int i;
- int ret;
-@@ -81,14 +83,16 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
-
- for_each_sgtable_dma_sg(sgt, sg, i) {
- phys_addr_t pa = sg_dma_address(sg) - sg->offset;
-- size_t bytes = sg_dma_len(sg) + sg->offset;
-+ unsigned int da_len = sg_dma_len(sg) + sg->offset;
-+ unsigned int bytes = min_t(unsigned int, da_len, va_len);
-
-- VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes);
-+ VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes);
-
- ret = etnaviv_context_map(context, da, pa, bytes, prot);
- if (ret)
- goto fail;
-
-+ va_len -= bytes;
- da += bytes;
- }
-
-@@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova,
- static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova,
- struct sg_table *sgt, unsigned len)
- {
-- struct scatterlist *sg;
-- unsigned int da = iova;
-- int i;
--
-- for_each_sgtable_dma_sg(sgt, sg, i) {
-- size_t bytes = sg_dma_len(sg) + sg->offset;
--
-- etnaviv_context_unmap(context, da, bytes);
--
-- VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
--
-- BUG_ON(!PAGE_ALIGNED(bytes));
--
-- da += bytes;
-- }
-+ etnaviv_context_unmap(context, iova, len);
-
- context->flush_seq++;
- }
-@@ -131,7 +121,7 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context,
- lockdep_assert_held(&context->lock);
-
- etnaviv_iommu_unmap(context, mapping->vram_node.start,
-- etnaviv_obj->sgt, etnaviv_obj->base.size);
-+ etnaviv_obj->sgt, etnaviv_obj->size);
- drm_mm_remove_node(&mapping->vram_node);
- }
-
-@@ -305,16 +295,14 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context,
- node = &mapping->vram_node;
-
- if (va)
-- ret = etnaviv_iommu_insert_exact(context, node,
-- etnaviv_obj->base.size, va);
-+ ret = etnaviv_iommu_insert_exact(context, node, etnaviv_obj->size, va);
- else
-- ret = etnaviv_iommu_find_iova(context, node,
-- etnaviv_obj->base.size);
-+ ret = etnaviv_iommu_find_iova(context, node, etnaviv_obj->size);
- if (ret < 0)
- goto unlock;
-
- mapping->iova = node->start;
-- ret = etnaviv_iommu_map(context, node->start, sgt,
-+ ret = etnaviv_iommu_map(context, node->start, etnaviv_obj->size, sgt,
- ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE);
-
- if (ret < 0) {
---
-2.39.5
-
+++ /dev/null
-From e3663f9578c6b60c820cd092f9ff91449aae2e91 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Sat, 26 Oct 2024 04:43:54 +0800
-Subject: drm/etnaviv: Record GPU visible size of GEM BO separately
-
-From: Sui Jingfeng <sui.jingfeng@linux.dev>
-
-[ Upstream commit b5f1eed853c6ea6a99149fd97fe179f3ebd96a02 ]
-
-The GPU visible size of a GEM BO is not necessarily PAGE_SIZE aligned,
-which happens when CPU page size is not equal to GPU page size. Extra
-precious resources such as GPU page tables and GPU TLBs may being paid
-because of this but never get used.
-
-Track the size of GPU visible part of GEM BO separately, ensure no
-GPUVA range wasting by aligning that size to GPU page size.
-
-Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>
-Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
-Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- drivers/gpu/drm/etnaviv/etnaviv_gem.c | 11 +++++------
- drivers/gpu/drm/etnaviv/etnaviv_gem.h | 5 +++++
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-index 814da8188f965..d9495743ec8bd 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
-@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = {
- .vm_ops = &vm_ops,
- };
-
--static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
-+static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags,
- const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj)
- {
- struct etnaviv_gem_object *etnaviv_obj;
-@@ -583,6 +583,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags,
- if (!etnaviv_obj)
- return -ENOMEM;
-
-+ etnaviv_obj->size = ALIGN(size, SZ_4K);
- etnaviv_obj->flags = flags;
- etnaviv_obj->ops = ops;
-
-@@ -603,15 +604,13 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file,
- struct drm_gem_object *obj = NULL;
- int ret;
-
-- size = PAGE_ALIGN(size);
--
-- ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, &etnaviv_gem_shmem_ops, &obj);
- if (ret)
- goto fail;
-
- lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class);
-
-- ret = drm_gem_object_init(dev, obj, size);
-+ ret = drm_gem_object_init(dev, obj, PAGE_ALIGN(size));
- if (ret)
- goto fail;
-
-@@ -640,7 +639,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags,
- struct drm_gem_object *obj;
- int ret;
-
-- ret = etnaviv_gem_new_impl(dev, flags, ops, &obj);
-+ ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj);
- if (ret)
- return ret;
-
-diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-index a42d260cac2cf..687555aae8079 100644
---- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
-@@ -36,6 +36,11 @@ struct etnaviv_gem_object {
- const struct etnaviv_gem_ops *ops;
- struct mutex lock;
-
-+ /*
-+ * The actual size that is visible to the GPU, not necessarily
-+ * PAGE_SIZE aligned, but should be aligned to GPU page size.
-+ */
-+ u32 size;
- u32 flags;
-
- struct list_head gem_node;
---
-2.39.5
-
x86-topology-use-x86_sched_itmt_flags-for-pkg-domain.patch
drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch
drm-etnaviv-fix-page-property-being-used-for-non-wri.patch
-drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch
-drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch
-drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch
-drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch
-drm-etnaviv-drop-the-offset-in-page-manipulation.patch
+hid-core-fix-assumption-that-resolution-multipliers-must-be-in-logical-collections.patch
drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch
drm-amdgpu-fix-potential-null-pointer-dereference-in.patch
drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch