You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branches 'misc', 'vdso' and 'fixes' into for-next
Conflicts: arch/arm/mm/proc-macros.S
This commit is contained in:
@@ -263,6 +263,7 @@ core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
|
||||
core-$(CONFIG_VFP) += arch/arm/vfp/
|
||||
core-$(CONFIG_XEN) += arch/arm/xen/
|
||||
core-$(CONFIG_KVM_ARM_HOST) += arch/arm/kvm/
|
||||
core-$(CONFIG_VDSO) += arch/arm/vdso/
|
||||
|
||||
# If we have a machine-specific directory, then include it in the build.
|
||||
core-y += arch/arm/kernel/ arch/arm/mm/ arch/arm/common/
|
||||
@@ -320,6 +321,12 @@ dtbs: prepare scripts
|
||||
dtbs_install:
|
||||
$(Q)$(MAKE) $(dtbinst)=$(boot)/dts
|
||||
|
||||
PHONY += vdso_install
|
||||
vdso_install:
|
||||
ifeq ($(CONFIG_VDSO),y)
|
||||
$(Q)$(MAKE) $(build)=arch/arm/vdso $@
|
||||
endif
|
||||
|
||||
# We use MRPROPER_FILES and CLEAN_FILES now
|
||||
archclean:
|
||||
$(Q)$(MAKE) $(clean)=$(boot)
|
||||
@@ -344,4 +351,5 @@ define archhelp
|
||||
echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
|
||||
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
|
||||
echo ' install to $$(INSTALL_PATH) and run lilo'
|
||||
echo ' vdso_install - Install unstripped vdso.so to $$(INSTALL_MOD_PATH)/vdso'
|
||||
endef
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
|
||||
|
||||
generic-y += auxvec.h
|
||||
generic-y += bitsperlong.h
|
||||
generic-y += cputime.h
|
||||
generic-y += current.h
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
#include <uapi/asm/auxvec.h>
|
||||
@@ -1,7 +1,9 @@
|
||||
#ifndef __ASMARM_ELF_H
|
||||
#define __ASMARM_ELF_H
|
||||
|
||||
#include <asm/auxvec.h>
|
||||
#include <asm/hwcap.h>
|
||||
#include <asm/vdso_datapage.h>
|
||||
|
||||
/*
|
||||
* ELF register definitions..
|
||||
@@ -115,7 +117,7 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
|
||||
the loader. We need to make sure that it is out of the way of the program
|
||||
that it will "exec", and that there is sufficient room for the brk. */
|
||||
|
||||
#define ELF_ET_DYN_BASE (2 * TASK_SIZE / 3)
|
||||
#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
|
||||
|
||||
/* When the program starts, a1 contains a pointer to a function to be
|
||||
registered with atexit, as per the SVR4 ABI. A value of 0 means we
|
||||
@@ -130,6 +132,13 @@ extern unsigned long arch_randomize_brk(struct mm_struct *mm);
|
||||
#define arch_randomize_brk arch_randomize_brk
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
#ifdef CONFIG_VDSO
|
||||
#define ARCH_DLINFO \
|
||||
do { \
|
||||
NEW_AUX_ENT(AT_SYSINFO_EHDR, \
|
||||
(elf_addr_t)current->mm->context.vdso); \
|
||||
} while (0)
|
||||
#endif
|
||||
#define ARCH_HAS_SETUP_ADDITIONAL_PAGES 1
|
||||
struct linux_binprm;
|
||||
int arch_setup_additional_pages(struct linux_binprm *, int);
|
||||
|
||||
@@ -11,6 +11,9 @@ typedef struct {
|
||||
#endif
|
||||
unsigned int vmalloc_seq;
|
||||
unsigned long sigpage;
|
||||
#ifdef CONFIG_VDSO
|
||||
unsigned long vdso;
|
||||
#endif
|
||||
} mm_context_t;
|
||||
|
||||
#ifdef CONFIG_CPU_HAS_ASID
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef __ASM_VDSO_H
|
||||
#define __ASM_VDSO_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
struct mm_struct;
|
||||
|
||||
#ifdef CONFIG_VDSO
|
||||
|
||||
void arm_install_vdso(struct mm_struct *mm, unsigned long addr);
|
||||
|
||||
extern char vdso_start, vdso_end;
|
||||
|
||||
extern unsigned int vdso_total_pages;
|
||||
|
||||
#else /* CONFIG_VDSO */
|
||||
|
||||
static inline void arm_install_vdso(struct mm_struct *mm, unsigned long addr)
|
||||
{
|
||||
}
|
||||
|
||||
#define vdso_total_pages 0
|
||||
|
||||
#endif /* CONFIG_VDSO */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ASM_VDSO_H */
|
||||
@@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Adapted from arm64 version.
|
||||
*
|
||||
* Copyright (C) 2012 ARM Limited
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef __ASM_VDSO_DATAPAGE_H
|
||||
#define __ASM_VDSO_DATAPAGE_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <asm/page.h>
|
||||
|
||||
/* Try to be cache-friendly on systems that don't implement the
|
||||
* generic timer: fit the unconditionally updated fields in the first
|
||||
* 32 bytes.
|
||||
*/
|
||||
struct vdso_data {
|
||||
u32 seq_count; /* sequence count - odd during updates */
|
||||
u16 tk_is_cntvct; /* fall back to syscall if false */
|
||||
u16 cs_shift; /* clocksource shift */
|
||||
u32 xtime_coarse_sec; /* coarse time */
|
||||
u32 xtime_coarse_nsec;
|
||||
|
||||
u32 wtm_clock_sec; /* wall to monotonic offset */
|
||||
u32 wtm_clock_nsec;
|
||||
u32 xtime_clock_sec; /* CLOCK_REALTIME - seconds */
|
||||
u32 cs_mult; /* clocksource multiplier */
|
||||
|
||||
u64 cs_cycle_last; /* last cycle value */
|
||||
u64 cs_mask; /* clocksource mask */
|
||||
|
||||
u64 xtime_clock_snsec; /* CLOCK_REALTIME sub-ns base */
|
||||
u32 tz_minuteswest; /* timezone info for gettimeofday(2) */
|
||||
u32 tz_dsttime;
|
||||
};
|
||||
|
||||
union vdso_data_store {
|
||||
struct vdso_data data;
|
||||
u8 page[PAGE_SIZE];
|
||||
};
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ASM_VDSO_DATAPAGE_H */
|
||||
@@ -1,6 +1,7 @@
|
||||
# UAPI Header export list
|
||||
include include/uapi/asm-generic/Kbuild.asm
|
||||
|
||||
header-y += auxvec.h
|
||||
header-y += byteorder.h
|
||||
header-y += fcntl.h
|
||||
header-y += hwcap.h
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#ifndef __ASM_AUXVEC_H
|
||||
#define __ASM_AUXVEC_H
|
||||
|
||||
/* VDSO location */
|
||||
#define AT_SYSINFO_EHDR 33
|
||||
|
||||
#endif
|
||||
@@ -75,6 +75,7 @@ obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o
|
||||
CFLAGS_pj4-cp0.o := -marm
|
||||
AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
|
||||
obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
|
||||
obj-$(CONFIG_VDSO) += vdso.o
|
||||
|
||||
ifneq ($(CONFIG_ARCH_EBSA110),y)
|
||||
obj-y += io.o
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <asm/memory.h>
|
||||
#include <asm/procinfo.h>
|
||||
#include <asm/suspend.h>
|
||||
#include <asm/vdso_datapage.h>
|
||||
#include <asm/hardware/cache-l2x0.h>
|
||||
#include <linux/kbuild.h>
|
||||
|
||||
@@ -209,6 +210,10 @@ int main(void)
|
||||
DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base));
|
||||
#endif
|
||||
DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr));
|
||||
#endif
|
||||
BLANK();
|
||||
#ifdef CONFIG_VDSO
|
||||
DEFINE(VDSO_DATA_SIZE, sizeof(union vdso_data_store));
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -334,7 +334,7 @@ const char *arch_vma_name(struct vm_area_struct *vma)
|
||||
}
|
||||
|
||||
/* If possible, provide a placement hint at a random offset from the
|
||||
* stack for the signal page.
|
||||
* stack for the sigpage and vdso pages.
|
||||
*/
|
||||
static unsigned long sigpage_addr(const struct mm_struct *mm,
|
||||
unsigned int npages)
|
||||
@@ -378,6 +378,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
||||
{
|
||||
struct mm_struct *mm = current->mm;
|
||||
struct vm_area_struct *vma;
|
||||
unsigned long npages;
|
||||
unsigned long addr;
|
||||
unsigned long hint;
|
||||
int ret = 0;
|
||||
@@ -387,9 +388,12 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
||||
if (!signal_page)
|
||||
return -ENOMEM;
|
||||
|
||||
npages = 1; /* for sigpage */
|
||||
npages += vdso_total_pages;
|
||||
|
||||
down_write(&mm->mmap_sem);
|
||||
hint = sigpage_addr(mm, 1);
|
||||
addr = get_unmapped_area(NULL, hint, PAGE_SIZE, 0, 0);
|
||||
hint = sigpage_addr(mm, npages);
|
||||
addr = get_unmapped_area(NULL, hint, npages << PAGE_SHIFT, 0, 0);
|
||||
if (IS_ERR_VALUE(addr)) {
|
||||
ret = addr;
|
||||
goto up_fail;
|
||||
@@ -406,6 +410,12 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
|
||||
|
||||
mm->context.sigpage = addr;
|
||||
|
||||
/* Unlike the sigpage, failure to install the vdso is unlikely
|
||||
* to be fatal to the process, so no error check needed
|
||||
* here.
|
||||
*/
|
||||
arm_install_vdso(mm, addr + PAGE_SIZE);
|
||||
|
||||
up_fail:
|
||||
up_write(&mm->mmap_sem);
|
||||
return ret;
|
||||
|
||||
@@ -246,12 +246,9 @@ static int __get_cpu_architecture(void)
|
||||
if (cpu_arch)
|
||||
cpu_arch += CPU_ARCH_ARMv3;
|
||||
} else if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
|
||||
unsigned int mmfr0;
|
||||
|
||||
/* Revised CPUID format. Read the Memory Model Feature
|
||||
* Register 0 and check for VMSAv7 or PMSAv7 */
|
||||
asm("mrc p15, 0, %0, c0, c1, 4"
|
||||
: "=r" (mmfr0));
|
||||
unsigned int mmfr0 = read_cpuid_ext(CPUID_EXT_MMFR0);
|
||||
if ((mmfr0 & 0x0000000f) >= 0x00000003 ||
|
||||
(mmfr0 & 0x000000f0) >= 0x00000030)
|
||||
cpu_arch = CPU_ARCH_ARMv7;
|
||||
|
||||
@@ -0,0 +1,337 @@
|
||||
/*
|
||||
* Adapted from arm64 version.
|
||||
*
|
||||
* Copyright (C) 2012 ARM Limited
|
||||
* Copyright (C) 2015 Mentor Graphics Corporation.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <linux/elf.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/printk.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/timekeeper_internal.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <asm/arch_timer.h>
|
||||
#include <asm/barrier.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/vdso.h>
|
||||
#include <asm/vdso_datapage.h>
|
||||
#include <clocksource/arm_arch_timer.h>
|
||||
|
||||
#define MAX_SYMNAME 64
|
||||
|
||||
static struct page **vdso_text_pagelist;
|
||||
|
||||
/* Total number of pages needed for the data and text portions of the VDSO. */
|
||||
unsigned int vdso_total_pages __read_mostly;
|
||||
|
||||
/*
|
||||
* The VDSO data page.
|
||||
*/
|
||||
static union vdso_data_store vdso_data_store __page_aligned_data;
|
||||
static struct vdso_data *vdso_data = &vdso_data_store.data;
|
||||
|
||||
static struct page *vdso_data_page;
|
||||
static struct vm_special_mapping vdso_data_mapping = {
|
||||
.name = "[vvar]",
|
||||
.pages = &vdso_data_page,
|
||||
};
|
||||
|
||||
static struct vm_special_mapping vdso_text_mapping = {
|
||||
.name = "[vdso]",
|
||||
};
|
||||
|
||||
struct elfinfo {
|
||||
Elf32_Ehdr *hdr; /* ptr to ELF */
|
||||
Elf32_Sym *dynsym; /* ptr to .dynsym section */
|
||||
unsigned long dynsymsize; /* size of .dynsym section */
|
||||
char *dynstr; /* ptr to .dynstr section */
|
||||
};
|
||||
|
||||
/* Cached result of boot-time check for whether the arch timer exists,
|
||||
* and if so, whether the virtual counter is useable.
|
||||
*/
|
||||
static bool cntvct_ok __read_mostly;
|
||||
|
||||
static bool __init cntvct_functional(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
bool ret = false;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
|
||||
goto out;
|
||||
|
||||
/* The arm_arch_timer core should export
|
||||
* arch_timer_use_virtual or similar so we don't have to do
|
||||
* this.
|
||||
*/
|
||||
np = of_find_compatible_node(NULL, NULL, "arm,armv7-timer");
|
||||
if (!np)
|
||||
goto out_put;
|
||||
|
||||
if (of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
|
||||
goto out_put;
|
||||
|
||||
ret = true;
|
||||
|
||||
out_put:
|
||||
of_node_put(np);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void * __init find_section(Elf32_Ehdr *ehdr, const char *name,
|
||||
unsigned long *size)
|
||||
{
|
||||
Elf32_Shdr *sechdrs;
|
||||
unsigned int i;
|
||||
char *secnames;
|
||||
|
||||
/* Grab section headers and strings so we can tell who is who */
|
||||
sechdrs = (void *)ehdr + ehdr->e_shoff;
|
||||
secnames = (void *)ehdr + sechdrs[ehdr->e_shstrndx].sh_offset;
|
||||
|
||||
/* Find the section they want */
|
||||
for (i = 1; i < ehdr->e_shnum; i++) {
|
||||
if (strcmp(secnames + sechdrs[i].sh_name, name) == 0) {
|
||||
if (size)
|
||||
*size = sechdrs[i].sh_size;
|
||||
return (void *)ehdr + sechdrs[i].sh_offset;
|
||||
}
|
||||
}
|
||||
|
||||
if (size)
|
||||
*size = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static Elf32_Sym * __init find_symbol(struct elfinfo *lib, const char *symname)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < (lib->dynsymsize / sizeof(Elf32_Sym)); i++) {
|
||||
char name[MAX_SYMNAME], *c;
|
||||
|
||||
if (lib->dynsym[i].st_name == 0)
|
||||
continue;
|
||||
strlcpy(name, lib->dynstr + lib->dynsym[i].st_name,
|
||||
MAX_SYMNAME);
|
||||
c = strchr(name, '@');
|
||||
if (c)
|
||||
*c = 0;
|
||||
if (strcmp(symname, name) == 0)
|
||||
return &lib->dynsym[i];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void __init vdso_nullpatch_one(struct elfinfo *lib, const char *symname)
|
||||
{
|
||||
Elf32_Sym *sym;
|
||||
|
||||
sym = find_symbol(lib, symname);
|
||||
if (!sym)
|
||||
return;
|
||||
|
||||
sym->st_name = 0;
|
||||
}
|
||||
|
||||
static void __init patch_vdso(void *ehdr)
|
||||
{
|
||||
struct elfinfo einfo;
|
||||
|
||||
einfo = (struct elfinfo) {
|
||||
.hdr = ehdr,
|
||||
};
|
||||
|
||||
einfo.dynsym = find_section(einfo.hdr, ".dynsym", &einfo.dynsymsize);
|
||||
einfo.dynstr = find_section(einfo.hdr, ".dynstr", NULL);
|
||||
|
||||
/* If the virtual counter is absent or non-functional we don't
|
||||
* want programs to incur the slight additional overhead of
|
||||
* dispatching through the VDSO only to fall back to syscalls.
|
||||
*/
|
||||
if (!cntvct_ok) {
|
||||
vdso_nullpatch_one(&einfo, "__vdso_gettimeofday");
|
||||
vdso_nullpatch_one(&einfo, "__vdso_clock_gettime");
|
||||
}
|
||||
}
|
||||
|
||||
static int __init vdso_init(void)
|
||||
{
|
||||
unsigned int text_pages;
|
||||
int i;
|
||||
|
||||
if (memcmp(&vdso_start, "\177ELF", 4)) {
|
||||
pr_err("VDSO is not a valid ELF object!\n");
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
text_pages = (&vdso_end - &vdso_start) >> PAGE_SHIFT;
|
||||
pr_debug("vdso: %i text pages at base %p\n", text_pages, &vdso_start);
|
||||
|
||||
/* Allocate the VDSO text pagelist */
|
||||
vdso_text_pagelist = kcalloc(text_pages, sizeof(struct page *),
|
||||
GFP_KERNEL);
|
||||
if (vdso_text_pagelist == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
/* Grab the VDSO data page. */
|
||||
vdso_data_page = virt_to_page(vdso_data);
|
||||
|
||||
/* Grab the VDSO text pages. */
|
||||
for (i = 0; i < text_pages; i++) {
|
||||
struct page *page;
|
||||
|
||||
page = virt_to_page(&vdso_start + i * PAGE_SIZE);
|
||||
vdso_text_pagelist[i] = page;
|
||||
}
|
||||
|
||||
vdso_text_mapping.pages = vdso_text_pagelist;
|
||||
|
||||
vdso_total_pages = 1; /* for the data/vvar page */
|
||||
vdso_total_pages += text_pages;
|
||||
|
||||
cntvct_ok = cntvct_functional();
|
||||
|
||||
patch_vdso(&vdso_start);
|
||||
|
||||
return 0;
|
||||
}
|
||||
arch_initcall(vdso_init);
|
||||
|
||||
static int install_vvar(struct mm_struct *mm, unsigned long addr)
|
||||
{
|
||||
struct vm_area_struct *vma;
|
||||
|
||||
vma = _install_special_mapping(mm, addr, PAGE_SIZE,
|
||||
VM_READ | VM_MAYREAD,
|
||||
&vdso_data_mapping);
|
||||
|
||||
return IS_ERR(vma) ? PTR_ERR(vma) : 0;
|
||||
}
|
||||
|
||||
/* assumes mmap_sem is write-locked */
|
||||
void arm_install_vdso(struct mm_struct *mm, unsigned long addr)
|
||||
{
|
||||
struct vm_area_struct *vma;
|
||||
unsigned long len;
|
||||
|
||||
mm->context.vdso = 0;
|
||||
|
||||
if (vdso_text_pagelist == NULL)
|
||||
return;
|
||||
|
||||
if (install_vvar(mm, addr))
|
||||
return;
|
||||
|
||||
/* Account for vvar page. */
|
||||
addr += PAGE_SIZE;
|
||||
len = (vdso_total_pages - 1) << PAGE_SHIFT;
|
||||
|
||||
vma = _install_special_mapping(mm, addr, len,
|
||||
VM_READ | VM_EXEC | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC,
|
||||
&vdso_text_mapping);
|
||||
|
||||
if (!IS_ERR(vma))
|
||||
mm->context.vdso = addr;
|
||||
}
|
||||
|
||||
static void vdso_write_begin(struct vdso_data *vdata)
|
||||
{
|
||||
++vdso_data->seq_count;
|
||||
smp_wmb(); /* Pairs with smp_rmb in vdso_read_retry */
|
||||
}
|
||||
|
||||
static void vdso_write_end(struct vdso_data *vdata)
|
||||
{
|
||||
smp_wmb(); /* Pairs with smp_rmb in vdso_read_begin */
|
||||
++vdso_data->seq_count;
|
||||
}
|
||||
|
||||
static bool tk_is_cntvct(const struct timekeeper *tk)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_ARM_ARCH_TIMER))
|
||||
return false;
|
||||
|
||||
if (strcmp(tk->tkr.clock->name, "arch_sys_counter") != 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* update_vsyscall - update the vdso data page
|
||||
*
|
||||
* Increment the sequence counter, making it odd, indicating to
|
||||
* userspace that an update is in progress. Update the fields used
|
||||
* for coarse clocks and, if the architected system timer is in use,
|
||||
* the fields used for high precision clocks. Increment the sequence
|
||||
* counter again, making it even, indicating to userspace that the
|
||||
* update is finished.
|
||||
*
|
||||
* Userspace is expected to sample seq_count before reading any other
|
||||
* fields from the data page. If seq_count is odd, userspace is
|
||||
* expected to wait until it becomes even. After copying data from
|
||||
* the page, userspace must sample seq_count again; if it has changed
|
||||
* from its previous value, userspace must retry the whole sequence.
|
||||
*
|
||||
* Calls to update_vsyscall are serialized by the timekeeping core.
|
||||
*/
|
||||
void update_vsyscall(struct timekeeper *tk)
|
||||
{
|
||||
struct timespec xtime_coarse;
|
||||
struct timespec64 *wtm = &tk->wall_to_monotonic;
|
||||
|
||||
if (!cntvct_ok) {
|
||||
/* The entry points have been zeroed, so there is no
|
||||
* point in updating the data page.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
vdso_write_begin(vdso_data);
|
||||
|
||||
xtime_coarse = __current_kernel_time();
|
||||
vdso_data->tk_is_cntvct = tk_is_cntvct(tk);
|
||||
vdso_data->xtime_coarse_sec = xtime_coarse.tv_sec;
|
||||
vdso_data->xtime_coarse_nsec = xtime_coarse.tv_nsec;
|
||||
vdso_data->wtm_clock_sec = wtm->tv_sec;
|
||||
vdso_data->wtm_clock_nsec = wtm->tv_nsec;
|
||||
|
||||
if (vdso_data->tk_is_cntvct) {
|
||||
vdso_data->cs_cycle_last = tk->tkr.cycle_last;
|
||||
vdso_data->xtime_clock_sec = tk->xtime_sec;
|
||||
vdso_data->xtime_clock_snsec = tk->tkr.xtime_nsec;
|
||||
vdso_data->cs_mult = tk->tkr.mult;
|
||||
vdso_data->cs_shift = tk->tkr.shift;
|
||||
vdso_data->cs_mask = tk->tkr.mask;
|
||||
}
|
||||
|
||||
vdso_write_end(vdso_data);
|
||||
|
||||
flush_dcache_page(virt_to_page(vdso_data));
|
||||
}
|
||||
|
||||
void update_vsyscall_tz(void)
|
||||
{
|
||||
vdso_data->tz_minuteswest = sys_tz.tz_minuteswest;
|
||||
vdso_data->tz_dsttime = sys_tz.tz_dsttime;
|
||||
flush_dcache_page(virt_to_page(vdso_data));
|
||||
}
|
||||
@@ -42,6 +42,7 @@ if ARCH_VEXPRESS
|
||||
config ARCH_VEXPRESS_CORTEX_A5_A9_ERRATA
|
||||
bool "Enable A5 and A9 only errata work-arounds"
|
||||
default y
|
||||
select ARM_ERRATA_643719 if SMP
|
||||
select ARM_ERRATA_720789
|
||||
select PL310_ERRATA_753970 if CACHE_L2X0
|
||||
help
|
||||
|
||||
+15
-1
@@ -738,7 +738,7 @@ config CPU_ICACHE_DISABLE
|
||||
|
||||
config CPU_DCACHE_DISABLE
|
||||
bool "Disable D-Cache (C-bit)"
|
||||
depends on CPU_CP15
|
||||
depends on CPU_CP15 && !SMP
|
||||
help
|
||||
Say Y here to disable the processor data cache. Unless
|
||||
you have a reason not to or are unsure, say N.
|
||||
@@ -825,6 +825,20 @@ config KUSER_HELPERS
|
||||
Say N here only if you are absolutely certain that you do not
|
||||
need these helpers; otherwise, the safe option is to say Y.
|
||||
|
||||
config VDSO
|
||||
bool "Enable VDSO for acceleration of some system calls"
|
||||
depends on AEABI && MMU
|
||||
default y if ARM_ARCH_TIMER
|
||||
select GENERIC_TIME_VSYSCALL
|
||||
help
|
||||
Place in the process address space an ELF shared object
|
||||
providing fast implementations of gettimeofday and
|
||||
clock_gettime. Systems that implement the ARM architected
|
||||
timer will receive maximum benefit.
|
||||
|
||||
You must have glibc 2.22 or later for programs to seamlessly
|
||||
take advantage of this.
|
||||
|
||||
config DMA_CACHE_RWFO
|
||||
bool "Enable read/write for ownership DMA cache maintenance"
|
||||
depends on CPU_V6K && SMP
|
||||
|
||||
+16
-17
@@ -1131,23 +1131,22 @@ static void __init l2c310_of_parse(const struct device_node *np,
|
||||
}
|
||||
|
||||
ret = l2x0_cache_size_of_parse(np, aux_val, aux_mask, &assoc, SZ_512K);
|
||||
if (ret)
|
||||
return;
|
||||
|
||||
switch (assoc) {
|
||||
case 16:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
case 8:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
default:
|
||||
pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n",
|
||||
assoc);
|
||||
break;
|
||||
if (!ret) {
|
||||
switch (assoc) {
|
||||
case 16:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_val |= L310_AUX_CTRL_ASSOCIATIVITY_16;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
case 8:
|
||||
*aux_val &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
*aux_mask &= ~L2X0_AUX_CTRL_ASSOC_MASK;
|
||||
break;
|
||||
default:
|
||||
pr_err("L2C-310 OF cache associativity %d invalid, only 8 or 16 permitted\n",
|
||||
assoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
prefetch = l2x0_saved_regs.prefetch_ctrl;
|
||||
|
||||
@@ -171,7 +171,7 @@ static int __dma_supported(struct device *dev, u64 mask, bool warn)
|
||||
*/
|
||||
if (sizeof(mask) != sizeof(dma_addr_t) &&
|
||||
mask > (dma_addr_t)~0 &&
|
||||
dma_to_pfn(dev, ~0) < max_pfn) {
|
||||
dma_to_pfn(dev, ~0) < max_pfn - 1) {
|
||||
if (warn) {
|
||||
dev_warn(dev, "Coherent DMA mask %#llx is larger than dma_addr_t allows\n",
|
||||
mask);
|
||||
@@ -1150,13 +1150,28 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,
|
||||
gfp |= __GFP_NOWARN | __GFP_HIGHMEM;
|
||||
|
||||
while (count) {
|
||||
int j, order = __fls(count);
|
||||
int j, order;
|
||||
|
||||
pages[i] = alloc_pages(gfp, order);
|
||||
while (!pages[i] && order)
|
||||
pages[i] = alloc_pages(gfp, --order);
|
||||
if (!pages[i])
|
||||
goto error;
|
||||
for (order = __fls(count); order > 0; --order) {
|
||||
/*
|
||||
* We do not want OOM killer to be invoked as long
|
||||
* as we can fall back to single pages, so we force
|
||||
* __GFP_NORETRY for orders higher than zero.
|
||||
*/
|
||||
pages[i] = alloc_pages(gfp | __GFP_NORETRY, order);
|
||||
if (pages[i])
|
||||
break;
|
||||
}
|
||||
|
||||
if (!pages[i]) {
|
||||
/*
|
||||
* Fall back to single page allocation.
|
||||
* Might invoke OOM killer as last resort.
|
||||
*/
|
||||
pages[i] = alloc_pages(gfp, 0);
|
||||
if (!pages[i])
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (order) {
|
||||
split_page(pages[i], order);
|
||||
|
||||
@@ -552,6 +552,7 @@ do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
|
||||
|
||||
pr_alert("Unhandled fault: %s (0x%03x) at 0x%08lx\n",
|
||||
inf->name, fsr, addr);
|
||||
show_pte(current->mm, addr);
|
||||
|
||||
info.si_signo = inf->sig;
|
||||
info.si_errno = 0;
|
||||
|
||||
@@ -49,7 +49,10 @@ static int change_memory_common(unsigned long addr, int numpages,
|
||||
WARN_ON_ONCE(1);
|
||||
}
|
||||
|
||||
if (!is_module_address(start) || !is_module_address(end - 1))
|
||||
if (start < MODULES_VADDR || start >= MODULES_END)
|
||||
return -EINVAL;
|
||||
|
||||
if (end < MODULES_VADDR || start >= MODULES_END)
|
||||
return -EINVAL;
|
||||
|
||||
data.set_mask = set_mask;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user