···11+What: /sys/bus/amba/devices/.../driver_override22+Date: September 201433+Contact: Antonios Motakis <a.motakis@virtualopensystems.com>44+Description:55+ This file allows the driver for a device to be specified which66+ will override standard OF, ACPI, ID table, and name matching.77+ When specified, only a driver with a name matching the value88+ written to driver_override will have an opportunity to bind to99+ the device. The override is specified by writing a string to the1010+ driver_override file (echo vfio-amba > driver_override) and may1111+ be cleared with an empty string (echo > driver_override).1212+ This returns the device to standard matching rules binding.1313+ Writing to driver_override does not automatically unbind the1414+ device from its current driver or make any attempt to1515+ automatically load the specified driver. If no driver with a1616+ matching name is currently loaded in the kernel, the device will1717+ not bind to any driver. This also allows devices to opt-out of1818+ driver binding using a driver_override name such as "none".1919+ Only a single driver may be specified in the override, there is2020+ no support for parsing delimiters.
+10
Documentation/devicetree/bindings/arm/l2cc.txt
···5757- cache-id-part: cache id part number to be used if it is not present5858 on hardware5959- wt-override: If present then L2 is forced to Write through mode6060+- arm,double-linefill : Override double linefill enable setting. Enable if6161+ non-zero, disable if zero.6262+- arm,double-linefill-incr : Override double linefill on INCR read. Enable6363+ if non-zero, disable if zero.6464+- arm,double-linefill-wrap : Override double linefill on WRAP read. Enable6565+ if non-zero, disable if zero.6666+- arm,prefetch-drop : Override prefetch drop enable setting. Enable if non-zero,6767+ disable if zero.6868+- arm,prefetch-offset : Override prefetch offset value. Valid values are6969+ 0-7, 15, 23, and 31.60706171Example:6272
+1
arch/arm/Kconfig
···2929 select HANDLE_DOMAIN_IRQ3030 select HARDIRQS_SW_RESEND3131 select HAVE_ARCH_AUDITSYSCALL if (AEABI && !OABI_COMPAT)3232+ select HAVE_ARCH_BITREVERSE if (CPU_32v7M || CPU_32v7) && !CPU_32v63233 select HAVE_ARCH_JUMP_LABEL if !XIP_KERNEL3334 select HAVE_ARCH_KGDB3435 select HAVE_ARCH_SECCOMP_FILTER if (AEABI && !OABI_COMPAT)
+31-10
arch/arm/boot/compressed/head.S
···178178179179 /*180180 * Set up a page table only if it won't overwrite ourself.181181- * That means r4 < pc && r4 - 16k page directory > &_end.181181+ * That means r4 < pc || r4 - 16k page directory > &_end.182182 * Given that r4 > &_end is most unfrequent, we add a rough183183 * additional 1MB of room for a possible appended DTB.184184 */···263263 * OK... Let's do some funky business here.264264 * If we do have a DTB appended to zImage, and we do have265265 * an ATAG list around, we want the later to be translated266266- * and folded into the former here. To be on the safe side,267267- * let's temporarily move the stack away into the malloc268268- * area. No GOT fixup has occurred yet, but none of the269269- * code we're about to call uses any global variable.266266+ * and folded into the former here. No GOT fixup has occurred267267+ * yet, but none of the code we're about to call uses any268268+ * global variable.270269 */271271- add sp, sp, #0x10000270270+271271+ /* Get the initial DTB size */272272+ ldr r5, [r6, #4]273273+#ifndef __ARMEB__274274+ /* convert to little endian */275275+ eor r1, r5, r5, ror #16276276+ bic r1, r1, #0x00ff0000277277+ mov r5, r5, ror #8278278+ eor r5, r5, r1, lsr #8279279+#endif280280+ /* 50% DTB growth should be good enough */281281+ add r5, r5, r5, lsr #1282282+ /* preserve 64-bit alignment */283283+ add r5, r5, #7284284+ bic r5, r5, #7285285+ /* clamp to 32KB min and 1MB max */286286+ cmp r5, #(1 << 15)287287+ movlo r5, #(1 << 15)288288+ cmp r5, #(1 << 20)289289+ movhi r5, #(1 << 20)290290+ /* temporarily relocate the stack past the DTB work space */291291+ add sp, sp, r5292292+272293 stmfd sp!, {r0-r3, ip, lr}273294 mov r0, r8274295 mov r1, r6275275- sub r2, sp, r6296296+ mov r2, r5276297 bl atags_to_fdt277298278299 /*···306285 bic r0, r0, #1307286 add r0, r0, #0x100308287 mov r1, r6309309- sub r2, sp, r6288288+ mov r2, r5310289 bleq atags_to_fdt311290312291 ldmfd sp!, {r0-r3, ip, lr}313313- sub sp, sp, #0x10000292292+ sub sp, sp, r5314293#endif315294316295 mov r8, r6 @ use the appended device tree···327306 subs r1, r5, r1328307 addhi r9, r9, r1329308330330- /* Get the dtb's size */309309+ /* Get the current DTB size */331310 ldr r5, [r6, #4]332311#ifndef __ARMEB__333312 /* convert r5 (dtb size) to little endian */
···88 * This string is meant to be concatenated with the inline asm string and99 * will cause compilation to stop on mismatch.1010 * (for details, see gcc PR 15089)1111+ * For compatibility with clang, we have to specifically take the equivalence1212+ * of 'r11' <-> 'fp' and 'r12' <-> 'ip' into account as well.1113 */1212-#define __asmeq(x, y) ".ifnc " x "," y " ; .err ; .endif\n\t"1414+#define __asmeq(x, y) \1515+ ".ifnc " x "," y "; " \1616+ ".ifnc " x y ",fpr11; " \1717+ ".ifnc " x y ",r11fp; " \1818+ ".ifnc " x y ",ipr12; " \1919+ ".ifnc " x y ",r12ip; " \2020+ ".err; " \2121+ ".endif; " \2222+ ".endif; " \2323+ ".endif; " \2424+ ".endif; " \2525+ ".endif\n\t"132614271528#endif /* __ASM_ARM_COMPILER_H */
+3
arch/arm/include/asm/outercache.h
···23232424#include <linux/types.h>25252626+struct l2x0_regs;2727+2628struct outer_cache_fns {2729 void (*inv_range)(unsigned long, unsigned long);2830 void (*clean_range)(unsigned long, unsigned long);···38363937 /* This is an ARM L2C thing */4038 void (*write_sec)(unsigned long, unsigned);3939+ void (*configure)(const struct l2x0_regs *);4140};42414342extern struct outer_cache_fns outer_cache;
+1
arch/arm/include/uapi/asm/unistd.h
···413413#define __NR_getrandom (__NR_SYSCALL_BASE+384)414414#define __NR_memfd_create (__NR_SYSCALL_BASE+385)415415#define __NR_bpf (__NR_SYSCALL_BASE+386)416416+#define __NR_execveat (__NR_SYSCALL_BASE+387)416417417418/*418419 * The following SWIs are ARM private.
···346346347347#if defined(CONFIG_SMP)348348 .text349349+ENTRY(secondary_startup_arm)350350+ .arm351351+ THUMB( adr r9, BSYM(1f) ) @ Kernel is entered in ARM.352352+ THUMB( bx r9 ) @ If this is a Thumb-2 kernel,353353+ THUMB( .thumb ) @ switch to Thumb now.354354+ THUMB(1: )349355ENTRY(secondary_startup)350356 /*351357 * Common entry point for secondary CPUs.···391385 THUMB( add r12, r10, #PROCINFO_INITFUNC )392386 THUMB( ret r12 )393387ENDPROC(secondary_startup)388388+ENDPROC(secondary_startup_arm)394389395390 /*396391 * r6 = &secondary_data···593586 add r5, r5, r3 @ adjust table end address594587 add r6, r6, r3 @ adjust __pv_phys_pfn_offset address595588 add r7, r7, r3 @ adjust __pv_offset address596596- mov r0, r8, lsr #12 @ convert to PFN589589+ mov r0, r8, lsr #PAGE_SHIFT @ convert to PFN597590 str r0, [r6] @ save computed PHYS_OFFSET to __pv_phys_pfn_offset598591 strcc ip, [r7, #HIGH_OFFSET] @ save to __pv_offset high bits599592 mov r6, r3, lsr #24 @ constant for add/sub instructions
+2-1
arch/arm/kernel/irq.c
···109109110110 if (IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_CACHE_L2X0) &&111111 (machine_desc->l2c_aux_mask || machine_desc->l2c_aux_val)) {112112- outer_cache.write_sec = machine_desc->l2c_write_sec;112112+ if (!outer_cache.write_sec)113113+ outer_cache.write_sec = machine_desc->l2c_write_sec;113114 ret = l2x0_of_init(machine_desc->l2c_aux_val,114115 machine_desc->l2c_aux_mask);115116 if (ret)
+8-2
arch/arm/kernel/perf_event.c
···116116 ret = 1;117117 }118118119119- if (left > (s64)armpmu->max_period)120120- left = armpmu->max_period;119119+ /*120120+ * Limit the maximum period to prevent the counter value121121+ * from overtaking the one we are about to program. In122122+ * effect we are reducing max_period to account for123123+ * interrupt latency (and we are being very conservative).124124+ */125125+ if (left > (armpmu->max_period >> 1))126126+ left = armpmu->max_period >> 1;121127122128 local64_set(&hwc->prev_count, (u64)-left);123129
+5-2
arch/arm/kernel/setup.c
···657657658658 /*659659 * Ensure that start/size are aligned to a page boundary.660660- * Size is appropriately rounded down, start is rounded up.660660+ * Size is rounded down, start is rounded up.661661 */662662- size -= start & ~PAGE_MASK;663662 aligned_start = PAGE_ALIGN(start);663663+ if (aligned_start > start + size)664664+ size = 0;665665+ else666666+ size -= aligned_start - start;664667665668#ifndef CONFIG_ARCH_PHYS_ADDR_T_64BIT666669 if (aligned_start > ULONG_MAX) {
-4
arch/arm/kernel/suspend.c
···1414extern void cpu_resume_mmu(void);15151616#ifdef CONFIG_MMU1717-/*1818- * Hide the first two arguments to __cpu_suspend - these are an implementation1919- * detail which platform code shouldn't have to know about.2020- */2117int cpu_suspend(unsigned long arg, int (*fn)(unsigned long))2218{2319 struct mm_struct *mm = current->active_mm;
+2-13
arch/arm/lib/Makefile
···1515 io-readsb.o io-writesb.o io-readsl.o io-writesl.o \1616 call_with_stack.o bswapsdi2.o17171818-mmu-y := clear_user.o copy_page.o getuser.o putuser.o1919-2020-# the code in uaccess.S is not preemption safe and2121-# probably faster on ARMv3 only2222-ifeq ($(CONFIG_PREEMPT),y)2323- mmu-y += copy_from_user.o copy_to_user.o2424-else2525-ifneq ($(CONFIG_CPU_32v3),y)2626- mmu-y += copy_from_user.o copy_to_user.o2727-else2828- mmu-y += uaccess.o2929-endif3030-endif1818+mmu-y := clear_user.o copy_page.o getuser.o putuser.o \1919+ copy_from_user.o copy_to_user.o31203221# using lib_ here won't override already available weak symbols3322obj-$(CONFIG_UACCESS_WITH_MEMCPY) += uaccess_with_memcpy.o
···1012101210131013config ARM_KERNMEM_PERMS10141014 bool "Restrict kernel memory permissions"10151015+ depends on MMU10151016 help10161017 If this is set, kernel memory other than kernel text (and rodata)10171018 will be made non-executable. The tradeoff is that each region is
+231-210
arch/arm/mm/cache-l2x0.c
···4141 void (*enable)(void __iomem *, u32, unsigned);4242 void (*fixup)(void __iomem *, u32, struct outer_cache_fns *);4343 void (*save)(void __iomem *);4444+ void (*configure)(void __iomem *);4445 struct outer_cache_fns outer_cache;4546};46474748#define CACHE_LINE_SIZE 3248494950static void __iomem *l2x0_base;5151+static const struct l2c_init_data *l2x0_data;5052static DEFINE_RAW_SPINLOCK(l2x0_lock);5153static u32 l2x0_way_mask; /* Bitmask of active ways */5254static u32 l2x0_size;···108106 }109107}110108109109+static void l2c_configure(void __iomem *base)110110+{111111+ if (outer_cache.configure) {112112+ outer_cache.configure(&l2x0_saved_regs);113113+ return;114114+ }115115+116116+ if (l2x0_data->configure)117117+ l2x0_data->configure(base);118118+119119+ l2c_write_sec(l2x0_saved_regs.aux_ctrl, base, L2X0_AUX_CTRL);120120+}121121+111122/*112123 * Enable the L2 cache controller. This function must only be113124 * called when the cache controller is known to be disabled.···129114{130115 unsigned long flags;131116132132- l2c_write_sec(aux, base, L2X0_AUX_CTRL);117117+ /* Do not touch the controller if already enabled. */118118+ if (readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN)119119+ return;120120+121121+ l2x0_saved_regs.aux_ctrl = aux;122122+ l2c_configure(base);133123134124 l2c_unlock(base, num_lock);135125···156136 dsb(st);157137}158138159159-#ifdef CONFIG_CACHE_PL310160160-static inline void cache_wait(void __iomem *reg, unsigned long mask)161161-{162162- /* cache operations by line are atomic on PL310 */163163-}164164-#else165165-#define cache_wait l2c_wait_mask166166-#endif167167-168168-static inline void cache_sync(void)169169-{170170- void __iomem *base = l2x0_base;171171-172172- writel_relaxed(0, base + sync_reg_offset);173173- cache_wait(base + L2X0_CACHE_SYNC, 1);174174-}175175-176176-#if defined(CONFIG_PL310_ERRATA_588369) || defined(CONFIG_PL310_ERRATA_727915)177177-static inline void debug_writel(unsigned long val)178178-{179179- l2c_set_debug(l2x0_base, val);180180-}181181-#else182182-/* Optimised out for non-errata case */183183-static inline void debug_writel(unsigned long val)184184-{185185-}186186-#endif187187-188188-static void l2x0_cache_sync(void)189189-{190190- unsigned long flags;191191-192192- raw_spin_lock_irqsave(&l2x0_lock, flags);193193- cache_sync();194194- raw_spin_unlock_irqrestore(&l2x0_lock, flags);195195-}196196-197197-static void __l2x0_flush_all(void)198198-{199199- debug_writel(0x03);200200- __l2c_op_way(l2x0_base + L2X0_CLEAN_INV_WAY);201201- cache_sync();202202- debug_writel(0x00);203203-}204204-205205-static void l2x0_flush_all(void)206206-{207207- unsigned long flags;208208-209209- /* clean all ways */210210- raw_spin_lock_irqsave(&l2x0_lock, flags);211211- __l2x0_flush_all();212212- raw_spin_unlock_irqrestore(&l2x0_lock, flags);213213-}214214-215215-static void l2x0_disable(void)216216-{217217- unsigned long flags;218218-219219- raw_spin_lock_irqsave(&l2x0_lock, flags);220220- __l2x0_flush_all();221221- l2c_write_sec(0, l2x0_base, L2X0_CTRL);222222- dsb(st);223223- raw_spin_unlock_irqrestore(&l2x0_lock, flags);224224-}225225-226139static void l2c_save(void __iomem *base)227140{228141 l2x0_saved_regs.aux_ctrl = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);142142+}143143+144144+static void l2c_resume(void)145145+{146146+ l2c_enable(l2x0_base, l2x0_saved_regs.aux_ctrl, l2x0_data->num_lock);229147}230148231149/*···246288 __l2c210_cache_sync(l2x0_base);247289}248290249249-static void l2c210_resume(void)250250-{251251- void __iomem *base = l2x0_base;252252-253253- if (!(readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN))254254- l2c_enable(base, l2x0_saved_regs.aux_ctrl, 1);255255-}256256-257291static const struct l2c_init_data l2c210_data __initconst = {258292 .type = "L2C-210",259293 .way_size_0 = SZ_8K,···259309 .flush_all = l2c210_flush_all,260310 .disable = l2c_disable,261311 .sync = l2c210_sync,262262- .resume = l2c210_resume,312312+ .resume = l2c_resume,263313 },264314};265315···416466 .flush_all = l2c220_flush_all,417467 .disable = l2c_disable,418468 .sync = l2c220_sync,419419- .resume = l2c210_resume,469469+ .resume = l2c_resume,420470 },421471};422472···565615 L310_POWER_CTRL);566616}567617568568-static void l2c310_resume(void)618618+static void l2c310_configure(void __iomem *base)569619{570570- void __iomem *base = l2x0_base;620620+ unsigned revision;571621572572- if (!(readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN)) {573573- unsigned revision;622622+ /* restore pl310 setup */623623+ l2c_write_sec(l2x0_saved_regs.tag_latency, base,624624+ L310_TAG_LATENCY_CTRL);625625+ l2c_write_sec(l2x0_saved_regs.data_latency, base,626626+ L310_DATA_LATENCY_CTRL);627627+ l2c_write_sec(l2x0_saved_regs.filter_end, base,628628+ L310_ADDR_FILTER_END);629629+ l2c_write_sec(l2x0_saved_regs.filter_start, base,630630+ L310_ADDR_FILTER_START);574631575575- /* restore pl310 setup */576576- writel_relaxed(l2x0_saved_regs.tag_latency,577577- base + L310_TAG_LATENCY_CTRL);578578- writel_relaxed(l2x0_saved_regs.data_latency,579579- base + L310_DATA_LATENCY_CTRL);580580- writel_relaxed(l2x0_saved_regs.filter_end,581581- base + L310_ADDR_FILTER_END);582582- writel_relaxed(l2x0_saved_regs.filter_start,583583- base + L310_ADDR_FILTER_START);632632+ revision = readl_relaxed(base + L2X0_CACHE_ID) &633633+ L2X0_CACHE_ID_RTL_MASK;584634585585- revision = readl_relaxed(base + L2X0_CACHE_ID) &586586- L2X0_CACHE_ID_RTL_MASK;587587-588588- if (revision >= L310_CACHE_ID_RTL_R2P0)589589- l2c_write_sec(l2x0_saved_regs.prefetch_ctrl, base,590590- L310_PREFETCH_CTRL);591591- if (revision >= L310_CACHE_ID_RTL_R3P0)592592- l2c_write_sec(l2x0_saved_regs.pwr_ctrl, base,593593- L310_POWER_CTRL);594594-595595- l2c_enable(base, l2x0_saved_regs.aux_ctrl, 8);596596-597597- /* Re-enable full-line-of-zeros for Cortex-A9 */598598- if (l2x0_saved_regs.aux_ctrl & L310_AUX_CTRL_FULL_LINE_ZERO)599599- set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));600600- }635635+ if (revision >= L310_CACHE_ID_RTL_R2P0)636636+ l2c_write_sec(l2x0_saved_regs.prefetch_ctrl, base,637637+ L310_PREFETCH_CTRL);638638+ if (revision >= L310_CACHE_ID_RTL_R3P0)639639+ l2c_write_sec(l2x0_saved_regs.pwr_ctrl, base,640640+ L310_POWER_CTRL);601641}602642603643static int l2c310_cpu_enable_flz(struct notifier_block *nb, unsigned long act, void *data)···639699 aux &= ~(L310_AUX_CTRL_FULL_LINE_ZERO | L310_AUX_CTRL_EARLY_BRESP);640700 }641701702702+ /* r3p0 or later has power control register */703703+ if (rev >= L310_CACHE_ID_RTL_R3P0)704704+ l2x0_saved_regs.pwr_ctrl = L310_DYNAMIC_CLK_GATING_EN |705705+ L310_STNDBY_MODE_EN;706706+707707+ /*708708+ * Always enable non-secure access to the lockdown registers -709709+ * we write to them as part of the L2C enable sequence so they710710+ * need to be accessible.711711+ */712712+ aux |= L310_AUX_CTRL_NS_LOCKDOWN;713713+714714+ l2c_enable(base, aux, num_lock);715715+716716+ /* Read back resulting AUX_CTRL value as it could have been altered. */717717+ aux = readl_relaxed(base + L2X0_AUX_CTRL);718718+642719 if (aux & (L310_AUX_CTRL_DATA_PREFETCH | L310_AUX_CTRL_INSTR_PREFETCH)) {643720 u32 prefetch = readl_relaxed(base + L310_PREFETCH_CTRL);644721···669712 if (rev >= L310_CACHE_ID_RTL_R3P0) {670713 u32 power_ctrl;671714672672- l2c_write_sec(L310_DYNAMIC_CLK_GATING_EN | L310_STNDBY_MODE_EN,673673- base, L310_POWER_CTRL);674715 power_ctrl = readl_relaxed(base + L310_POWER_CTRL);675716 pr_info("L2C-310 dynamic clock gating %sabled, standby mode %sabled\n",676717 power_ctrl & L310_DYNAMIC_CLK_GATING_EN ? "en" : "dis",677718 power_ctrl & L310_STNDBY_MODE_EN ? "en" : "dis");678719 }679679-680680- /*681681- * Always enable non-secure access to the lockdown registers -682682- * we write to them as part of the L2C enable sequence so they683683- * need to be accessible.684684- */685685- aux |= L310_AUX_CTRL_NS_LOCKDOWN;686686-687687- l2c_enable(base, aux, num_lock);688720689721 if (aux & L310_AUX_CTRL_FULL_LINE_ZERO) {690722 set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));···706760707761 if (revision >= L310_CACHE_ID_RTL_R3P0 &&708762 revision < L310_CACHE_ID_RTL_R3P2) {709709- u32 val = readl_relaxed(base + L310_PREFETCH_CTRL);763763+ u32 val = l2x0_saved_regs.prefetch_ctrl;710764 /* I don't think bit23 is required here... but iMX6 does so */711765 if (val & (BIT(30) | BIT(23))) {712766 val &= ~(BIT(30) | BIT(23));713713- l2c_write_sec(val, base, L310_PREFETCH_CTRL);767767+ l2x0_saved_regs.prefetch_ctrl = val;714768 errata[n++] = "752271";715769 }716770 }···746800 l2c_disable();747801}748802803803+static void l2c310_resume(void)804804+{805805+ l2c_resume();806806+807807+ /* Re-enable full-line-of-zeros for Cortex-A9 */808808+ if (l2x0_saved_regs.aux_ctrl & L310_AUX_CTRL_FULL_LINE_ZERO)809809+ set_auxcr(get_auxcr() | BIT(3) | BIT(2) | BIT(1));810810+}811811+749812static const struct l2c_init_data l2c310_init_fns __initconst = {750813 .type = "L2C-310",751814 .way_size_0 = SZ_8K,···762807 .enable = l2c310_enable,763808 .fixup = l2c310_fixup,764809 .save = l2c310_save,810810+ .configure = l2c310_configure,765811 .outer_cache = {766812 .inv_range = l2c210_inv_range,767813 .clean_range = l2c210_clean_range,···774818 },775819};776820777777-static void __init __l2c_init(const struct l2c_init_data *data,778778- u32 aux_val, u32 aux_mask, u32 cache_id)821821+static int __init __l2c_init(const struct l2c_init_data *data,822822+ u32 aux_val, u32 aux_mask, u32 cache_id)779823{780824 struct outer_cache_fns fns;781825 unsigned way_size_bits, ways;782826 u32 aux, old_aux;827827+828828+ /*829829+ * Save the pointer globally so that callbacks which do not receive830830+ * context from callers can access the structure.831831+ */832832+ l2x0_data = kmemdup(data, sizeof(*data), GFP_KERNEL);833833+ if (!l2x0_data)834834+ return -ENOMEM;783835784836 /*785837 * Sanity check the aux values. aux_mask is the bits we preserve···848884849885 fns = data->outer_cache;850886 fns.write_sec = outer_cache.write_sec;887887+ fns.configure = outer_cache.configure;851888 if (data->fixup)852889 data->fixup(l2x0_base, cache_id, &fns);853890···875910 data->type, ways, l2x0_size >> 10);876911 pr_info("%s: CACHE_ID 0x%08x, AUX_CTRL 0x%08x\n",877912 data->type, cache_id, aux);913913+914914+ return 0;878915}879916880917void __init l2x0_init(void __iomem *base, u32 aux_val, u32 aux_mask)···902935 data = &l2c310_init_fns;903936 break;904937 }938938+939939+ /* Read back current (default) hardware configuration */940940+ if (data->save)941941+ data->save(l2x0_base);905942906943 __l2c_init(data, aux_val, aux_mask, cache_id);907944}···10731102 .flush_all = l2c210_flush_all,10741103 .disable = l2c_disable,10751104 .sync = l2c210_sync,10761076- .resume = l2c210_resume,11051105+ .resume = l2c_resume,10771106 },10781107};10791108···10911120 .flush_all = l2c220_flush_all,10921121 .disable = l2c_disable,10931122 .sync = l2c220_sync,10941094- .resume = l2c210_resume,11231123+ .resume = l2c_resume,10951124 },10961125};10971126···11021131 u32 tag[3] = { 0, 0, 0 };11031132 u32 filter[2] = { 0, 0 };11041133 u32 assoc;11341134+ u32 prefetch;11351135+ u32 val;11051136 int ret;1106113711071138 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));11081139 if (tag[0] && tag[1] && tag[2])11091109- writel_relaxed(11401140+ l2x0_saved_regs.tag_latency =11101141 L310_LATENCY_CTRL_RD(tag[0] - 1) |11111142 L310_LATENCY_CTRL_WR(tag[1] - 1) |11121112- L310_LATENCY_CTRL_SETUP(tag[2] - 1),11131113- l2x0_base + L310_TAG_LATENCY_CTRL);11431143+ L310_LATENCY_CTRL_SETUP(tag[2] - 1);1114114411151145 of_property_read_u32_array(np, "arm,data-latency",11161146 data, ARRAY_SIZE(data));11171147 if (data[0] && data[1] && data[2])11181118- writel_relaxed(11481148+ l2x0_saved_regs.data_latency =11191149 L310_LATENCY_CTRL_RD(data[0] - 1) |11201150 L310_LATENCY_CTRL_WR(data[1] - 1) |11211121- L310_LATENCY_CTRL_SETUP(data[2] - 1),11221122- l2x0_base + L310_DATA_LATENCY_CTRL);11511151+ L310_LATENCY_CTRL_SETUP(data[2] - 1);1123115211241153 of_property_read_u32_array(np, "arm,filter-ranges",11251154 filter, ARRAY_SIZE(filter));11261155 if (filter[1]) {11271127- writel_relaxed(ALIGN(filter[0] + filter[1], SZ_1M),11281128- l2x0_base + L310_ADDR_FILTER_END);11291129- writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L310_ADDR_FILTER_EN,11301130- l2x0_base + L310_ADDR_FILTER_START);11561156+ l2x0_saved_regs.filter_end =11571157+ ALIGN(filter[0] + filter[1], SZ_1M);11581158+ l2x0_saved_regs.filter_start = (filter[0] & ~(SZ_1M - 1))11591159+ | L310_ADDR_FILTER_EN;11311160 }1132116111331162 ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K);···11491178 assoc);11501179 break;11511180 }11811181+11821182+ prefetch = l2x0_saved_regs.prefetch_ctrl;11831183+11841184+ ret = of_property_read_u32(np, "arm,double-linefill", &val);11851185+ if (ret == 0) {11861186+ if (val)11871187+ prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL;11881188+ else11891189+ prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL;11901190+ } else if (ret != -EINVAL) {11911191+ pr_err("L2C-310 OF arm,double-linefill property value is missing\n");11921192+ }11931193+11941194+ ret = of_property_read_u32(np, "arm,double-linefill-incr", &val);11951195+ if (ret == 0) {11961196+ if (val)11971197+ prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;11981198+ else11991199+ prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;12001200+ } else if (ret != -EINVAL) {12011201+ pr_err("L2C-310 OF arm,double-linefill-incr property value is missing\n");12021202+ }12031203+12041204+ ret = of_property_read_u32(np, "arm,double-linefill-wrap", &val);12051205+ if (ret == 0) {12061206+ if (!val)12071207+ prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;12081208+ else12091209+ prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;12101210+ } else if (ret != -EINVAL) {12111211+ pr_err("L2C-310 OF arm,double-linefill-wrap property value is missing\n");12121212+ }12131213+12141214+ ret = of_property_read_u32(np, "arm,prefetch-drop", &val);12151215+ if (ret == 0) {12161216+ if (val)12171217+ prefetch |= L310_PREFETCH_CTRL_PREFETCH_DROP;12181218+ else12191219+ prefetch &= ~L310_PREFETCH_CTRL_PREFETCH_DROP;12201220+ } else if (ret != -EINVAL) {12211221+ pr_err("L2C-310 OF arm,prefetch-drop property value is missing\n");12221222+ }12231223+12241224+ ret = of_property_read_u32(np, "arm,prefetch-offset", &val);12251225+ if (ret == 0) {12261226+ prefetch &= ~L310_PREFETCH_CTRL_OFFSET_MASK;12271227+ prefetch |= val & L310_PREFETCH_CTRL_OFFSET_MASK;12281228+ } else if (ret != -EINVAL) {12291229+ pr_err("L2C-310 OF arm,prefetch-offset property value is missing\n");12301230+ }12311231+12321232+ l2x0_saved_regs.prefetch_ctrl = prefetch;11521233}1153123411541235static const struct l2c_init_data of_l2c310_data __initconst = {···12111188 .enable = l2c310_enable,12121189 .fixup = l2c310_fixup,12131190 .save = l2c310_save,11911191+ .configure = l2c310_configure,12141192 .outer_cache = {12151193 .inv_range = l2c210_inv_range,12161194 .clean_range = l2c210_clean_range,···12401216 .enable = l2c310_enable,12411217 .fixup = l2c310_fixup,12421218 .save = l2c310_save,12191219+ .configure = l2c310_configure,12431220 .outer_cache = {12441221 .inv_range = l2c210_inv_range,12451222 .clean_range = l2c210_clean_range,···12561231 * noninclusive, while the hardware cache range operations use12571232 * inclusive start and end addresses.12581233 */12591259-static unsigned long calc_range_end(unsigned long start, unsigned long end)12341234+static unsigned long aurora_range_end(unsigned long start, unsigned long end)12601235{12611236 /*12621237 * Limit the number of cache lines processed at once,···12751250 return end;12761251}1277125212781278-/*12791279- * Make sure 'start' and 'end' reference the same page, as L2 is PIPT12801280- * and range operations only do a TLB lookup on the start address.12811281- */12821253static void aurora_pa_range(unsigned long start, unsigned long end,12831283- unsigned long offset)12541254+ unsigned long offset)12841255{12561256+ void __iomem *base = l2x0_base;12571257+ unsigned long range_end;12851258 unsigned long flags;1286125912871287- raw_spin_lock_irqsave(&l2x0_lock, flags);12881288- writel_relaxed(start, l2x0_base + AURORA_RANGE_BASE_ADDR_REG);12891289- writel_relaxed(end, l2x0_base + offset);12901290- raw_spin_unlock_irqrestore(&l2x0_lock, flags);12911291-12921292- cache_sync();12931293-}12941294-12951295-static void aurora_inv_range(unsigned long start, unsigned long end)12961296-{12971260 /*12981261 * round start and end adresses up to cache line size12991262 */···12891276 end = ALIGN(end, CACHE_LINE_SIZE);1290127712911278 /*12921292- * Invalidate all full cache lines between 'start' and 'end'.12791279+ * perform operation on all full cache lines between 'start' and 'end'12931280 */12941281 while (start < end) {12951295- unsigned long range_end = calc_range_end(start, end);12961296- aurora_pa_range(start, range_end - CACHE_LINE_SIZE,12971297- AURORA_INVAL_RANGE_REG);12821282+ range_end = aurora_range_end(start, end);12831283+12841284+ raw_spin_lock_irqsave(&l2x0_lock, flags);12851285+ writel_relaxed(start, base + AURORA_RANGE_BASE_ADDR_REG);12861286+ writel_relaxed(range_end - CACHE_LINE_SIZE, base + offset);12871287+ raw_spin_unlock_irqrestore(&l2x0_lock, flags);12881288+12891289+ writel_relaxed(0, base + AURORA_SYNC_REG);12981290 start = range_end;12991291 }12921292+}12931293+static void aurora_inv_range(unsigned long start, unsigned long end)12941294+{12951295+ aurora_pa_range(start, end, AURORA_INVAL_RANGE_REG);13001296}1301129713021298static void aurora_clean_range(unsigned long start, unsigned long end)···13141292 * If L2 is forced to WT, the L2 will always be clean and we13151293 * don't need to do anything here.13161294 */13171317- if (!l2_wt_override) {13181318- start &= ~(CACHE_LINE_SIZE - 1);13191319- end = ALIGN(end, CACHE_LINE_SIZE);13201320- while (start != end) {13211321- unsigned long range_end = calc_range_end(start, end);13221322- aurora_pa_range(start, range_end - CACHE_LINE_SIZE,13231323- AURORA_CLEAN_RANGE_REG);13241324- start = range_end;13251325- }13261326- }12951295+ if (!l2_wt_override)12961296+ aurora_pa_range(start, end, AURORA_CLEAN_RANGE_REG);13271297}1328129813291299static void aurora_flush_range(unsigned long start, unsigned long end)13301300{13311331- start &= ~(CACHE_LINE_SIZE - 1);13321332- end = ALIGN(end, CACHE_LINE_SIZE);13331333- while (start != end) {13341334- unsigned long range_end = calc_range_end(start, end);13351335- /*13361336- * If L2 is forced to WT, the L2 will always be clean and we13371337- * just need to invalidate.13381338- */13391339- if (l2_wt_override)13401340- aurora_pa_range(start, range_end - CACHE_LINE_SIZE,13411341- AURORA_INVAL_RANGE_REG);13421342- else13431343- aurora_pa_range(start, range_end - CACHE_LINE_SIZE,13441344- AURORA_FLUSH_RANGE_REG);13451345- start = range_end;13461346- }13011301+ if (l2_wt_override)13021302+ aurora_pa_range(start, end, AURORA_INVAL_RANGE_REG);13031303+ else13041304+ aurora_pa_range(start, end, AURORA_FLUSH_RANGE_REG);13051305+}13061306+13071307+static void aurora_flush_all(void)13081308+{13091309+ void __iomem *base = l2x0_base;13101310+ unsigned long flags;13111311+13121312+ /* clean all ways */13131313+ raw_spin_lock_irqsave(&l2x0_lock, flags);13141314+ __l2c_op_way(base + L2X0_CLEAN_INV_WAY);13151315+ raw_spin_unlock_irqrestore(&l2x0_lock, flags);13161316+13171317+ writel_relaxed(0, base + AURORA_SYNC_REG);13181318+}13191319+13201320+static void aurora_cache_sync(void)13211321+{13221322+ writel_relaxed(0, l2x0_base + AURORA_SYNC_REG);13231323+}13241324+13251325+static void aurora_disable(void)13261326+{13271327+ void __iomem *base = l2x0_base;13281328+ unsigned long flags;13291329+13301330+ raw_spin_lock_irqsave(&l2x0_lock, flags);13311331+ __l2c_op_way(base + L2X0_CLEAN_INV_WAY);13321332+ writel_relaxed(0, base + AURORA_SYNC_REG);13331333+ l2c_write_sec(0, base, L2X0_CTRL);13341334+ dsb(st);13351335+ raw_spin_unlock_irqrestore(&l2x0_lock, flags);13471336}1348133713491338static void aurora_save(void __iomem *base)13501339{13511340 l2x0_saved_regs.ctrl = readl_relaxed(base + L2X0_CTRL);13521341 l2x0_saved_regs.aux_ctrl = readl_relaxed(base + L2X0_AUX_CTRL);13531353-}13541354-13551355-static void aurora_resume(void)13561356-{13571357- void __iomem *base = l2x0_base;13581358-13591359- if (!(readl(base + L2X0_CTRL) & L2X0_CTRL_EN)) {13601360- writel_relaxed(l2x0_saved_regs.aux_ctrl, base + L2X0_AUX_CTRL);13611361- writel_relaxed(l2x0_saved_regs.ctrl, base + L2X0_CTRL);13621362- }13631342}1364134313651344/*···14211398 .inv_range = aurora_inv_range,14221399 .clean_range = aurora_clean_range,14231400 .flush_range = aurora_flush_range,14241424- .flush_all = l2x0_flush_all,14251425- .disable = l2x0_disable,14261426- .sync = l2x0_cache_sync,14271427- .resume = aurora_resume,14011401+ .flush_all = aurora_flush_all,14021402+ .disable = aurora_disable,14031403+ .sync = aurora_cache_sync,14041404+ .resume = l2c_resume,14281405 },14291406};14301407···14371414 .fixup = aurora_fixup,14381415 .save = aurora_save,14391416 .outer_cache = {14401440- .resume = aurora_resume,14171417+ .resume = l2c_resume,14411418 },14421419};14431420···15851562 .of_parse = l2c310_of_parse,15861563 .enable = l2c310_enable,15871564 .save = l2c310_save,15651565+ .configure = l2c310_configure,15881566 .outer_cache = {15891567 .inv_range = bcm_inv_range,15901568 .clean_range = bcm_clean_range,···16071583 readl_relaxed(base + L310_PREFETCH_CTRL);16081584}1609158516101610-static void tauros3_resume(void)15861586+static void tauros3_configure(void __iomem *base)16111587{16121612- void __iomem *base = l2x0_base;16131613-16141614- if (!(readl_relaxed(base + L2X0_CTRL) & L2X0_CTRL_EN)) {16151615- writel_relaxed(l2x0_saved_regs.aux2_ctrl,16161616- base + TAUROS3_AUX2_CTRL);16171617- writel_relaxed(l2x0_saved_regs.prefetch_ctrl,16181618- base + L310_PREFETCH_CTRL);16191619-16201620- l2c_enable(base, l2x0_saved_regs.aux_ctrl, 8);16211621- }15881588+ writel_relaxed(l2x0_saved_regs.aux2_ctrl,15891589+ base + TAUROS3_AUX2_CTRL);15901590+ writel_relaxed(l2x0_saved_regs.prefetch_ctrl,15911591+ base + L310_PREFETCH_CTRL);16221592}1623159316241594static const struct l2c_init_data of_tauros3_data __initconst = {···16211603 .num_lock = 8,16221604 .enable = l2c_enable,16231605 .save = tauros3_save,16061606+ .configure = tauros3_configure,16241607 /* Tauros3 broadcasts L1 cache operations to L2 */16251608 .outer_cache = {16261626- .resume = tauros3_resume,16091609+ .resume = l2c_resume,16271610 },16281611};16291612···16801661 if (!of_property_read_bool(np, "cache-unified"))16811662 pr_err("L2C: device tree omits to specify unified cache\n");1682166316641664+ /* Read back current (default) hardware configuration */16651665+ if (data->save)16661666+ data->save(l2x0_base);16671667+16831668 /* L2 configuration can only be changed if the cache is disabled */16841669 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & L2X0_CTRL_EN))16851670 if (data->of_parse)···16941671 else16951672 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);1696167316971697- __l2c_init(data, aux_val, aux_mask, cache_id);16981698-16991699- return 0;16741674+ return __l2c_init(data, aux_val, aux_mask, cache_id);17001675}17011676#endif
+11-15
arch/arm/mm/context.c
···144144 /* Update the list of reserved ASIDs and the ASID bitmap. */145145 bitmap_clear(asid_map, 0, NUM_USER_ASIDS);146146 for_each_possible_cpu(i) {147147- if (i == cpu) {148148- asid = 0;149149- } else {150150- asid = atomic64_xchg(&per_cpu(active_asids, i), 0);151151- /*152152- * If this CPU has already been through a153153- * rollover, but hasn't run another task in154154- * the meantime, we must preserve its reserved155155- * ASID, as this is the only trace we have of156156- * the process it is still running.157157- */158158- if (asid == 0)159159- asid = per_cpu(reserved_asids, i);160160- __set_bit(asid & ~ASID_MASK, asid_map);161161- }147147+ asid = atomic64_xchg(&per_cpu(active_asids, i), 0);148148+ /*149149+ * If this CPU has already been through a150150+ * rollover, but hasn't run another task in151151+ * the meantime, we must preserve its reserved152152+ * ASID, as this is the only trace we have of153153+ * the process it is still running.154154+ */155155+ if (asid == 0)156156+ asid = per_cpu(reserved_asids, i);157157+ __set_bit(asid & ~ASID_MASK, asid_map);162158 per_cpu(reserved_asids, i) = asid;163159 }164160
···229229 depends on MIPS_GIC230230 select CLKSRC_OF231231232232+config CLKSRC_PXA233233+ def_bool y if ARCH_PXA || ARCH_SA1100234234+ select CLKSRC_OF if USE_OF235235+ help236236+ This enables OST0 support available on PXA and SA-11x0237237+ platforms.238238+232239endmenu
···1313config BITREVERSE1414 tristate15151616+config HAVE_ARCH_BITREVERSE1717+ boolean1818+ default n1919+ depends on BITREVERSE2020+ help2121+ This option provides an config for the architecture which have instruction2222+ can do bitreverse operation, we use the hardware instruction if the architecture2323+ have this capability.2424+1625config RATIONAL1726 boolean1827
+2-15
lib/bitrev.c
···11+#ifndef CONFIG_HAVE_ARCH_BITREVERSE12#include <linux/types.h>23#include <linux/module.h>34#include <linux/bitrev.h>···4342};4443EXPORT_SYMBOL_GPL(byte_rev_table);45444646-u16 bitrev16(u16 x)4747-{4848- return (bitrev8(x & 0xff) << 8) | bitrev8(x >> 8);4949-}5050-EXPORT_SYMBOL(bitrev16);5151-5252-/**5353- * bitrev32 - reverse the order of bits in a u32 value5454- * @x: value to be bit-reversed5555- */5656-u32 bitrev32(u32 x)5757-{5858- return (bitrev16(x & 0xffff) << 16) | bitrev16(x >> 16);5959-}6060-EXPORT_SYMBOL(bitrev32);4545+#endif /* CONFIG_HAVE_ARCH_BITREVERSE */