Re: [PATCH 6/9] swiotlb: refactor swiotlb_tbl_map_single

2021-02-22 Thread Nicolas Saenz Julienne
Hi Christoph, On Sun, 2021-02-07 at 17:03 +0100, Christoph Hellwig wrote: > Split out a bunch of a self-contained helpers to make the function easier > to follow. > > Signed-off-by: Christoph Hellwig > --- >  kernel/dma/swiotlb.c | 179 +-- >  1 file

Re: [PATCH 3/3] dt-bindings: Fix errors in 'if' schemas

2021-02-03 Thread Nicolas Saenz Julienne
applies to all entries. 'contains' is the correct schema > to use in the case of multiple entries. > > Cc: Herbert Xu > Cc: "David S. Miller" > Cc: Maxime Ripard > Cc: Chen-Yu Tsai > Cc: Eric Anholt > Cc: Nicolas Saenz Julienne > Cc: Florian Fainelli > Cc:

Re: [RFC PATCH v3 2/6] swiotlb: Add restricted DMA pool

2021-01-13 Thread Nicolas Saenz Julienne
Hi All, On Tue, 2021-01-12 at 16:03 -0800, Florian Fainelli wrote: > On 1/5/21 7:41 PM, Claire Chang wrote: > > Add the initialization function to create restricted DMA pools from > > matching reserved-memory nodes in the device tree. > > > > Signed-off-by: Claire Chang > > --- > >  

[PATCH v7 7/7] mm: Remove examples from enum zone_type comment

2020-11-19 Thread Nicolas Saenz Julienne
We can't really list every setup in common code. On top of that they are unlikely to stay true for long as things change in the arch trees independently of this comment. Suggested-by: Christoph Hellwig Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Christoph Hellwig --- include/linux

[PATCH v7 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-11-19 Thread Nicolas Saenz Julienne
the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne --- Changes since v4: - Use fls64 as we're now using the max address (as opposed to the limit) Changes since v3: - Simplify code for readability. Changes since v2: - Updated commit log by shamelessly copying Ard's

[PATCH v7 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-11-19 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v5: - Update address expected by test Changes since v3: - Remove HAS_DMA guards drivers

[PATCH v7 6/7] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-11-19 Thread Nicolas Saenz Julienne
if implemented, and so we will not lose the ability to perform streaming DMA outside the ZONE_DMA if the _DMA method permits it. Cc: Jeremy Linton Cc: Lorenzo Pieralisi Cc: Nicolas Saenz Julienne Cc: Rob Herring Cc: Christoph Hellwig Cc: Robin Murphy Cc: Hanjun Guo Cc: Sudeep Holla Cc: Anshuman

[PATCH v7 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-19 Thread Nicolas Saenz Julienne
string Ard Biesheuvel (1): arm64: mm: Set ZONE_DMA size based on early IORT scan Nicolas Saenz Julienne (6): arm64: mm: Move reserve_crashkernel() into mem_init() arm64: mm: Move zone_dma_bits initialization into zone_sizes_init() of/address: Introduce of_dma_get_max_cpu_address

[PATCH v7 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-19 Thread Nicolas Saenz Julienne
-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- Changes since v6: - Move crashkernel reserve placement earlier, in bootmem_init() arch/arm64/mm/init.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index

[PATCH v7 2/7] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-11-19 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5

Re: [PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-19 Thread Nicolas Saenz Julienne
On Thu, 2020-11-19 at 17:10 +, Catalin Marinas wrote: > On Thu, Nov 19, 2020 at 03:09:58PM +0100, Nicolas Saenz Julienne wrote: > > On Fri, 2020-11-13 at 11:29 +, Catalin Marinas wrote: > > [...] > > > > > > Let me stress that knowing the DMA

Re: [PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-19 Thread Nicolas Saenz Julienne
Hi Catalin, James, sorry for the late reply but I got sidetracked. On Fri, 2020-11-13 at 11:29 +, Catalin Marinas wrote: [...] > > > > Let me stress that knowing the DMA constraints in the system before > > > > reserving > > > > crashkernel's regions is necessary if we ever want it to work

Re: [PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-12 Thread Nicolas Saenz Julienne
Hi Catalin, On Tue, 2020-11-10 at 18:17 +, Catalin Marinas wrote: > On Fri, Nov 06, 2020 at 07:46:29PM +0100, Nicolas Saenz Julienne wrote: > > On Thu, 2020-11-05 at 16:11 +, James Morse wrote: > > > On 03/11/2020 17:31, Nicolas Saenz Julienne wrote: > > >

Re: [PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-06 Thread Nicolas Saenz Julienne
Hi James, thanks for the review. Some comments/questions below. On Thu, 2020-11-05 at 16:11 +, James Morse wrote: > Hi! > > On 03/11/2020 17:31, Nicolas Saenz Julienne wrote: > > crashkernel might reserve memory located in ZONE_DMA. We plan to delay > > ZONE_DMA's

[PATCH v6 7/7] mm: Remove examples from enum zone_type comment

2020-11-03 Thread Nicolas Saenz Julienne
We can't really list every setup in common code. On top of that they are unlikely to stay true for long as things change in the arch trees independently of this comment. Suggested-by: Christoph Hellwig Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Christoph Hellwig --- include/linux

[PATCH v6 6/7] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-11-03 Thread Nicolas Saenz Julienne
if implemented, and so we will not lose the ability to perform streaming DMA outside the ZONE_DMA if the _DMA method permits it. Cc: Jeremy Linton Cc: Lorenzo Pieralisi Cc: Nicolas Saenz Julienne Cc: Rob Herring Cc: Christoph Hellwig Cc: Robin Murphy Cc: Hanjun Guo Cc: Sudeep Holla Cc: Anshuman

[PATCH v6 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-11-03 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v5: - Update address expected by test Changes since v3: - Remove HAS_DMA guards drivers

[PATCH v6 3/7] of/address: Introduce of_dma_get_max_cpu_address()

2020-11-03 Thread Nicolas Saenz Julienne
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v4

[PATCH v6 2/7] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-11-03 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5

[PATCH v6 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-11-03 Thread Nicolas Saenz Julienne
the memory before the page allocator kicks in. There isn't any apparent reason for doing this earlier. Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64

[PATCH v6 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-11-03 Thread Nicolas Saenz Julienne
the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne --- Changes since v4: - Use fls64 as we're now using the max address (as opposed to the limit) Changes since v3: - Simplify code for readability. Changes since v2: - Updated commit log by shamelessly copying Ard's

[PATCH v6 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-03 Thread Nicolas Saenz Julienne
- Address small changes - Move crashkernel reservation later in boot process Changes since v1: - Parse dma-ranges instead of using machine compatible string Ard Biesheuvel (1): arm64: mm: Set ZONE_DMA size based on early IORT scan Nicolas Saenz Julienne (6): arm64: mm: Move

Re: [PATCH v5 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-11-03 Thread Nicolas Saenz Julienne
On Fri, 2020-10-30 at 18:11 +, Catalin Marinas wrote: > On Thu, Oct 29, 2020 at 06:25:43PM +0100, Nicolas Saenz Julienne wrote: > > Ard Biesheuvel (1): > > arm64: mm: Set ZONE_DMA size based on early IORT scan > > > > Nicolas Saenz Julienne (6): > > ar

[PATCH v5 7/7] mm: Remove examples from enum zone_type comment

2020-10-29 Thread Nicolas Saenz Julienne
We can't really list every setup in common code. On top of that they are unlikely to stay true for long as things change in the arch trees independently of this comment. Suggested-by: Christoph Hellwig Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Christoph Hellwig --- include/linux

[PATCH v5 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-10-29 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne Reviewed-by: Rob Herring --- Changes since v3: - Remove HAS_DMA guards drivers/of/unittest.c | 18 ++ 1 file changed, 18

[PATCH v5 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-10-29 Thread Nicolas Saenz Julienne
reservation later in boot process Changes since v1: - Parse dma-ranges instead of using machine compatible string Ard Biesheuvel (1): arm64: mm: Set ZONE_DMA size based on early IORT scan Nicolas Saenz Julienne (6): arm64: mm: Move reserve_crashkernel() into mem_init() arm64: mm: Move

[PATCH v5 6/7] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-10-29 Thread Nicolas Saenz Julienne
if implemented, and so we will not lose the ability to perform streaming DMA outside the ZONE_DMA if the _DMA method permits it. Cc: Jeremy Linton Cc: Lorenzo Pieralisi Cc: Nicolas Saenz Julienne Cc: Rob Herring Cc: Christoph Hellwig Cc: Robin Murphy Cc: Hanjun Guo Cc: Sudeep Holla Cc: Anshuman

[PATCH v5 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-10-29 Thread Nicolas Saenz Julienne
the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne --- Changes since v4: - Use fls64 as we're now using the max address (as opposed to the limit) Changes since v3: - Simplify code for readability. Changes since v2: - Updated commit log by shamelessly copying Ard's

[PATCH v5 2/7] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-10-29 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5

[PATCH v5 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-10-29 Thread Nicolas Saenz Julienne
the memory before the page allocator kicks in. There isn't any apparent reason for doing this earlier. Signed-off-by: Nicolas Saenz Julienne Tested-by: Jeremy Linton --- arch/arm64/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64

[PATCH v5 3/7] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-29 Thread Nicolas Saenz Julienne
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne --- Changes since v4: - Return max address

Re: [PATCH v4 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-10-27 Thread Nicolas Saenz Julienne
On Fri, 2020-10-23 at 14:05 -0500, Jeremy Linton wrote: > Hi, > > On 10/21/20 7:34 AM, Nicolas Saenz Julienne wrote: > > Using two distinct DMA zones turned out to be problematic. Here's an > > attempt go back to a saner default. > > > > I tested this on both

Re: [PATCH v4 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-10-23 Thread Nicolas Saenz Julienne
Hi Catalin, On Thu, 2020-10-22 at 19:06 +0100, Catalin Marinas wrote: > On Wed, Oct 21, 2020 at 02:34:35PM +0200, Nicolas Saenz Julienne wrote: > > @@ -188,9 +186,11 @@ static phys_addr_t __init max_zone_phys(unsigned int > > zone_bits) > > static void __init zone_sizes_i

Re: [PATCH v4 3/7] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-22 Thread Nicolas Saenz Julienne
On Thu, 2020-10-22 at 14:23 +0200, Ard Biesheuvel wrote: > > +/** > > + * of_dma_get_max_cpu_address - Gets highest CPU address suitable for DMA > > + * @np: The node to start searching from or NULL to start from the root > > + * > > + * Gets the highest CPU physical address that is addressable by

[PATCH v4 0/7] arm64: Default to 32-bit wide ZONE_DMA

2020-10-21 Thread Nicolas Saenz Julienne
Ard Biesheuvel (1): arm64: mm: Set ZONE_DMA size based on early IORT scan Nicolas Saenz Julienne (6): arm64: mm: Move reserve_crashkernel() into mem_init() arm64: mm: Move zone_dma_bits initialization into zone_sizes_init() of/address: Introduce of_dma_get_max_cpu_address() of: unittest

[PATCH v4 7/7] mm: Remove examples from enum zone_type comment

2020-10-21 Thread Nicolas Saenz Julienne
We can't really list every setup in common code. On top of that they are unlikely to stay true for long as things change in the arch trees independently of this comment. Suggested-by: Christoph Hellwig Signed-off-by: Nicolas Saenz Julienne --- include/linux/mmzone.h | 20

[PATCH v4 2/7] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-10-21 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch

[PATCH v4 3/7] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-21 Thread Nicolas Saenz Julienne
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne --- Changes since v3: - use u64 with cpu_end

[PATCH v4 4/7] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-10-21 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne --- Changes since v3: - Remove HAS_DMA guards drivers/of/unittest.c | 18 ++ 1 file changed, 18 insertions(+) diff --git

[PATCH v4 1/7] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-10-21 Thread Nicolas Saenz Julienne
the memory before the page allocator kicks in. There isn't any apparent reason for doing this earlier. Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index

[PATCH v4 6/7] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-10-21 Thread Nicolas Saenz Julienne
if implemented, and so we will not lose the ability to perform streaming DMA outside the ZONE_DMA if the _DMA method permits it. Cc: Jeremy Linton Cc: Lorenzo Pieralisi Cc: Nicolas Saenz Julienne Cc: Rob Herring Cc: Christoph Hellwig Cc: Robin Murphy Cc: Hanjun Guo Cc: Sudeep Holla Cc: Anshuman

[PATCH v4 5/7] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-10-21 Thread Nicolas Saenz Julienne
the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne --- Changes since v3: - Simplify code for readability. Changes since v2: - Updated commit log by shamelessly copying Ard's ACPI commit log arch/arm64/mm/init.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions

Re: [PATCH v3 7/8] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 22:26 +0800, Hanjun Guo wrote: > On 2020/10/15 3:12, Nicolas Saenz Julienne wrote: > > From: Ard Biesheuvel > > > > We recently introduced a 1 GB sized ZONE_DMA to cater for platforms > > incorporating masters that can address less than 32 bit

Re: [PATCH v3 6/8] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 07:39 +0200, Christoph Hellwig wrote: > On Wed, Oct 14, 2020 at 09:12:08PM +0200, Nicolas Saenz Julienne wrote: > > + zone_dma_bits = min(zone_dma_bits, > > + (unsigned > > int)ilog2(of_dma_get_max_cpu_address(NULL))); > &

Re: [PATCH v3 5/8] dma-direct: Turn zone_dma_bits default value into a define

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 07:38 +0200, Christoph Hellwig wrote: > On Wed, Oct 14, 2020 at 09:12:07PM +0200, Nicolas Saenz Julienne wrote: > > Set zone_dma_bits default value through a define so as for architectures > > to be able to override it with their default value. > >

Re: [PATCH v3 3/8] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 07:42 +0200, Christoph Hellwig wrote: > > +phys_addr_t __init of_dma_get_max_cpu_address(struct device_node *np) > > +{ > > + phys_addr_t max_cpu_addr = PHYS_ADDR_MAX; > > + struct of_range_parser parser; > > + phys_addr_t subtree_max_addr; > > + struct device_node

Re: [PATCH v3 4/8] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-10-15 Thread Nicolas Saenz Julienne
On Wed, 2020-10-14 at 17:04 -0500, Rob Herring wrote: > On Wed, Oct 14, 2020 at 2:12 PM Nicolas Saenz Julienne > wrote: > > Introduce a test for of_dma_get_max_cup_address(), it uses the same DT > > data as the rest of dma-ranges unit tests. > > > > Signed-

Re: [PATCH v3 3/8] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 08:56 +0200, Ard Biesheuvel wrote: > On Thu, 15 Oct 2020 at 00:03, Rob Herring wrote: > > On Wed, Oct 14, 2020 at 2:12 PM Nicolas Saenz Julienne > > wrote: > > > Introduce of_dma_get_max_cpu_address(), which provides the highest CPU > > > ph

Re: [PATCH v3 1/8] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-10-15 Thread Nicolas Saenz Julienne
On Thu, 2020-10-15 at 09:40 +0100, Will Deacon wrote: > On Wed, Oct 14, 2020 at 09:12:03PM +0200, Nicolas Saenz Julienne wrote: > > crashkernel might reserve memory located in ZONE_DMA. We plan to delay > > ZONE_DMA's initialization after unflattening the devicetree and ACPI's

Re: [PATCH v3 3/8] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-15 Thread Nicolas Saenz Julienne
On Wed, 2020-10-14 at 17:02 -0500, Rob Herring wrote: > On Wed, Oct 14, 2020 at 2:12 PM Nicolas Saenz Julienne > wrote: > > Introduce of_dma_get_max_cpu_address(), which provides the highest CPU > > physical address addressable by all DMA masters in the system. It's &g

[PATCH v3 4/8] of: unittest: Add test for of_dma_get_max_cpu_address()

2020-10-14 Thread Nicolas Saenz Julienne
Introduce a test for of_dma_get_max_cup_address(), it uses the same DT data as the rest of dma-ranges unit tests. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/unittest.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/of/unittest.c b/drivers

[PATCH v3 7/8] arm64: mm: Set ZONE_DMA size based on early IORT scan

2020-10-14 Thread Nicolas Saenz Julienne
if implemented, and so we will not lose the ability to perform streaming DMA outside the ZONE_DMA if the _DMA method permits it. Cc: Jeremy Linton Cc: Lorenzo Pieralisi Cc: Nicolas Saenz Julienne Cc: Rob Herring Cc: Christoph Hellwig Cc: Robin Murphy Cc: Hanjun Guo Cc: Sudeep Holla Cc: Anshuman

[PATCH v3 2/8] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-10-14 Thread Nicolas Saenz Julienne
zone_dma_bits's initialization happens earlier that it's actually needed, in arm64_memblock_init(). So move it into the more suitable zone_sizes_init(). Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch

[PATCH v3 6/8] arm64: mm: Set ZONE_DMA size based on devicetree's dma-ranges

2020-10-14 Thread Nicolas Saenz Julienne
the rest of the 32-bit address space. Signed-off-by: Nicolas Saenz Julienne --- Changes since v2: - Updated commit log by shamelessly copying Ard's ACPI counterpart commit log arch/arm64/include/asm/processor.h | 1 + arch/arm64/mm/init.c | 5 ++--- 2 files changed, 3 insertions

[PATCH v3 3/8] of/address: Introduce of_dma_get_max_cpu_address()

2020-10-14 Thread Nicolas Saenz Julienne
Introduce of_dma_get_max_cpu_address(), which provides the highest CPU physical address addressable by all DMA masters in the system. It's specially useful for setting memory zones sizes at early boot time. Signed-off-by: Nicolas Saenz Julienne --- Changes since v2: - Use PHYS_ADDR_MAX

[PATCH v3 0/8] arm64: Default to 32-bit wide ZONE_DMA

2020-10-14 Thread Nicolas Saenz Julienne
- Move crashkernel reservation later in boot process Changes since v1: - Parse dma-ranges instead of using machine compatible string Ard Biesheuvel (1): arm64: mm: Set ZONE_DMA size based on early IORT scan Nicolas Saenz Julienne (7): arm64: mm: Move reserve_crashkernel() into mem_init

[PATCH v3 5/8] dma-direct: Turn zone_dma_bits default value into a define

2020-10-14 Thread Nicolas Saenz Julienne
Set zone_dma_bits default value through a define so as for architectures to be able to override it with their default value. Signed-off-by: Nicolas Saenz Julienne --- include/linux/dma-direct.h | 3 +++ kernel/dma/direct.c| 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff

[PATCH v3 1/8] arm64: mm: Move reserve_crashkernel() into mem_init()

2020-10-14 Thread Nicolas Saenz Julienne
the memory before the page allocator kicks in and there is no need to do it earlier. Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index a53c1e0fb017..1d29f2ca81c7

[PATCH v3 8/8] mm: Update DMA zones description

2020-10-14 Thread Nicolas Saenz Julienne
The default behavior for arm64 changed, so reflect that. Signed-off-by: Nicolas Saenz Julienne Acked-by: Catalin Marinas --- include/linux/mmzone.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fb3bf696c05e

Re: [PATCH v2 2/5] of/address: Introduce of_dma_lower_bus_limit()

2020-10-14 Thread Nicolas Saenz Julienne
Hi Rob, On Mon, 2020-10-12 at 10:25 -0500, Rob Herring wrote: > On Sat, Oct 10, 2020 at 10:12 AM Nicolas Saenz Julienne > wrote: > > The function provides the CPU physical address addressable by the most > > constrained bus in the system. It might be useful in order to >

Re: [PATCH v2 2/5] of/address: Introduce of_dma_lower_bus_limit()

2020-10-14 Thread Nicolas Saenz Julienne
ed, I'll update all commit logs. > On Sat, 10 Oct 2020 at 17:12, Nicolas Saenz Julienne > wrote: > > The function provides the CPU physical address addressable by the most > > constrained bus in the system. It might be useful in order to > > dynamically set up memory

[PATCH v2 3/5] dma-direct: Turn zone_dma_bits default value into a define

2020-10-10 Thread Nicolas Saenz Julienne
So as for architecture code to set their own default values when relevant. Signed-off-by: Nicolas Saenz Julienne --- Note: This is not really needed, but I think it nicer having architectures use this than setting zone_dma_bits in a random place in arch code. That said, I'll hapily edit it out

[PATCH v2 4/5] arm64: mm: Dynamically resize zone_dma_bits based on system's constraints

2020-10-10 Thread Nicolas Saenz Julienne
With the help of of_dma_safe_phys_limit() we can get the topmost physical address accessible for DMA to the whole system and use that information to properly setup zone_dma_bits. Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/include/asm/processor.h | 1 + arch/arm64/mm/init.c

[PATCH v2 1/5] arm64: mm: Move zone_dma_bits initialization into zone_sizes_init()

2020-10-10 Thread Nicolas Saenz Julienne
There no use for initializing it earlier in arm64_memblock_init(). Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index f6902a2b4ea6..0eca5865dcb1 100644

[PATCH v2 2/5] of/address: Introduce of_dma_lower_bus_limit()

2020-10-10 Thread Nicolas Saenz Julienne
The function provides the CPU physical address addressable by the most constrained bus in the system. It might be useful in order to dynamically set up memory zones during boot. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/address.c | 34 ++ include/linux

[PATCH v2 0/5] arm64: Default to 32-bit wide ZONE_DMA

2020-10-10 Thread Nicolas Saenz Julienne
dma-ranges instead of using machine compatible string Nicolas Saenz Julienne (5): arm64: mm: Move zone_dma_bits initialization into zone_sizes_init() of/address: Introduce of_dma_lower_bus_limit() dma-direct: Turn zone_dma_bits default value into a define arm64: mm: Dynamically resize zon

[PATCH v2 5/5] mm: Update DMA zones description

2020-10-10 Thread Nicolas Saenz Julienne
The default behavior for arm64 changed, so reflect that. Signed-off-by: Nicolas Saenz Julienne Acked-by: Catalin Marinas --- include/linux/mmzone.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fb3bf696c05e

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-10 Thread Nicolas Saenz Julienne
On Sat, 2020-10-10 at 12:36 +0200, Ard Biesheuvel wrote: > On Fri, 9 Oct 2020 at 19:10, Catalin Marinas wrote: > > On Fri, Oct 09, 2020 at 06:23:06PM +0200, Ard Biesheuvel wrote: > > > On Fri, 9 Oct 2020 at 17:24, Lorenzo Pieralisi > > > wrote: > > > > We can move this check to IORT code and

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-09 Thread Nicolas Saenz Julienne
On Fri, 2020-10-09 at 11:13 +0200, Ard Biesheuvel wrote: > On Fri, 9 Oct 2020 at 10:36, Nicolas Saenz Julienne > wrote: > > On Fri, 2020-10-09 at 09:37 +0200, Ard Biesheuvel wrote: > > > On Fri, 9 Oct 2020 at 09:11, Christoph Hellwig wrote: > > > > On Thu,

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-09 Thread Nicolas Saenz Julienne
Hi Jeremy. On Thu, 2020-10-08 at 22:59 -0500, Jeremy Linton wrote: > On 10/8/20 2:43 PM, Ard Biesheuvel wrote: > > (+ Lorenzo) > > > > On Thu, 8 Oct 2020 at 12:14, Catalin Marinas > > wrote: > > > On Thu, Oct 08, 2020 at 12:05:25PM +0200, Nicolas Saenz Jul

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-09 Thread Nicolas Saenz Julienne
On Fri, 2020-10-09 at 09:37 +0200, Ard Biesheuvel wrote: > On Fri, 9 Oct 2020 at 09:11, Christoph Hellwig wrote: > > On Thu, Oct 08, 2020 at 12:05:25PM +0200, Nicolas Saenz Julienne wrote: > > > Sadly I just realised that the series is incomplete, we have RPi4 users > > &

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-08 Thread Nicolas Saenz Julienne
Hi Catalin, sorry for the late reply. On Fri, 2020-10-02 at 12:55 +0100, Catalin Marinas wrote: > On Thu, Oct 01, 2020 at 07:31:19PM +0200, Nicolas Saenz Julienne wrote: > > On Thu, 2020-10-01 at 18:23 +0100, Catalin Marinas wrote: > > > On Thu, Oct 01, 2020 at 06:15:01PM +010

Re: [PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-01 Thread Nicolas Saenz Julienne
On Thu, 2020-10-01 at 18:23 +0100, Catalin Marinas wrote: > On Thu, Oct 01, 2020 at 06:15:01PM +0100, Catalin Marinas wrote: > > Hi Nicolas, > > > > Thanks for putting this together. > > > > On Thu, Oct 01, 2020 at 06:17:37PM +0200, Nicolas Saenz Julienne

[PATCH 0/4] arm64: Default to 32-bit wide ZONE_DMA

2020-10-01 Thread Nicolas Saenz Julienne
Using two distinct DMA zones turned out to be problematic. Here's an attempt go back to a saner default. I tested this on both a RPi4 and QEMU. --- Nicolas Saenz Julienne (4): of/fdt: Update zone_dma_bits when running in bcm2711 dma-direct: Turn zone_dma_bits default value into a define

[PATCH 3/4] arm64: Default to 32-bit ZONE_DMA

2020-10-01 Thread Nicolas Saenz Julienne
ZONE_DMA and only define both zones if running on RPi4. Signed-off-by: Nicolas Saenz Julienne --- arch/arm64/mm/init.c | 12 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index e1a69a618832..3c3f462466eb 100644 --- a/arch

[PATCH 2/4] dma-direct: Turn zone_dma_bits default value into a define

2020-10-01 Thread Nicolas Saenz Julienne
Other code might need to reference it. Signed-off-by: Nicolas Saenz Julienne --- include/linux/dma-direct.h | 1 + kernel/dma/direct.c| 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h index 38ed3b55034d

[PATCH 4/4] mm: Update DMA zones description

2020-10-01 Thread Nicolas Saenz Julienne
The default behavior for arm64 changed, so reflect that. Signed-off-by: Nicolas Saenz Julienne --- include/linux/mmzone.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index fb3bf696c05e..d28ce77ccc2a 100644

[PATCH 1/4] of/fdt: Update zone_dma_bits when running in bcm2711

2020-10-01 Thread Nicolas Saenz Julienne
as the only platform interested in using this is the Raspberry Pi 4. So update zone_dma_bits if the machine's compatible string matches Raspberry Pi 4's, otherwise let arm64's mm code deal with it. Signed-off-by: Nicolas Saenz Julienne --- drivers/of/fdt.c | 10 ++ 1 file changed, 10 insertions

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-08 Thread Nicolas Saenz Julienne
On Tue, 2020-09-08 at 11:43 +0200, Christoph Hellwig wrote: > And because I like replying to myself so much, here is a link to the > version with the arm cleanup patch applied. Unlike the previous two > attempts this has at least survived very basic sanity testing: > >

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-07 Thread Nicolas Saenz Julienne
On Mon, 2020-09-07 at 13:40 -0400, Jim Quinlan wrote: > On Mon, Sep 7, 2020 at 11:01 AM Nicolas Saenz Julienne > wrote: > > > > > > Hi Nicolas, > > > > > > Can you please help us out here? It appears that your commit > > > > It's dma_offse

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-07 Thread Nicolas Saenz Julienne
Hi Christoph, a small fix to your fixes: On Tue, 2020-09-01 at 10:24 +0200, Christoph Hellwig wrote: > I've applied this to the dma-mapping tree. > > I had to resolve a conflict in drivers/of/address.c with a recent > mainline commit. I also applied the minor tweaks Andy pointed out > plus a

Re: [PATCH v11 07/11] device-mapping: Introduce DMA range map, supplanting dma_pfn_offset

2020-09-07 Thread Nicolas Saenz Julienne
Hi Jim, sorry I'm a little late to the party, but was on vacation. On Thu, 2020-09-03 at 13:32 -0400, Jim Quinlan wrote: > On Wed, Sep 2, 2020 at 8:52 PM Nathan Chancellor > wrote: > > On Wed, Sep 02, 2020 at 05:36:29PM -0700, Florian Fainelli wrote: > > > > > > On 9/2/2020 3:38 PM, Nathan

[PATCH v4 1/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-14 Thread Nicolas Saenz Julienne
There is no guarantee to CMA's placement, so allocating a zone specific atomic pool from CMA might return memory from a completely different memory zone. To get around this double check CMA's placement before allocating from it. Signed-off-by: Nicolas Saenz Julienne [hch: rebased, added

[PATCH v4 0/2] dma-pool fixes

2020-08-14 Thread Nicolas Saenz Julienne
- Check if phys_addr_ok() exists prior calling it Christoph Hellwig (1): dma-pool: fix coherent pool allocations for IOMMU mappings Nicolas Saenz Julienne (1): dma-pool: Only allocate from CMA when in same memory zone drivers/iommu/dma-iommu.c | 4 +- include/linux/dma-direct.h | 3

[PATCH v4 2/2] dma-pool: fix coherent pool allocations for IOMMU mappings

2020-08-14 Thread Nicolas Saenz Julienne
From: Christoph Hellwig When allocating coherent pool memory for an IOMMU mapping we don't care about the DMA mask. Move the guess for the initial GFP mask into the dma_direct_alloc_pages and pass dma_coherent_ok as a function pointer argument so that it doesn't get applied to the IOMMU case.

Re: [PATCH v3 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-14 Thread Nicolas Saenz Julienne
On Fri, 2020-08-14 at 08:06 +0200, Christoph Hellwig wrote: > On Sat, Aug 08, 2020 at 08:33:54AM +0200, Christoph Hellwig wrote: > > On Fri, Aug 07, 2020 at 10:50:19AM +0200, Nicolas Saenz Julienne wrote: > > > On Fri, 2020-08-07 at 07:21 +0200, Christoph Hellwig wrote: >

Re: [PATCH v3 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-07 Thread Nicolas Saenz Julienne
On Fri, 2020-08-07 at 07:21 +0200, Christoph Hellwig wrote: > On Thu, Aug 06, 2020 at 08:47:55PM +0200, Nicolas Saenz Julienne wrote: > > There is no guarantee to CMA's placement, so allocating a zone specific > > atomic pool from CMA might return memory from a completely different

[PATCH v3 1/2] dma-pool: fix coherent pool allocations for IOMMU mappings

2020-08-06 Thread Nicolas Saenz Julienne
From: Christoph Hellwig When allocating coherent pool memory for an IOMMU mapping we don't care about the DMA mask. Move the guess for the initial GFP mask into the dma_direct_alloc_pages and pass dma_coherent_ok as a function pointer argument so that it doesn't get applied to the IOMMU case.

[PATCH v3 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-06 Thread Nicolas Saenz Julienne
There is no guarantee to CMA's placement, so allocating a zone specific atomic pool from CMA might return memory from a completely different memory zone. To get around this double check CMA's placement before allocating from it. Signed-off-by: Nicolas Saenz Julienne [hch: rebased, added

[PATCH v3 0/2] dma-pool fixes

2020-08-06 Thread Nicolas Saenz Julienne
it Christoph Hellwig (1): dma-pool: fix coherent pool allocations for IOMMU mappings Nicolas Saenz Julienne (1): dma-pool: Only allocate from CMA when in same memory zone drivers/iommu/dma-iommu.c | 4 +- include/linux/dma-direct.h | 3 - include/linux/dma-mapping.h | 5 +- kernel/dma/direct.c

Re: [PATCH v2 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-06 Thread Nicolas Saenz Julienne
On Thu, 2020-08-06 at 07:18 +0200, Christoph Hellwig wrote: > On Tue, Aug 04, 2020 at 11:43:15AM +0200, Nicolas Saenz Julienne wrote: > > > Second I don't see the need (and actually some harm) in preventing > > > GFP_KERNEL > > > allocations from dipping into lower

Re: [PATCH v2 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-04 Thread Nicolas Saenz Julienne
On Tue, 2020-08-04 at 08:06 +0200, Christoph Hellwig wrote: > On Mon, Aug 03, 2020 at 06:09:56PM +0200, Nicolas Saenz Julienne wrote: > > + if (IS_ENABLED(CONFIG_ZONE_DMA) && (gfp & GFP_DMA)) > > + return end <= DMA_BIT_MASK(zone_dma_bits); > >

[PATCH v2 2/2] dma-pool: Only allocate from CMA when in same memory zone

2020-08-03 Thread Nicolas Saenz Julienne
There is no guarantee to CMA's placement, so allocating a zone specific atomic pool from CMA might return memory from a completely different memory zone. To get around this double check CMA's placement before allocating from it. Signed-off-by: Nicolas Saenz Julienne --- Changes since v1

[PATCH v2 0/2] dma-pool fixes

2020-08-03 Thread Nicolas Saenz Julienne
it Christoph Hellwig (1): dma-pool: fix coherent pool allocations for IOMMU mappings Nicolas Saenz Julienne (1): dma-pool: Only allocate from CMA when in same memory zone drivers/iommu/dma-iommu.c | 4 +- include/linux/dma-direct.h | 3 - include/linux/dma-mapping.h | 5 +- kernel

[PATCH v2 1/2] dma-pool: fix coherent pool allocations for IOMMU mappings

2020-08-03 Thread Nicolas Saenz Julienne
From: Christoph Hellwig When allocating coherent pool memory for an IOMMU mapping we don't care about the DMA mask. Move the guess for the initial GFP mask into the dma_direct_alloc_pages and pass dma_coherent_ok as a function pointer argument so that it doesn't get applied to the IOMMU case.

Re: [PATCH v9 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset

2020-08-01 Thread Nicolas Saenz Julienne
Hi Jim, here's some comments after testing your series against RPi4. On Fri, 2020-07-24 at 16:33 -0400, Jim Quinlan wrote: > The new field 'dma_range_map' in struct device is used to facilitate the > use of single or multiple offsets between mapping regions of cpu addrs and > dma addrs. It

Re: revert scope for 5.8, was Re: dma-pool fixes

2020-08-01 Thread Nicolas Saenz Julienne
On Sat, 2020-08-01 at 17:27 +0530, Amit Pundir wrote: [...] > > I'm between a rock and a hard place here. If we simply want to revert > > commits as-is to make sure both the Raspberry Pi 4 and thone phone do > > not regress we'll have to go all the way back and revert the whole SEV > > pool

Re: dma-pool fixes

2020-07-31 Thread Nicolas Saenz Julienne
On Fri, 2020-07-31 at 16:47 +0530, Amit Pundir wrote: > On Fri, 31 Jul 2020 at 16:17, Nicolas Saenz Julienne [...] > > Ok, so lets see who's doing what and with what constraints: > > Here is the relevant dmesg log: https://pastebin.ubuntu.com/p/dh3pPnxS2v/ Sadly nothing out

Re: dma-pool fixes

2020-07-31 Thread Nicolas Saenz Julienne
Hi Amit, On Wed, 2020-07-29 at 17:52 +0530, Amit Pundir wrote: > On Wed, 29 Jul 2020 at 16:15, Nicolas Saenz Julienne > wrote: > > On Tue, 2020-07-28 at 17:30 +0200, Christoph Hellwig wrote: > > > On Tue, Jul 28, 2020 at 06:18:41PM +0530, Amit Pundir wrote: > > &g

Re: [PATCH] dma-pool: Do not allocate pool memory from CMA

2020-07-31 Thread Nicolas Saenz Julienne
Hi Nathan, On Thu, 2020-07-30 at 18:10 -0700, Nathan Chancellor wrote: > On Tue, Jul 28, 2020 at 12:09:18PM +0200, Christoph Hellwig wrote: > > Ok, I found a slight bug that wasn't intended. I wanted to make sure > > we can always fall back to a lower pool, but got that wrong. Should be > >

  1   2   3   >