[PATCH] drm/prime: Fix documentation of drm_gem_prime_fd_to_handle()

2023-02-25 Thread Petr Tesarik
From: Petr Tesarik The DRM device passed to drm_gem_prime_fd_to_handle() is where the dma-buf is being imported, not the device where it was exported. Also fix a trivial typo in drm_gem_prime_import_dev(). Signed-off-by: Petr Tesarik --- drivers/gpu/drm/drm_prime.c | 4 ++-- 1 file changed

[PATCH v2 0/7] Allow dynamic allocation of software IO TLB bounce buffers

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik The goal of my work is to provide more flexibility in the sizing of SWIOTLB. The software IO TLB was designed with these assumptions: 1. It would not be used much, especially on 64-bit systems. 2. A small fixed memory area (64 MiB by default) is sufficient to handle the

[PATCH v2 2/7] swiotlb: Move code around in preparation for dynamic bounce buffers

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik To prepare for the introduction of dynamically allocated bounce buffers, separate out common code and code which handles non-dynamic (aka fixed) bounce buffers. No functional change, but this commit should make the addition of dynamic allocations easier to review. Signed-off

[PATCH v2 1/7] swiotlb: Use a helper to initialize swiotlb fields in struct device

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik Move swiotlb initialization code to swiotlb.h. This change also allows to provide a stub implementation if swiotlb is not configured, getting rid of an #ifdef in driver core. Signed-off-by: Petr Tesarik --- drivers/base/core.c | 4 +--- include/linux/swiotlb.h | 12

[PATCH v2 3/7] dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik Introduce a DMA attribute to tell the DMA-mapping subsystem that the operation is allowed to sleep. This patch merely adds the flag, but it does not do anything at the moment. Signed-off-by: Petr Tesarik --- Documentation/core-api/dma-attributes.rst | 10

[PATCH v2 4/7] swiotlb: Dynamically allocated bounce buffers

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik The software IO TLB was designed with the assumption that it is not used much, especially on 64-bit systems, so a small fixed memory area (currently 64 MiB) is sufficient to handle the few cases which still require a bounce buffer. However, these cases are not so rare in some

[PATCH v2 5/7] swiotlb: Add a boot option to enable dynamic bounce buffers

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik The main goal of allocating bounce buffers dynamically is to allow allocating a minimal fixed swiotlb at boot time but avoid hard limits on the amount of I/O that can be handled later. Compared to fixed IO TLB slots, dynamic allocation of bounce buffers typically increases

[PATCH v2 6/7] drm: Use DMA_ATTR_MAY_SLEEP from process context

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik These mappings are never done from atomic context. If a dynamically allocated bounce buffer is used for the mapping, this change allows to allocate from CMA. Signed-off-by: Petr Tesarik --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- drivers/gpu/drm/drm_prime.c

[PATCH v2 7/7] swiotlb: per-device flag if there are dynamically allocated buffers

2023-04-19 Thread Petr Tesarik
From: Petr Tesarik Do not walk the list of dynamically allocated bounce buffers if the list is empty. This avoids taking dma_io_tlb_dyn_lock for devices which do not use any dynamically allocated bounce buffers. When unmapping the last dynamically allocated bounce buffer, the flag is set to

Re: [PATCH v2 0/7] Allow dynamic allocation of software IO TLB bounce buffers

2023-05-03 Thread Petr Tesarik
cture... As always, YMMV. Petr T > Mike > > On Fri, 28 Apr 2023 at 10:07, Petr Tesařík wrote: >> >> On Fri, 28 Apr 2023 09:53:38 +0100 >> Mike Lothian wrote: >> >>> On Wed, 19 Apr 2023 at 11:05, Petr Tesarik >>> wrote: >>>> >>>

Re: [PATCH] drm/prime: Fix documentation of drm_gem_prime_fd_to_handle()

2023-03-20 Thread Petr Tesarik
On 2/25/2023 12:08 PM, Simon Ser wrote: > Reviewed-by: Simon Ser Hi Simon, so how about taking this one? I can't see it in git yet (but maybe I'm looking at the wrong branch). Petr T

[PATCH v2 RESEND 0/7] Allow dynamic allocation of software IO TLB bounce buffers

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik The goal of my work is to provide more flexibility in the sizing of SWIOTLB. The software IO TLB was designed with these assumptions: 1. It would not be used much, especially on 64-bit systems. 2. A small fixed memory area (64 MiB by default) is sufficient to handle the

[PATCH v2 RESEND 1/7] swiotlb: Use a helper to initialize swiotlb fields in struct device

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik Move swiotlb initialization code to swiotlb.h. This change also allows to provide a stub implementation if swiotlb is not configured, getting rid of an #ifdef in driver core. Signed-off-by: Petr Tesarik --- drivers/base/core.c | 4 +--- include/linux/swiotlb.h | 12

[PATCH v2 RESEND 2/7] swiotlb: Move code around in preparation for dynamic bounce buffers

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik To prepare for the introduction of dynamically allocated bounce buffers, separate out common code and code which handles non-dynamic (aka fixed) bounce buffers. No functional change, but this commit should make the addition of dynamic allocations easier to review. Signed-off

[PATCH v2 RESEND 3/7] dma-mapping: introduce the DMA_ATTR_MAY_SLEEP attribute

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik Introduce a DMA attribute to tell the DMA-mapping subsystem that the operation is allowed to sleep. This patch merely adds the flag, but it does not do anything at the moment. Signed-off-by: Petr Tesarik --- Documentation/core-api/dma-attributes.rst | 10

[PATCH v2 RESEND 4/7] swiotlb: Dynamically allocated bounce buffers

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik The software IO TLB was designed with the assumption that it is not used much, especially on 64-bit systems, so a small fixed memory area (currently 64 MiB) is sufficient to handle the few cases which still require a bounce buffer. However, these cases are not so rare in some

[PATCH v2 RESEND 5/7] swiotlb: Add a boot option to enable dynamic bounce buffers

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik The main goal of allocating bounce buffers dynamically is to allow allocating a minimal fixed swiotlb at boot time but avoid hard limits on the amount of I/O that can be handled later. Compared to fixed IO TLB slots, dynamic allocation of bounce buffers typically increases

[PATCH v2 RESEND 6/7] drm: Use DMA_ATTR_MAY_SLEEP from process context

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik These mappings are never done from atomic context. If a dynamically allocated bounce buffer is used for the mapping, this change allows to allocate from CMA. Signed-off-by: Petr Tesarik --- drivers/gpu/drm/drm_gem_shmem_helper.c | 2 +- drivers/gpu/drm/drm_prime.c

[PATCH v2 RESEND 7/7] swiotlb: per-device flag if there are dynamically allocated buffers

2023-05-09 Thread Petr Tesarik
From: Petr Tesarik Do not walk the list of dynamically allocated bounce buffers if the list is empty. This avoids taking dma_io_tlb_dyn_lock for devices which do not use any dynamically allocated bounce buffers. When unmapping the last dynamically allocated bounce buffer, the flag is set to