Merge branch 'core/urgent' into x86/urgent, to pick up objtool fix
Signed-off-by: Ingo Molnar <mingo@kernel.org>
This commit is contained in:
@@ -169,7 +169,6 @@ config X86
|
||||
select HAVE_KRETPROBES
|
||||
select HAVE_KVM
|
||||
select HAVE_LIVEPATCH if X86_64
|
||||
select HAVE_MEMBLOCK
|
||||
select HAVE_MEMBLOCK_NODE_MAP
|
||||
select HAVE_MIXED_BREAKPOINTS_REGS
|
||||
select HAVE_MOD_ARCH_SPECIFIC
|
||||
@@ -186,6 +185,7 @@ config X86
|
||||
select HAVE_RCU_TABLE_INVALIDATE if HAVE_RCU_TABLE_FREE
|
||||
select HAVE_REGS_AND_STACK_ACCESS_API
|
||||
select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION
|
||||
select HAVE_FUNCTION_ARG_ACCESS_API
|
||||
select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR
|
||||
select HAVE_STACK_VALIDATION if X86_64
|
||||
select HAVE_RSEQ
|
||||
@@ -833,9 +833,6 @@ config JAILHOUSE_GUEST
|
||||
|
||||
endif #HYPERVISOR_GUEST
|
||||
|
||||
config NO_BOOTMEM
|
||||
def_bool y
|
||||
|
||||
source "arch/x86/Kconfig.cpu"
|
||||
|
||||
config HPET_TIMER
|
||||
|
@@ -105,8 +105,10 @@ int iosf_mbi_modify(u8 port, u8 opcode, u32 offset, u32 mdr, u32 mask);
|
||||
* the PMIC bus while another driver is also accessing the PMIC bus various bad
|
||||
* things happen.
|
||||
*
|
||||
* To avoid these problems this function must be called before accessing the
|
||||
* P-Unit or the PMIC, be it through iosf_mbi* functions or through other means.
|
||||
* Call this function before sending requests to the P-Unit which may make it
|
||||
* access the PMIC, be it through iosf_mbi* functions or through other means.
|
||||
* This function will block all kernel access to the PMIC I2C bus, so that the
|
||||
* P-Unit can safely access the PMIC over the shared I2C bus.
|
||||
*
|
||||
* Note on these systems the i2c-bus driver will request a sempahore from the
|
||||
* P-Unit for exclusive access to the PMIC bus when i2c drivers are accessing
|
||||
@@ -122,6 +124,31 @@ void iosf_mbi_punit_acquire(void);
|
||||
*/
|
||||
void iosf_mbi_punit_release(void);
|
||||
|
||||
/**
|
||||
* iosf_mbi_block_punit_i2c_access() - Block P-Unit accesses to the PMIC bus
|
||||
*
|
||||
* Call this function to block P-Unit access to the PMIC I2C bus, so that the
|
||||
* kernel can safely access the PMIC over the shared I2C bus.
|
||||
*
|
||||
* This function acquires the P-Unit bus semaphore and notifies
|
||||
* pmic_bus_access_notifier listeners that they may no longer access the
|
||||
* P-Unit in a way which may cause it to access the shared I2C bus.
|
||||
*
|
||||
* Note this function may be called multiple times and the bus will not
|
||||
* be released until iosf_mbi_unblock_punit_i2c_access() has been called the
|
||||
* same amount of times.
|
||||
*
|
||||
* Return: Nonzero on error
|
||||
*/
|
||||
int iosf_mbi_block_punit_i2c_access(void);
|
||||
|
||||
/*
|
||||
* iosf_mbi_unblock_punit_i2c_access() - Release PMIC I2C bus block
|
||||
*
|
||||
* Release i2c access block gotten through iosf_mbi_block_punit_i2c_access().
|
||||
*/
|
||||
void iosf_mbi_unblock_punit_i2c_access(void);
|
||||
|
||||
/**
|
||||
* iosf_mbi_register_pmic_bus_access_notifier - Register PMIC bus notifier
|
||||
*
|
||||
@@ -158,14 +185,6 @@ int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb);
|
||||
int iosf_mbi_unregister_pmic_bus_access_notifier_unlocked(
|
||||
struct notifier_block *nb);
|
||||
|
||||
/**
|
||||
* iosf_mbi_call_pmic_bus_access_notifier_chain - Call PMIC bus notifier chain
|
||||
*
|
||||
* @val: action to pass into listener's notifier_call function
|
||||
* @v: data pointer to pass into listener's notifier_call function
|
||||
*/
|
||||
int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v);
|
||||
|
||||
/**
|
||||
* iosf_mbi_assert_punit_acquired - Assert that the P-Unit has been acquired.
|
||||
*/
|
||||
|
@@ -21,6 +21,7 @@
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/string.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/ptrace.h>
|
||||
@@ -132,7 +133,7 @@ static inline void crash_setup_regs(struct pt_regs *newregs,
|
||||
asm volatile("movl %%cs, %%eax;" :"=a"(newregs->cs));
|
||||
asm volatile("pushfq; popq %0" :"=m"(newregs->flags));
|
||||
#endif
|
||||
newregs->ip = (unsigned long)current_text_addr();
|
||||
newregs->ip = _THIS_IP_;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -42,18 +42,6 @@ struct vm86;
|
||||
#define NET_IP_ALIGN 0
|
||||
|
||||
#define HBP_NUM 4
|
||||
/*
|
||||
* Default implementation of macro that returns current
|
||||
* instruction pointer ("program counter").
|
||||
*/
|
||||
static inline void *current_text_addr(void)
|
||||
{
|
||||
void *pc;
|
||||
|
||||
asm volatile("mov $1f, %0; 1:":"=r" (pc));
|
||||
|
||||
return pc;
|
||||
}
|
||||
|
||||
/*
|
||||
* These alignment constraints are for performance in the vSMP case,
|
||||
|
@@ -286,6 +286,44 @@ static inline unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* regs_get_kernel_argument() - get Nth function argument in kernel
|
||||
* @regs: pt_regs of that context
|
||||
* @n: function argument number (start from 0)
|
||||
*
|
||||
* regs_get_argument() returns @n th argument of the function call.
|
||||
* Note that this chooses most probably assignment, in some case
|
||||
* it can be incorrect.
|
||||
* This is expected to be called from kprobes or ftrace with regs
|
||||
* where the top of stack is the return address.
|
||||
*/
|
||||
static inline unsigned long regs_get_kernel_argument(struct pt_regs *regs,
|
||||
unsigned int n)
|
||||
{
|
||||
static const unsigned int argument_offs[] = {
|
||||
#ifdef __i386__
|
||||
offsetof(struct pt_regs, ax),
|
||||
offsetof(struct pt_regs, cx),
|
||||
offsetof(struct pt_regs, dx),
|
||||
#define NR_REG_ARGUMENTS 3
|
||||
#else
|
||||
offsetof(struct pt_regs, di),
|
||||
offsetof(struct pt_regs, si),
|
||||
offsetof(struct pt_regs, dx),
|
||||
offsetof(struct pt_regs, cx),
|
||||
offsetof(struct pt_regs, r8),
|
||||
offsetof(struct pt_regs, r9),
|
||||
#define NR_REG_ARGUMENTS 6
|
||||
#endif
|
||||
};
|
||||
|
||||
if (n >= NR_REG_ARGUMENTS) {
|
||||
n -= NR_REG_ARGUMENTS - 1;
|
||||
return regs_get_kernel_stack_nth(regs, n);
|
||||
} else
|
||||
return regs_get_register(regs, argument_offs[n]);
|
||||
}
|
||||
|
||||
#define arch_has_single_step() (1)
|
||||
#ifdef CONFIG_X86_DEBUGCTLMSR
|
||||
#define arch_has_block_step() (1)
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/efi-bgrt.h>
|
||||
@@ -933,7 +933,8 @@ static int __init acpi_parse_hpet(struct acpi_table_header *table)
|
||||
* the resource tree during the lateinit timeframe.
|
||||
*/
|
||||
#define HPET_RESOURCE_NAME_SIZE 9
|
||||
hpet_res = alloc_bootmem(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE);
|
||||
hpet_res = memblock_alloc(sizeof(*hpet_res) + HPET_RESOURCE_NAME_SIZE,
|
||||
SMP_CACHE_BYTES);
|
||||
|
||||
hpet_res->name = (void *)&hpet_res[1];
|
||||
hpet_res->flags = IORESOURCE_MEM;
|
||||
|
@@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/cpumask.h>
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <linux/acpi_pmtmr.h>
|
||||
#include <linux/clockchips.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/export.h>
|
||||
|
@@ -47,7 +47,7 @@
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/jiffies.h> /* time_after() */
|
||||
#include <linux/slab.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/irqdomain.h>
|
||||
#include <asm/io.h>
|
||||
@@ -2578,7 +2578,7 @@ static struct resource * __init ioapic_setup_resources(void)
|
||||
n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource);
|
||||
n *= nr_ioapics;
|
||||
|
||||
mem = alloc_bootmem(n);
|
||||
mem = memblock_alloc(n, SMP_CACHE_BYTES);
|
||||
res = (void *)mem;
|
||||
|
||||
mem += sizeof(struct resource) * nr_ioapics;
|
||||
@@ -2621,7 +2621,8 @@ void __init io_apic_init_mappings(void)
|
||||
#ifdef CONFIG_X86_32
|
||||
fake_ioapic_page:
|
||||
#endif
|
||||
ioapic_phys = (unsigned long)alloc_bootmem_pages(PAGE_SIZE);
|
||||
ioapic_phys = (unsigned long)memblock_alloc(PAGE_SIZE,
|
||||
PAGE_SIZE);
|
||||
ioapic_phys = __pa(ioapic_phys);
|
||||
}
|
||||
set_fixmap_nocache(idx, ioapic_phys);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/* cpu_feature_enabled() cannot be used this early */
|
||||
#define USE_EARLY_PGTABLE_L5
|
||||
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -9,11 +9,10 @@
|
||||
* allocation code routines via a platform independent interface (memblock, etc.).
|
||||
*/
|
||||
#include <linux/crash_dump.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/firmware-map.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/sort.h>
|
||||
|
||||
#include <asm/e820/api.h>
|
||||
@@ -1094,7 +1093,8 @@ void __init e820__reserve_resources(void)
|
||||
struct resource *res;
|
||||
u64 end;
|
||||
|
||||
res = alloc_bootmem(sizeof(*res) * e820_table->nr_entries);
|
||||
res = memblock_alloc(sizeof(*res) * e820_table->nr_entries,
|
||||
SMP_CACHE_BYTES);
|
||||
e820_res = res;
|
||||
|
||||
for (i = 0; i < e820_table->nr_entries; i++) {
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/kernel_stat.h>
|
||||
#include <linux/mc146818rtc.h>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#include <linux/dma-debug.h>
|
||||
#include <linux/dmar.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/pci.h>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#include <linux/cache.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/swiotlb.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/dma-direct.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/nmi.h>
|
||||
|
||||
#include <asm/fixmap.h>
|
||||
|
@@ -30,7 +30,6 @@
|
||||
#include <linux/sfi.h>
|
||||
#include <linux/apm_bios.h>
|
||||
#include <linux/initrd.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/console.h>
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/kexec.h>
|
||||
#include <linux/crash_dump.h>
|
||||
@@ -106,20 +106,22 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, unsigned long size,
|
||||
void *ptr;
|
||||
|
||||
if (!node_online(node) || !NODE_DATA(node)) {
|
||||
ptr = __alloc_bootmem_nopanic(size, align, goal);
|
||||
ptr = memblock_alloc_from_nopanic(size, align, goal);
|
||||
pr_info("cpu %d has no node %d or node-local memory\n",
|
||||
cpu, node);
|
||||
pr_debug("per cpu data for cpu%d %lu bytes at %016lx\n",
|
||||
cpu, size, __pa(ptr));
|
||||
} else {
|
||||
ptr = __alloc_bootmem_node_nopanic(NODE_DATA(node),
|
||||
size, align, goal);
|
||||
ptr = memblock_alloc_try_nid_nopanic(size, align, goal,
|
||||
MEMBLOCK_ALLOC_ACCESSIBLE,
|
||||
node);
|
||||
|
||||
pr_debug("per cpu data for cpu%d %lu bytes on node%d at %016lx\n",
|
||||
cpu, size, node, __pa(ptr));
|
||||
}
|
||||
return ptr;
|
||||
#else
|
||||
return __alloc_bootmem_nopanic(size, align, goal);
|
||||
return memblock_alloc_from_nopanic(size, align, goal);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -133,7 +135,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
|
||||
|
||||
static void __init pcpu_fc_free(void *ptr, size_t size)
|
||||
{
|
||||
free_bootmem(__pa(ptr), size);
|
||||
memblock_free(__pa(ptr), size);
|
||||
}
|
||||
|
||||
static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)
|
||||
|
@@ -49,7 +49,7 @@
|
||||
#include <linux/sched/hotplug.h>
|
||||
#include <linux/sched/task_stack.h>
|
||||
#include <linux/percpu.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/nmi.h>
|
||||
#include <linux/tboot.h>
|
||||
|
@@ -30,7 +30,7 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <asm/tce.h>
|
||||
#include <asm/calgary.h>
|
||||
#include <asm/proto.h>
|
||||
@@ -173,7 +173,7 @@ void * __init alloc_tce_table(void)
|
||||
size = table_size_to_number_of_entries(specified_table_size);
|
||||
size *= TCE_ENTRY_SIZE;
|
||||
|
||||
return __alloc_bootmem_low(size, size, 0);
|
||||
return memblock_alloc_low(size, size);
|
||||
}
|
||||
|
||||
void __init free_tce_table(void *tbl)
|
||||
@@ -186,5 +186,5 @@ void __init free_tce_table(void *tbl)
|
||||
size = table_size_to_number_of_entries(specified_table_size);
|
||||
size *= TCE_ENTRY_SIZE;
|
||||
|
||||
free_bootmem(__pa(tbl), size);
|
||||
memblock_free(__pa(tbl), size);
|
||||
}
|
||||
|
@@ -12,7 +12,6 @@
|
||||
#include <linux/string.h>
|
||||
#include <linux/nodemask.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/bootmem.h>
|
||||
|
||||
#include <asm/io.h>
|
||||
#include <linux/pci_ids.h>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#include <linux/sched/task_stack.h> /* task_stack_*(), ... */
|
||||
#include <linux/kdebug.h> /* oops_begin/end, ... */
|
||||
#include <linux/extable.h> /* search_exception_tables */
|
||||
#include <linux/bootmem.h> /* max_low_pfn */
|
||||
#include <linux/memblock.h> /* max_low_pfn */
|
||||
#include <linux/kprobes.h> /* NOKPROBE_SYMBOL, ... */
|
||||
#include <linux/mmiotrace.h> /* kmmio_handler, ... */
|
||||
#include <linux/perf_event.h> /* perf_sw_event */
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/swap.h> /* for totalram_pages */
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
void *kmap(struct page *page)
|
||||
{
|
||||
@@ -111,7 +111,7 @@ void __init set_highmem_pages_init(void)
|
||||
|
||||
/*
|
||||
* Explicitly reset zone->managed_pages because set_highmem_pages_init()
|
||||
* is invoked before free_all_bootmem()
|
||||
* is invoked before memblock_free_all()
|
||||
*/
|
||||
reset_all_zones_managed_pages();
|
||||
for_each_zone(zone) {
|
||||
|
@@ -3,7 +3,6 @@
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/bootmem.h> /* for max_low_pfn */
|
||||
#include <linux/swapfile.h>
|
||||
#include <linux/swapops.h>
|
||||
|
||||
|
@@ -23,7 +23,6 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/pfn.h>
|
||||
#include <linux/poison.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/memory_hotplug.h>
|
||||
@@ -771,7 +770,7 @@ void __init mem_init(void)
|
||||
#endif
|
||||
/*
|
||||
* With CONFIG_DEBUG_PAGEALLOC initialization of highmem pages has to
|
||||
* be done before free_all_bootmem(). Memblock use free low memory for
|
||||
* be done before memblock_free_all(). Memblock use free low memory for
|
||||
* temporary data (see find_range_array()) and for this purpose can use
|
||||
* pages that was already passed to the buddy allocator, hence marked as
|
||||
* not accessible in the page tables when compiled with
|
||||
@@ -781,7 +780,7 @@ void __init mem_init(void)
|
||||
set_highmem_pages_init();
|
||||
|
||||
/* this will put all low memory onto the freelists */
|
||||
free_all_bootmem();
|
||||
memblock_free_all();
|
||||
|
||||
after_bootmem = 1;
|
||||
x86_init.hyper.init_after_bootmem();
|
||||
|
@@ -20,7 +20,6 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/initrd.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/pci.h>
|
||||
@@ -197,7 +196,7 @@ static __ref void *spp_getpage(void)
|
||||
if (after_bootmem)
|
||||
ptr = (void *) get_zeroed_page(GFP_ATOMIC);
|
||||
else
|
||||
ptr = alloc_bootmem_pages(PAGE_SIZE);
|
||||
ptr = memblock_alloc(PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
if (!ptr || ((unsigned long)ptr & ~PAGE_MASK)) {
|
||||
panic("set_pte_phys: cannot allocate page data %s\n",
|
||||
@@ -1188,14 +1187,14 @@ void __init mem_init(void)
|
||||
/* clear_bss() already clear the empty_zero_page */
|
||||
|
||||
/* this will put all memory onto the freelists */
|
||||
free_all_bootmem();
|
||||
memblock_free_all();
|
||||
after_bootmem = 1;
|
||||
x86_init.hyper.init_after_bootmem();
|
||||
|
||||
/*
|
||||
* Must be done after boot memory is put on freelist, because here we
|
||||
* might set fields in deferred struct pages that have not yet been
|
||||
* initialized, and free_all_bootmem() initializes all the reserved
|
||||
* initialized, and memblock_free_all() initializes all the reserved
|
||||
* deferred pages for us.
|
||||
*/
|
||||
register_page_bootmem_info();
|
||||
|
@@ -6,7 +6,7 @@
|
||||
* (C) Copyright 1995 1996 Linus Torvalds
|
||||
*/
|
||||
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/ioport.h>
|
||||
|
@@ -5,10 +5,9 @@
|
||||
/* cpu_feature_enabled() cannot be used this early */
|
||||
#define USE_EARLY_PGTABLE_L5
|
||||
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/kasan.h>
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/task.h>
|
||||
@@ -28,11 +27,11 @@ static p4d_t tmp_p4d_table[MAX_PTRS_PER_P4D] __initdata __aligned(PAGE_SIZE);
|
||||
static __init void *early_alloc(size_t size, int nid, bool panic)
|
||||
{
|
||||
if (panic)
|
||||
return memblock_virt_alloc_try_nid(size, size,
|
||||
__pa(MAX_DMA_ADDRESS), BOOTMEM_ALLOC_ACCESSIBLE, nid);
|
||||
return memblock_alloc_try_nid(size, size,
|
||||
__pa(MAX_DMA_ADDRESS), MEMBLOCK_ALLOC_ACCESSIBLE, nid);
|
||||
else
|
||||
return memblock_virt_alloc_try_nid_nopanic(size, size,
|
||||
__pa(MAX_DMA_ADDRESS), BOOTMEM_ALLOC_ACCESSIBLE, nid);
|
||||
return memblock_alloc_try_nid_nopanic(size, size,
|
||||
__pa(MAX_DMA_ADDRESS), MEMBLOCK_ALLOC_ACCESSIBLE, nid);
|
||||
}
|
||||
|
||||
static void __init kasan_populate_pmd(pmd_t *pmd, unsigned long addr,
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/pgalloc.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@@ -4,7 +4,6 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/mmzone.h>
|
||||
#include <linux/ctype.h>
|
||||
@@ -196,7 +195,7 @@ static void __init alloc_node_data(int nid)
|
||||
* Allocate node data. Try node-local memory and then any node.
|
||||
* Never allocate in DMA zone.
|
||||
*/
|
||||
nd_pa = memblock_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
|
||||
nd_pa = memblock_phys_alloc_nid(nd_size, SMP_CACHE_BYTES, nid);
|
||||
if (!nd_pa) {
|
||||
nd_pa = __memblock_alloc_base(nd_size, SMP_CACHE_BYTES,
|
||||
MEMBLOCK_ALLOC_ACCESSIBLE);
|
||||
|
@@ -22,7 +22,6 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* Generic VM initialization for x86-64 NUMA setups.
|
||||
* Copyright 2002,2003 Andi Kleen, SuSE Labs.
|
||||
*/
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include "numa_internal.h"
|
||||
|
||||
|
@@ -6,7 +6,6 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/topology.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <asm/dma.h>
|
||||
|
||||
#include "numa_internal.h"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
* Clears the a test pte bit on random pages in the direct mapping,
|
||||
* then reverts and compares page tables forwards and afterwards.
|
||||
*/
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/kthread.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
* Thanks to Ben LaHaise for precious feedback.
|
||||
*/
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/kernel.h>
|
||||
|
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/mmdebug.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/mm.h>
|
||||
|
@@ -32,7 +32,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/pat.h>
|
||||
#include <asm/e820/api.h>
|
||||
|
@@ -36,9 +36,8 @@
|
||||
#include <linux/efi.h>
|
||||
#include <linux/efi-bgrt.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/time.h>
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <linux/mm.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/ioport.h>
|
||||
#include <linux/mc146818rtc.h>
|
||||
#include <linux/efi.h>
|
||||
|
@@ -8,7 +8,6 @@
|
||||
#include <linux/efi.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/dmi.h>
|
||||
|
||||
@@ -333,7 +332,7 @@ void __init efi_reserve_boot_services(void)
|
||||
|
||||
/*
|
||||
* Because the following memblock_reserve() is paired
|
||||
* with free_bootmem_late() for this region in
|
||||
* with memblock_free_late() for this region in
|
||||
* efi_free_boot_services(), we must be extremely
|
||||
* careful not to reserve, and subsequently free,
|
||||
* critical regions of memory (like the kernel image) or
|
||||
@@ -364,7 +363,7 @@ void __init efi_reserve_boot_services(void)
|
||||
* doesn't make sense as far as the firmware is
|
||||
* concerned, but it does provide us with a way to tag
|
||||
* those regions that must not be paired with
|
||||
* free_bootmem_late().
|
||||
* memblock_free_late().
|
||||
*/
|
||||
md->attribute |= EFI_MEMORY_RUNTIME;
|
||||
}
|
||||
@@ -414,7 +413,7 @@ void __init efi_free_boot_services(void)
|
||||
size -= rm_size;
|
||||
}
|
||||
|
||||
free_bootmem_late(start, size);
|
||||
memblock_free_late(start, size);
|
||||
}
|
||||
|
||||
if (!num_entries)
|
||||
|
@@ -18,24 +18,26 @@
|
||||
* enumerate the device using PCI.
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/pm_qos.h>
|
||||
|
||||
#include <asm/iosf_mbi.h>
|
||||
|
||||
#define PCI_DEVICE_ID_BAYTRAIL 0x0F00
|
||||
#define PCI_DEVICE_ID_BRASWELL 0x2280
|
||||
#define PCI_DEVICE_ID_QUARK_X1000 0x0958
|
||||
#define PCI_DEVICE_ID_TANGIER 0x1170
|
||||
#define PCI_DEVICE_ID_INTEL_BAYTRAIL 0x0F00
|
||||
#define PCI_DEVICE_ID_INTEL_BRASWELL 0x2280
|
||||
#define PCI_DEVICE_ID_INTEL_QUARK_X1000 0x0958
|
||||
#define PCI_DEVICE_ID_INTEL_TANGIER 0x1170
|
||||
|
||||
static struct pci_dev *mbi_pdev;
|
||||
static DEFINE_SPINLOCK(iosf_mbi_lock);
|
||||
static DEFINE_MUTEX(iosf_mbi_punit_mutex);
|
||||
static BLOCKING_NOTIFIER_HEAD(iosf_mbi_pmic_bus_access_notifier);
|
||||
|
||||
/**************** Generic iosf_mbi access helpers ****************/
|
||||
|
||||
static inline u32 iosf_mbi_form_mcr(u8 op, u8 port, u8 offset)
|
||||
{
|
||||
@@ -192,6 +194,30 @@ bool iosf_mbi_available(void)
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_available);
|
||||
|
||||
/*
|
||||
**************** P-Unit/kernel shared I2C bus arbritration ****************
|
||||
*
|
||||
* Some Bay Trail and Cherry Trail devices have the P-Unit and us (the kernel)
|
||||
* share a single I2C bus to the PMIC. Below are helpers to arbitrate the
|
||||
* accesses between the kernel and the P-Unit.
|
||||
*
|
||||
* See arch/x86/include/asm/iosf_mbi.h for kernel-doc text for each function.
|
||||
*/
|
||||
|
||||
#define SEMAPHORE_TIMEOUT 500
|
||||
#define PUNIT_SEMAPHORE_BYT 0x7
|
||||
#define PUNIT_SEMAPHORE_CHT 0x10e
|
||||
#define PUNIT_SEMAPHORE_BIT BIT(0)
|
||||
#define PUNIT_SEMAPHORE_ACQUIRE BIT(1)
|
||||
|
||||
static DEFINE_MUTEX(iosf_mbi_punit_mutex);
|
||||
static DEFINE_MUTEX(iosf_mbi_block_punit_i2c_access_count_mutex);
|
||||
static BLOCKING_NOTIFIER_HEAD(iosf_mbi_pmic_bus_access_notifier);
|
||||
static u32 iosf_mbi_block_punit_i2c_access_count;
|
||||
static u32 iosf_mbi_sem_address;
|
||||
static unsigned long iosf_mbi_sem_acquired;
|
||||
static struct pm_qos_request iosf_mbi_pm_qos;
|
||||
|
||||
void iosf_mbi_punit_acquire(void)
|
||||
{
|
||||
mutex_lock(&iosf_mbi_punit_mutex);
|
||||
@@ -204,6 +230,159 @@ void iosf_mbi_punit_release(void)
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_punit_release);
|
||||
|
||||
static int iosf_mbi_get_sem(u32 *sem)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = iosf_mbi_read(BT_MBI_UNIT_PMC, MBI_REG_READ,
|
||||
iosf_mbi_sem_address, sem);
|
||||
if (ret) {
|
||||
dev_err(&mbi_pdev->dev, "Error P-Unit semaphore read failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
*sem &= PUNIT_SEMAPHORE_BIT;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void iosf_mbi_reset_semaphore(void)
|
||||
{
|
||||
if (iosf_mbi_modify(BT_MBI_UNIT_PMC, MBI_REG_READ,
|
||||
iosf_mbi_sem_address, 0, PUNIT_SEMAPHORE_BIT))
|
||||
dev_err(&mbi_pdev->dev, "Error P-Unit semaphore reset failed\n");
|
||||
|
||||
pm_qos_update_request(&iosf_mbi_pm_qos, PM_QOS_DEFAULT_VALUE);
|
||||
|
||||
blocking_notifier_call_chain(&iosf_mbi_pmic_bus_access_notifier,
|
||||
MBI_PMIC_BUS_ACCESS_END, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* This function blocks P-Unit accesses to the PMIC I2C bus, so that kernel
|
||||
* I2C code, such as e.g. a fuel-gauge driver, can access it safely.
|
||||
*
|
||||
* This function may be called by I2C controller code while an I2C driver has
|
||||
* already blocked P-Unit accesses because it wants them blocked over multiple
|
||||
* i2c-transfers, for e.g. read-modify-write of an I2C client register.
|
||||
*
|
||||
* The P-Unit accesses already being blocked is tracked through the
|
||||
* iosf_mbi_block_punit_i2c_access_count variable which is protected by the
|
||||
* iosf_mbi_block_punit_i2c_access_count_mutex this mutex is hold for the
|
||||
* entire duration of the function.
|
||||
*
|
||||
* If access is not blocked yet, this function takes the following steps:
|
||||
*
|
||||
* 1) Some code sends request to the P-Unit which make it access the PMIC
|
||||
* I2C bus. Testing has shown that the P-Unit does not check its internal
|
||||
* PMIC bus semaphore for these requests. Callers of these requests call
|
||||
* iosf_mbi_punit_acquire()/_release() around their P-Unit accesses, these
|
||||
* functions lock/unlock the iosf_mbi_punit_mutex.
|
||||
* As the first step we lock the iosf_mbi_punit_mutex, to wait for any in
|
||||
* flight requests to finish and to block any new requests.
|
||||
*
|
||||
* 2) Some code makes such P-Unit requests from atomic contexts where it
|
||||
* cannot call iosf_mbi_punit_acquire() as that may sleep.
|
||||
* As the second step we call a notifier chain which allows any code
|
||||
* needing P-Unit resources from atomic context to acquire them before
|
||||
* we take control over the PMIC I2C bus.
|
||||
*
|
||||
* 3) When CPU cores enter C6 or C7 the P-Unit needs to talk to the PMIC
|
||||
* if this happens while the kernel itself is accessing the PMIC I2C bus
|
||||
* the SoC hangs.
|
||||
* As the third step we call pm_qos_update_request() to disallow the CPU
|
||||
* to enter C6 or C7.
|
||||
*
|
||||
* 4) The P-Unit has a PMIC bus semaphore which we can request to stop
|
||||
* autonomous P-Unit tasks from accessing the PMIC I2C bus while we hold it.
|
||||
* As the fourth and final step we request this semaphore and wait for our
|
||||
* request to be acknowledged.
|
||||
*/
|
||||
int iosf_mbi_block_punit_i2c_access(void)
|
||||
{
|
||||
unsigned long start, end;
|
||||
int ret = 0;
|
||||
u32 sem;
|
||||
|
||||
if (WARN_ON(!mbi_pdev || !iosf_mbi_sem_address))
|
||||
return -ENXIO;
|
||||
|
||||
mutex_lock(&iosf_mbi_block_punit_i2c_access_count_mutex);
|
||||
|
||||
if (iosf_mbi_block_punit_i2c_access_count > 0)
|
||||
goto success;
|
||||
|
||||
mutex_lock(&iosf_mbi_punit_mutex);
|
||||
blocking_notifier_call_chain(&iosf_mbi_pmic_bus_access_notifier,
|
||||
MBI_PMIC_BUS_ACCESS_BEGIN, NULL);
|
||||
|
||||
/*
|
||||
* Disallow the CPU to enter C6 or C7 state, entering these states
|
||||
* requires the P-Unit to talk to the PMIC and if this happens while
|
||||
* we're holding the semaphore, the SoC hangs.
|
||||
*/
|
||||
pm_qos_update_request(&iosf_mbi_pm_qos, 0);
|
||||
|
||||
/* host driver writes to side band semaphore register */
|
||||
ret = iosf_mbi_write(BT_MBI_UNIT_PMC, MBI_REG_WRITE,
|
||||
iosf_mbi_sem_address, PUNIT_SEMAPHORE_ACQUIRE);
|
||||
if (ret) {
|
||||
dev_err(&mbi_pdev->dev, "Error P-Unit semaphore request failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* host driver waits for bit 0 to be set in semaphore register */
|
||||
start = jiffies;
|
||||
end = start + msecs_to_jiffies(SEMAPHORE_TIMEOUT);
|
||||
do {
|
||||
ret = iosf_mbi_get_sem(&sem);
|
||||
if (!ret && sem) {
|
||||
iosf_mbi_sem_acquired = jiffies;
|
||||
dev_dbg(&mbi_pdev->dev, "P-Unit semaphore acquired after %ums\n",
|
||||
jiffies_to_msecs(jiffies - start));
|
||||
/*
|
||||
* Success, keep iosf_mbi_punit_mutex locked till
|
||||
* iosf_mbi_unblock_punit_i2c_access() gets called.
|
||||
*/
|
||||
goto success;
|
||||
}
|
||||
|
||||
usleep_range(1000, 2000);
|
||||
} while (time_before(jiffies, end));
|
||||
|
||||
ret = -ETIMEDOUT;
|
||||
dev_err(&mbi_pdev->dev, "Error P-Unit semaphore timed out, resetting\n");
|
||||
error:
|
||||
iosf_mbi_reset_semaphore();
|
||||
mutex_unlock(&iosf_mbi_punit_mutex);
|
||||
|
||||
if (!iosf_mbi_get_sem(&sem))
|
||||
dev_err(&mbi_pdev->dev, "P-Unit semaphore: %d\n", sem);
|
||||
success:
|
||||
if (!WARN_ON(ret))
|
||||
iosf_mbi_block_punit_i2c_access_count++;
|
||||
|
||||
mutex_unlock(&iosf_mbi_block_punit_i2c_access_count_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_block_punit_i2c_access);
|
||||
|
||||
void iosf_mbi_unblock_punit_i2c_access(void)
|
||||
{
|
||||
mutex_lock(&iosf_mbi_block_punit_i2c_access_count_mutex);
|
||||
|
||||
iosf_mbi_block_punit_i2c_access_count--;
|
||||
if (iosf_mbi_block_punit_i2c_access_count == 0) {
|
||||
iosf_mbi_reset_semaphore();
|
||||
mutex_unlock(&iosf_mbi_punit_mutex);
|
||||
dev_dbg(&mbi_pdev->dev, "punit semaphore held for %ums\n",
|
||||
jiffies_to_msecs(jiffies - iosf_mbi_sem_acquired));
|
||||
}
|
||||
|
||||
mutex_unlock(&iosf_mbi_block_punit_i2c_access_count_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_unblock_punit_i2c_access);
|
||||
|
||||
int iosf_mbi_register_pmic_bus_access_notifier(struct notifier_block *nb)
|
||||
{
|
||||
int ret;
|
||||
@@ -241,19 +420,14 @@ int iosf_mbi_unregister_pmic_bus_access_notifier(struct notifier_block *nb)
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_unregister_pmic_bus_access_notifier);
|
||||
|
||||
int iosf_mbi_call_pmic_bus_access_notifier_chain(unsigned long val, void *v)
|
||||
{
|
||||
return blocking_notifier_call_chain(
|
||||
&iosf_mbi_pmic_bus_access_notifier, val, v);
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_call_pmic_bus_access_notifier_chain);
|
||||
|
||||
void iosf_mbi_assert_punit_acquired(void)
|
||||
{
|
||||
WARN_ON(!mutex_is_locked(&iosf_mbi_punit_mutex));
|
||||
}
|
||||
EXPORT_SYMBOL(iosf_mbi_assert_punit_acquired);
|
||||
|
||||
/**************** iosf_mbi debug code ****************/
|
||||
|
||||
#ifdef CONFIG_IOSF_MBI_DEBUG
|
||||
static u32 dbg_mdr;
|
||||
static u32 dbg_mcr;
|
||||
@@ -338,7 +512,7 @@ static inline void iosf_debugfs_remove(void) { }
|
||||
#endif /* CONFIG_IOSF_MBI_DEBUG */
|
||||
|
||||
static int iosf_mbi_probe(struct pci_dev *pdev,
|
||||
const struct pci_device_id *unused)
|
||||
const struct pci_device_id *dev_id)
|
||||
{
|
||||
int ret;
|
||||
|
||||
@@ -349,14 +523,16 @@ static int iosf_mbi_probe(struct pci_dev *pdev,
|
||||
}
|
||||
|
||||
mbi_pdev = pci_dev_get(pdev);
|
||||
iosf_mbi_sem_address = dev_id->driver_data;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct pci_device_id iosf_mbi_pci_ids[] = {
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BAYTRAIL) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_BRASWELL) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_QUARK_X1000) },
|
||||
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_TANGIER) },
|
||||
{ PCI_DEVICE_DATA(INTEL, BAYTRAIL, PUNIT_SEMAPHORE_BYT) },
|
||||
{ PCI_DEVICE_DATA(INTEL, BRASWELL, PUNIT_SEMAPHORE_CHT) },
|
||||
{ PCI_DEVICE_DATA(INTEL, QUARK_X1000, 0) },
|
||||
{ PCI_DEVICE_DATA(INTEL, TANGIER, 0) },
|
||||
{ 0, },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(pci, iosf_mbi_pci_ids);
|
||||
@@ -371,6 +547,9 @@ static int __init iosf_mbi_init(void)
|
||||
{
|
||||
iosf_debugfs_init();
|
||||
|
||||
pm_qos_add_request(&iosf_mbi_pm_qos, PM_QOS_CPU_DMA_LATENCY,
|
||||
PM_QOS_DEFAULT_VALUE);
|
||||
|
||||
return pci_register_driver(&iosf_mbi_pci_driver);
|
||||
}
|
||||
|
||||
@@ -381,6 +560,8 @@ static void __exit iosf_mbi_exit(void)
|
||||
pci_unregister_driver(&iosf_mbi_pci_driver);
|
||||
pci_dev_put(mbi_pdev);
|
||||
mbi_pdev = NULL;
|
||||
|
||||
pm_qos_remove_request(&iosf_mbi_pm_qos);
|
||||
}
|
||||
|
||||
module_init(iosf_mbi_init);
|
||||
|
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_pdt.h>
|
||||
@@ -141,7 +141,7 @@ void * __init prom_early_alloc(unsigned long size)
|
||||
* fast enough on the platforms we care about while minimizing
|
||||
* wasted bootmem) and hand off chunks of it to callers.
|
||||
*/
|
||||
res = alloc_bootmem(chunk_size);
|
||||
res = memblock_alloc(chunk_size, SMP_CACHE_BYTES);
|
||||
BUG_ON(!res);
|
||||
prom_early_allocated += chunk_size;
|
||||
memset(res, 0, chunk_size);
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/suspend.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
@@ -47,14 +47,6 @@ static inline void arch_copy_thread(struct arch_thread *from,
|
||||
memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array));
|
||||
}
|
||||
|
||||
/*
|
||||
* Default implementation of macro that returns current
|
||||
* instruction pointer ("program counter"). Stolen
|
||||
* from asm-i386/processor.h
|
||||
*/
|
||||
#define current_text_addr() \
|
||||
({ void *pc; __asm__("movl $1f,%0\n1:":"=g" (pc)); pc; })
|
||||
|
||||
#define current_sp() ({ void *sp; __asm__("movl %%esp, %0" : "=r" (sp) : ); sp; })
|
||||
#define current_bp() ({ unsigned long bp; __asm__("movl %%ebp, %0" : "=r" (bp) : ); bp; })
|
||||
|
||||
|
@@ -31,9 +31,6 @@ static inline void arch_copy_thread(struct arch_thread *from,
|
||||
to->fs = from->fs;
|
||||
}
|
||||
|
||||
#define current_text_addr() \
|
||||
({ void *pc; __asm__("movq $1f,%0\n1:":"=g" (pc)); pc; })
|
||||
|
||||
#define current_sp() ({ void *sp; __asm__("movq %%rsp, %0" : "=r" (sp) : ); sp; })
|
||||
#define current_bp() ({ unsigned long bp; __asm__("movq %%rbp, %0" : "=r" (bp) : ); bp; })
|
||||
|
||||
|
@@ -8,22 +8,10 @@
|
||||
|
||||
#define MAX_FP_NR HOST_FPX_SIZE
|
||||
|
||||
static inline void update_debugregs(int seq) {}
|
||||
|
||||
/* syscall emulation path in ptrace */
|
||||
|
||||
#ifndef PTRACE_SYSEMU
|
||||
#define PTRACE_SYSEMU 31
|
||||
#endif
|
||||
|
||||
void set_using_sysemu(int value);
|
||||
int get_using_sysemu(void);
|
||||
extern int sysemu_supported;
|
||||
|
||||
#ifndef PTRACE_SYSEMU_SINGLESTEP
|
||||
#define PTRACE_SYSEMU_SINGLESTEP 32
|
||||
#endif
|
||||
|
||||
#define UPT_SYSCALL_ARG1(r) UPT_BX(r)
|
||||
#define UPT_SYSCALL_ARG2(r) UPT_CX(r)
|
||||
#define UPT_SYSCALL_ARG3(r) UPT_DX(r)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
#ifdef CONFIG_XEN_BALLOON_MEMORY_HOTPLUG
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#endif
|
||||
#include <linux/cpu.h>
|
||||
#include <linux/kexec.h>
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#include <linux/start_kernel.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/kprobes.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/export.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/page-flags.h>
|
||||
@@ -31,7 +31,6 @@
|
||||
#include <linux/console.h>
|
||||
#include <linux/pci.h>
|
||||
#include <linux/gfp.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/edd.h>
|
||||
#include <linux/frame.h>
|
||||
|
||||
|
@@ -864,7 +864,7 @@ static int __init xen_mark_pinned(struct mm_struct *mm, struct page *page,
|
||||
* The init_mm pagetable is really pinned as soon as its created, but
|
||||
* that's before we have page structures to store the bits. So do all
|
||||
* the book-keeping now once struct pages for allocated pages are
|
||||
* initialized. This happens only after free_all_bootmem() is called.
|
||||
* initialized. This happens only after memblock_free_all() is called.
|
||||
*/
|
||||
static void __init xen_after_bootmem(void)
|
||||
{
|
||||
|
@@ -67,7 +67,7 @@
|
||||
#include <linux/hash.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/bootmem.h>
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
@@ -182,7 +182,7 @@ static void p2m_init_identity(unsigned long *p2m, unsigned long pfn)
|
||||
static void * __ref alloc_p2m_page(void)
|
||||
{
|
||||
if (unlikely(!slab_is_available()))
|
||||
return alloc_bootmem_align(PAGE_SIZE, PAGE_SIZE);
|
||||
return memblock_alloc(PAGE_SIZE, PAGE_SIZE);
|
||||
|
||||
return (void *)__get_free_page(GFP_KERNEL);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ static void * __ref alloc_p2m_page(void)
|
||||
static void __ref free_p2m_page(void *p)
|
||||
{
|
||||
if (unlikely(!slab_is_available())) {
|
||||
free_bootmem((unsigned long)p, PAGE_SIZE);
|
||||
memblock_free((unsigned long)p, PAGE_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -134,6 +134,10 @@ void xen_unplug_emulated_devices(void)
|
||||
{
|
||||
int r;
|
||||
|
||||
/* PVH guests don't have emulated devices. */
|
||||
if (xen_pvh_domain())
|
||||
return;
|
||||
|
||||
/* user explicitly requested no unplug */
|
||||
if (xen_emul_unplug & XEN_UNPLUG_NEVER)
|
||||
return;
|
||||
|
@@ -39,34 +39,25 @@ static void xen_qlock_kick(int cpu)
|
||||
*/
|
||||
static void xen_qlock_wait(u8 *byte, u8 val)
|
||||
{
|
||||
unsigned long flags;
|
||||
int irq = __this_cpu_read(lock_kicker_irq);
|
||||
|
||||
/* If kicker interrupts not initialized yet, just spin */
|
||||
if (irq == -1)
|
||||
if (irq == -1 || in_nmi())
|
||||
return;
|
||||
|
||||
/* clear pending */
|
||||
xen_clear_irq_pending(irq);
|
||||
barrier();
|
||||
/* Guard against reentry. */
|
||||
local_irq_save(flags);
|
||||
|
||||
/*
|
||||
* We check the byte value after clearing pending IRQ to make sure
|
||||
* that we won't miss a wakeup event because of the clearing.
|
||||
*
|
||||
* The sync_clear_bit() call in xen_clear_irq_pending() is atomic.
|
||||
* So it is effectively a memory barrier for x86.
|
||||
*/
|
||||
if (READ_ONCE(*byte) != val)
|
||||
return;
|
||||
/* If irq pending already clear it. */
|
||||
if (xen_test_irq_pending(irq)) {
|
||||
xen_clear_irq_pending(irq);
|
||||
} else if (READ_ONCE(*byte) == val) {
|
||||
/* Block until irq becomes pending (or a spurious wakeup) */
|
||||
xen_poll_irq(irq);
|
||||
}
|
||||
|
||||
/*
|
||||
* If an interrupt happens here, it will leave the wakeup irq
|
||||
* pending, which will cause xen_poll_irq() to return
|
||||
* immediately.
|
||||
*/
|
||||
|
||||
/* Block until irq becomes pending (or perhaps a spurious wakeup) */
|
||||
xen_poll_irq(irq);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
static irqreturn_t dummy_handler(int irq, void *dev_id)
|
||||
|
@@ -170,7 +170,7 @@ canary:
|
||||
.fill 48, 1, 0
|
||||
|
||||
early_stack:
|
||||
.fill 256, 1, 0
|
||||
.fill BOOT_STACK_SIZE, 1, 0
|
||||
early_stack_end:
|
||||
|
||||
ELFNOTE(Xen, XEN_ELFNOTE_PHYS32_ENTRY,
|
||||
|
Reference in New Issue
Block a user