From 364230b9952143eb2062dc071e919fb751540ae8 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Thu, 1 Aug 2013 15:29:29 -0500 Subject: [PATCH 01/10] ARM: use phys_addr_t for DMA zone sizes In order to specify a DMA zone size of 4GB on LPAE systems, the sizes need to be 64-bit. So make machine_desc.dma_zone_size and arm_dma_zone_size be phys_addr_t instead of unsigned long. Signed-off-by: Rob Herring --- arch/arm/include/asm/mach/arch.h | 2 +- arch/arm/mm/init.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h index 441efc491b50..d91b16857971 100644 --- a/arch/arm/include/asm/mach/arch.h +++ b/arch/arm/include/asm/mach/arch.h @@ -35,7 +35,7 @@ struct machine_desc { unsigned int nr_irqs; /* number of IRQs */ #ifdef CONFIG_ZONE_DMA - unsigned long dma_zone_size; /* size of DMA-able area */ + phys_addr_t dma_zone_size; /* size of DMA-able area */ #endif unsigned int video_start; /* start of video RAM */ diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 15225d829d71..c0bb66e69999 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -207,7 +207,7 @@ static void __init arm_bootmem_init(unsigned long start_pfn, #ifdef CONFIG_ZONE_DMA -unsigned long arm_dma_zone_size __read_mostly; +phys_addr_t arm_dma_zone_size __read_mostly; EXPORT_SYMBOL(arm_dma_zone_size); /* From a6a398341d5d073a717858b4488a7abe5f242cf2 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Thu, 1 Aug 2013 15:50:55 -0500 Subject: [PATCH 02/10] ARM: highbank: enable DMA zone for LPAE Some devices are restricted to 32-bit DMA. Thus the platform dma_zone_size needs to be set. Otherwise dma-mapping code is complaining, e.g. calxedaxgmac fff50000.ethernet: coherent DMA mask 0xffffffff is smaller than system GFP_DMA mask 0xffffffffffffffff Signed-off-by: Andreas Herrmann Signed-off-by: Rob Herring --- arch/arm/mach-highbank/Kconfig | 1 + arch/arm/mach-highbank/highbank.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index cd9fcb1cd7ab..efe49610ec4c 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig @@ -18,3 +18,4 @@ config ARCH_HIGHBANK select PL320_MBOX select SPARSE_IRQ select USE_OF + select ZONE_DMA if ARM_LPAE diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 88815795fe26..0749b42f33c9 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -176,6 +176,9 @@ static const char *highbank_match[] __initconst = { }; DT_MACHINE_START(HIGHBANK, "Highbank") +#if defined(CONFIG_ZONE_DMA) && defined(CONFIG_ARM_LPAE) + .dma_zone_size = (4ULL * SZ_1G), +#endif .smp = smp_ops(highbank_smp_ops), .init_irq = highbank_init_irq, .init_time = highbank_timer_init, From e511333212de472a0dc0b85e7b5524d18177d1ed Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Thu, 25 Jul 2013 15:25:26 -0500 Subject: [PATCH 03/10] ARM: highbank: select ARCH_HAS_HOLES_MEMORYMODEL On Midway, the first 4G of memory starts at 0 and the rest of memory (4GB+) starts at 0x2_00000000, so we need to enable pfn_valid checks by selecting ARCH_HAS_HOLES_MEMORYMODEL. Signed-off-by: Rob Herring --- arch/arm/mach-highbank/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index efe49610ec4c..8b2948f7424f 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig @@ -1,6 +1,7 @@ config ARCH_HIGHBANK bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 select ARCH_HAS_CPUFREQ + select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_OPP select ARCH_WANT_OPTIONAL_GPIOLIB select ARM_AMBA From 2c634946253d68039fef5a44295e4bc9c62163c8 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Wed, 31 Jul 2013 11:14:45 -0500 Subject: [PATCH 04/10] ARM: highbank: select required errata work-arounds Ensure necessary errata work-arounds are always enabled for Highbank and Midway platforms. Highbank requires 764369 and 764369. Midway requires 798181, but only the first half of the work-around (no IPI). Support for skipping the IPI is introduced in another commit. Signed-off-by: Rob Herring --- arch/arm/mach-highbank/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index 8b2948f7424f..386835ed3acf 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig @@ -5,6 +5,9 @@ config ARCH_HIGHBANK select ARCH_HAS_OPP select ARCH_WANT_OPTIONAL_GPIOLIB select ARM_AMBA + select ARM_ERRATA_764369 + select ARM_ERRATA_775420 + select ARM_ERRATA_798181 select ARM_GIC select ARM_TIMER_SP804 select CACHE_L2X0 From 1c38b28980f15c5d217d6b36cd8159c2fbdfeb43 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Mon, 19 Aug 2013 12:19:28 +0200 Subject: [PATCH 05/10] DMA: fix AMBA PL08x compilation issue with 64bit DMA address type When dma_addr_t is 64 bits long, compilation of the AMBA PL08x DMA driver breaks due to a missing 64bit%8bit modulo operation. Looking more closely the divisor in these operations can only be 1, 2 or 4, so the full featured '%' modulo operation is overkill and can be replaced with simple bit masking. Change from v1: Replace open-coded function with existing IS_ALIGNED macro and use a macro around that to avoid a line becoming too long. Signed-off-by: Andre Przywara Acked-by: Vinod Koul Signed-off-by: Rob Herring --- drivers/dma/amba-pl08x.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 06fe45c74de5..fb3ce9eefca7 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -133,6 +133,8 @@ struct pl08x_bus_data { u8 buswidth; }; +#define IS_BUS_ALIGNED(bus) IS_ALIGNED((bus)->addr, (bus)->buswidth) + /** * struct pl08x_phy_chan - holder for the physical channels * @id: physical index to this channel @@ -886,8 +888,8 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, return 0; } - if ((bd.srcbus.addr % bd.srcbus.buswidth) || - (bd.dstbus.addr % bd.dstbus.buswidth)) { + if (!IS_BUS_ALIGNED(&bd.srcbus) || + !IS_BUS_ALIGNED(&bd.dstbus)) { dev_err(&pl08x->adev->dev, "%s src & dst address must be aligned to src" " & dst width if peripheral is flow controller", @@ -908,9 +910,9 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, */ if (bd.remainder < mbus->buswidth) early_bytes = bd.remainder; - else if ((mbus->addr) % (mbus->buswidth)) { - early_bytes = mbus->buswidth - (mbus->addr) % - (mbus->buswidth); + else if (!IS_BUS_ALIGNED(mbus)) { + early_bytes = mbus->buswidth - + (mbus->addr & (mbus->buswidth - 1)); if ((bd.remainder - early_bytes) < mbus->buswidth) early_bytes = bd.remainder; } @@ -928,7 +930,7 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, * Master now aligned * - if slave is not then we must set its width down */ - if (sbus->addr % sbus->buswidth) { + if (!IS_BUS_ALIGNED(sbus)) { dev_dbg(&pl08x->adev->dev, "%s set down bus width to one byte\n", __func__); From b90ca0636cdf16dfb763f1cd6f3d4bf7ce975fb5 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Wed, 14 Aug 2013 14:52:09 +0200 Subject: [PATCH 06/10] DMA: fix printk warning in AMBA PL08x DMA driver In Rob's recent pull request the patch ARM: highbank: select ARCH_DMA_ADDR_T_64BIT for LPAE promotes dma_addr_t to 64bit, so printk generates a warning about an incorrect type. Fix this by casting it to u64 and using %llx. Fixing long lines on the way. Signed-off-by: Andre Przywara Signed-off-by: Rob Herring --- drivers/dma/amba-pl08x.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index fb3ce9eefca7..bff41d4848e5 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -847,10 +847,13 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x, pl08x_choose_master_bus(&bd, &mbus, &sbus, cctl); - dev_vdbg(&pl08x->adev->dev, "src=0x%08x%s/%u dst=0x%08x%s/%u len=%zu\n", - bd.srcbus.addr, cctl & PL080_CONTROL_SRC_INCR ? "+" : "", + dev_vdbg(&pl08x->adev->dev, + "src=0x%08llx%s/%u dst=0x%08llx%s/%u len=%zu\n", + (u64)bd.srcbus.addr, + cctl & PL080_CONTROL_SRC_INCR ? "+" : "", bd.srcbus.buswidth, - bd.dstbus.addr, cctl & PL080_CONTROL_DST_INCR ? "+" : "", + (u64)bd.dstbus.addr, + cctl & PL080_CONTROL_DST_INCR ? "+" : "", bd.dstbus.buswidth, bd.remainder); dev_vdbg(&pl08x->adev->dev, "mbus=%s sbus=%s\n", From 62b4d60519044c25f84a778ce093e58155ffce05 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Tue, 13 Aug 2013 15:55:07 -0500 Subject: [PATCH 07/10] ARM: highbank: select ARCH_DMA_ADDR_T_64BIT for LPAE ECX-2000 has some 64-bit capable DMA and therefore needs dma_addr_t to be a 64-bit size. Signed-off-by: Rob Herring --- arch/arm/mach-highbank/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig index 386835ed3acf..b9dd13ae3dca 100644 --- a/arch/arm/mach-highbank/Kconfig +++ b/arch/arm/mach-highbank/Kconfig @@ -1,5 +1,6 @@ config ARCH_HIGHBANK bool "Calxeda ECX-1000/2000 (Highbank/Midway)" if ARCH_MULTI_V7 + select ARCH_DMA_ADDR_T_64BIT if ARM_LPAE select ARCH_HAS_CPUFREQ select ARCH_HAS_HOLES_MEMORYMODEL select ARCH_HAS_OPP From 0b53c11d533a8f6688d73fad0baf67dd08ec1b90 Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Sat, 17 Aug 2013 20:12:57 -0500 Subject: [PATCH 08/10] ARM: move outer_cache declaration out of ifdef Move the outer_cache declaration of the CONFIG_OUTER_CACHE ifdef so that outer_cache can be used inside IS_ENABLED condition. Signed-off-by: Rob Herring Cc: Russell King --- arch/arm/include/asm/outercache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h index 12f71a190422..f94784f0e3a6 100644 --- a/arch/arm/include/asm/outercache.h +++ b/arch/arm/include/asm/outercache.h @@ -37,10 +37,10 @@ struct outer_cache_fns { void (*resume)(void); }; -#ifdef CONFIG_OUTER_CACHE - extern struct outer_cache_fns outer_cache; +#ifdef CONFIG_OUTER_CACHE + static inline void outer_inv_range(phys_addr_t start, phys_addr_t end) { if (outer_cache.inv_range) From a56a5cf1f2ec895599eace0ac6eba1e4a489e4bf Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Sat, 17 Aug 2013 20:10:28 -0500 Subject: [PATCH 09/10] ARM: highbank: avoid L2 cache smc calls when PL310 is not present While Midway firmware handles L2 smc calls as nops, the custom smc calls present a problem when running virtualized Midway guest. They aren't needed so just avoid calling them. In the process, cleanup the L2X0 ifdefs and use IS_ENABLED instead. Signed-off-by: Rob Herring --- arch/arm/mach-highbank/highbank.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 0749b42f33c9..42ac14bd0b9d 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -65,13 +65,11 @@ void highbank_set_cpu_jump(int cpu, void *jump_addr) HB_JUMP_TABLE_PHYS(cpu) + 15); } -#ifdef CONFIG_CACHE_L2X0 static void highbank_l2x0_disable(void) { /* Disable PL310 L2 Cache controller */ highbank_smc1(0x102, 0x0); } -#endif static void __init highbank_init_irq(void) { @@ -80,12 +78,13 @@ static void __init highbank_init_irq(void) if (of_find_compatible_node(NULL, NULL, "arm,cortex-a9")) highbank_scu_map_io(); -#ifdef CONFIG_CACHE_L2X0 /* Enable PL310 L2 Cache controller */ - highbank_smc1(0x102, 0x1); - l2x0_of_init(0, ~0UL); - outer_cache.disable = highbank_l2x0_disable; -#endif + if (IS_ENABLED(CONFIG_CACHE_L2X0) && + of_find_compatible_node(NULL, NULL, "arm,pl310-cache")) { + highbank_smc1(0x102, 0x1); + l2x0_of_init(0, ~0UL); + outer_cache.disable = highbank_l2x0_disable; + } } static void __init highbank_timer_init(void) From e7dc0796083c7a9e8e3620600a80f6bc7a2fce1a Mon Sep 17 00:00:00 2001 From: Rob Herring Date: Sun, 17 Feb 2013 21:33:05 -0600 Subject: [PATCH 10/10] ARM: highbank: clean-up some unused includes Signed-off-by: Rob Herring --- arch/arm/mach-highbank/highbank.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 42ac14bd0b9d..8e63ccdb0de3 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -18,14 +18,11 @@ #include #include #include -#include #include -#include #include #include #include #include -#include #include #include @@ -35,7 +32,6 @@ #include #include #include -#include #include "core.h" #include "sysregs.h"