Skip to content

Commit

Permalink
Merge branch 'akpm/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfrothwell committed Feb 6, 2019
2 parents 97686b7 + c079194 commit 7647da0
Show file tree
Hide file tree
Showing 130 changed files with 900 additions and 481 deletions.
5 changes: 4 additions & 1 deletion arch/alpha/kernel/core_cia.c
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,10 @@ cia_prepare_tbia_workaround(int window)
long i;

/* Use minimal 1K map. */
ppte = memblock_alloc_from(CIA_BROKEN_TBIA_SIZE, 32768, 0);
ppte = memblock_alloc(CIA_BROKEN_TBIA_SIZE, 32768);
if (!ppte)
panic("%s: Failed to allocate %u bytes align=0x%x\n",
__func__, CIA_BROKEN_TBIA_SIZE, 32768);
pte = (virt_to_phys(ppte) >> (PAGE_SHIFT - 1)) | 1;

for (i = 0; i < CIA_BROKEN_TBIA_SIZE / sizeof(unsigned long); ++i)
Expand Down
6 changes: 6 additions & 0 deletions arch/alpha/kernel/core_marvel.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ mk_resource_name(int pe, int port, char *str)

sprintf(tmp, "PCI %s PE %d PORT %d", str, pe, port);
name = memblock_alloc(strlen(tmp) + 1, SMP_CACHE_BYTES);
if (!name)
panic("%s: Failed to allocate %zu bytes\n", __func__,
strlen(tmp) + 1);
strcpy(name, tmp);

return name;
Expand Down Expand Up @@ -118,6 +121,9 @@ alloc_io7(unsigned int pe)
}

io7 = memblock_alloc(sizeof(*io7), SMP_CACHE_BYTES);
if (!io7)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*io7));
io7->pe = pe;
raw_spin_lock_init(&io7->irq_lock);

Expand Down
13 changes: 11 additions & 2 deletions arch/alpha/kernel/pci-noop.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ alloc_pci_controller(void)
struct pci_controller *hose;

hose = memblock_alloc(sizeof(*hose), SMP_CACHE_BYTES);
if (!hose)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*hose));

*hose_tail = hose;
hose_tail = &hose->next;
Expand All @@ -44,7 +47,13 @@ alloc_pci_controller(void)
struct resource * __init
alloc_resource(void)
{
return memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
void *ptr = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);

if (!ptr)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(struct resource));

return ptr;
}

SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, bus,
Expand All @@ -54,7 +63,7 @@ SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, bus,

/* from hose or from bus.devfn */
if (which & IOBASE_FROM_HOSE) {
for (hose = hose_head; hose; hose = hose->next)
for (hose = hose_head; hose; hose = hose->next)
if (hose->index == bus)
break;
if (!hose)
Expand Down
11 changes: 10 additions & 1 deletion arch/alpha/kernel/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,9 @@ alloc_pci_controller(void)
struct pci_controller *hose;

hose = memblock_alloc(sizeof(*hose), SMP_CACHE_BYTES);
if (!hose)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*hose));

*hose_tail = hose;
hose_tail = &hose->next;
Expand All @@ -403,7 +406,13 @@ alloc_pci_controller(void)
struct resource * __init
alloc_resource(void)
{
return memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
void *ptr = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);

if (!ptr)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(struct resource));

return ptr;
}


Expand Down
16 changes: 14 additions & 2 deletions arch/alpha/kernel/pci_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,32 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
" falling back to system-wide allocation\n",
__func__, nid);
arena = memblock_alloc(sizeof(*arena), SMP_CACHE_BYTES);
if (!arena)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*arena));
}

arena->ptes = memblock_alloc_node(sizeof(*arena), align, nid);
if (!NODE_DATA(nid) || !arena->ptes) {
printk("%s: couldn't allocate arena ptes from node %d\n"
" falling back to system-wide allocation\n",
__func__, nid);
arena->ptes = memblock_alloc_from(mem_size, align, 0);
arena->ptes = memblock_alloc(mem_size, align);
if (!arena->ptes)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, mem_size, align);
}

#else /* CONFIG_DISCONTIGMEM */

arena = memblock_alloc(sizeof(*arena), SMP_CACHE_BYTES);
arena->ptes = memblock_alloc_from(mem_size, align, 0);
if (!arena)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*arena));
arena->ptes = memblock_alloc(mem_size, align);
if (!arena->ptes)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, mem_size, align);

#endif /* CONFIG_DISCONTIGMEM */

Expand Down
2 changes: 1 addition & 1 deletion arch/alpha/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ move_initrd(unsigned long mem_limit)
unsigned long size;

size = initrd_end - initrd_start;
start = memblock_alloc_from(PAGE_ALIGN(size), PAGE_SIZE, 0);
start = memblock_alloc(PAGE_ALIGN(size), PAGE_SIZE);
if (!start || __pa(start) + size > mem_limit) {
initrd_start = initrd_end = 0;
return NULL;
Expand Down
3 changes: 1 addition & 2 deletions arch/arc/kernel/unwind.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ static void init_unwind_hdr(struct unwind_table *table,
*/
static void *__init unw_hdr_alloc_early(unsigned long sz)
{
return memblock_alloc_from_nopanic(sz, sizeof(unsigned int),
MAX_DMA_ADDRESS);
return memblock_alloc_from(sz, sizeof(unsigned int), MAX_DMA_ADDRESS);
}

static void *unw_hdr_alloc(unsigned long sz)
Expand Down
4 changes: 4 additions & 0 deletions arch/arc/mm/highmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ static noinline pte_t * __init alloc_kmap_pgtable(unsigned long kvaddr)
pmd_k = pmd_offset(pud_k, kvaddr);

pte_k = (pte_t *)memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
if (!pte_k)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_SIZE, PAGE_SIZE);

pmd_populate_kernel(&init_mm, pmd_k, pte_k);
return pte_k;
}
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,9 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
boot_alias_start = phys_to_idmap(start);
if (arm_has_idmap_alias() && boot_alias_start != IDMAP_INVALID_ADDR) {
res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
if (!res)
panic("%s: Failed to allocate %zu bytes\n",
__func__, sizeof(*res));
res->name = "System RAM (boot alias)";
res->start = boot_alias_start;
res->end = phys_to_idmap(end);
Expand All @@ -875,6 +878,9 @@ static void __init request_standard_resources(const struct machine_desc *mdesc)
}

res = memblock_alloc(sizeof(*res), SMP_CACHE_BYTES);
if (!res)
panic("%s: Failed to allocate %zu bytes\n", __func__,
sizeof(*res));
res->name = "System RAM";
res->start = start;
res->end = end;
Expand Down
6 changes: 5 additions & 1 deletion arch/arm/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,11 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)

BUG_ON(!arm_memblock_steal_permitted);

phys = memblock_alloc_base(size, align, MEMBLOCK_ALLOC_ANYWHERE);
phys = memblock_phys_alloc(size, align);
if (!phys)
panic("Failed to steal %pa bytes at %pS\n",
&size, (void *)_RET_IP_);

memblock_free(phys, size);
memblock_remove(phys, size);

Expand Down
14 changes: 13 additions & 1 deletion arch/arm/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,13 @@ EXPORT_SYMBOL(phys_mem_access_prot);

static void __init *early_alloc(unsigned long sz)
{
return memblock_alloc(sz, sz);
void *ptr = memblock_alloc(sz, sz);

if (!ptr)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, sz, sz);

return ptr;
}

static void *__init late_alloc(unsigned long sz)
Expand Down Expand Up @@ -994,6 +1000,9 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
return;

svm = memblock_alloc(sizeof(*svm) * nr, __alignof__(*svm));
if (!svm)
panic("%s: Failed to allocate %zu bytes align=0x%zx\n",
__func__, sizeof(*svm) * nr, __alignof__(*svm));

for (md = io_desc; nr; md++, nr--) {
create_mapping(md);
Expand All @@ -1016,6 +1025,9 @@ void __init vm_reserve_area_early(unsigned long addr, unsigned long size,
struct static_vm *svm;

svm = memblock_alloc(sizeof(*svm), __alignof__(*svm));
if (!svm)
panic("%s: Failed to allocate %zu bytes align=0x%zx\n",
__func__, sizeof(*svm), __alignof__(*svm));

vm = &svm->vm;
vm->addr = (void *)addr;
Expand Down
8 changes: 5 additions & 3 deletions arch/arm64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,18 @@ static void __init request_standard_resources(void)
struct memblock_region *region;
struct resource *res;
unsigned long i = 0;
size_t res_size;

kernel_code.start = __pa_symbol(_text);
kernel_code.end = __pa_symbol(__init_begin - 1);
kernel_data.start = __pa_symbol(_sdata);
kernel_data.end = __pa_symbol(_end - 1);

num_standard_resources = memblock.memory.cnt;
standard_resources = memblock_alloc_low(num_standard_resources *
sizeof(*standard_resources),
SMP_CACHE_BYTES);
res_size = num_standard_resources * sizeof(*standard_resources);
standard_resources = memblock_alloc_low(res_size, SMP_CACHE_BYTES);
if (!standard_resources)
panic("%s: Failed to allocate %zu bytes\n", __func__, res_size);

for_each_memblock(memory, region) {
res = &standard_resources[i++];
Expand Down
10 changes: 10 additions & 0 deletions arch/arm64/mm/kasan_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ static phys_addr_t __init kasan_alloc_zeroed_page(int node)
void *p = memblock_alloc_try_nid(PAGE_SIZE, PAGE_SIZE,
__pa(MAX_DMA_ADDRESS),
MEMBLOCK_ALLOC_KASAN, node);
if (!p)
panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
__func__, PAGE_SIZE, PAGE_SIZE, node,
__pa(MAX_DMA_ADDRESS));

return __pa(p);
}

Expand All @@ -48,6 +53,11 @@ static phys_addr_t __init kasan_alloc_raw_page(int node)
void *p = memblock_alloc_try_nid_raw(PAGE_SIZE, PAGE_SIZE,
__pa(MAX_DMA_ADDRESS),
MEMBLOCK_ALLOC_KASAN, node);
if (!p)
panic("%s: Failed to allocate %lu bytes align=0x%lx nid=%d from=%llx\n",
__func__, PAGE_SIZE, PAGE_SIZE, node,
__pa(MAX_DMA_ADDRESS));

return __pa(p);
}

Expand Down
2 changes: 2 additions & 0 deletions arch/arm64/mm/mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ static phys_addr_t __init early_pgtable_alloc(void)
void *ptr;

phys = memblock_phys_alloc(PAGE_SIZE, PAGE_SIZE);
if (!phys)
panic("Failed to allocate page table page\n");

/*
* The FIX_{PGD,PUD,PMD} slots may be in active use, but the FIX_PTE
Expand Down
4 changes: 4 additions & 0 deletions arch/arm64/mm/numa.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,10 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
pr_info("Initmem setup node %d [<memory-less node>]\n", nid);

nd_pa = memblock_phys_alloc_try_nid(nd_size, SMP_CACHE_BYTES, nid);
if (!nd_pa)
panic("Cannot allocate %zu bytes for node %d data\n",
nd_size, nid);

nd = __va(nd_pa);

/* report and initialize */
Expand Down
4 changes: 4 additions & 0 deletions arch/c6x/mm/dma-coherent.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)

dma_bitmap = memblock_alloc(BITS_TO_LONGS(dma_pages) * sizeof(long),
sizeof(long));
if (!dma_bitmap)
panic("%s: Failed to allocate %zu bytes align=0x%zx\n",
__func__, BITS_TO_LONGS(dma_pages) * sizeof(long),
sizeof(long));
}

static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
Expand Down
4 changes: 3 additions & 1 deletion arch/c6x/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ void __init paging_init(void)

empty_zero_page = (unsigned long) memblock_alloc(PAGE_SIZE,
PAGE_SIZE);
memset((void *)empty_zero_page, 0, PAGE_SIZE);
if (!empty_zero_page)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_SIZE, PAGE_SIZE);

/*
* Set up user data space
Expand Down
5 changes: 5 additions & 0 deletions arch/csky/mm/highmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ static void __init fixrange_init(unsigned long start, unsigned long end,
for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) {
if (pmd_none(*pmd)) {
pte = (pte_t *) memblock_alloc_low(PAGE_SIZE, PAGE_SIZE);
if (!pte)
panic("%s: Failed to allocate %lu bytes align=%lx\n",
__func__, PAGE_SIZE,
PAGE_SIZE);

set_pmd(pmd, __pmd(__pa(pte)));
BUG_ON(pte != pte_offset_kernel(pmd, 0));
}
Expand Down
4 changes: 3 additions & 1 deletion arch/h8300/mm/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ void __init paging_init(void)
* to a couple of allocated pages.
*/
empty_zero_page = (unsigned long)memblock_alloc(PAGE_SIZE, PAGE_SIZE);
memset((void *)empty_zero_page, 0, PAGE_SIZE);
if (!empty_zero_page)
panic("%s: Failed to allocate %lu bytes align=0x%lx\n",
__func__, PAGE_SIZE, PAGE_SIZE);

/*
* Set up SFC/DFC registers (user data space).
Expand Down
25 changes: 15 additions & 10 deletions arch/ia64/kernel/mca.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,6 @@ typedef struct ia64_state_log_s

static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES];

#define IA64_LOG_ALLOCATE(it, size) \
{ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] = \
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES); \
ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] = \
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES);}
#define IA64_LOG_LOCK_INIT(it) spin_lock_init(&ia64_state_log[it].isl_lock)
#define IA64_LOG_LOCK(it) spin_lock_irqsave(&ia64_state_log[it].isl_lock, s)
#define IA64_LOG_UNLOCK(it) spin_unlock_irqrestore(&ia64_state_log[it].isl_lock,s)
Expand All @@ -378,6 +373,19 @@ static ia64_state_log_t ia64_state_log[IA64_MAX_LOG_TYPES];
#define IA64_LOG_CURR_BUFFER(it) (void *)((ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)]))
#define IA64_LOG_COUNT(it) ia64_state_log[it].isl_count

static inline void ia64_log_allocate(int it, u64 size)
{
ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)] =
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES);
if (!ia64_state_log[it].isl_log[IA64_LOG_CURR_INDEX(it)])
panic("%s: Failed to allocate %llu bytes\n", __func__, size);

ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)] =
(ia64_err_rec_t *)memblock_alloc(size, SMP_CACHE_BYTES);
if (!ia64_state_log[it].isl_log[IA64_LOG_NEXT_INDEX(it)])
panic("%s: Failed to allocate %llu bytes\n", __func__, size);
}

/*
* ia64_log_init
* Reset the OS ia64 log buffer
Expand All @@ -399,9 +407,7 @@ ia64_log_init(int sal_info_type)
return;

// set up OS data structures to hold error info
IA64_LOG_ALLOCATE(sal_info_type, max_size);
memset(IA64_LOG_CURR_BUFFER(sal_info_type), 0, max_size);
memset(IA64_LOG_NEXT_BUFFER(sal_info_type), 0, max_size);
ia64_log_allocate(sal_info_type, max_size);
}

/*
Expand Down Expand Up @@ -1835,8 +1841,7 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
/* Caller prevents this from being called after init */
static void * __ref mca_bootmem(void)
{
return memblock_alloc_from(sizeof(struct ia64_mca_cpu),
KERNEL_STACK_SIZE, 0);
return memblock_alloc(sizeof(struct ia64_mca_cpu), KERNEL_STACK_SIZE);
}

/* Do per-CPU MCA-related initialization. */
Expand Down
Loading

0 comments on commit 7647da0

Please sign in to comment.