[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230713195307.08d68b01@meshulam.tesarici.cz>
Date: Thu, 13 Jul 2023 19:53:07 +0200
From: Petr Tesařík <petr@...arici.cz>
To: Petr Tesarik <petrtesarik@...weicloud.com>
Cc: Stefano Stabellini <sstabellini@...nel.org>,
Russell King <linux@...linux.org.uk>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
x86@...nel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)),
"H. Peter Anvin" <hpa@...or.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Juergen Gross <jgross@...e.com>,
Oleksandr Tyshchenko <oleksandr_tyshchenko@...m.com>,
Christoph Hellwig <hch@....de>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Petr Tesarik <petr.tesarik.ext@...wei.com>,
Jonathan Corbet <corbet@....net>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>,
James Seo <james@...iv.tech>,
James Clark <james.clark@....com>,
Kees Cook <keescook@...omium.org>,
xen-devel@...ts.xenproject.org (moderated list:XEN HYPERVISOR ARM),
linux-arm-kernel@...ts.infradead.org (moderated list:ARM PORT),
linux-kernel@...r.kernel.org (open list),
linux-mips@...r.kernel.org (open list:MIPS),
iommu@...ts.linux.dev (open list:XEN SWIOTLB SUBSYSTEM),
Roberto Sassu <roberto.sassu@...weicloud.com>,
Kefeng Wang <wangkefeng.wang@...wei.com>
Subject: Re: [PATCH v4 3/8] swiotlb: separate memory pool data from other
allocator data
On Thu, 13 Jul 2023 17:23:14 +0200
Petr Tesarik <petrtesarik@...weicloud.com> wrote:
> From: Petr Tesarik <petr.tesarik.ext@...wei.com>
>
> Carve out memory pool specific fields from struct io_tlb_mem. The original
> struct now contains shared data for the whole allocator, while the new
> struct io_tlb_pool contains data that is specific to one memory pool of
> (potentially) many.
>
> Allocate both structures together for restricted DMA pools to keep the
> error cleanup path simple.
>
> Signed-off-by: Petr Tesarik <petr.tesarik.ext@...wei.com>
> ---
> include/linux/device.h | 2 +-
> include/linux/swiotlb.h | 47 +++++++----
> kernel/dma/swiotlb.c | 181 +++++++++++++++++++++++++---------------
> 3 files changed, 147 insertions(+), 83 deletions(-)
>
> diff --git a/include/linux/device.h b/include/linux/device.h
> index bbaeabd04b0d..d9754a68ba95 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -625,7 +625,7 @@ struct device_physical_location {
> * @dma_pools: Dma pools (if dma'ble device).
> * @dma_mem: Internal for coherent mem override.
> * @cma_area: Contiguous memory area for dma allocations
> - * @dma_io_tlb_mem: Pointer to the swiotlb pool used. Not for driver use.
> + * @dma_io_tlb_mem: Software IO TLB allocator. Not for driver use.
> * @archdata: For arch-specific additions.
> * @of_node: Associated device tree node.
> * @fwnode: Associated device node supplied by platform firmware.
> diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
> index 39313c3a791a..d669e11e2827 100644
> --- a/include/linux/swiotlb.h
> +++ b/include/linux/swiotlb.h
> @@ -62,8 +62,7 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
> #ifdef CONFIG_SWIOTLB
>
> /**
> - * struct io_tlb_mem - IO TLB Memory Pool Descriptor
> - *
> + * struct io_tlb_pool - IO TLB memory pool descriptor
> * @start: The start address of the swiotlb memory pool. Used to do a quick
> * range check to see if the memory was in fact allocated by this
> * API.
> @@ -73,15 +72,36 @@ dma_addr_t swiotlb_map(struct device *dev, phys_addr_t phys,
> * @vaddr: The vaddr of the swiotlb memory pool. The swiotlb memory pool
> * may be remapped in the memory encrypted case and store virtual
> * address for bounce buffer operation.
> - * @nslabs: The number of IO TLB blocks (in groups of 64) between @start and
> - * @end. For default swiotlb, this is command line adjustable via
> - * setup_io_tlb_npages.
> + * @nslabs: The number of IO TLB slots between @start and @end. For the
> + * default swiotlb, this can be adjusted with a boot parameter,
> + * see setup_io_tlb_npages().
> + * @used: The number of used IO TLB slots.
> + * @late_alloc: %true if allocated using the page allocator.
> + * @nareas: Number of areas in the pool.
> + * @area_nslabs: Number of slots in each area.
> + * @areas: Array of memory area descriptors.
> + * @slots: Array of slot descriptors.
> + */
> +struct io_tlb_pool {
> + phys_addr_t start;
> + phys_addr_t end;
> + void *vaddr;
> + unsigned long nslabs;
> + unsigned long used;
Oops. This member should not be re-introduced here after I removed it
with commit efa76afdde16...
I'm going to fix this in a v5, but I don't think it's critical enough
to make an immediate resend.
Petr T
Powered by blists - more mailing lists