mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
![Christoph Hellwig](/assets/img/avatar_default.png)
[ Upstream commit 0348801151
]
vmap does not take a gfp_t, the flags argument is for VM_* flags.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Christophe Leroy <christophe.leroy@c-s.fr>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: David Airlie <airlied@linux.ie>
Cc: Gao Xiang <xiang@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Laura Abbott <labbott@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Kelley <mikelley@microsoft.com>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Nitin Gupta <ngupta@vflare.org>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Paul Mackerras <paulus@ozlabs.org>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Will Deacon <will@kernel.org>
Link: http://lkml.kernel.org/r/20200414131348.444715-3-hch@lst.de
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
72 lines
1.8 KiB
C
72 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
|
|
*
|
|
* This file contains the lowest level x86_64-specific interrupt
|
|
* entry and irq statistics code. All the remaining irq logic is
|
|
* done by the generic kernel/irq/ code and in the
|
|
* x86_64-specific irq controller code. (e.g. i8259.c and
|
|
* io_apic.c.)
|
|
*/
|
|
|
|
#include <linux/kernel_stat.h>
|
|
#include <linux/interrupt.h>
|
|
#include <linux/irq.h>
|
|
#include <linux/seq_file.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/ftrace.h>
|
|
#include <linux/uaccess.h>
|
|
#include <linux/smp.h>
|
|
#include <linux/sched/task_stack.h>
|
|
|
|
#include <asm/cpu_entry_area.h>
|
|
#include <asm/io_apic.h>
|
|
#include <asm/apic.h>
|
|
|
|
DEFINE_PER_CPU_PAGE_ALIGNED(struct irq_stack, irq_stack_backing_store) __visible;
|
|
DECLARE_INIT_PER_CPU(irq_stack_backing_store);
|
|
|
|
#ifdef CONFIG_VMAP_STACK
|
|
/*
|
|
* VMAP the backing store with guard pages
|
|
*/
|
|
static int map_irq_stack(unsigned int cpu)
|
|
{
|
|
char *stack = (char *)per_cpu_ptr(&irq_stack_backing_store, cpu);
|
|
struct page *pages[IRQ_STACK_SIZE / PAGE_SIZE];
|
|
void *va;
|
|
int i;
|
|
|
|
for (i = 0; i < IRQ_STACK_SIZE / PAGE_SIZE; i++) {
|
|
phys_addr_t pa = per_cpu_ptr_to_phys(stack + (i << PAGE_SHIFT));
|
|
|
|
pages[i] = pfn_to_page(pa >> PAGE_SHIFT);
|
|
}
|
|
|
|
va = vmap(pages, IRQ_STACK_SIZE / PAGE_SIZE, VM_MAP, PAGE_KERNEL);
|
|
if (!va)
|
|
return -ENOMEM;
|
|
|
|
per_cpu(hardirq_stack_ptr, cpu) = va + IRQ_STACK_SIZE;
|
|
return 0;
|
|
}
|
|
#else
|
|
/*
|
|
* If VMAP stacks are disabled due to KASAN, just use the per cpu
|
|
* backing store without guard pages.
|
|
*/
|
|
static int map_irq_stack(unsigned int cpu)
|
|
{
|
|
void *va = per_cpu_ptr(&irq_stack_backing_store, cpu);
|
|
|
|
per_cpu(hardirq_stack_ptr, cpu) = va + IRQ_STACK_SIZE;
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
int irq_init_percpu_irqstack(unsigned int cpu)
|
|
{
|
|
if (per_cpu(hardirq_stack_ptr, cpu))
|
|
return 0;
|
|
return map_irq_stack(cpu);
|
|
}
|