This is a note to let you know that I've just added the patch titled ARM: 8296/1: cache-l2x0: clean up aurora cache handling to the 3.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: arm-8296-1-cache-l2x0-clean-up-aurora-cache-handling.patch and it can be found in the queue-3.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 20e783e39e55c2615fb61d1b3d139ee9edcf6772 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann <arnd@xxxxxxxx> Date: Wed, 28 Jan 2015 17:54:38 +0100 Subject: ARM: 8296/1: cache-l2x0: clean up aurora cache handling From: Arnd Bergmann <arnd@xxxxxxxx> commit 20e783e39e55c2615fb61d1b3d139ee9edcf6772 upstream. The aurora cache controller is the only remaining user of a couple of functions in this file and are completely unused when that is disabled, leading to build warnings: arch/arm/mm/cache-l2x0.c:167:13: warning: 'l2x0_cache_sync' defined but not used [-Wunused-function] arch/arm/mm/cache-l2x0.c:184:13: warning: 'l2x0_flush_all' defined but not used [-Wunused-function] arch/arm/mm/cache-l2x0.c:194:13: warning: 'l2x0_disable' defined but not used [-Wunused-function] With the knowledge that the code is now aurora-specific, we can simplify it noticeably: - The pl310 errata workarounds are not needed on aurora and can be removed - As confirmed by Thomas Petazzoni from the data sheet, the cache_wait() macro is never needed. - No need to hold the lock across atomic cache sync - We can load the l2x0_base into a local variable across operations There should be no functional change in this patch, but readability and the generated object code improves, along with avoiding the warnings. (on Armada 370 RD and Armada XP GP, boot tested, plus a little bit of DMA traffic by reading data from a SD card) Acked-by: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx> Tested-by: Thomas Petazzoni <thomas.petazzoni@xxxxxxxxxxxxxxxxxx> Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx> Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- arch/arm/mm/cache-l2x0.c | 111 ++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 73 deletions(-) --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -136,73 +136,6 @@ static void l2c_disable(void) dsb(st); } -#ifdef CONFIG_CACHE_PL310 -static inline void cache_wait(void __iomem *reg, unsigned long mask) -{ - /* cache operations by line are atomic on PL310 */ -} -#else -#define cache_wait l2c_wait_mask -#endif - -static inline void cache_sync(void) -{ - void __iomem *base = l2x0_base; - - writel_relaxed(0, base + sync_reg_offset); - cache_wait(base + L2X0_CACHE_SYNC, 1); -} - -#if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915) -static inline void debug_writel(unsigned long val) -{ - l2c_set_debug(l2x0_base, val); -} -#else -/* Optimised out for non-errata case */ -static inline void debug_writel(unsigned long val) -{ -} -#endif - -static void l2x0_cache_sync(void) -{ - unsigned long flags; - - raw_spin_lock_irqsave(&l2x0_lock, flags); - cache_sync(); - raw_spin_unlock_irqrestore(&l2x0_lock, flags); -} - -static void __l2x0_flush_all(void) -{ - debug_writel(0x03); - __l2c_op_way(l2x0_base + L2X0_CLEAN_INV_WAY); - cache_sync(); - debug_writel(0x00); -} - -static void l2x0_flush_all(void) -{ - unsigned long flags; - - /* clean all ways */ - raw_spin_lock_irqsave(&l2x0_lock, flags); - __l2x0_flush_all(); - raw_spin_unlock_irqrestore(&l2x0_lock, flags); -} - -static void l2x0_disable(void) -{ - unsigned long flags; - - raw_spin_lock_irqsave(&l2x0_lock, flags); - __l2x0_flush_all(); - l2c_write_sec(0, l2x0_base, L2X0_CTRL); - dsb(st); - raw_spin_unlock_irqrestore(&l2x0_lock, flags); -} - static void l2c_save(void __iomem *base) { l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL); @@ -1257,14 +1190,15 @@ static unsigned long calc_range_end(unsi static void aurora_pa_range(unsigned long start, unsigned long end, unsigned long offset) { + void __iomem *base = l2x0_base; unsigned long flags; raw_spin_lock_irqsave(&l2x0_lock, flags); - writel_relaxed(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG); - writel_relaxed(end, l2x0_base + offset); + writel_relaxed(start, base + AURORA_RANGE_BASE_ADDR_REG); + writel_relaxed(end, base + offset); raw_spin_unlock_irqrestore(&l2x0_lock, flags); - cache_sync(); + writel_relaxed(0, base + AURORA_SYNC_REG); } static void aurora_inv_range(unsigned long start, unsigned long end) @@ -1324,6 +1258,37 @@ static void aurora_flush_range(unsigned } } +static void aurora_flush_all(void) +{ + void __iomem *base = l2x0_base; + unsigned long flags; + + /* clean all ways */ + raw_spin_lock_irqsave(&l2x0_lock, flags); + __l2c_op_way(base + L2X0_CLEAN_INV_WAY); + raw_spin_unlock_irqrestore(&l2x0_lock, flags); + + writel_relaxed(0, base + AURORA_SYNC_REG); +} + +static void aurora_cache_sync(void) +{ + writel_relaxed(0, l2x0_base + AURORA_SYNC_REG); +} + +static void aurora_disable(void) +{ + void __iomem *base = l2x0_base; + unsigned long flags; + + raw_spin_lock_irqsave(&l2x0_lock, flags); + __l2c_op_way(base + L2X0_CLEAN_INV_WAY); + writel_relaxed(0, base + AURORA_SYNC_REG); + l2c_write_sec(0, base, L2X0_CTRL); + dsb(st); + raw_spin_unlock_irqrestore(&l2x0_lock, flags); +} + static void aurora_save(void __iomem *base) { l2x0_saved_regs.ctrl = readl_relaxed(base + L2X0_CTRL); @@ -1398,9 +1363,9 @@ static const struct l2c_init_data of_aur .inv_range = aurora_inv_range, .clean_range = aurora_clean_range, .flush_range = aurora_flush_range, - .flush_all = l2x0_flush_all, - .disable = l2x0_disable, - .sync = l2x0_cache_sync, + .flush_all = aurora_flush_all, + .disable = aurora_disable, + .sync = aurora_cache_sync, .resume = aurora_resume, }, }; Patches currently in stable-queue which might be from arnd@xxxxxxxx are queue-3.18/net-vxge-avoid-unused-function-warnings.patch queue-3.18/tty-nozomi-avoid-a-harmless-gcc-warning.patch queue-3.18/perf-avoid-horrible-stack-usage.patch queue-3.18/btrfs-fix-state-private-cast-on-32-bit-machines.patch queue-3.18/mm-init-fix-zone-boundary-creation.patch queue-3.18/iommu-vt-d-remove-unused-variable.patch queue-3.18/mips-msp71xx-remove-odd-locking-in-pci-config-space-access-code.patch queue-3.18/net-tulip-turn-compile-time-warning-into-dev_warn.patch queue-3.18/nfsd-work-around-a-gcc-5.1-warning.patch queue-3.18/fs-nfs-fix-new-compiler-warning-about-boolean-in-switch.patch queue-3.18/aic94xx-skip-reading-user-settings-if-flash-is-not-found.patch queue-3.18/mmc-sunxi-avoid-invalid-pointer-calculation.patch queue-3.18/acpi-power-avoid-maybe-uninitialized-warning.patch queue-3.18/gfs2-avoid-uninitialized-variable-warning.patch queue-3.18/gadgetfs-fix-uninitialized-variable-in-error-handling.patch queue-3.18/arm-8296-1-cache-l2x0-clean-up-aurora-cache-handling.patch queue-3.18/brcmfmac-avoid-gcc-5.1-warning.patch queue-3.18/kconfig-tinyconfig-provide-whole-choice-blocks-to-avoid-warnings.patch queue-3.18/net-ti-cpmac-fix-compiler-warning-due-to-type-confusion.patch queue-3.18/clk-at91-usb-fix-determine_rate-prototype-again.patch queue-3.18/mips-ralink-cosmetic-change-to-prom_init.patch queue-3.18/mips-fix-the-build-on-jz4740-after-removing-the-custom-gpio.h.patch queue-3.18/mips-asm-compiler-add-new-macros-to-set-isa-and-arch-asm-annotations.patch queue-3.18/misc-ioc4-simplify-wave-period-measurement-in-clock_calibrate.patch queue-3.18/hostap-avoid-uninitialized-variable-use-in-hfa384x_get_rid.patch queue-3.18/dm-bufio-hide-bogus-warning.patch queue-3.18/fix-signed-unsigned-pointer-warning.patch