mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge branches 'fixes', 'mcpm', 'misc' and 'mmci' into for-next
This commit is contained in:
@@ -16,6 +16,9 @@ Required properties:
|
||||
performs the same operation).
|
||||
"marvell,"aurora-outer-cache: Marvell Controller designed to be
|
||||
compatible with the ARM one with outer cache mode.
|
||||
"bcm,bcm11351-a2-pl310-cache": For Broadcom bcm11351 chipset where an
|
||||
offset needs to be added to the address before passing down to the L2
|
||||
cache controller
|
||||
- cache-unified : Specifies the cache is a unified cache.
|
||||
- cache-level : Should be set to 2 for a level 2 cache.
|
||||
- reg : Physical base address and size of cache controller's memory mapped
|
||||
|
||||
@@ -175,6 +175,9 @@ config ARCH_HAS_CPUFREQ
|
||||
and that the relevant menu configurations are displayed for
|
||||
it.
|
||||
|
||||
config ARCH_HAS_BANDGAP
|
||||
bool
|
||||
|
||||
config GENERIC_HWEIGHT
|
||||
bool
|
||||
default y
|
||||
|
||||
+33
-26
@@ -59,37 +59,43 @@ comma = ,
|
||||
# Note that GCC does not numerically define an architecture version
|
||||
# macro, but instead defines a whole series of macros which makes
|
||||
# testing for a specific architecture or later rather impossible.
|
||||
arch-$(CONFIG_CPU_32v7) :=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
|
||||
arch-$(CONFIG_CPU_32v6) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
|
||||
arch-$(CONFIG_CPU_32v7) =-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
|
||||
arch-$(CONFIG_CPU_32v6) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
|
||||
# Only override the compiler option if ARMv6. The ARMv6K extensions are
|
||||
# always available in ARMv7
|
||||
ifeq ($(CONFIG_CPU_32v6),y)
|
||||
arch-$(CONFIG_CPU_32v6K) :=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
|
||||
arch-$(CONFIG_CPU_32v6K) =-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6k,-march=armv5t -Wa$(comma)-march=armv6k)
|
||||
endif
|
||||
arch-$(CONFIG_CPU_32v5) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
|
||||
arch-$(CONFIG_CPU_32v4T) :=-D__LINUX_ARM_ARCH__=4 -march=armv4t
|
||||
arch-$(CONFIG_CPU_32v4) :=-D__LINUX_ARM_ARCH__=4 -march=armv4
|
||||
arch-$(CONFIG_CPU_32v3) :=-D__LINUX_ARM_ARCH__=3 -march=armv3
|
||||
arch-$(CONFIG_CPU_32v5) =-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te,-march=armv4t)
|
||||
arch-$(CONFIG_CPU_32v4T) =-D__LINUX_ARM_ARCH__=4 -march=armv4t
|
||||
arch-$(CONFIG_CPU_32v4) =-D__LINUX_ARM_ARCH__=4 -march=armv4
|
||||
arch-$(CONFIG_CPU_32v3) =-D__LINUX_ARM_ARCH__=3 -march=armv3
|
||||
|
||||
# Evaluate arch cc-option calls now
|
||||
arch-y := $(arch-y)
|
||||
|
||||
# This selects how we optimise for the processor.
|
||||
tune-$(CONFIG_CPU_ARM7TDMI) :=-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM720T) :=-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM740T) :=-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM9TDMI) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM940T) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM946E) :=$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
|
||||
tune-$(CONFIG_CPU_ARM920T) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM922T) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM925T) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_FA526) :=-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
|
||||
tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
|
||||
tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
|
||||
tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
|
||||
tune-$(CONFIG_CPU_FEROCEON) :=$(call cc-option,-mtune=marvell-f,-mtune=xscale)
|
||||
tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
|
||||
tune-$(CONFIG_CPU_V6K) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
|
||||
tune-$(CONFIG_CPU_ARM7TDMI) =-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM720T) =-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM740T) =-mtune=arm7tdmi
|
||||
tune-$(CONFIG_CPU_ARM9TDMI) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM940T) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM946E) =$(call cc-option,-mtune=arm9e,-mtune=arm9tdmi)
|
||||
tune-$(CONFIG_CPU_ARM920T) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM922T) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM925T) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_ARM926T) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_FA526) =-mtune=arm9tdmi
|
||||
tune-$(CONFIG_CPU_SA110) =-mtune=strongarm110
|
||||
tune-$(CONFIG_CPU_SA1100) =-mtune=strongarm1100
|
||||
tune-$(CONFIG_CPU_XSCALE) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
|
||||
tune-$(CONFIG_CPU_XSC3) =$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
|
||||
tune-$(CONFIG_CPU_FEROCEON) =$(call cc-option,-mtune=marvell-f,-mtune=xscale)
|
||||
tune-$(CONFIG_CPU_V6) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
|
||||
tune-$(CONFIG_CPU_V6K) =$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
|
||||
|
||||
# Evaluate tune cc-option calls now
|
||||
tune-y := $(tune-y)
|
||||
|
||||
ifeq ($(CONFIG_AEABI),y)
|
||||
CFLAGS_ABI :=-mabi=aapcs-linux -mno-thumb-interwork
|
||||
@@ -289,9 +295,10 @@ zImage Image xipImage bootpImage uImage: vmlinux
|
||||
zinstall uinstall install: vmlinux
|
||||
$(Q)$(MAKE) $(build)=$(boot) MACHINE=$(MACHINE) $@
|
||||
|
||||
%.dtb: scripts
|
||||
%.dtb: | scripts
|
||||
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) $(boot)/dts/$@
|
||||
|
||||
PHONY += dtbs
|
||||
dtbs: scripts
|
||||
$(Q)$(MAKE) $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
|
||||
|
||||
|
||||
@@ -53,6 +53,17 @@ static const void *getprop(const void *fdt, const char *node_path,
|
||||
return fdt_getprop(fdt, offset, property, len);
|
||||
}
|
||||
|
||||
static uint32_t get_cell_size(const void *fdt)
|
||||
{
|
||||
int len;
|
||||
uint32_t cell_size = 1;
|
||||
const uint32_t *size_len = getprop(fdt, "/", "#size-cells", &len);
|
||||
|
||||
if (size_len)
|
||||
cell_size = fdt32_to_cpu(*size_len);
|
||||
return cell_size;
|
||||
}
|
||||
|
||||
static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
|
||||
{
|
||||
char cmdline[COMMAND_LINE_SIZE];
|
||||
@@ -95,9 +106,11 @@ static void merge_fdt_bootargs(void *fdt, const char *fdt_cmdline)
|
||||
int atags_to_fdt(void *atag_list, void *fdt, int total_space)
|
||||
{
|
||||
struct tag *atag = atag_list;
|
||||
uint32_t mem_reg_property[2 * NR_BANKS];
|
||||
/* In the case of 64 bits memory size, need to reserve 2 cells for
|
||||
* address and size for each bank */
|
||||
uint32_t mem_reg_property[2 * 2 * NR_BANKS];
|
||||
int memcount = 0;
|
||||
int ret;
|
||||
int ret, memsize;
|
||||
|
||||
/* make sure we've got an aligned pointer */
|
||||
if ((u32)atag_list & 0x3)
|
||||
@@ -137,8 +150,25 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
|
||||
continue;
|
||||
if (!atag->u.mem.size)
|
||||
continue;
|
||||
mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.start);
|
||||
mem_reg_property[memcount++] = cpu_to_fdt32(atag->u.mem.size);
|
||||
memsize = get_cell_size(fdt);
|
||||
|
||||
if (memsize == 2) {
|
||||
/* if memsize is 2, that means that
|
||||
* each data needs 2 cells of 32 bits,
|
||||
* so the data are 64 bits */
|
||||
uint64_t *mem_reg_prop64 =
|
||||
(uint64_t *)mem_reg_property;
|
||||
mem_reg_prop64[memcount++] =
|
||||
cpu_to_fdt64(atag->u.mem.start);
|
||||
mem_reg_prop64[memcount++] =
|
||||
cpu_to_fdt64(atag->u.mem.size);
|
||||
} else {
|
||||
mem_reg_property[memcount++] =
|
||||
cpu_to_fdt32(atag->u.mem.start);
|
||||
mem_reg_property[memcount++] =
|
||||
cpu_to_fdt32(atag->u.mem.size);
|
||||
}
|
||||
|
||||
} else if (atag->hdr.tag == ATAG_INITRD2) {
|
||||
uint32_t initrd_start, initrd_size;
|
||||
initrd_start = atag->u.initrd.start;
|
||||
@@ -150,8 +180,10 @@ int atags_to_fdt(void *atag_list, void *fdt, int total_space)
|
||||
}
|
||||
}
|
||||
|
||||
if (memcount)
|
||||
setprop(fdt, "/memory", "reg", mem_reg_property, 4*memcount);
|
||||
if (memcount) {
|
||||
setprop(fdt, "/memory", "reg", mem_reg_property,
|
||||
4 * memcount * memsize);
|
||||
}
|
||||
|
||||
return fdt_pack(fdt);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,6 @@ start:
|
||||
mov r7, r1 @ save architecture ID
|
||||
mov r8, r2 @ save atags pointer
|
||||
|
||||
#ifndef __ARM_ARCH_2__
|
||||
/*
|
||||
* Booting from Angel - need to enter SVC mode and disable
|
||||
* FIQs/IRQs (numeric definitions from angel arm.h source).
|
||||
@@ -158,10 +157,6 @@ not_angel:
|
||||
safe_svcmode_maskall r0
|
||||
msr spsr_cxsf, r9 @ Save the CPU boot mode in
|
||||
@ SPSR
|
||||
#else
|
||||
teqp pc, #0x0c000003 @ turn off interrupts
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note that some cache flushing and other stuff may
|
||||
* be needed here - is there an Angel SWI call for this?
|
||||
@@ -183,7 +178,19 @@ not_angel:
|
||||
ldr r4, =zreladdr
|
||||
#endif
|
||||
|
||||
bl cache_on
|
||||
/*
|
||||
* Set up a page table only if it won't overwrite ourself.
|
||||
* That means r4 < pc && r4 - 16k page directory > &_end.
|
||||
* Given that r4 > &_end is most unfrequent, we add a rough
|
||||
* additional 1MB of room for a possible appended DTB.
|
||||
*/
|
||||
mov r0, pc
|
||||
cmp r0, r4
|
||||
ldrcc r0, LC0+32
|
||||
addcc r0, r0, pc
|
||||
cmpcc r4, r0
|
||||
orrcc r4, r4, #1 @ remember we skipped cache_on
|
||||
blcs cache_on
|
||||
|
||||
restart: adr r0, LC0
|
||||
ldmia r0, {r1, r2, r3, r6, r10, r11, r12}
|
||||
@@ -229,7 +236,7 @@ restart: adr r0, LC0
|
||||
* r0 = delta
|
||||
* r2 = BSS start
|
||||
* r3 = BSS end
|
||||
* r4 = final kernel address
|
||||
* r4 = final kernel address (possibly with LSB set)
|
||||
* r5 = appended dtb size (still unknown)
|
||||
* r6 = _edata
|
||||
* r7 = architecture ID
|
||||
@@ -277,6 +284,7 @@ restart: adr r0, LC0
|
||||
*/
|
||||
cmp r0, #1
|
||||
sub r0, r4, #TEXT_OFFSET
|
||||
bic r0, r0, #1
|
||||
add r0, r0, #0x100
|
||||
mov r1, r6
|
||||
sub r2, sp, r6
|
||||
@@ -323,12 +331,13 @@ dtb_check_done:
|
||||
|
||||
/*
|
||||
* Check to see if we will overwrite ourselves.
|
||||
* r4 = final kernel address
|
||||
* r4 = final kernel address (possibly with LSB set)
|
||||
* r9 = size of decompressed image
|
||||
* r10 = end of this image, including bss/stack/malloc space if non XIP
|
||||
* We basically want:
|
||||
* r4 - 16k page directory >= r10 -> OK
|
||||
* r4 + image length <= address of wont_overwrite -> OK
|
||||
* Note: the possible LSB in r4 is harmless here.
|
||||
*/
|
||||
add r10, r10, #16384
|
||||
cmp r4, r10
|
||||
@@ -390,7 +399,8 @@ dtb_check_done:
|
||||
add sp, sp, r6
|
||||
#endif
|
||||
|
||||
bl cache_clean_flush
|
||||
tst r4, #1
|
||||
bleq cache_clean_flush
|
||||
|
||||
adr r0, BSYM(restart)
|
||||
add r0, r0, r6
|
||||
@@ -402,7 +412,7 @@ wont_overwrite:
|
||||
* r0 = delta
|
||||
* r2 = BSS start
|
||||
* r3 = BSS end
|
||||
* r4 = kernel execution address
|
||||
* r4 = kernel execution address (possibly with LSB set)
|
||||
* r5 = appended dtb size (0 if not present)
|
||||
* r7 = architecture ID
|
||||
* r8 = atags pointer
|
||||
@@ -465,6 +475,15 @@ not_relocated: mov r0, #0
|
||||
cmp r2, r3
|
||||
blo 1b
|
||||
|
||||
/*
|
||||
* Did we skip the cache setup earlier?
|
||||
* That is indicated by the LSB in r4.
|
||||
* Do it now if so.
|
||||
*/
|
||||
tst r4, #1
|
||||
bic r4, r4, #1
|
||||
blne cache_on
|
||||
|
||||
/*
|
||||
* The C runtime environment should now be setup sufficiently.
|
||||
* Set up some pointers, and start decompressing.
|
||||
@@ -513,6 +532,7 @@ LC0: .word LC0 @ r1
|
||||
.word _got_start @ r11
|
||||
.word _got_end @ ip
|
||||
.word .L_user_stack_end @ sp
|
||||
.word _end - restart + 16384 + 1024*1024
|
||||
.size LC0, . - LC0
|
||||
|
||||
#ifdef CONFIG_ARCH_RPC
|
||||
|
||||
@@ -47,10 +47,10 @@
|
||||
};
|
||||
|
||||
L2: l2-cache {
|
||||
compatible = "arm,pl310-cache";
|
||||
reg = <0x3ff20000 0x1000>;
|
||||
cache-unified;
|
||||
cache-level = <2>;
|
||||
compatible = "bcm,bcm11351-a2-pl310-cache";
|
||||
reg = <0x3ff20000 0x1000>;
|
||||
cache-unified;
|
||||
cache-level = <2>;
|
||||
};
|
||||
|
||||
timer@35006000 {
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
1901: adr r0, 1902b
|
||||
bl printascii
|
||||
mov r0, r9
|
||||
bl printhex8
|
||||
bl printhex2
|
||||
adr r0, 1903b
|
||||
bl printascii
|
||||
mov r0, r10
|
||||
bl printhex8
|
||||
bl printhex2
|
||||
adr r0, 1904b
|
||||
bl printascii
|
||||
#endif
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
#include <asm/smp.h>
|
||||
#include <asm/smp_plat.h>
|
||||
|
||||
static void __init simple_smp_init_cpus(void)
|
||||
{
|
||||
}
|
||||
|
||||
static int __cpuinit mcpm_boot_secondary(unsigned int cpu, struct task_struct *idle)
|
||||
{
|
||||
unsigned int mpidr, pcpu, pcluster, ret;
|
||||
@@ -74,7 +70,6 @@ static void mcpm_cpu_die(unsigned int cpu)
|
||||
#endif
|
||||
|
||||
static struct smp_operations __initdata mcpm_smp_ops = {
|
||||
.smp_init_cpus = simple_smp_init_cpus,
|
||||
.smp_boot_secondary = mcpm_boot_secondary,
|
||||
.smp_secondary_init = mcpm_secondary_init,
|
||||
#ifdef CONFIG_HOTPLUG_CPU
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
__rem; \
|
||||
})
|
||||
|
||||
#if __GNUC__ < 4
|
||||
#if __GNUC__ < 4 || !defined(CONFIG_AEABI)
|
||||
|
||||
/*
|
||||
* gcc versions earlier than 4.0 are simply too problematic for the
|
||||
|
||||
@@ -130,16 +130,16 @@ static inline u32 __raw_readl(const volatile void __iomem *addr)
|
||||
*/
|
||||
extern void __iomem *__arm_ioremap_pfn_caller(unsigned long, unsigned long,
|
||||
size_t, unsigned int, void *);
|
||||
extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
|
||||
extern void __iomem *__arm_ioremap_caller(phys_addr_t, size_t, unsigned int,
|
||||
void *);
|
||||
|
||||
extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
|
||||
extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
|
||||
extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
|
||||
extern void __iomem *__arm_ioremap(phys_addr_t, size_t, unsigned int);
|
||||
extern void __iomem *__arm_ioremap_exec(phys_addr_t, size_t, bool cached);
|
||||
extern void __iounmap(volatile void __iomem *addr);
|
||||
extern void __arm_iounmap(volatile void __iomem *addr);
|
||||
|
||||
extern void __iomem * (*arch_ioremap_caller)(unsigned long, size_t,
|
||||
extern void __iomem * (*arch_ioremap_caller)(phys_addr_t, size_t,
|
||||
unsigned int, void *);
|
||||
extern void (*arch_iounmap)(volatile void __iomem *);
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/cachetype.h>
|
||||
#include <asm/proc-fns.h>
|
||||
#include <asm/smp_plat.h>
|
||||
#include <asm-generic/mm_hooks.h>
|
||||
|
||||
void __check_vmalloc_seq(struct mm_struct *mm);
|
||||
@@ -27,7 +28,15 @@ void __check_vmalloc_seq(struct mm_struct *mm);
|
||||
void check_and_switch_context(struct mm_struct *mm, struct task_struct *tsk);
|
||||
#define init_new_context(tsk,mm) ({ atomic64_set(&mm->context.id, 0); 0; })
|
||||
|
||||
DECLARE_PER_CPU(atomic64_t, active_asids);
|
||||
#ifdef CONFIG_ARM_ERRATA_798181
|
||||
void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
|
||||
cpumask_t *mask);
|
||||
#else /* !CONFIG_ARM_ERRATA_798181 */
|
||||
static inline void a15_erratum_get_cpumask(int this_cpu, struct mm_struct *mm,
|
||||
cpumask_t *mask)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_ARM_ERRATA_798181 */
|
||||
|
||||
#else /* !CONFIG_CPU_HAS_ASID */
|
||||
|
||||
@@ -98,12 +107,16 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
|
||||
#ifdef CONFIG_MMU
|
||||
unsigned int cpu = smp_processor_id();
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* check for possible thread migration */
|
||||
if (!cpumask_empty(mm_cpumask(next)) &&
|
||||
/*
|
||||
* __sync_icache_dcache doesn't broadcast the I-cache invalidation,
|
||||
* so check for possible thread migration and invalidate the I-cache
|
||||
* if we're new to this CPU.
|
||||
*/
|
||||
if (cache_ops_need_broadcast() &&
|
||||
!cpumask_empty(mm_cpumask(next)) &&
|
||||
!cpumask_test_cpu(cpu, mm_cpumask(next)))
|
||||
__flush_icache_all();
|
||||
#endif
|
||||
|
||||
if (!cpumask_test_and_set_cpu(cpu, mm_cpumask(next)) || prev != next) {
|
||||
check_and_switch_context(next, tsk);
|
||||
if (cache_is_vivt())
|
||||
|
||||
@@ -97,19 +97,22 @@ static inline void arch_spin_lock(arch_spinlock_t *lock)
|
||||
|
||||
static inline int arch_spin_trylock(arch_spinlock_t *lock)
|
||||
{
|
||||
unsigned long tmp;
|
||||
unsigned long contended, res;
|
||||
u32 slock;
|
||||
|
||||
__asm__ __volatile__(
|
||||
" ldrex %0, [%2]\n"
|
||||
" subs %1, %0, %0, ror #16\n"
|
||||
" addeq %0, %0, %3\n"
|
||||
" strexeq %1, %0, [%2]"
|
||||
: "=&r" (slock), "=&r" (tmp)
|
||||
: "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
|
||||
: "cc");
|
||||
do {
|
||||
__asm__ __volatile__(
|
||||
" ldrex %0, [%3]\n"
|
||||
" mov %2, #0\n"
|
||||
" subs %1, %0, %0, ror #16\n"
|
||||
" addeq %0, %0, %4\n"
|
||||
" strexeq %2, %0, [%3]"
|
||||
: "=&r" (slock), "=&r" (contended), "=r" (res)
|
||||
: "r" (&lock->slock), "I" (1 << TICKET_SHIFT)
|
||||
: "cc");
|
||||
} while (res);
|
||||
|
||||
if (tmp == 0) {
|
||||
if (!contended) {
|
||||
smp_mb();
|
||||
return 1;
|
||||
} else {
|
||||
|
||||
@@ -58,7 +58,7 @@ struct thread_info {
|
||||
struct cpu_context_save cpu_context; /* cpu context */
|
||||
__u32 syscall; /* syscall number */
|
||||
__u8 used_cp[16]; /* thread used copro */
|
||||
unsigned long tp_value;
|
||||
unsigned long tp_value[2]; /* TLS registers */
|
||||
#ifdef CONFIG_CRUNCH
|
||||
struct crunch_state crunchstate;
|
||||
#endif
|
||||
|
||||
+27
-13
@@ -2,27 +2,30 @@
|
||||
#define __ASMARM_TLS_H
|
||||
|
||||
#ifdef __ASSEMBLY__
|
||||
.macro set_tls_none, tp, tmp1, tmp2
|
||||
#include <asm/asm-offsets.h>
|
||||
.macro switch_tls_none, base, tp, tpuser, tmp1, tmp2
|
||||
.endm
|
||||
|
||||
.macro set_tls_v6k, tp, tmp1, tmp2
|
||||
.macro switch_tls_v6k, base, tp, tpuser, tmp1, tmp2
|
||||
mrc p15, 0, \tmp2, c13, c0, 2 @ get the user r/w register
|
||||
mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
|
||||
mov \tmp1, #0
|
||||
mcr p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
|
||||
mcr p15, 0, \tpuser, c13, c0, 2 @ and the user r/w register
|
||||
str \tmp2, [\base, #TI_TP_VALUE + 4] @ save it
|
||||
.endm
|
||||
|
||||
.macro set_tls_v6, tp, tmp1, tmp2
|
||||
.macro switch_tls_v6, base, tp, tpuser, tmp1, tmp2
|
||||
ldr \tmp1, =elf_hwcap
|
||||
ldr \tmp1, [\tmp1, #0]
|
||||
mov \tmp2, #0xffff0fff
|
||||
tst \tmp1, #HWCAP_TLS @ hardware TLS available?
|
||||
mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
|
||||
movne \tmp1, #0
|
||||
mcrne p15, 0, \tmp1, c13, c0, 2 @ clear user r/w TLS register
|
||||
streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
|
||||
mrcne p15, 0, \tmp2, c13, c0, 2 @ get the user r/w register
|
||||
mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
|
||||
mcrne p15, 0, \tpuser, c13, c0, 2 @ set user r/w register
|
||||
strne \tmp2, [\base, #TI_TP_VALUE + 4] @ save it
|
||||
.endm
|
||||
|
||||
.macro set_tls_software, tp, tmp1, tmp2
|
||||
.macro switch_tls_software, base, tp, tpuser, tmp1, tmp2
|
||||
mov \tmp1, #0xffff0fff
|
||||
str \tp, [\tmp1, #-15] @ set TLS value at 0xffff0ff0
|
||||
.endm
|
||||
@@ -31,19 +34,30 @@
|
||||
#ifdef CONFIG_TLS_REG_EMUL
|
||||
#define tls_emu 1
|
||||
#define has_tls_reg 1
|
||||
#define set_tls set_tls_none
|
||||
#define switch_tls switch_tls_none
|
||||
#elif defined(CONFIG_CPU_V6)
|
||||
#define tls_emu 0
|
||||
#define has_tls_reg (elf_hwcap & HWCAP_TLS)
|
||||
#define set_tls set_tls_v6
|
||||
#define switch_tls switch_tls_v6
|
||||
#elif defined(CONFIG_CPU_32v6K)
|
||||
#define tls_emu 0
|
||||
#define has_tls_reg 1
|
||||
#define set_tls set_tls_v6k
|
||||
#define switch_tls switch_tls_v6k
|
||||
#else
|
||||
#define tls_emu 0
|
||||
#define has_tls_reg 0
|
||||
#define set_tls set_tls_software
|
||||
#define switch_tls switch_tls_software
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
static inline unsigned long get_tpuser(void)
|
||||
{
|
||||
unsigned long reg = 0;
|
||||
|
||||
if (has_tls_reg && !tls_emu)
|
||||
__asm__("mrc p15, 0, %0, c13, c0, 2" : "=r" (reg));
|
||||
|
||||
return reg;
|
||||
}
|
||||
#endif
|
||||
#endif /* __ASMARM_TLS_H */
|
||||
|
||||
@@ -685,15 +685,16 @@ ENTRY(__switch_to)
|
||||
UNWIND(.fnstart )
|
||||
UNWIND(.cantunwind )
|
||||
add ip, r1, #TI_CPU_SAVE
|
||||
ldr r3, [r2, #TI_TP_VALUE]
|
||||
ARM( stmia ip!, {r4 - sl, fp, sp, lr} ) @ Store most regs on stack
|
||||
THUMB( stmia ip!, {r4 - sl, fp} ) @ Store most regs on stack
|
||||
THUMB( str sp, [ip], #4 )
|
||||
THUMB( str lr, [ip], #4 )
|
||||
ldr r4, [r2, #TI_TP_VALUE]
|
||||
ldr r5, [r2, #TI_TP_VALUE + 4]
|
||||
#ifdef CONFIG_CPU_USE_DOMAINS
|
||||
ldr r6, [r2, #TI_CPU_DOMAIN]
|
||||
#endif
|
||||
set_tls r3, r4, r5
|
||||
switch_tls r1, r4, r5, r3, r7
|
||||
#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
|
||||
ldr r7, [r2, #TI_TASK]
|
||||
ldr r8, =__stack_chk_guard
|
||||
|
||||
@@ -362,6 +362,16 @@ ENTRY(vector_swi)
|
||||
str r0, [sp, #S_OLD_R0] @ Save OLD_R0
|
||||
zero_fp
|
||||
|
||||
#ifdef CONFIG_ALIGNMENT_TRAP
|
||||
ldr ip, __cr_alignment
|
||||
ldr ip, [ip]
|
||||
mcr p15, 0, ip, c1, c0 @ update control register
|
||||
#endif
|
||||
|
||||
enable_irq
|
||||
ct_user_exit
|
||||
get_thread_info tsk
|
||||
|
||||
/*
|
||||
* Get the system call number.
|
||||
*/
|
||||
@@ -375,9 +385,9 @@ ENTRY(vector_swi)
|
||||
#ifdef CONFIG_ARM_THUMB
|
||||
tst r8, #PSR_T_BIT
|
||||
movne r10, #0 @ no thumb OABI emulation
|
||||
ldreq r10, [lr, #-4] @ get SWI instruction
|
||||
USER( ldreq r10, [lr, #-4] ) @ get SWI instruction
|
||||
#else
|
||||
ldr r10, [lr, #-4] @ get SWI instruction
|
||||
USER( ldr r10, [lr, #-4] ) @ get SWI instruction
|
||||
#endif
|
||||
#ifdef CONFIG_CPU_ENDIAN_BE8
|
||||
rev r10, r10 @ little endian instruction
|
||||
@@ -392,22 +402,13 @@ ENTRY(vector_swi)
|
||||
/* Legacy ABI only, possibly thumb mode. */
|
||||
tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
|
||||
addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
|
||||
ldreq scno, [lr, #-4]
|
||||
USER( ldreq scno, [lr, #-4] )
|
||||
|
||||
#else
|
||||
/* Legacy ABI only. */
|
||||
ldr scno, [lr, #-4] @ get SWI instruction
|
||||
USER( ldr scno, [lr, #-4] ) @ get SWI instruction
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ALIGNMENT_TRAP
|
||||
ldr ip, __cr_alignment
|
||||
ldr ip, [ip]
|
||||
mcr p15, 0, ip, c1, c0 @ update control register
|
||||
#endif
|
||||
enable_irq
|
||||
ct_user_exit
|
||||
|
||||
get_thread_info tsk
|
||||
adr tbl, sys_call_table @ load syscall table pointer
|
||||
|
||||
#if defined(CONFIG_OABI_COMPAT)
|
||||
@@ -442,6 +443,21 @@ local_restart:
|
||||
eor r0, scno, #__NR_SYSCALL_BASE @ put OS number back
|
||||
bcs arm_syscall
|
||||
b sys_ni_syscall @ not private func
|
||||
|
||||
#if defined(CONFIG_OABI_COMPAT) || !defined(CONFIG_AEABI)
|
||||
/*
|
||||
* We failed to handle a fault trying to access the page
|
||||
* containing the swi instruction, but we're not really in a
|
||||
* position to return -EFAULT. Instead, return back to the
|
||||
* instruction and re-enter the user fault handling path trying
|
||||
* to page it in. This will likely result in sending SEGV to the
|
||||
* current task.
|
||||
*/
|
||||
9001:
|
||||
sub lr, lr, #4
|
||||
str lr, [sp, #S_PC]
|
||||
b ret_fast_syscall
|
||||
#endif
|
||||
ENDPROC(vector_swi)
|
||||
|
||||
/*
|
||||
|
||||
@@ -569,6 +569,7 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs)
|
||||
return;
|
||||
}
|
||||
|
||||
perf_callchain_store(entry, regs->ARM_pc);
|
||||
tail = (struct frame_tail __user *)regs->ARM_fp - 1;
|
||||
|
||||
while ((entry->nr < PERF_MAX_STACK_DEPTH) &&
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <asm/thread_notify.h>
|
||||
#include <asm/stacktrace.h>
|
||||
#include <asm/mach/time.h>
|
||||
#include <asm/tls.h>
|
||||
|
||||
#ifdef CONFIG_CC_STACKPROTECTOR
|
||||
#include <linux/stackprotector.h>
|
||||
@@ -374,7 +375,8 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start,
|
||||
clear_ptrace_hw_breakpoint(p);
|
||||
|
||||
if (clone_flags & CLONE_SETTLS)
|
||||
thread->tp_value = childregs->ARM_r3;
|
||||
thread->tp_value[0] = childregs->ARM_r3;
|
||||
thread->tp_value[1] = get_tpuser();
|
||||
|
||||
thread_notify(THREAD_NOTIFY_COPY, thread);
|
||||
|
||||
|
||||
@@ -849,7 +849,7 @@ long arch_ptrace(struct task_struct *child, long request,
|
||||
#endif
|
||||
|
||||
case PTRACE_GET_THREAD_AREA:
|
||||
ret = put_user(task_thread_info(child)->tp_value,
|
||||
ret = put_user(task_thread_info(child)->tp_value[0],
|
||||
datap);
|
||||
break;
|
||||
|
||||
|
||||
@@ -456,6 +456,13 @@ void __init smp_setup_processor_id(void)
|
||||
for (i = 1; i < nr_cpu_ids; ++i)
|
||||
cpu_logical_map(i) = i == cpu ? 0 : i;
|
||||
|
||||
/*
|
||||
* clear __my_cpu_offset on boot CPU to avoid hang caused by
|
||||
* using percpu variable early, for example, lockdep will
|
||||
* access percpu variable inside lock_release
|
||||
*/
|
||||
set_my_cpu_offset(0);
|
||||
|
||||
printk(KERN_INFO "Booting Linux on physical CPU 0x%x\n", mpidr);
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user