[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240321171902.85-1-petrtesarik@huaweicloud.com>
Date: Thu, 21 Mar 2024 18:19:00 +0100
From: Petr Tesarik <petrtesarik@...weicloud.com>
To: Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Petr Tesarik <petr.tesarik1@...wei-partners.com>,
Michael Kelley <mhklinux@...look.com>,
Will Deacon <will@...nel.org>,
linux-kernel@...r.kernel.org (open list),
iommu@...ts.linux.dev (open list:DMA MAPPING HELPERS)
Cc: Roberto Sassu <roberto.sassu@...weicloud.com>,
Petr Tesarik <petr@...arici.cz>
Subject: [PATCH v3 0/2] swiotlb: allocate padding slots if necessary
From: Petr Tesarik <petr.tesarik1@...wei-partners.com>
If the allocation alignment is bigger than IO_TLB_SIZE and min_align_mask
covers some bits in the original address between IO_TLB_SIZE and
alloc_align_mask, preserve these bits by allocating additional padding
slots before the actual swiotlb buffer.
Changes from v2
---------------
* Fix assignment of an uninitialized variable to pad_slots.
* Improve commit message wrt INVALID_PHYS_ADDR.
Changes from v1
---------------
* Rename padding to pad_slots.
* Set pad_slots only for the first allocated non-padding slot.
* Do not bother initializing orig_addr to INVALID_PHYS_ADDR.
* Change list and pad_slots to unsigned short to avoid growing
struct io_tlb_slot on 32-bit targets.
* Add build-time check that list and pad_slots can hold the maximum
allowed value of IO_TLB_SEGSIZE.
Petr Tesarik (2):
swiotlb: extend buffer pre-padding to alloc_align_mask if necessary
bug: introduce ASSERT_VAR_CAN_HOLD()
include/linux/build_bug.h | 10 ++++++++++
kernel/dma/swiotlb.c | 37 +++++++++++++++++++++++++++++++------
2 files changed, 41 insertions(+), 6 deletions(-)
--
2.34.1
Powered by blists - more mailing lists