Commit 576c25eb authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'arm64-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64

Pull ARM64 update from Catalin Marinas:
 - User tagged pointers support (top 8-bit of user pointers
   automatically ignored by the CPU).
 - Kernel mode NEON (no users for arm64 yet but work in progress).
 - arm64 kernel Image header extended to accommodate future EFI stub.
 - Remove BogoMIPS reporting (not relevant, it's just the timer
   frequency).
 - Clean-up (EM_AARCH64/EM_ARM to elf-em.h, ELF notes in read-only
   segment, unused variable).
 - Bug-fixes (RAM boundaries not 2MB aligned, perf, includes).

* tag 'arm64-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cmarinas/linux-aarch64:
  Documentation/arm64: clarify requirements for DTB placement
  arm64: mm: permit use of tagged pointers at EL0
  Move the EM_ARM and EM_AARCH64 definitions to uapi/linux/elf-em.h
  arm64: Remove unused cpu_name ascii in arch/arm64/mm/proc.S
  arm64: delay: don't bother reporting bogomips in /proc/cpuinfo
  arm64: Fix mapping of memory banks not ending on a PMD_SIZE boundary
  arm64: move elf notes into readonly segment
  arm64: Enable interrupts in the EL0 undef handler
  arm64: Expand arm64 image header
  ARM64: include: asm: include "asm/types.h" in "pgtable-2level-types.h" and "pgtable-3level-types.h"
  arm64: add support for kernel mode NEON
  arm64: perf: fix ARMv8 EVTYPE_MASK to include NSH bit
  arm64: perf: fix group validation when using enable_on_exec
parents 5872c840 4d5e0b15
...@@ -45,9 +45,9 @@ sees fit.) ...@@ -45,9 +45,9 @@ sees fit.)
Requirement: MANDATORY Requirement: MANDATORY
The device tree blob (dtb) must be no bigger than 2 megabytes in size The device tree blob (dtb) must be placed on an 8-byte boundary within
and placed at a 2-megabyte boundary within the first 512 megabytes from the first 512 megabytes from the start of the kernel image and must not
the start of the kernel image. This is to allow the kernel to map the cross a 2-megabyte boundary. This is to allow the kernel to map the
blob using a single section mapping in the initial page tables. blob using a single section mapping in the initial page tables.
...@@ -68,13 +68,23 @@ Image target is available instead. ...@@ -68,13 +68,23 @@ Image target is available instead.
Requirement: MANDATORY Requirement: MANDATORY
The decompressed kernel image contains a 32-byte header as follows: The decompressed kernel image contains a 64-byte header as follows:
u32 magic = 0x14000008; /* branch to stext, little-endian */ u32 code0; /* Executable code */
u32 res0 = 0; /* reserved */ u32 code1; /* Executable code */
u64 text_offset; /* Image load offset */ u64 text_offset; /* Image load offset */
u64 res0 = 0; /* reserved */
u64 res1 = 0; /* reserved */ u64 res1 = 0; /* reserved */
u64 res2 = 0; /* reserved */ u64 res2 = 0; /* reserved */
u64 res3 = 0; /* reserved */
u64 res4 = 0; /* reserved */
u32 magic = 0x644d5241; /* Magic number, little endian, "ARM\x64" */
u32 res5 = 0; /* reserved */
Header notes:
- code0/code1 are responsible for branching to stext.
The image must be placed at the specified offset (currently 0x80000) The image must be placed at the specified offset (currently 0x80000)
from the start of the system RAM and called there. The start of the from the start of the system RAM and called there. The start of the
......
Tagged virtual addresses in AArch64 Linux
=========================================
Author: Will Deacon <will.deacon@arm.com>
Date : 12 June 2013
This document briefly describes the provision of tagged virtual
addresses in the AArch64 translation system and their potential uses
in AArch64 Linux.
The kernel configures the translation tables so that translations made
via TTBR0 (i.e. userspace mappings) have the top byte (bits 63:56) of
the virtual address ignored by the translation hardware. This frees up
this byte for application use, with the following caveats:
(1) The kernel requires that all user addresses passed to EL1
are tagged with tag 0x00. This means that any syscall
parameters containing user virtual addresses *must* have
their top byte cleared before trapping to the kernel.
(2) Tags are not guaranteed to be preserved when delivering
signals. This means that signal handlers in applications
making use of tags cannot rely on the tag information for
user virtual addresses being maintained for fields inside
siginfo_t. One exception to this rule is for signals raised
in response to debug exceptions, where the tag information
will be preserved.
(3) Special care should be taken when using tagged pointers,
since it is likely that C compilers will not hazard two
addresses differing only in the upper bits.
The architecture prevents the use of a tagged PC, so the upper byte will
be set to a sign-extension of bit 55 on exception return.
...@@ -19,8 +19,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG]; ...@@ -19,8 +19,6 @@ typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct user_fp elf_fpregset_t; typedef struct user_fp elf_fpregset_t;
#define EM_ARM 40
#define EF_ARM_EABI_MASK 0xff000000 #define EF_ARM_EABI_MASK 0xff000000
#define EF_ARM_EABI_UNKNOWN 0x00000000 #define EF_ARM_EABI_UNKNOWN 0x00000000
#define EF_ARM_EABI_VER1 0x01000000 #define EF_ARM_EABI_VER1 0x01000000
......
...@@ -96,6 +96,9 @@ config SWIOTLB ...@@ -96,6 +96,9 @@ config SWIOTLB
config IOMMU_HELPER config IOMMU_HELPER
def_bool SWIOTLB def_bool SWIOTLB
config KERNEL_MODE_NEON
def_bool y
source "init/Kconfig" source "init/Kconfig"
source "kernel/Kconfig.freezer" source "kernel/Kconfig.freezer"
......
...@@ -33,8 +33,6 @@ typedef unsigned long elf_greg_t; ...@@ -33,8 +33,6 @@ typedef unsigned long elf_greg_t;
typedef elf_greg_t elf_gregset_t[ELF_NGREG]; typedef elf_greg_t elf_gregset_t[ELF_NGREG];
typedef struct user_fpsimd_state elf_fpregset_t; typedef struct user_fpsimd_state elf_fpregset_t;
#define EM_AARCH64 183
/* /*
* AArch64 static relocation types. * AArch64 static relocation types.
*/ */
...@@ -151,7 +149,6 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm); ...@@ -151,7 +149,6 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
#define arch_randomize_brk arch_randomize_brk #define arch_randomize_brk arch_randomize_brk
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
#define EM_ARM 40
#define COMPAT_ELF_PLATFORM ("v8l") #define COMPAT_ELF_PLATFORM ("v8l")
#define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3)) #define COMPAT_ELF_ET_DYN_BASE (randomize_et_dyn(2 * TASK_SIZE_32 / 3))
......
/*
* linux/arch/arm64/include/asm/neon.h
*
* Copyright (C) 2013 Linaro Ltd <ard.biesheuvel@linaro.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#define cpu_has_neon() (1)
void kernel_neon_begin(void);
void kernel_neon_end(void);
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#ifndef __ASM_PGTABLE_2LEVEL_TYPES_H #ifndef __ASM_PGTABLE_2LEVEL_TYPES_H
#define __ASM_PGTABLE_2LEVEL_TYPES_H #define __ASM_PGTABLE_2LEVEL_TYPES_H
#include <asm/types.h>
typedef u64 pteval_t; typedef u64 pteval_t;
typedef u64 pgdval_t; typedef u64 pgdval_t;
typedef pgdval_t pmdval_t; typedef pgdval_t pmdval_t;
......
...@@ -16,6 +16,8 @@ ...@@ -16,6 +16,8 @@
#ifndef __ASM_PGTABLE_3LEVEL_TYPES_H #ifndef __ASM_PGTABLE_3LEVEL_TYPES_H
#define __ASM_PGTABLE_3LEVEL_TYPES_H #define __ASM_PGTABLE_3LEVEL_TYPES_H
#include <asm/types.h>
typedef u64 pteval_t; typedef u64 pteval_t;
typedef u64 pmdval_t; typedef u64 pmdval_t;
typedef u64 pgdval_t; typedef u64 pgdval_t;
......
...@@ -122,5 +122,6 @@ ...@@ -122,5 +122,6 @@
#define TCR_TG1_64K (UL(1) << 30) #define TCR_TG1_64K (UL(1) << 30)
#define TCR_IPS_40BIT (UL(2) << 32) #define TCR_IPS_40BIT (UL(2) << 32)
#define TCR_ASID16 (UL(1) << 36) #define TCR_ASID16 (UL(1) << 36)
#define TCR_TBI0 (UL(1) << 37)
#endif #endif
...@@ -423,6 +423,7 @@ el0_da: ...@@ -423,6 +423,7 @@ el0_da:
* Data abort handling * Data abort handling
*/ */
mrs x0, far_el1 mrs x0, far_el1
bic x0, x0, #(0xff << 56)
disable_step x1 disable_step x1
isb isb
enable_dbg enable_dbg
...@@ -476,6 +477,8 @@ el0_undef: ...@@ -476,6 +477,8 @@ el0_undef:
* Undefined instruction * Undefined instruction
*/ */
mov x0, sp mov x0, sp
// enable interrupts before calling the main handler
enable_irq
b do_undefinstr b do_undefinstr
el0_dbg: el0_dbg:
/* /*
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/signal.h> #include <linux/signal.h>
#include <linux/hardirq.h>
#include <asm/fpsimd.h> #include <asm/fpsimd.h>
#include <asm/cputype.h> #include <asm/cputype.h>
...@@ -83,6 +84,33 @@ void fpsimd_flush_thread(void) ...@@ -83,6 +84,33 @@ void fpsimd_flush_thread(void)
fpsimd_load_state(&current->thread.fpsimd_state); fpsimd_load_state(&current->thread.fpsimd_state);
} }
#ifdef CONFIG_KERNEL_MODE_NEON
/*
* Kernel-side NEON support functions
*/
void kernel_neon_begin(void)
{
/* Avoid using the NEON in interrupt context */
BUG_ON(in_interrupt());
preempt_disable();
if (current->mm)
fpsimd_save_state(&current->thread.fpsimd_state);
}
EXPORT_SYMBOL(kernel_neon_begin);
void kernel_neon_end(void)
{
if (current->mm)
fpsimd_load_state(&current->thread.fpsimd_state);
preempt_enable();
}
EXPORT_SYMBOL(kernel_neon_end);
#endif /* CONFIG_KERNEL_MODE_NEON */
/* /*
* FP/SIMD support code initialisation. * FP/SIMD support code initialisation.
*/ */
......
...@@ -112,6 +112,14 @@ ...@@ -112,6 +112,14 @@
.quad TEXT_OFFSET // Image load offset from start of RAM .quad TEXT_OFFSET // Image load offset from start of RAM
.quad 0 // reserved .quad 0 // reserved
.quad 0 // reserved .quad 0 // reserved
.quad 0 // reserved
.quad 0 // reserved
.quad 0 // reserved
.byte 0x41 // Magic number, "ARM\x64"
.byte 0x52
.byte 0x4d
.byte 0x64
.word 0 // reserved
ENTRY(stext) ENTRY(stext)
mov x21, x0 // x21=FDT mov x21, x0 // x21=FDT
......
...@@ -325,7 +325,10 @@ validate_event(struct pmu_hw_events *hw_events, ...@@ -325,7 +325,10 @@ validate_event(struct pmu_hw_events *hw_events,
if (is_software_event(event)) if (is_software_event(event))
return 1; return 1;
if (event->pmu != leader_pmu || event->state <= PERF_EVENT_STATE_OFF) if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF)
return 1;
if (event->state == PERF_EVENT_STATE_OFF && !event->attr.enable_on_exec)
return 1; return 1;
return armpmu->get_event_idx(hw_events, &fake_event) >= 0; return armpmu->get_event_idx(hw_events, &fake_event) >= 0;
...@@ -781,7 +784,7 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX] ...@@ -781,7 +784,7 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]
/* /*
* PMXEVTYPER: Event selection reg * PMXEVTYPER: Event selection reg
*/ */
#define ARMV8_EVTYPE_MASK 0xc00000ff /* Mask for writable bits */ #define ARMV8_EVTYPE_MASK 0xc80000ff /* Mask for writable bits */
#define ARMV8_EVTYPE_EVENT 0xff /* Mask for EVENT bits */ #define ARMV8_EVTYPE_EVENT 0xff /* Mask for EVENT bits */
/* /*
......
...@@ -328,9 +328,6 @@ static int c_show(struct seq_file *m, void *v) ...@@ -328,9 +328,6 @@ static int c_show(struct seq_file *m, void *v)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
seq_printf(m, "processor\t: %d\n", i); seq_printf(m, "processor\t: %d\n", i);
#endif #endif
seq_printf(m, "BogoMIPS\t: %lu.%02lu\n\n",
loops_per_jiffy / (500000UL/HZ),
loops_per_jiffy / (5000UL/HZ) % 100);
} }
/* dump out the processor features */ /* dump out the processor features */
......
...@@ -223,11 +223,7 @@ asmlinkage void secondary_start_kernel(void) ...@@ -223,11 +223,7 @@ asmlinkage void secondary_start_kernel(void)
void __init smp_cpus_done(unsigned int max_cpus) void __init smp_cpus_done(unsigned int max_cpus)
{ {
unsigned long bogosum = loops_per_jiffy * num_online_cpus(); pr_info("SMP: Total of %d processors activated.\n", num_online_cpus());
pr_info("SMP: Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
num_online_cpus(), bogosum / (500000/HZ),
(bogosum / (5000/HZ)) % 100);
} }
void __init smp_prepare_boot_cpu(void) void __init smp_prepare_boot_cpu(void)
......
...@@ -71,6 +71,7 @@ SECTIONS ...@@ -71,6 +71,7 @@ SECTIONS
RO_DATA(PAGE_SIZE) RO_DATA(PAGE_SIZE)
EXCEPTION_TABLE(8) EXCEPTION_TABLE(8)
NOTES
_etext = .; /* End of text and rodata section */ _etext = .; /* End of text and rodata section */
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
...@@ -122,8 +123,6 @@ SECTIONS ...@@ -122,8 +123,6 @@ SECTIONS
} }
_edata_loc = __data_loc + SIZEOF(.data); _edata_loc = __data_loc + SIZEOF(.data);
NOTES
BSS_SECTION(0, 0, 0) BSS_SECTION(0, 0, 0)
_end = .; _end = .;
......
...@@ -296,6 +296,7 @@ void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt) ...@@ -296,6 +296,7 @@ void __iomem * __init early_io_map(phys_addr_t phys, unsigned long virt)
static void __init map_mem(void) static void __init map_mem(void)
{ {
struct memblock_region *reg; struct memblock_region *reg;
phys_addr_t limit;
/* /*
* Temporarily limit the memblock range. We need to do this as * Temporarily limit the memblock range. We need to do this as
...@@ -303,9 +304,11 @@ static void __init map_mem(void) ...@@ -303,9 +304,11 @@ static void __init map_mem(void)
* memory addressable from the initial direct kernel mapping. * memory addressable from the initial direct kernel mapping.
* *
* The initial direct kernel mapping, located at swapper_pg_dir, * The initial direct kernel mapping, located at swapper_pg_dir,
* gives us PGDIR_SIZE memory starting from PHYS_OFFSET (aligned). * gives us PGDIR_SIZE memory starting from PHYS_OFFSET (which must be
* aligned to 2MB as per Documentation/arm64/booting.txt).
*/ */
memblock_set_current_limit((PHYS_OFFSET & PGDIR_MASK) + PGDIR_SIZE); limit = PHYS_OFFSET + PGDIR_SIZE;
memblock_set_current_limit(limit);
/* map all the memory banks */ /* map all the memory banks */
for_each_memblock(memory, reg) { for_each_memblock(memory, reg) {
...@@ -315,6 +318,22 @@ static void __init map_mem(void) ...@@ -315,6 +318,22 @@ static void __init map_mem(void)
if (start >= end) if (start >= end)
break; break;
#ifndef CONFIG_ARM64_64K_PAGES
/*
* For the first memory bank align the start address and
* current memblock limit to prevent create_mapping() from
* allocating pte page tables from unmapped memory.
* When 64K pages are enabled, the pte page table for the
* first PGDIR_SIZE is already present in swapper_pg_dir.
*/
if (start < limit)
start = ALIGN(start, PMD_SIZE);
if (end < limit) {
limit = end & PMD_MASK;
memblock_set_current_limit(limit);
}
#endif
create_mapping(start, __phys_to_virt(start), end - start); create_mapping(start, __phys_to_virt(start), end - start);
} }
......
...@@ -95,10 +95,6 @@ ENTRY(cpu_do_switch_mm) ...@@ -95,10 +95,6 @@ ENTRY(cpu_do_switch_mm)
ret ret
ENDPROC(cpu_do_switch_mm) ENDPROC(cpu_do_switch_mm)
cpu_name:
.ascii "AArch64 Processor"
.align
.section ".text.init", #alloc, #execinstr .section ".text.init", #alloc, #execinstr
/* /*
...@@ -151,7 +147,7 @@ ENTRY(__cpu_setup) ...@@ -151,7 +147,7 @@ ENTRY(__cpu_setup)
* both user and kernel. * both user and kernel.
*/ */
ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | TCR_IPS_40BIT | \ ldr x10, =TCR_TxSZ(VA_BITS) | TCR_FLAGS | TCR_IPS_40BIT | \
TCR_ASID16 | (1 << 31) TCR_ASID16 | TCR_TBI0 | (1 << 31)
#ifdef CONFIG_ARM64_64K_PAGES #ifdef CONFIG_ARM64_64K_PAGES
orr x10, x10, TCR_TG0_64K orr x10, x10, TCR_TG0_64K
orr x10, x10, TCR_TG1_64K orr x10, x10, TCR_TG1_64K
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define EM_PPC 20 /* PowerPC */ #define EM_PPC 20 /* PowerPC */
#define EM_PPC64 21 /* PowerPC64 */ #define EM_PPC64 21 /* PowerPC64 */
#define EM_SPU 23 /* Cell BE SPU */ #define EM_SPU 23 /* Cell BE SPU */
#define EM_ARM 40 /* ARM 32 bit */
#define EM_SH 42 /* SuperH */ #define EM_SH 42 /* SuperH */
#define EM_SPARCV9 43 /* SPARC v9 64-bit */ #define EM_SPARCV9 43 /* SPARC v9 64-bit */
#define EM_IA_64 50 /* HP/Intel IA-64 */ #define EM_IA_64 50 /* HP/Intel IA-64 */
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ #define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ #define EM_BLACKFIN 106 /* ADI Blackfin Processor */
#define EM_TI_C6000 140 /* TI C6X DSPs */ #define EM_TI_C6000 140 /* TI C6X DSPs */
#define EM_AARCH64 183 /* ARM 64 bit */
#define EM_FRV 0x5441 /* Fujitsu FR-V */ #define EM_FRV 0x5441 /* Fujitsu FR-V */
#define EM_AVR32 0x18ad /* Atmel AVR32 */ #define EM_AVR32 0x18ad /* Atmel AVR32 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment