Re: [PATCH] mm: Generalize HUGETLB_PAGE_SIZE_VARIABLE

2021-02-28 Thread Christoph Hellwig
On Mon, Mar 01, 2021 at 01:13:41PM +0530, Anshuman Khandual wrote: > > doesn't this need a 'if HUGETLB_PAGE' > > While making HUGETLB_PAGE_SIZE_VARIABLE a generic option, also made it > dependent on HUGETLB_PAGE. Should not that gate HUGETLB_PAGE_SIZE_VARIABLE > when HUGETLB_PAGE is not available

[PATCH 14/14] swiotlb: remove swiotlb_nr_tbl

2021-02-28 Thread Christoph Hellwig
All callers just use it to check if swiotlb is active at all, for which they can just use is_swiotlb_active. In the longer run drivers need to stop using is_swiotlb_active as well, but let's do the simple step first. Signed-off-by: Christoph Hellwig --- drivers/gpu/drm/i915/gem/i915_gem_interna

[PATCH 13/14] swiotlb: dynamically allocate io_tlb_default_mem

2021-02-28 Thread Christoph Hellwig
Instead of allocating ->list and ->orig_addr separately just do one dynamic allocation for the actual io_tlb_mem structure. This simplifies a lot of the initialization code, and also allows to just check io_tlb_default_mem to see if swiotlb is in use. Signed-off-by: Christoph Hellwig --- driver

[PATCH 12/14] swiotlb: move global variables into a new io_tlb_mem structure

2021-02-28 Thread Christoph Hellwig
From: Claire Chang Added a new struct, io_tlb_mem, as the IO TLB memory pool descriptor and moved relevant global variables into that struct. This will be useful later to allow for restricted DMA pool. Signed-off-by: Claire Chang [hch: rebased] Signed-off-by: Christoph Hellwig --- drivers/xen

[PATCH 11/14] xen-swiotlb: remove the unused size argument from xen_swiotlb_fixup

2021-02-28 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 00adeb95ebb9df..4ecfce2c6f7263 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen

[PATCH 10/14] xen-swiotlb: split xen_swiotlb_init

2021-02-28 Thread Christoph Hellwig
Split xen_swiotlb_init into a normal an an early case. That makes both much simpler and more readable, and also allows marking the early code as __init and x86-only. Signed-off-by: Christoph Hellwig --- arch/arm/xen/mm.c | 2 +- arch/x86/xen/pci-swiotlb-xen.c | 4 +- drivers/xe

[PATCH 09/14] swiotlb: lift the double initialization protection from xen-swiotlb

2021-02-28 Thread Christoph Hellwig
Lift the double initialization protection from xen-swiotlb to the core code to avoid exposing too many swiotlb internals. Also upgrade the check to a warning as it should not happen. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 7 --- kernel/dma/swiotlb.c | 8 ++

[PATCH 08/14] xen-swiotlb: remove xen_io_tlb_start and xen_io_tlb_nslabs

2021-02-28 Thread Christoph Hellwig
The xen_io_tlb_start and xen_io_tlb_nslabs variables ar now only used in xen_swiotlb_init, so replace them with local variables. Signed-off-by: Christoph Hellwig --- drivers/xen/swiotlb-xen.c | 57 +-- 1 file changed, 25 insertions(+), 32 deletions(-) diff --

[PATCH 07/14] xen-swiotlb: remove xen_set_nslabs

2021-02-28 Thread Christoph Hellwig
The xen_set_nslabs function is a little weird, as it has just one caller, that caller passes a global variable as the argument, which is then overriden in the function and a derivative of it returned. Just add a cpp symbol for the default size using a readable constant and open code the remaining

[PATCH 06/14] xen-swiotlb: use io_tlb_end in xen_swiotlb_dma_supported

2021-02-28 Thread Christoph Hellwig
Use the existing variable that holds the physical address for xen_io_tlb_end to simplify xen_swiotlb_dma_supported a bit, and remove the otherwise unused xen_io_tlb_end variable and the xen_virt_to_bus helper. Signed-off-by: Christoph Hellwig Reviewed-by: Konrad Rzeszutek Wilk --- drivers/xen/s

[PATCH 05/14] xen-swiotlb: use is_swiotlb_buffer in is_xen_swiotlb_buffer

2021-02-28 Thread Christoph Hellwig
Use the is_swiotlb_buffer to check if a physical address is a swiotlb buffer. This works because xen-swiotlb does use the same buffer as the main swiotlb code, and xen_io_tlb_{start,end} are just the addresses for it that went through phys_to_virt. Signed-off-by: Christoph Hellwig Reviewed-by: K

[PATCH 04/14] swiotlb: split swiotlb_tbl_sync_single

2021-02-28 Thread Christoph Hellwig
Split swiotlb_tbl_sync_single into two separate funtions for the to device and to cpu synchronization. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 12 ++-- drivers/xen/swiotlb-xen.c | 4 ++-- include/linux/swiotlb.h | 17 - kernel/dma/direct.c

[PATCH 03/14] swiotlb: move orig addr and size validation into swiotlb_bounce

2021-02-28 Thread Christoph Hellwig
Move the code to find and validate the original buffer address and size from the callers into swiotlb_bounce. This means a tiny bit of extra work in the swiotlb_map path, but avoids code duplication and a leads to a better code structure. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.

[PATCH 02/14] swiotlb: remove the alloc_size parameter to swiotlb_tbl_unmap_single

2021-02-28 Thread Christoph Hellwig
Now that swiotlb remembers the allocation size there is no need to pass it back to swiotlb_tbl_unmap_single. Signed-off-by: Christoph Hellwig --- drivers/iommu/dma-iommu.c | 11 +++--- drivers/xen/swiotlb-xen.c | 4 ++-- include/linux/swiotlb.h | 1 - kernel/dma/direct.h | 2 +- k

swiotlb cleanups v2

2021-02-28 Thread Christoph Hellwig
Hi Konrad, this series contains a bunch of swiotlb cleanups, mostly to reduce the amount of internals exposed to code outside of swiotlb.c, which should helper to prepare for supporting multiple different bounce buffer pools. Changes since v1: - rebased to v5.12-rc1 - a few more cleanups - mer

[PATCH 01/14] powerpc/svm: stop using io_tlb_start

2021-02-28 Thread Christoph Hellwig
Use the local variable that is passed to swiotlb_init_with_tbl for freeing the memory in the failure case to isolate the code a little better from swiotlb internals. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/pseries/svm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

Re: [PATCH] mm: Generalize HUGETLB_PAGE_SIZE_VARIABLE

2021-02-28 Thread Anshuman Khandual
On 3/1/21 11:53 AM, Christoph Hellwig wrote: > On Mon, Mar 01, 2021 at 11:20:53AM +0530, Anshuman Khandual wrote: >> HUGETLB_PAGE_SIZE_VARIABLE need not be defined for each individual >> platform subscribing it. Instead just make it generic. >> >> Cc: Michael Ellerman >> Cc: Benjamin Herrenschm

[PATCH kernel v2] powerpc/iommu: Annotate nested lock for lockdep

2021-02-28 Thread Alexey Kardashevskiy
The IOMMU table is divided into pools for concurrent mappings and each pool has a separate spinlock. When taking the ownership of an IOMMU group to pass through a device to a VM, we lock these spinlocks which triggers a false negative warning in lockdep (below). This fixes it by annotating the lar

Re: [PATCH] mm: Generalize HUGETLB_PAGE_SIZE_VARIABLE

2021-02-28 Thread Christoph Hellwig
On Mon, Mar 01, 2021 at 11:20:53AM +0530, Anshuman Khandual wrote: > HUGETLB_PAGE_SIZE_VARIABLE need not be defined for each individual > platform subscribing it. Instead just make it generic. > > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Andrew Morton > Cc:

[PATCH] mm: Generalize HUGETLB_PAGE_SIZE_VARIABLE

2021-02-28 Thread Anshuman Khandual
HUGETLB_PAGE_SIZE_VARIABLE need not be defined for each individual platform subscribing it. Instead just make it generic. Cc: Michael Ellerman Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: Andrew Morton Cc: Christoph Hellwig Cc: linux-i...@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org

[PATCH V2] mm/memtest: Add ARCH_USE_MEMTEST

2021-02-28 Thread Anshuman Khandual
early_memtest() does not get called from all architectures. Hence enabling CONFIG_MEMTEST and providing a valid memtest=[1..N] kernel command line option might not trigger the memory pattern tests as would be expected in normal circumstances. This situation is misleading. The change here prevents

[Reoprt] Some compile warning on ppc dts

2021-02-28 Thread chenjun (AM)
Hi After run the following commands make distclean make allmodconfig ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- make oldconfig ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- make -j64 ARCH=powerpc CROSS_COMPILE=powerpc64-linux-gnu- I get some warning: arch/powerpc/boot/dts/mpc5200b.dtsi:267

Re: [PATCH V2] powerpc/perf: Fix handling of privilege level checks in perf interrupt context

2021-02-28 Thread Athira Rajeev
> On 26-Feb-2021, at 3:05 PM, Peter Zijlstra wrote: > > On Thu, Feb 25, 2021 at 05:10:39AM -0500, Athira Rajeev wrote: >> diff --git a/arch/powerpc/perf/core-book3s.c >> b/arch/powerpc/perf/core-book3s.c >> index 4b4319d8..c8be44c 100644 >> --- a/arch/powerpc/perf/core-book3s.c >> +++ b/arch/

Re: [PATCH v3 28/32] powerpc/64s: interrupt implement exit logic in C

2021-02-28 Thread Nicholas Piggin
Excerpts from Christophe Leroy's message of February 27, 2021 8:07 pm: > > > Le 25/02/2020 à 18:35, Nicholas Piggin a écrit : >> Implement the bulk of interrupt return logic in C. The asm return code >> must handle a few cases: restoring full GPRs, and emulating stack store. >> >> The stack stor