firefly-linux-kernel-4.4.55.git
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
Mark Brown [Fri, 30 May 2014 17:26:54 +0000 (18:26 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk

10 years agoconfigs: Enable function tracing
Mark Brown [Fri, 30 May 2014 17:26:10 +0000 (18:26 +0100)]
configs: Enable function tracing

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-ftrace' into linux-linaro-lsk
Mark Brown [Fri, 30 May 2014 17:18:44 +0000 (18:18 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-ftrace' into linux-linaro-lsk

Conflicts:
arch/arm64/Kconfig
arch/arm64/kernel/Makefile
arch/arm64/kernel/hw_breakpoint.c
arch/arm64/kernel/ptrace.c

10 years agoarm64: ftrace: (bugfix) synced with ftcace interface change
AKASHI Takahiro [Fri, 30 May 2014 02:23:41 +0000 (11:23 +0900)]
arm64: ftrace: (bugfix) synced with ftcace interface change

ftrace_init() failed since ftrace_dyn_arch_init() doesn't initialize
the argument to null.
This bug comes in only if arm64 ftrace is back-ported as
ftrace_dyn_arch_init() interface has been changed in the merge window of
3.15.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add __ASSEMBLY__ guards to insn.h
Mark Brown [Thu, 29 May 2014 15:02:15 +0000 (16:02 +0100)]
arm64: Add __ASSEMBLY__ guards to insn.h

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: ftrace: Add system call tracepoint
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:36 +0000 (18:54 +0900)]
arm64: ftrace: Add system call tracepoint

This patch allows system call entry or exit to be traced as ftrace events,
ie. sys_enter_*/sys_exit_*, if CONFIG_FTRACE_SYSCALLS is enabled.
Those events appear and can be controlled under
    ${sysfs}/tracing/events/syscalls/

Please note that we can't trace compat system calls here because
AArch32 mode does not share the same syscall table with AArch64.
Just define ARCH_TRACE_IGNORE_COMPAT_SYSCALLS in order to avoid unexpected
results (bogus syscalls reported or even hang-up).

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: ftrace: Add CALLER_ADDRx macros
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:35 +0000 (18:54 +0900)]
arm64: ftrace: Add CALLER_ADDRx macros

CALLER_ADDRx returns caller's address at specified level in call stacks.
They are used for several tracers like irqsoff and preemptoff.
Strange to say, however, they are refered even without FTRACE.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: ftrace: Add dynamic ftrace support
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:34 +0000 (18:54 +0900)]
arm64: ftrace: Add dynamic ftrace support

This patch allows "dynamic ftrace" if CONFIG_DYNAMIC_FTRACE is enabled.
Here we can turn on and off tracing dynamically per-function base.

On arm64, this is done by patching single branch instruction to _mcount()
inserted by gcc -pg option. The branch is replaced to NOP initially at
kernel start up, and later on, NOP to branch to ftrace_caller() when
enabled or branch to NOP when disabled.
Please note that ftrace_caller() is a counterpart of _mcount() in case of
'static' ftrace.

More details on architecture specific requirements are described in
Documentation/trace/ftrace-design.txt.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add ftrace support
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:33 +0000 (18:54 +0900)]
arm64: Add ftrace support

This patch implements arm64 specific part to support function tracers,
such as function (CONFIG_FUNCTION_TRACER), function_graph
(CONFIG_FUNCTION_GRAPH_TRACER) and function profiler
(CONFIG_FUNCTION_PROFILER).

With 'function' tracer, all the functions in the kernel are traced with
timestamps in ${sysfs}/tracing/trace. If function_graph tracer is
specified, call graph is generated.

The kernel must be compiled with -pg option so that _mcount() is inserted
at the beginning of functions. This function is called on every function's
entry as long as tracing is enabled.
In addition, function_graph tracer also needs to be able to probe function's
exit. ftrace_graph_caller() & return_to_handler do this by faking link
register's value to intercept function's return path.

More details on architecture specific requirements are described in
Documentation/trace/ftrace-design.txt.

Reviewed-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoftrace: Add arm64 support to recordmcount
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:32 +0000 (18:54 +0900)]
ftrace: Add arm64 support to recordmcount

Recordmcount utility under scripts is run, after compiling each object,
to find out all the locations of calling _mcount() and put them into
specific seciton named __mcount_loc.
Then linker collects all such information into a table in the kernel image
(between __start_mcount_loc and __stop_mcount_loc) for later use by ftrace.

This patch adds arm64 specific definitions to identify such locations.
There are two types of implementation, C and Perl. On arm64, only C version
is used to build the kernel now that CONFIG_HAVE_C_RECORDMCOUNT is on.
But Perl version is also maintained.

This patch also contains a workaround just in case where a header file,
elf.h, on host machine doesn't have definitions of EM_AARCH64 nor
R_AARCH64_ABS64. Without them, compiling C version of recordmcount will
fail.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add 'notrace' attribute to unwind_frame() for ftrace
AKASHI Takahiro [Sat, 15 Mar 2014 05:40:43 +0000 (14:40 +0900)]
arm64: Add 'notrace' attribute to unwind_frame() for ftrace

walk_stackframe() calls unwind_frame(), and if walk_stackframe() is
"notrace", unwind_frame() should be also "notrace".

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoftrace: make CALLER_ADDRx macros more generic
AKASHI Takahiro [Wed, 30 Apr 2014 09:54:29 +0000 (18:54 +0900)]
ftrace: make CALLER_ADDRx macros more generic

Most archs with HAVE_ARCH_CALLER_ADDR have the almost same definitions
of CALLER_ADDRx(n), and so put them into linux/ftrace.h.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: is_compat_task is defined both in asm/compat.h and linux/compat.h
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:32 +0000 (10:51 +0100)]
arm64: is_compat_task is defined both in asm/compat.h and linux/compat.h

Some kernel files may include both linux/compat.h and asm/compat.h directly
or indirectly. Since both header files contain is_compat_task() under
!CONFIG_COMPAT, compiling them with !CONFIG_COMPAT will eventually fail.
Such files include kernel/auditsc.c, kernel/seccomp.c and init/do_mountfs.c
(do_mountfs.c may read asm/compat.h via asm/ftrace.h once ftrace is
implemented).

So this patch proactively
1) removes is_compat_task() under !CONFIG_COMPAT from asm/compat.h
2) replaces asm/compat.h to linux/compat.h in kernel/*.c,
   but asm/compat.h is still necessary in ptrace.c and process.c because
   they use is_compat_thread().

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit fd92d4a54a069953b4679958121317f2a25389cd)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kernel/hw_breakpoint.c

10 years agoarm64: Add regs_return_value() in syscall.h
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:31 +0000 (10:51 +0100)]
arm64: Add regs_return_value() in syscall.h

This macro, regs_return_value, is used mainly for audit to record system
call's results, but may also be used in test_kprobes.c.

Acked-by: Will Deacon <will.deacon@arm.com>
Acked-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit d34a3ebd8d25cf691a94fae66a957a480cf46430)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: split syscall_trace() into separate functions for enter/exit
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:30 +0000 (10:51 +0100)]
arm64: split syscall_trace() into separate functions for enter/exit

As done in arm, this change makes it easy to confirm we invoke syscall
related hooks, including syscall tracepoint, audit and seccomp which would
be implemented later, in correct order. That is, undoing operations in the
opposite order on exit that they were done on entry.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 3157858feff89196635b01495d5ec9ebe206639e)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kernel/ptrace.c

10 years agoarm64: make a single hook to syscall_trace() for all syscall features
AKASHI Takahiro [Wed, 30 Apr 2014 09:51:29 +0000 (10:51 +0100)]
arm64: make a single hook to syscall_trace() for all syscall features

Currently syscall_trace() is called only for ptrace.
With additional TIF_xx flags defined, it is now called in all the cases
of audit, ftrace and seccomp in addition to ptrace.

Acked-by: Richard Guy Briggs <rgb@redhat.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 449f81a4da4d99980064943d504bb19d07e86aec)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kernel/entry.S

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-hugepages' into linux-linaro-lsk
Mark Brown [Fri, 30 May 2014 14:18:38 +0000 (15:18 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-hugepages' into linux-linaro-lsk

10 years agoarm64: mm: fix pmd_write CoW brokenness
Will Deacon [Tue, 27 May 2014 18:11:58 +0000 (19:11 +0100)]
arm64: mm: fix pmd_write CoW brokenness

Commit 9c7e535fcc17 ("arm64: mm: Route pmd thp functions through pte
equivalents") changed the pmd manipulator and accessor functions to
convert the target pmd to a pte, process it with the pte functions, then
convert it back. Along the way, we gained support for PTE_WRITE, however
this is completely ignored by set_pmd_at, and so we fail to set the
PMD_SECT_RDONLY for PMDs, resulting in all sorts of lovely failures (like
CoW not working).

Partially reverting the offending commit (by making use of
PMD_SECT_RDONLY explicitly for pmd_{write,wrprotect,mkwrite} functions)
leads to further issues because pmd_write can then return potentially
incorrect values for page table entries marked as RDONLY, leading to
BUG_ON(pmd_write(entry)) tripping under some THP workloads.

This patch fixes the issue by routing set_pmd_at through set_pte_at,
which correctly takes the PTE_WRITE flag into account. Given that
THP mappings are always anonymous, the additional cache-flushing code
in __sync_icache_dcache won't impose any significant overhead as the
flush will be skipped.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Steve Capper <steve.capper@arm.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit ceb218359de22e70980801d4fa04fffbfc44adb8)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
Mark Brown [Fri, 30 May 2014 10:28:41 +0000 (11:28 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk

10 years agoconfigs: Enable ARMv8 PSCI based cpuidle
Mark Brown [Fri, 30 May 2014 10:27:15 +0000 (11:27 +0100)]
configs: Enable ARMv8 PSCI based cpuidle

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-cpuidle' into linux-linaro-lsk
Mark Brown [Fri, 30 May 2014 10:14:13 +0000 (11:14 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-cpuidle' into linux-linaro-lsk

Conflicts:
drivers/cpuidle/Makefile

10 years agocpuidle: Add cpumask to ease backporting
Mark Brown [Thu, 29 May 2014 22:05:18 +0000 (23:05 +0100)]
cpuidle: Add cpumask to ease backporting

To make backporting a little easier provide a cpumask variable in the
driver struct - the core won't do anything with it but it's less code
to maintain.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: boot: dts: update rtsm aemv8 dts with PSCI and idle states
Lorenzo Pieralisi [Fri, 14 Mar 2014 11:10:35 +0000 (11:10 +0000)]
arm64: boot: dts: update rtsm aemv8 dts with PSCI and idle states

This patch updates the RTSM dts file with PSCI bindings and nodes
describing the AEMv8 model idle states parameters.

PSCI function IDs compliancy with PSCI v0.2 is still under development
so this patch provides PSCI function IDs for demonstration purposes only.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agodrivers: cpuidle: CPU idle ARM64 driver
Lorenzo Pieralisi [Fri, 28 Feb 2014 13:03:44 +0000 (13:03 +0000)]
drivers: cpuidle: CPU idle ARM64 driver

This patch implements a generic CPU idle driver for ARM64 machines.

It relies on the DT idle states infrastructure to initialize idle
states count and respective parameters. Current code assumes the driver
is managing idle states on all possible CPUs but can be easily
generalized to support heterogenous systems and build cpumasks at
runtime using MIDRs or DT cpu nodes compatible properties.

Suspend back-ends (eg PSCI) must register a suspend initializer with
the CPU idle driver so that the suspend backend call can be detected,
and the driver code can call the back-end infrastructure to complete the
suspend backend initialization.

Idle state index 0 is always initialized as a simple wfi state, ie always
considered present and functional on all ARM64 platforms.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
drivers/cpuidle/Kconfig
drivers/cpuidle/Makefile

10 years agoarm64: add PSCI CPU_SUSPEND based cpu_suspend support
Lorenzo Pieralisi [Fri, 27 Sep 2013 09:25:02 +0000 (10:25 +0100)]
arm64: add PSCI CPU_SUSPEND based cpu_suspend support

This patch implements the cpu_suspend cpu operations method through
the PSCI CPU_SUSPEND API. The PSCI implementation translates the idle state
index passed by the cpu_suspend core call into a valid PSCI state according to
the PSCI states initialized at boot by the PSCI suspend backend.

Entry point is set to cpu_resume physical address, that represents the
default kernel execution address following a CPU reset.

Idle state indices missing a DT node description are initialized to power
state standby WFI so that if called by the idle driver they provide the
default behaviour.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agodrivers: cpuidle: implement OF based idle states infrastructure
Lorenzo Pieralisi [Fri, 14 Feb 2014 14:28:39 +0000 (14:28 +0000)]
drivers: cpuidle: implement OF based idle states infrastructure

On most common ARM systems, the low-power states a CPU can be put into are
not discoverable in HW and require device tree bindings to describe
the respective power domains, power down protocol and idle states parameters.

In order to enable DT based idle states and configure idle drivers, this
patch implements the bulk infrastructure required to parse the device tree
idle states bindings and initialize the corresponding CPUidle driver states
data.

Code that initializes idle states checks the CPU idle driver cpumask so
that multiple CPU idle drivers can be initialized through it in the
kernel. The CPU idle driver cpumask defines which idle states should be
considered valid for the driver, ie idle states that are valid on a set
of cpus the idle driver manages.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
drivers/cpuidle/Kconfig

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-ptrace' into HEAD
Mark Brown [Wed, 28 May 2014 19:12:09 +0000 (20:12 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-ptrace' into HEAD

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
Mark Brown [Tue, 27 May 2014 16:26:51 +0000 (17:26 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk

10 years agoconfig: Enable cpufreq for vexpress64
Mark Brown [Tue, 27 May 2014 16:26:21 +0000 (17:26 +0100)]
config: Enable cpufreq for vexpress64

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-bl-cpufreq' into linux-linaro-lsk
Mark Brown [Tue, 27 May 2014 16:25:03 +0000 (17:25 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-bl-cpufreq' into linux-linaro-lsk

Conflicts:
arch/arm64/Kconfig
drivers/cpufreq/Kconfig.arm

10 years agocpufreq: Enable big.LITTLE cpufreq driver on arm64
Mark Brown [Fri, 9 May 2014 16:40:31 +0000 (17:40 +0100)]
cpufreq: Enable big.LITTLE cpufreq driver on arm64

There are arm64 big.LITTLE systems so enable the big.LITTLE cpufreq driver.
While IKS is not available for these systems the driver is still useful
since it manages clusters with shared frequencies which is the common case
for these systems.

Long term combining the cpufreq-cpu0 and big.LITTLE drivers may be a
more sensible option but that is substantially more complex especially
in the case of IKS.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4920ab84979d8cd2eb7e3c4fefcc924efabf1cb2)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
drivers/cpufreq/Kconfig.arm

10 years agoarm64: Add big.LITTLE switcher stub
Mark Brown [Fri, 9 May 2014 16:24:17 +0000 (17:24 +0100)]
arm64: Add big.LITTLE switcher stub

The big.LITTLE cpufreq driver is useful on arm64 big.LITTLE systems even
without IKS support since it implements support for clusters with shared
clocks (a common big.LITTLE configuration). In order to allow it to be
built provide the non-IKS stubs for arm64, enabling cpufreq with all the
cores available.

It may make sense to make an asm-generic version of these stubs instead but
given that there's only likely to be these two architectures using the code
and asm-generic stubs also need per architecture updates it's probably more
trouble than it's worth.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Enable OPP
Mark Brown [Tue, 27 May 2014 15:52:23 +0000 (16:52 +0100)]
arm64: Enable OPP

Upstream OPP has been converted into a selectable symbol by commit
049d595a4db3b (PM / OPP: Make OPP invisible to users in Kconfig) however
for v3.10 it is less invasive to follow the practice in v3.10.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge branch 'v3.10/topic/arm64-misc' into linux-linaro-lsk
Alex Shi [Mon, 26 May 2014 09:25:46 +0000 (17:25 +0800)]
Merge branch 'v3.10/topic/arm64-misc' into linux-linaro-lsk

For armv8 clock getting failure bug.

10 years agoRevert "arm64: init: Move of_clk_init to time_init"
Alex Shi [Mon, 26 May 2014 08:31:57 +0000 (16:31 +0800)]
Revert "arm64: init: Move of_clk_init to time_init"

This reverts commit 638b6642b041f83802ea5d7ca68b45ce508bbc5c.
Since time is close to 14.05 release, we revert this commit for a
quick fix to clock missing bug on armv8:

[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:64 nr_irqs:64 0
[    0.000000] vexpress-osc: Failed to obtain config func for node
'/smb/motherboard/mcc/osc@1'!

Signed-off-by: Alex Shi <alex.shi@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk
Mark Brown [Sat, 24 May 2014 13:11:01 +0000 (14:11 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk

Conflicts:
arch/arm64/Kconfig

10 years agoarm64: Clean up the default pgprot setting
Catalin Marinas [Thu, 3 Apr 2014 14:57:15 +0000 (15:57 +0100)]
arm64: Clean up the default pgprot setting

The primary aim of this patchset is to remove the pgprot_default and
prot_sect_default global variables and rely strictly on predefined
values. The original goal was to be able to run SMP kernels on UP
hardware by not setting the Shareability bit. However, it is unlikely to
see UP ARMv8 hardware and even if we do, the Shareability bit is no
longer assumed to disable cacheable accesses.

A side effect is that the device mappings now have the Shareability
attribute set. The hardware, however, should ignore it since Device
accesses are always Outer Shareable.

Following the removal of the two global variables, there is some PROT_*
macro reshuffling and cleanup, including the __PAGE_* macros (replaced
by PAGE_*).

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit a501e32430d4232012ab708b8f0ce841f29e0f02)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/include/asm/io.h
arch/arm64/include/asm/pgtable.h

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-dma' into lsk-v3.10-arm64-misc
Mark Brown [Sat, 24 May 2014 13:04:44 +0000 (14:04 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-dma' into lsk-v3.10-arm64-misc

Conflicts:
arch/arm64/Kconfig
arch/arm64/mm/dma-mapping.c
mm/Kconfig

10 years agoarm64: add early_ioremap support
Mark Salter [Mon, 7 Apr 2014 22:39:52 +0000 (15:39 -0700)]
arm64: add early_ioremap support

Add support for early IO or memory mappings which are needed before the
normal ioremap() is usable.  This also adds fixmap support for permanent
fixed mappings such as that used by the earlyprintk device register
region.

Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit bf4b558eba920a38f91beb5ee62a8ce2628c92f7)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/Kconfig
arch/arm64/mm/ioremap.c

10 years agomm: create generic early_ioremap() support
Mark Salter [Mon, 7 Apr 2014 22:39:48 +0000 (15:39 -0700)]
mm: create generic early_ioremap() support

This patch creates a generic implementation of early_ioremap() support
based on the existing x86 implementation.  early_ioremp() is useful for
early boot code which needs to temporarily map I/O or memory regions
before normal mapping functions such as ioremap() are available.

Some architectures have optional MMU.  In the no-MMU case, the remap
functions simply return the passed in physical address and the unmap
functions do nothing.

Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 9e5c33d7aeeef62e5fa7e74f94432685bd03026b)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
mm/Kconfig
mm/Makefile

10 years agoadd generic fixmap.h
Mark Salter [Thu, 23 Jan 2014 23:53:48 +0000 (15:53 -0800)]
add generic fixmap.h

Many architectures provide an asm/fixmap.h which defines support for
compile-time 'special' virtual mappings which need to be made before
paging_init() has run.  This support is also used for early ioremap on
x86.  Much of this support is identical across the architectures.  This
patch consolidates all of the common bits into asm-generic/fixmap.h
which is intended to be included from arch/*/include/asm/fixmap.h.

Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Richard Kuo <rkuo@codeaurora.org>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jonas Bonn <jonas.bonn@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit d57c33c5daa4efa9e4d303bd0faf868080b532be)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-hugepages' into linux-linaro-lsk
Mark Brown [Fri, 23 May 2014 13:37:43 +0000 (14:37 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-hugepages' into linux-linaro-lsk

10 years agoarm64: mm: Route pmd thp functions through pte equivalents
Steve Capper [Tue, 25 Feb 2014 10:02:13 +0000 (10:02 +0000)]
arm64: mm: Route pmd thp functions through pte equivalents

Rather than have separate hugetlb and transparent huge page pmd
manipulation functions, re-wire our thp functions to simply call the
pte equivalents.

This allows THP to take advantage of the new PTE_WRITE logic introduced
in:
  c2c93e5 arm64: mm: Introduce PTE_WRITE

To represent splitting THPs we use the PTE_SPECIAL bit as this is not
used for pmds.

Signed-off-by: Steve Capper <steve.capper@linaro.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 9c7e535fcc1725fc2e2d4f0d9dd14137f0243e23)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
Mark Brown [Thu, 22 May 2014 18:44:34 +0000 (19:44 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk

10 years agoconfigs: Enable KGDB
Mark Brown [Thu, 22 May 2014 18:43:20 +0000 (19:43 +0100)]
configs: Enable KGDB

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk
Mark Brown [Thu, 22 May 2014 10:36:03 +0000 (11:36 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/configs' into linux-linaro-lsk

10 years agoconfigs: Enable jump label optimisation and strict devmem
Mark Brown [Thu, 22 May 2014 10:34:36 +0000 (11:34 +0100)]
configs: Enable jump label optimisation and strict devmem

For the coverage.

Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 23:13:20 +0000 (00:13 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk

Conflicts:
arch/arm64/kernel/debug-monitors.c
arch/arm64/mm/dma-mapping.c

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-dma' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 23:11:40 +0000 (00:11 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-dma' into linux-linaro-lsk

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-kgdb' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 23:11:36 +0000 (00:11 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-kgdb' into linux-linaro-lsk

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-perf' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 23:11:30 +0000 (00:11 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-perf' into linux-linaro-lsk

Conflicts:
arch/arm64/kernel/Makefile

10 years agoarm64: add APM X-Gene SoC RTC DTS entry
Loc Ho [Wed, 14 May 2014 00:02:37 +0000 (10:02 +1000)]
arm64: add APM X-Gene SoC RTC DTS entry

This patch adds APM X-Gene SoC RTC DTS entry

Signed-off-by: Rameshwar Prasad Sahu <rsahu@apm.com>
Signed-off-by: Loc Ho <lho@apm.com>
Cc: Jon Masters <jcm@redhat.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit 7fe2f8776216e25ad7fdb22f3966177777c5022c)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: barriers: make use of barrier options with explicit barriers
Will Deacon [Fri, 2 May 2014 15:24:10 +0000 (16:24 +0100)]
arm64: barriers: make use of barrier options with explicit barriers

When calling our low-level barrier macros directly, we can often suffice
with more relaxed behaviour than the default "all accesses, full system"
option.

This patch updates the users of dsb() to specify the option which they
actually require.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 98f7685ee69f871ba991089cb9685f0da07517ea)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kvm/sys_regs.c

10 years agoarm64: xchg: prevent warning if return value is unused
Will Deacon [Wed, 30 Apr 2014 15:23:06 +0000 (16:23 +0100)]
arm64: xchg: prevent warning if return value is unused

Some users of xchg() don't bother using the return value, which results
in a compiler warning like the following (from kgdb):

In file included from linux/arch/arm64/include/asm/atomic.h:27:0,
                 from include/linux/atomic.h:4,
                 from include/linux/spinlock.h:402,
                 from include/linux/seqlock.h:35,
                 from include/linux/time.h:5,
                 from include/uapi/linux/timex.h:56,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:19,
                 from include/linux/pid_namespace.h:4,
                 from kernel/debug/debug_core.c:30:
kernel/debug/debug_core.c: In function â€˜kgdb_cpu_enter’:
linux/arch/arm64/include/asm/cmpxchg.h:75:3: warning: value computed is not used [-Wunused-value]
  ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
   ^
linux/arch/arm64/include/asm/atomic.h:132:30: note: in expansion of macro â€˜xchg’
 #define atomic_xchg(v, new) (xchg(&((v)->counter), new))

kernel/debug/debug_core.c:504:4: note: in expansion of macro â€˜atomic_xchg’
    atomic_xchg(&kgdb_active, cpu);
    ^

This patch makes use of the same trick as we do for cmpxchg, by assigning
the return value to a dummy variable in the xchg() macro itself.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit e1dfda9ced9bea1413a736f0d578f8218a7788ec)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Make atomic64_t() return "long", not "long long"
Bjorn Helgaas [Thu, 8 May 2014 21:13:47 +0000 (22:13 +0100)]
arm64: Make atomic64_t() return "long", not "long long"

arm64 sets CONFIG_64BIT=y and hence uses the "long counter" atomic64_t
definition from include/linux/types.h.  Make atomic64_read() return "long",
not "long long".

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit ba6bf8c85cb0d263ca9a98ef6a76ab651a97c60b)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Introduce execute-only page access permissions
Catalin Marinas [Thu, 3 Apr 2014 15:17:32 +0000 (16:17 +0100)]
arm64: Introduce execute-only page access permissions

The ARMv8 architecture allows execute-only user permissions by clearing
the PTE_UXN and PTE_USER bits. The kernel, however, can still access
such page, so execute-only page permission does not protect against
read(2)/write(2) etc. accesses. Systems requiring such protection must
implement/enable features like SECCOMP.

This patch changes the arm64 __P100 and __S100 protection_map[] macros
to the new __PAGE_EXECONLY attributes. A side effect is that
pte_valid_user() no longer triggers for __PAGE_EXECONLY since PTE_USER
isn't set. To work around this, the check is done on the PTE_NG bit via
the pte_valid_ng() macro. VM_READ is also checked now for page faults.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit bc07c2c6e9ed125d362af0214b6313dca180cb08)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Remove the aux_context structure
Catalin Marinas [Fri, 4 Apr 2014 14:42:16 +0000 (15:42 +0100)]
arm64: Remove the aux_context structure

This patch removes the aux_context structure (and the containing file)
to allow the placement of the _aarch64_ctx end magic based on the
context stored on the signal stack.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 0e0276d1e1dd063cd14ce377707970d0417a0792)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Remove boot thread synchronisation for spin-table release method
Catalin Marinas [Fri, 4 Apr 2014 10:49:05 +0000 (11:49 +0100)]
arm64: Remove boot thread synchronisation for spin-table release method

The synchronisation with the boot thread already happens in __cpu_up()
via wait_for_completion_timeout(). In addition, __cpu_up() calls are
protected by the cpu_add_remove_lock mutex and already serialised.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 6400111399e16a535231ebd76389c894ea1837ff)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: mm: Remove superfluous "the" in comment
Geert Uytterhoeven [Tue, 11 Mar 2014 10:23:39 +0000 (11:23 +0100)]
arm64: mm: Remove superfluous "the" in comment

Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
(cherry picked from commit aad9061bf37e05d29a2a94ae8fe1e12d8808a0dd)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: init: Move of_clk_init to time_init
Chanho Min [Mon, 14 Apr 2014 07:38:53 +0000 (08:38 +0100)]
arm64: init: Move of_clk_init to time_init

Clock providers should be initialized before clocksource_of_init.
If not, Clock source initialization can be fail to get the clock.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Chanho Min <chanho.min@lge.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit bc3ee18a7a57243721ecfd879319e3d2e882f289)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: initialize spinlock for init_mm's context
Leo Yan [Wed, 16 Apr 2014 12:26:35 +0000 (13:26 +0100)]
arm64: initialize spinlock for init_mm's context

ARM64 has defined the spinlock for init_mm's context, so need initialize
the spinlock structure; otherwise during the suspend flow it will dump
the info for spinlock's bad magic warning as below:

[   39.084394] Disabling non-boot CPUs ...
[   39.092871] BUG: spinlock bad magic on CPU#1, swapper/1/0
[   39.092896]  lock: init_mm+0x338/0x3e0, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[   39.092907] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G           O 3.10.33 #125
[   39.092912] Call trace:
[   39.092927] [<ffffffc000087e64>] dump_backtrace+0x0/0x16c
[   39.092934] [<ffffffc000087fe0>] show_stack+0x10/0x1c
[   39.092947] [<ffffffc000765334>] dump_stack+0x1c/0x28
[   39.092953] [<ffffffc0007653b8>] spin_dump+0x78/0x88
[   39.092960] [<ffffffc0007653ec>] spin_bug+0x24/0x34
[   39.092971] [<ffffffc000300a28>] do_raw_spin_lock+0x98/0x17c
[   39.092979] [<ffffffc00076cf08>] _raw_spin_lock_irqsave+0x4c/0x60
[   39.092990] [<ffffffc000094044>] set_mm_context+0x1c/0x6c
[   39.092996] [<ffffffc0000941c8>] __new_context+0x94/0x10c
[   39.093007] [<ffffffc0000d63d4>] idle_task_exit+0x104/0x1b0
[   39.093014] [<ffffffc00008d91c>] cpu_die+0x14/0x74
[   39.093021] [<ffffffc000084f74>] arch_cpu_idle_dead+0x8/0x14
[   39.093030] [<ffffffc0000e7f18>] cpu_startup_entry+0x1ec/0x258
[   39.093036] [<ffffffc00008d810>] secondary_start_kernel+0x114/0x124

Signed-off-by: Leo Yan <leoy@marvell.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 8f0712037b4ed63dfce844939ac9866054f15ca0)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: enable FIX_EARLYCON_MEM kconfig
Rob Herring [Fri, 18 Apr 2014 22:19:59 +0000 (17:19 -0500)]
arm64: enable FIX_EARLYCON_MEM kconfig

In order to support earlycon on arm64, we need to enable earlycon fixmap
support.

Signed-off-by: Rob Herring <robh@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 92cc15fcb543a8ab9af5682a2011944e6f48fd4c)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/Kconfig

10 years agoRevert "arm64, debug-monitors: Fix CPU hotplug callback registration"
Mark Brown [Wed, 21 May 2014 19:11:24 +0000 (20:11 +0100)]
Revert "arm64, debug-monitors: Fix CPU hotplug callback registration"

This reverts commit b057e1d80f916922081c7c5bd2c08ff53ed9e4fc.

10 years agoarm64: Use bus notifiers to set per-device coherent DMA ops
Catalin Marinas [Fri, 25 Apr 2014 14:31:45 +0000 (15:31 +0100)]
arm64: Use bus notifiers to set per-device coherent DMA ops

Recently, the default DMA ops have been changed to non-coherent for
alignment with 32-bit ARM platforms (and DT files). This patch adds bus
notifiers to be able to set the coherent DMA ops (with no cache
maintenance) for devices explicitly marked as coherent via the
"dma-coherent" DT property.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 6ecba8eb51b7d23fda66388a5420be7d8688b186)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: debug: remove noisy, pointless warning
Will Deacon [Thu, 17 Apr 2014 11:37:14 +0000 (12:37 +0100)]
arm64: debug: remove noisy, pointless warning

Sending a SIGTRAP to a user task after execution of a BRK instruction at
EL0 is fundamental to the way in which software breakpoints work and
doesn't deserve a warning to be logged in dmesg. Whilst the warning can
be justified from EL1, do_debug_exception will already do the right thing,
so simply remove the code altogether.

Cc: Sandeepa Prabhu <sandeepa.prabhu@linaro.org>
Reported-by: Kyrylo Tkachov <kyrylo.tkachov@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 43683afbcb32f7b7318ac1badd6469d91fe22711)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: initialize pgprot info earlier in boot
Mark Salter [Mon, 7 Apr 2014 22:39:51 +0000 (15:39 -0700)]
arm64: initialize pgprot info earlier in boot

Presently, paging_init() calls init_mem_pgprot() to initialize pgprot
values used by macros such as PAGE_KERNEL, PAGE_KERNEL_EXEC, etc.

The new fixmap and early_ioremap support also needs to use these macros
before paging_init() is called.  This patch moves the init_mem_pgprot()
call out of paging_init() and into setup_arch() so that pgprot_default
gets initialized in time for fixmap and early_ioremap.

Signed-off-by: Mark Salter <msalter@redhat.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 0bf757c73d6612d3d279de3f61b35062aa9c8b1d)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add missing Kconfig for CONFIG_STRICT_DEVMEM
Laura Abbott [Sat, 5 Apr 2014 00:30:50 +0000 (01:30 +0100)]
arm64: Add missing Kconfig for CONFIG_STRICT_DEVMEM

The Kconfig for CONFIG_STRICT_DEVMEM is missing despite being
used in mmap.c. Add it.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit d253b4406df69fa7a74231769d6f6ad80dc33063)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/Kconfig.debug

10 years agoarm64: fix !CONFIG_COMPAT build failures
Mark Salter [Sat, 5 Apr 2014 14:25:49 +0000 (15:25 +0100)]
arm64: fix !CONFIG_COMPAT build failures

Recent arm64 builds using CONFIG_ARM64_64K_PAGES are failing with:

  arch/arm64/kernel/perf_regs.c: In function â€˜perf_reg_abi’:
  arch/arm64/kernel/perf_regs.c:41:2: error: implicit declaration of function â€˜is_compat_thread’

  arch/arm64/kernel/perf_event.c:1398:2: error: unknown type name â€˜compat_uptr_t’

This is due to some recent arm64 perf commits with compat support:

  commit 23c7d70d55c6d9:
    ARM64: perf: add support for frame pointer unwinding in compat mode

  commit 2ee0d7fd36a3f8:
    ARM64: perf: add support for perf registers API

Those patches make the arm64 kernel unbuildable if CONFIG_COMPAT is not
defined and CONFIG_ARM64_64K_PAGES depends on !CONFIG_COMPAT. This patch
allows the arm64 kernel to build with and without CONFIG_COMPAT.

Signed-off-by: Mark Salter <msalter@redhat.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit ff268ff7f32bf5388b7422f0c0773d88add23423)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoRevert "arm64: virt: ensure visibility of __boot_cpu_mode"
Catalin Marinas [Fri, 28 Mar 2014 09:49:13 +0000 (09:49 +0000)]
Revert "arm64: virt: ensure visibility of __boot_cpu_mode"

This reverts commit 82b2f495fba338d1e3098dde1df54944a9c19751. The
__boot_cpu_mode variable is flushed in head.S after being written,
therefore the additional cache flushing is no longer required.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 0a997ecc08e0b551119c56d52a591d9e5b38a7cd)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Support DMA_ATTR_WRITE_COMBINE
Laura Abbott [Fri, 14 Mar 2014 19:52:24 +0000 (19:52 +0000)]
arm64: Support DMA_ATTR_WRITE_COMBINE

DMA_ATTR_WRITE_COMBINE is currently ignored. Set the pgprot
appropriately for non coherent opperations.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 214fdbe74a096c3aeb7af81d7900e2ab966b10d6)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Implement custom mmap functions for dma mapping
Laura Abbott [Fri, 14 Mar 2014 19:52:23 +0000 (19:52 +0000)]
arm64: Implement custom mmap functions for dma mapping

The current dma_ops do not specify an mmap function so maping
falls back to the default implementation. There are at least
two issues with using the default implementation:

1) The pgprot is always pgprot_noncached (strongly ordered)
memory even with coherent operations
2) dma_common_mmap calls virt_to_page on the remapped non-coherent
address which leads to invalid memory being mapped.

Fix both these issue by implementing a custom mmap function which
correctly accounts for remapped addresses and sets vm_pg_prot
appropriately.

Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
[catalin.marinas@arm.com: replaced "arm64_" with "__" prefix for consistency]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 6e8d7968e92f7668a2a615773ad3940f0219dcbd)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Fix __range_ok macro
Christopher Covington [Wed, 19 Mar 2014 16:29:37 +0000 (16:29 +0000)]
arm64: Fix __range_ok macro

Without this, the following scenario is incorrectly determined
to be invalid.

addr 0x7f_ffffe000 size 8192 addr_limit 0x80_00000000

This behavior was observed while trying to vmsplice the stack
as part of a CRIU dump of a process on a system started with the
norandmaps kernel parameter.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 31b1e940c5d47ee1a01baeccfb1b2b8890822d1a)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64, debug-monitors: Fix CPU hotplug callback registration
Srivatsa S. Bhat [Mon, 10 Mar 2014 20:39:20 +0000 (02:09 +0530)]
arm64, debug-monitors: Fix CPU hotplug callback registration

Subsystems that want to register CPU hotplug callbacks, as well as perform
initialization for the CPUs that are already online, often do it as shown
below:

get_online_cpus();

for_each_online_cpu(cpu)
init_cpu(cpu);

register_cpu_notifier(&foobar_cpu_notifier);

put_online_cpus();

This is wrong, since it is prone to ABBA deadlocks involving the
cpu_add_remove_lock and the cpu_hotplug.lock (when running concurrently
with CPU hotplug operations).

Instead, the correct and race-free way of performing the callback
registration is:

cpu_notifier_register_begin();

for_each_online_cpu(cpu)
init_cpu(cpu);

/* Note the use of the double underscored version of the API */
__register_cpu_notifier(&foobar_cpu_notifier);

cpu_notifier_register_done();

Fix the debug-monitors code in arm64 by using this latter form of callback
registration.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Ingo Molnar <mingo@kernel.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit 4b0b68af37b930403cf9074c0cf504fc2387c2fa)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add APM X-Gene SoC AHCI SATA host controller DTS entries
Loc Ho [Fri, 14 Mar 2014 23:53:21 +0000 (17:53 -0600)]
arm64: Add APM X-Gene SoC AHCI SATA host controller DTS entries

This patch adds APM X-Gene SoC AHCI SATA host controller DTS entries.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Tuan Phan <tphan@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit db8c0286d18c2d3eaec2c4da34767db0f4f6ffaa)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries
Loc Ho [Fri, 14 Mar 2014 23:53:18 +0000 (17:53 -0600)]
arm64: Add APM X-Gene SoC 15Gbps Multi-purpose PHY DTS entries

This patch adds the DTS entries for the APM X-Gene SoC 15Gbps Multi-purpose
PHY driver. The PHY for SATA controller 2 and 3 are enabled by default.

Signed-off-by: Loc Ho <lho@apm.com>
Signed-off-by: Tuan Phan <tphan@apm.com>
Signed-off-by: Suman Tripathi <stripathi@apm.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Tejun Heo <tj@kernel.org>
(cherry picked from commit 71b70ee9350f239ea021bbb737771ebd5d02c020)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: rwsem: use asm-generic rwsem implementation
Will Deacon [Fri, 14 Mar 2014 17:47:05 +0000 (17:47 +0000)]
arm64: rwsem: use asm-generic rwsem implementation

asm-generic offers an atomic-add based rwsem implementation, which
can avoid the need for heavier, spinlock-based synchronisation on the
fast path.

This patch makes use of the optimised implementation for arm64 CPUs.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit c209f79940ac0c75ae8d2f503a2b9d86255e266c)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoasm-generic: rwsem: de-PPCify rwsem.h
Will Deacon [Fri, 14 Mar 2014 17:47:04 +0000 (17:47 +0000)]
asm-generic: rwsem: de-PPCify rwsem.h

asm-generic/rwsem.h used to live under arch/powerpc. During its
liberation to common code, a few references to its former home where
preserved, in particular the definition of RWSEM_ACTIVE_MASK is
predicated on CONFIG_PPC64.

This patch updates the ifdefs and comments to architecturally neutral
versions.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Richard Kuo <rkuo@codeaurora.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit e172800e5d3162f97d332b3745e3743ce150ec48)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: smp: make local symbol static
Jingoo Han [Wed, 5 Mar 2014 05:35:45 +0000 (05:35 +0000)]
arm64: smp: make local symbol static

Make smp_spin_table_cpu_postboot() static, because this function
is used only in this file.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 7184659bed3090248e382d98a49a3c1bcfe11174)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: debug: make local symbols static
Jingoo Han [Wed, 5 Mar 2014 05:34:32 +0000 (05:34 +0000)]
arm64: debug: make local symbols static

Make local symbols static, because these are used only in this
file.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 242c04bc4be959ae28618772e439c27e87a7d880)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoARM64: perf: support dwarf unwinding in compat mode
Jean Pihet [Mon, 3 Feb 2014 18:18:29 +0000 (19:18 +0100)]
ARM64: perf: support dwarf unwinding in compat mode

Add support for unwinding using the dwarf information in compat
mode. Using the correct user stack pointer allows perf to record
the frames correctly in the native and compat modes.

Note that although the dwarf frame unwinding works ok using
libunwind in native mode (on ARMv7 & ARMv8), some changes are
required to the libunwind code for the compat mode. Those changes
are posted separately on the libunwind mailing list.

Tested on ARMv8 platform with v8 and compat v7 binaries, the latter
are statically built.

Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 5f888a1d33c48900012e6b4c18296ce7c715dc6c)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoARM64: perf: add support for frame pointer unwinding in compat mode
Jean Pihet [Mon, 3 Feb 2014 18:18:28 +0000 (19:18 +0100)]
ARM64: perf: add support for frame pointer unwinding in compat mode

When profiling a 32-bit application, user space callchain unwinding
using the frame pointer is performed in compat mode. The code is taken
over from the AARCH32 code and adapted to work on AARCH64.

Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 23c7d70d55c6d963f225744cd1b996dee68c88d1)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoARM64: perf: add support for perf registers API
Jean Pihet [Mon, 3 Feb 2014 18:18:27 +0000 (19:18 +0100)]
ARM64: perf: add support for perf registers API

This patch implements the functions required for the perf registers API,
allowing the perf tool to interface kernel register dumps with libunwind
in order to provide userspace backtracing.
Compat mode is also supported.

Only the general purpose user space registers are exported, i.e.:
 PERF_REG_ARM_X0,
 ...
 PERF_REG_ARM_X28,
 PERF_REG_ARM_FP,
 PERF_REG_ARM_LR,
 PERF_REG_ARM_SP,
 PERF_REG_ARM_PC
and not the PERF_REG_ARM_V* registers.

Signed-off-by: Jean Pihet <jean.pihet@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 2ee0d7fd36a3f87bc5b29b1ec54ad6728deedb41)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kernel/Makefile

10 years agoarm64: barriers: add dmb barrier
Will Deacon [Mon, 10 Mar 2014 10:36:52 +0000 (10:36 +0000)]
arm64: barriers: add dmb barrier

Commit 8adbf57fc429 ("irqchip: gic: use dmb ishst instead of dsb when
raising a softirq") added an explicit dmb(...) call to the GIC driver.

This patch adds a simple dmb() macro to arm64, which expands to a DMB SY
instruction.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit d152d22a18c240286c19997a6249ee76ea055926)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: remove unnecessary cache flush at boot
Mark Rutland [Wed, 14 Aug 2013 08:54:54 +0000 (09:54 +0100)]
arm64: remove unnecessary cache flush at boot

Currently we flush the entire dcache at boot within __cpu_setup, but
this is unnecessary as the booting protocol demands that the dcache is
invalid and off upon entering the kernel. The presence of the cache
flush only serves to hide bugs in bootloaders, and is not safe in the
presence of SMP.

In an SMP boot scenario the CPUs enter coherency outside of the kernel,
and the primary CPU enables its caches before bringing up secondary
CPUs. Therefore if any secondary CPU has an entry in its cache (in
violation of the boot protocol), the primary CPU might snoop it even if
the secondary CPU's cache is disabled. The boot-time cache flush only
serves to hide a firmware bug, and slows down a cpu boot unnecessarily.

This patch removes the unnecessary boot-time cache flush.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Acked-by: Will Deacon <will.deacon@arm.com>
[catalin.marinas@arm.com: make __flush_dcache_all local only]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit bff705950e2cdcf35641dee35eb14bad9ed49e8f)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Fix !CONFIG_SMP kernel build
Catalin Marinas [Fri, 28 Feb 2014 16:12:25 +0000 (16:12 +0000)]
arm64: Fix !CONFIG_SMP kernel build

Commit fb4a96029c8a (arm64: kernel: fix per-cpu offset restore on
resume) uses per_cpu_offset() unconditionally during CPU wakeup,
however, this is only defined for the SMP case.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Reported-by: Dave P Martin <Dave.Martin@arm.com>
(cherry picked from commit b57fc9e80692043e2a3a74e1d2c047eb700dcd0c)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: remove return value form psci_init()
Vladimir Murzin [Fri, 28 Feb 2014 09:57:33 +0000 (09:57 +0000)]
arm64: remove return value form psci_init()

psci_init() is written to return err code if something goes wrong. However,
the single user, setup_arch(), doesn't care about it. Moreover, every error
path is supplied with a clear message which is enough for pleasant debugging.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 64b4f60f497058f1c6ba118a0260249ee5c091a6)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: remove redundant "psci:" prefixes
Vladimir Murzin [Fri, 28 Feb 2014 09:57:47 +0000 (09:57 +0000)]
arm64: remove redundant "psci:" prefixes

Since 652af899799354049b273af897b798b8f03fdd88 "arm64: factor out spin-table
boot method" psci prefix's been introduced. We have a common pr_fmt, so clean
them up.

Signed-off-by: Vladimir Murzin <vladimir.murzin@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 288ac26cc2334e5e6ecad6416e9bf750691afd84)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: vdso: clean up vdso_pagelist initialization
Nathan Lynch [Tue, 11 Feb 2014 22:28:42 +0000 (22:28 +0000)]
arm64: vdso: clean up vdso_pagelist initialization

Remove some unnecessary bits that were apparently carried over from
another architecture's implementation:

- No need to get_page() the vdso text/data - these are part of the
  kernel image.
- No need for ClearPageReserved on the vdso text.
- No need to vmap the first text page to check the ELF header - this
  can be done through &vdso_start.

Also some minor cleanup:
- Use kcalloc for vdso_pagelist array allocation.
- Don't print on allocation failure, slab/slub will do that for us.

Signed-off-by: Nathan Lynch <nathan_lynch@mentor.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 16fb1a9bec6126162560f159df449e4781560807)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Change misleading function names in dma-mapping
Ritesh Harjani [Thu, 6 Feb 2014 11:51:51 +0000 (17:21 +0530)]
arm64: Change misleading function names in dma-mapping

arm64_swiotlb_alloc/free_coherent name can be misleading
somtimes with CMA support being enabled after this
patch (c2104debc235b745265b64d610237a6833fd53)

Change this name to be more generic:
__dma_alloc/free_coherent

Signed-off-by: Ritesh Harjani <ritesh.harjani@gmail.com>
[catalin.marinas@arm.com: renamed arm64_swiotlb_dma_ops to coherent_swiotlb_dma_ops]
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit bb10eb7b4d176f408d45fb492df28bed2981a1f3)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Fix the soft_restart routine
Geoff Levand [Tue, 17 Dec 2013 00:19:29 +0000 (00:19 +0000)]
arm64: Fix the soft_restart routine

Change the soft_restart() routine to call cpu_reset() at its identity mapped
physical address.

The cpu_reset() routine must be called at its identity mapped physical address
so that when the MMU is turned off the instruction pointer will be at the correct
location in physical memory.

Signed-off-by: Geoff Levand <geoff@infradead.org> for Huawei, Linaro
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 09024aa61e1bc994404683e2e5b363484a15dd12)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: Extend the idmap to the whole kernel image
Catalin Marinas [Mon, 17 Feb 2014 12:03:25 +0000 (12:03 +0000)]
arm64: Extend the idmap to the whole kernel image

This patch changes the idmap page table creation during boot to cover
the whole kernel image, allowing functions like cpu_reset() to be safely
called with the physical address.

This patch also simplifies the create_block_map asm macro to no longer
take an idmap argument and always use the phys/virt/end parameters. For
the idmap case, phys == virt.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit ea8c2e1124457f266f82effc3e6558552527943a)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoarm64: enable processor debug state for secondary cpus
Vijaya Kumar K [Fri, 21 Feb 2014 05:13:49 +0000 (05:13 +0000)]
arm64: enable processor debug state for secondary cpus

processor debug state PSTATE.D is unmasked in smp call
clear_os_lock for secondary cpus. So debug state is still
masked in normal kernel context.  With this patch, unmask
debug state on secondary boot for the cpus in normal kernel
context. Now kgdb tests passed with multicore.

Signed-off-by: Vijaya Kumar K <Vijaya.Kumar@caviumnetworks.com>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit d8ed442a009ecfe155b57d58f231db3d6084633d)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
arch/arm64/kernel/smp.c

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-kgdb' into lsk-v3.10-arm64-misc
Mark Brown [Wed, 21 May 2014 17:39:39 +0000 (18:39 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-kgdb' into lsk-v3.10-arm64-misc

Conflicts:
arch/arm64/include/asm/debug-monitors.h
arch/arm64/kernel/debug-monitors.c

10 years agoarm64: Extend the PCI I/O space to 16MB
Catalin Marinas [Tue, 4 Feb 2014 16:37:59 +0000 (16:37 +0000)]
arm64: Extend the PCI I/O space to 16MB

The patch moves the PCI I/O space (currently at 64K) before the
earlyprintk mapping and extends it to 16MB.

Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit 22bd1c91fe13d59cff734b69b6757adcfbd8dee9)
Signed-off-by: Mark Brown <broonie@linaro.org>
Conflicts:
Documentation/arm64/memory.txt

10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-be' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 16:59:59 +0000 (17:59 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-be' into linux-linaro-lsk

10 years agoword-at-a-time: simplify big-endian zero_bytemask macro
H. Peter Anvin [Wed, 30 Apr 2014 21:22:19 +0000 (14:22 -0700)]
word-at-a-time: simplify big-endian zero_bytemask macro

This is simpler and cleaner.  Depending on architecture, a smart
compiler may or may not generate the same code.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 789ce9dca8007ab5d7c72b9a174a29243817ac32)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoword-at-a-time: avoid undefined behaviour in zero_bytemask macro
Will Deacon [Wed, 23 Apr 2014 16:52:52 +0000 (17:52 +0100)]
word-at-a-time: avoid undefined behaviour in zero_bytemask macro

The asm-generic, big-endian version of zero_bytemask creates a mask of
bytes preceding the first zero-byte by left shifting ~0ul based on the
position of the first zero byte.

Unfortunately, if the first (top) byte is zero, the output of
prep_zero_mask has only the top bit set, resulting in undefined C
behaviour as we shift left by an amount equal to the width of the type.
As it happens, GCC doesn't manage to spot this through the call to fls(),
but the issue remains if architectures choose to implement their shift
instructions differently.

An example would be arch/arm/ (AArch32), where LSL Rd, Rn, #32 results
in Rd == 0x0, whilst on arch/arm64 (AArch64) LSL Xd, Xn, #64 results in
Xd == Xn.

Rather than check explicitly for the problematic shift, this patch adds
an extra shift by 1, replacing fls with __fls. Since zero_bytemask is
never called with a zero argument (has_zero() is used to check the data
first), we don't need to worry about calling __fls(0), which is
undefined.

Cc: <stable@vger.kernel.org>
Cc: Victor Kamensky <victor.kamensky@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit ec6931b281797b69e6cf109f9cc94d5a2bf994e0)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoword-at-a-time: provide generic big-endian zero_bytemask implementation
Will Deacon [Thu, 12 Dec 2013 17:40:22 +0000 (17:40 +0000)]
word-at-a-time: provide generic big-endian zero_bytemask implementation

Whilst architectures may be able to do better than this (which they can,
by simply defining their own macro), this is a generic stab at a
zero_bytemask implementation for the asm-generic, big-endian
word-at-a-time implementation.

On arm64, a clz instruction is used to implement the fls efficiently.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 11ec50caedb56e3a87715edeff6a1852e6ae5416)
Signed-off-by: Mark Brown <broonie@linaro.org>
10 years agoMerge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk
Mark Brown [Wed, 21 May 2014 16:55:59 +0000 (17:55 +0100)]
Merge remote-tracking branch 'lsk/v3.10/topic/arm64-misc' into linux-linaro-lsk

10 years agoarm64, jump label: detect %c support for ARM64
Jiang Liu [Tue, 7 Jan 2014 14:17:12 +0000 (22:17 +0800)]
arm64, jump label: detect %c support for ARM64

As commit a9468f30b5eac6 "ARM: 7333/2: jump label: detect %c
support for ARM", this patch detects the same thing for ARM64
because some ARM64 GCC versions have the same issue.

Some versions of ARM64 GCC which do support asm goto, do not
support the %c specifier. Since we need the %c to support jump
labels on ARM64, detect that too in the asm goto detection script
to avoid build errors with these versions.

Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
(cherry picked from commit f3c003f72dfb2497056bcbb864885837a1968ed5)
Signed-off-by: Mark Brown <broonie@linaro.org>