.. | .. |
---|
22 | 22 | #include <linux/cache.h> |
---|
23 | 23 | #include <linux/jiffies.h> |
---|
24 | 24 | #include <linux/profile.h> |
---|
25 | | -#include <linux/bootmem.h> |
---|
| 25 | +#include <linux/memblock.h> |
---|
26 | 26 | #include <linux/vmalloc.h> |
---|
27 | 27 | #include <linux/ftrace.h> |
---|
28 | 28 | #include <linux/cpu.h> |
---|
.. | .. |
---|
43 | 43 | #include <asm/irq.h> |
---|
44 | 44 | #include <asm/irq_regs.h> |
---|
45 | 45 | #include <asm/page.h> |
---|
46 | | -#include <asm/pgtable.h> |
---|
47 | 46 | #include <asm/oplib.h> |
---|
48 | 47 | #include <linux/uaccess.h> |
---|
49 | 48 | #include <asm/starfire.h> |
---|
50 | 49 | #include <asm/tlb.h> |
---|
| 50 | +#include <asm/pgalloc.h> |
---|
51 | 51 | #include <asm/sections.h> |
---|
52 | 52 | #include <asm/prom.h> |
---|
53 | 53 | #include <asm/mdesc.h> |
---|
.. | .. |
---|
137 | 137 | rmb(); |
---|
138 | 138 | |
---|
139 | 139 | set_cpu_online(cpuid, true); |
---|
140 | | - |
---|
141 | | - /* idle thread is expected to have preempt disabled */ |
---|
142 | | - preempt_disable(); |
---|
143 | 140 | |
---|
144 | 141 | local_irq_enable(); |
---|
145 | 142 | |
---|
.. | .. |
---|
1014 | 1011 | } |
---|
1015 | 1012 | |
---|
1016 | 1013 | #ifdef CONFIG_KGDB |
---|
1017 | | -void kgdb_roundup_cpus(unsigned long flags) |
---|
| 1014 | +void kgdb_roundup_cpus(void) |
---|
1018 | 1015 | { |
---|
1019 | 1016 | smp_cross_call(&xcall_kgdb_capture, 0, 0, 0); |
---|
1020 | 1017 | } |
---|
.. | .. |
---|
1551 | 1548 | void *ptr; |
---|
1552 | 1549 | |
---|
1553 | 1550 | if (!node_online(node) || !NODE_DATA(node)) { |
---|
1554 | | - ptr = __alloc_bootmem(size, align, goal); |
---|
| 1551 | + ptr = memblock_alloc_from(size, align, goal); |
---|
1555 | 1552 | pr_info("cpu %d has no node %d or node-local memory\n", |
---|
1556 | 1553 | cpu, node); |
---|
1557 | 1554 | pr_debug("per cpu data for cpu%d %lu bytes at %016lx\n", |
---|
1558 | 1555 | cpu, size, __pa(ptr)); |
---|
1559 | 1556 | } else { |
---|
1560 | | - ptr = __alloc_bootmem_node(NODE_DATA(node), |
---|
1561 | | - size, align, goal); |
---|
| 1557 | + ptr = memblock_alloc_try_nid(size, align, goal, |
---|
| 1558 | + MEMBLOCK_ALLOC_ACCESSIBLE, node); |
---|
1562 | 1559 | pr_debug("per cpu data for cpu%d %lu bytes on node%d at " |
---|
1563 | 1560 | "%016lx\n", cpu, size, node, __pa(ptr)); |
---|
1564 | 1561 | } |
---|
1565 | 1562 | return ptr; |
---|
1566 | 1563 | #else |
---|
1567 | | - return __alloc_bootmem(size, align, goal); |
---|
| 1564 | + return memblock_alloc_from(size, align, goal); |
---|
1568 | 1565 | #endif |
---|
1569 | 1566 | } |
---|
1570 | 1567 | |
---|
1571 | 1568 | static void __init pcpu_free_bootmem(void *ptr, size_t size) |
---|
1572 | 1569 | { |
---|
1573 | | - free_bootmem(__pa(ptr), size); |
---|
| 1570 | + memblock_free(__pa(ptr), size); |
---|
1574 | 1571 | } |
---|
1575 | 1572 | |
---|
1576 | 1573 | static int __init pcpu_cpu_distance(unsigned int from, unsigned int to) |
---|
.. | .. |
---|
1584 | 1581 | static void __init pcpu_populate_pte(unsigned long addr) |
---|
1585 | 1582 | { |
---|
1586 | 1583 | pgd_t *pgd = pgd_offset_k(addr); |
---|
| 1584 | + p4d_t *p4d; |
---|
1587 | 1585 | pud_t *pud; |
---|
1588 | 1586 | pmd_t *pmd; |
---|
1589 | 1587 | |
---|
1590 | 1588 | if (pgd_none(*pgd)) { |
---|
1591 | 1589 | pud_t *new; |
---|
1592 | 1590 | |
---|
1593 | | - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1591 | + new = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1592 | + if (!new) |
---|
| 1593 | + goto err_alloc; |
---|
1594 | 1594 | pgd_populate(&init_mm, pgd, new); |
---|
1595 | 1595 | } |
---|
1596 | 1596 | |
---|
1597 | | - pud = pud_offset(pgd, addr); |
---|
| 1597 | + p4d = p4d_offset(pgd, addr); |
---|
| 1598 | + if (p4d_none(*p4d)) { |
---|
| 1599 | + pud_t *new; |
---|
| 1600 | + |
---|
| 1601 | + new = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1602 | + if (!new) |
---|
| 1603 | + goto err_alloc; |
---|
| 1604 | + p4d_populate(&init_mm, p4d, new); |
---|
| 1605 | + } |
---|
| 1606 | + |
---|
| 1607 | + pud = pud_offset(p4d, addr); |
---|
1598 | 1608 | if (pud_none(*pud)) { |
---|
1599 | 1609 | pmd_t *new; |
---|
1600 | 1610 | |
---|
1601 | | - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1611 | + new = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1612 | + if (!new) |
---|
| 1613 | + goto err_alloc; |
---|
1602 | 1614 | pud_populate(&init_mm, pud, new); |
---|
1603 | 1615 | } |
---|
1604 | 1616 | |
---|
.. | .. |
---|
1606 | 1618 | if (!pmd_present(*pmd)) { |
---|
1607 | 1619 | pte_t *new; |
---|
1608 | 1620 | |
---|
1609 | | - new = __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1621 | + new = memblock_alloc_from(PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
| 1622 | + if (!new) |
---|
| 1623 | + goto err_alloc; |
---|
1610 | 1624 | pmd_populate_kernel(&init_mm, pmd, new); |
---|
1611 | 1625 | } |
---|
| 1626 | + |
---|
| 1627 | + return; |
---|
| 1628 | + |
---|
| 1629 | +err_alloc: |
---|
| 1630 | + panic("%s: Failed to allocate %lu bytes align=%lx from=%lx\n", |
---|
| 1631 | + __func__, PAGE_SIZE, PAGE_SIZE, PAGE_SIZE); |
---|
1612 | 1632 | } |
---|
1613 | 1633 | |
---|
1614 | 1634 | void __init setup_per_cpu_areas(void) |
---|
.. | .. |
---|
1624 | 1644 | pcpu_alloc_bootmem, |
---|
1625 | 1645 | pcpu_free_bootmem); |
---|
1626 | 1646 | if (rc) |
---|
1627 | | - pr_warning("PERCPU: %s allocator failed (%d), " |
---|
1628 | | - "falling back to page size\n", |
---|
1629 | | - pcpu_fc_names[pcpu_chosen_fc], rc); |
---|
| 1647 | + pr_warn("PERCPU: %s allocator failed (%d), " |
---|
| 1648 | + "falling back to page size\n", |
---|
| 1649 | + pcpu_fc_names[pcpu_chosen_fc], rc); |
---|
1630 | 1650 | } |
---|
1631 | 1651 | if (rc < 0) |
---|
1632 | 1652 | rc = pcpu_page_first_chunk(PERCPU_MODULE_RESERVE, |
---|