memblock: rename memblock_free to memblock_phys_free

Since memblock_free() operates on a physical range, make its name
reflect it and rename it to memblock_phys_free(), so it will be a
logical counterpart to memblock_phys_alloc().

The callers are updated with the below semantic patch:

    @@
    expression addr;
    expression size;
    @@
    - memblock_free(addr, size);
    + memblock_phys_free(addr, size);

Link: https://lkml.kernel.org/r/20210930185031.18648-6-rppt@kernel.org
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Juergen Gross <jgross@suse.com>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Mike Rapoport 2021-11-05 13:43:19 -07:00 committed by Linus Torvalds
parent 621d973901
commit 3ecc68349b
45 changed files with 79 additions and 76 deletions

View File

@ -233,7 +233,8 @@ albacore_init_arch(void)
unsigned long size; unsigned long size;
size = initrd_end - initrd_start; size = initrd_end - initrd_start;
memblock_free(__pa(initrd_start), PAGE_ALIGN(size)); memblock_phys_free(__pa(initrd_start),
PAGE_ALIGN(size));
if (!move_initrd(pci_mem)) if (!move_initrd(pci_mem))
printk("irongate_init_arch: initrd too big " printk("irongate_init_arch: initrd too big "
"(%ldK)\ndisabling initrd\n", "(%ldK)\ndisabling initrd\n",

View File

@ -173,7 +173,7 @@ static void __init highmem_init(void)
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
unsigned long tmp; unsigned long tmp;
memblock_free(high_mem_start, high_mem_sz); memblock_phys_free(high_mem_start, high_mem_sz);
for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++) for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
free_highmem_page(pfn_to_page(tmp)); free_highmem_page(pfn_to_page(tmp));
#endif #endif

View File

@ -339,7 +339,7 @@ err_fabric:
err_sysctrl: err_sysctrl:
iounmap(relocation); iounmap(relocation);
err_reloc: err_reloc:
memblock_free(hip04_boot_method[0], hip04_boot_method[1]); memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
err: err:
return ret; return ret;
} }

View File

@ -158,7 +158,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
panic("Failed to steal %pa bytes at %pS\n", panic("Failed to steal %pa bytes at %pS\n",
&size, (void *)_RET_IP_); &size, (void *)_RET_IP_);
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
return phys; return phys;

View File

@ -738,8 +738,8 @@ void __init paging_init(void)
cpu_replace_ttbr1(lm_alias(swapper_pg_dir)); cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
init_mm.pgd = swapper_pg_dir; init_mm.pgd = swapper_pg_dir;
memblock_free(__pa_symbol(init_pg_dir), memblock_phys_free(__pa_symbol(init_pg_dir),
__pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir)); __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
memblock_allow_resize(); memblock_allow_resize();
} }

View File

@ -529,7 +529,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_fc_free(void *ptr, size_t size) static void __init pcpu_fc_free(void *ptr, size_t size)
{ {
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
void __init setup_per_cpu_areas(void) void __init setup_per_cpu_areas(void)

View File

@ -69,10 +69,10 @@ static void __init ip30_mem_init(void)
total_mem += size; total_mem += size;
if (addr >= IP30_REAL_MEMORY_START) if (addr >= IP30_REAL_MEMORY_START)
memblock_free(addr, size); memblock_phys_free(addr, size);
else if ((addr + size) > IP30_REAL_MEMORY_START) else if ((addr + size) > IP30_REAL_MEMORY_START)
memblock_free(IP30_REAL_MEMORY_START, memblock_phys_free(IP30_REAL_MEMORY_START,
size - IP30_MAX_PROM_MEMORY); size - IP30_MAX_PROM_MEMORY);
} }
pr_info("Detected %luMB of physical memory.\n", MEM_SHIFT(total_mem)); pr_info("Detected %luMB of physical memory.\n", MEM_SHIFT(total_mem));
} }

View File

@ -1095,8 +1095,8 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
cpufeatures_setup_finished(); cpufeatures_setup_finished();
memblock_free(__pa(dt_cpu_features), memblock_phys_free(__pa(dt_cpu_features),
sizeof(struct dt_cpu_feature)*nr_dt_cpu_features); sizeof(struct dt_cpu_feature) * nr_dt_cpu_features);
return 0; return 0;
} }

View File

@ -322,8 +322,8 @@ void __init free_unused_pacas(void)
new_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids; new_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
if (new_ptrs_size < paca_ptrs_size) if (new_ptrs_size < paca_ptrs_size)
memblock_free(__pa(paca_ptrs) + new_ptrs_size, memblock_phys_free(__pa(paca_ptrs) + new_ptrs_size,
paca_ptrs_size - new_ptrs_size); paca_ptrs_size - new_ptrs_size);
paca_nr_cpu_ids = nr_cpu_ids; paca_nr_cpu_ids = nr_cpu_ids;
paca_ptrs_size = new_ptrs_size; paca_ptrs_size = new_ptrs_size;
@ -331,8 +331,8 @@ void __init free_unused_pacas(void)
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
if (early_radix_enabled()) { if (early_radix_enabled()) {
/* Ugly fixup, see new_slb_shadow() */ /* Ugly fixup, see new_slb_shadow() */
memblock_free(__pa(paca_ptrs[boot_cpuid]->slb_shadow_ptr), memblock_phys_free(__pa(paca_ptrs[boot_cpuid]->slb_shadow_ptr),
sizeof(struct slb_shadow)); sizeof(struct slb_shadow));
paca_ptrs[boot_cpuid]->slb_shadow_ptr = NULL; paca_ptrs[boot_cpuid]->slb_shadow_ptr = NULL;
} }
#endif #endif

View File

@ -825,7 +825,7 @@ static void __init smp_setup_pacas(void)
set_hard_smp_processor_id(cpu, cpu_to_phys_id[cpu]); set_hard_smp_processor_id(cpu, cpu_to_phys_id[cpu]);
} }
memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32)); memblock_phys_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
cpu_to_phys_id = NULL; cpu_to_phys_id = NULL;
} }
#endif #endif

View File

@ -812,7 +812,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
static void __init pcpu_free_bootmem(void *ptr, size_t size) static void __init pcpu_free_bootmem(void *ptr, size_t size)
{ {
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
static int pcpu_cpu_distance(unsigned int from, unsigned int to) static int pcpu_cpu_distance(unsigned int from, unsigned int to)

View File

@ -2981,7 +2981,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
if (!phb->hose) { if (!phb->hose) {
pr_err(" Can't allocate PCI controller for %pOF\n", pr_err(" Can't allocate PCI controller for %pOF\n",
np); np);
memblock_free(__pa(phb), sizeof(struct pnv_phb)); memblock_phys_free(__pa(phb), sizeof(struct pnv_phb));
return; return;
} }

View File

@ -56,7 +56,8 @@ void __init svm_swiotlb_init(void)
return; return;
memblock_free(__pa(vstart), PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT)); memblock_phys_free(__pa(vstart),
PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
panic("SVM: Cannot allocate SWIOTLB buffer"); panic("SVM: Cannot allocate SWIOTLB buffer");
} }

View File

@ -230,13 +230,14 @@ static void __init init_resources(void)
/* Clean-up any unused pre-allocated resources */ /* Clean-up any unused pre-allocated resources */
if (res_idx >= 0) if (res_idx >= 0)
memblock_free(__pa(mem_res), (res_idx + 1) * sizeof(*mem_res)); memblock_phys_free(__pa(mem_res),
(res_idx + 1) * sizeof(*mem_res));
return; return;
error: error:
/* Better an empty resource tree than an inconsistent one */ /* Better an empty resource tree than an inconsistent one */
release_child_resources(&iomem_resource); release_child_resources(&iomem_resource);
memblock_free(__pa(mem_res), mem_res_sz); memblock_phys_free(__pa(mem_res), mem_res_sz);
} }

View File

@ -693,7 +693,7 @@ static void __init reserve_crashkernel(void)
} }
if (register_memory_notifier(&kdump_mem_nb)) { if (register_memory_notifier(&kdump_mem_nb)) {
memblock_free(crash_base, crash_size); memblock_phys_free(crash_base, crash_size);
return; return;
} }
@ -748,7 +748,7 @@ static void __init free_mem_detect_info(void)
get_mem_detect_reserved(&start, &size); get_mem_detect_reserved(&start, &size);
if (size) if (size)
memblock_free(start, size); memblock_phys_free(start, size);
} }
static const char * __init get_mem_info_source(void) static const char * __init get_mem_info_source(void)
@ -793,7 +793,7 @@ static void __init check_initrd(void)
if (initrd_data.start && initrd_data.size && if (initrd_data.start && initrd_data.size &&
!memblock_is_region_memory(initrd_data.start, initrd_data.size)) { !memblock_is_region_memory(initrd_data.start, initrd_data.size)) {
pr_err("The initial RAM disk does not fit into the memory\n"); pr_err("The initial RAM disk does not fit into the memory\n");
memblock_free(initrd_data.start, initrd_data.size); memblock_phys_free(initrd_data.start, initrd_data.size);
initrd_start = initrd_end = 0; initrd_start = initrd_end = 0;
} }
#endif #endif
@ -890,7 +890,7 @@ static void __init setup_randomness(void)
if (stsi(vmms, 3, 2, 2) == 0 && vmms->count) if (stsi(vmms, 3, 2, 2) == 0 && vmms->count)
add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count); add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count);
memblock_free((unsigned long) vmms, PAGE_SIZE); memblock_phys_free((unsigned long)vmms, PAGE_SIZE);
} }
/* /*

View File

@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
/* Get the CPU registers */ /* Get the CPU registers */
smp_save_cpu_regs(sa, addr, is_boot_cpu, page); smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
} }
memblock_free(page, PAGE_SIZE); memblock_phys_free(page, PAGE_SIZE);
diag_amode31_ops.diag308_reset(); diag_amode31_ops.diag308_reset();
pcpu_set_smt(0); pcpu_set_smt(0);
} }
@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
/* Add CPUs present at boot */ /* Add CPUs present at boot */
__smp_rescan_cpus(info, true); __smp_rescan_cpus(info, true);
memblock_free((unsigned long)info, sizeof(*info)); memblock_phys_free((unsigned long)info, sizeof(*info));
} }
/* /*

View File

@ -64,7 +64,7 @@ void __init setup_uv(void)
} }
if (uv_init(uv_stor_base, uv_info.uv_base_stor_len)) { if (uv_init(uv_stor_base, uv_info.uv_base_stor_len)) {
memblock_free(uv_stor_base, uv_info.uv_base_stor_len); memblock_phys_free(uv_stor_base, uv_info.uv_base_stor_len);
goto fail; goto fail;
} }

View File

@ -399,5 +399,5 @@ void __init kasan_copy_shadow_mapping(void)
void __init kasan_free_early_identity(void) void __init kasan_free_early_identity(void)
{ {
memblock_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos); memblock_phys_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos);
} }

View File

@ -560,7 +560,7 @@ static void __init ap325rxa_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU memory\n"); panic("Failed to allocate CEU memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu_dma_membase = phys; ceu_dma_membase = phys;

View File

@ -1502,7 +1502,7 @@ static void __init ecovec_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU0 memory\n"); panic("Failed to allocate CEU0 memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu0_dma_membase = phys; ceu0_dma_membase = phys;
@ -1510,7 +1510,7 @@ static void __init ecovec_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU1 memory\n"); panic("Failed to allocate CEU1 memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu1_dma_membase = phys; ceu1_dma_membase = phys;
} }

View File

@ -633,7 +633,7 @@ static void __init kfr2r09_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU memory\n"); panic("Failed to allocate CEU memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu_dma_membase = phys; ceu_dma_membase = phys;

View File

@ -633,7 +633,7 @@ static void __init migor_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU memory\n"); panic("Failed to allocate CEU memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu_dma_membase = phys; ceu_dma_membase = phys;

View File

@ -966,7 +966,7 @@ static void __init ms7724se_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU0 memory\n"); panic("Failed to allocate CEU0 memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu0_dma_membase = phys; ceu0_dma_membase = phys;
@ -974,7 +974,7 @@ static void __init ms7724se_mv_mem_reserve(void)
if (!phys) if (!phys)
panic("Failed to allocate CEU1 memory\n"); panic("Failed to allocate CEU1 memory\n");
memblock_free(phys, size); memblock_phys_free(phys, size);
memblock_remove(phys, size); memblock_remove(phys, size);
ceu1_dma_membase = phys; ceu1_dma_membase = phys;
} }

View File

@ -1567,7 +1567,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
static void __init pcpu_free_bootmem(void *ptr, size_t size) static void __init pcpu_free_bootmem(void *ptr, size_t size)
{ {
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
static int __init pcpu_cpu_distance(unsigned int from, unsigned int to) static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)

View File

@ -47,7 +47,7 @@ void __init mem_init(void)
*/ */
brk_end = (unsigned long) UML_ROUND_UP(sbrk(0)); brk_end = (unsigned long) UML_ROUND_UP(sbrk(0));
map_memory(brk_end, __pa(brk_end), uml_reserved - brk_end, 1, 1, 0); map_memory(brk_end, __pa(brk_end), uml_reserved - brk_end, 1, 1, 0);
memblock_free(__pa(brk_end), uml_reserved - brk_end); memblock_phys_free(__pa(brk_end), uml_reserved - brk_end);
uml_reserved = brk_end; uml_reserved = brk_end;
/* this will put all low memory onto the freelists */ /* this will put all low memory onto the freelists */

View File

@ -322,7 +322,7 @@ static void __init reserve_initrd(void)
relocate_initrd(); relocate_initrd();
memblock_free(ramdisk_image, ramdisk_end - ramdisk_image); memblock_phys_free(ramdisk_image, ramdisk_end - ramdisk_image);
} }
#else #else
@ -521,7 +521,7 @@ static void __init reserve_crashkernel(void)
} }
if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) { if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
memblock_free(crash_base, crash_size); memblock_phys_free(crash_base, crash_size);
return; return;
} }

View File

@ -618,7 +618,7 @@ static void __init memory_map_top_down(unsigned long map_start,
*/ */
addr = memblock_phys_alloc_range(PMD_SIZE, PMD_SIZE, map_start, addr = memblock_phys_alloc_range(PMD_SIZE, PMD_SIZE, map_start,
map_end); map_end);
memblock_free(addr, PMD_SIZE); memblock_phys_free(addr, PMD_SIZE);
real_end = addr + PMD_SIZE; real_end = addr + PMD_SIZE;
/* step_size need to be small so pgt_buf from BRK could cover it */ /* step_size need to be small so pgt_buf from BRK could cover it */

View File

@ -1025,7 +1025,7 @@ static void __init xen_free_ro_pages(unsigned long paddr, unsigned long size)
for (; vaddr < vaddr_end; vaddr += PAGE_SIZE) for (; vaddr < vaddr_end; vaddr += PAGE_SIZE)
make_lowmem_page_readwrite(vaddr); make_lowmem_page_readwrite(vaddr);
memblock_free(paddr, size); memblock_phys_free(paddr, size);
} }
static void __init xen_cleanmfnmap_free_pgtbl(void *pgtbl, bool unpin) static void __init xen_cleanmfnmap_free_pgtbl(void *pgtbl, bool unpin)
@ -1151,7 +1151,7 @@ static void __init xen_pagetable_p2m_free(void)
xen_cleanhighmap(addr, addr + size); xen_cleanhighmap(addr, addr + size);
size = PAGE_ALIGN(xen_start_info->nr_pages * size = PAGE_ALIGN(xen_start_info->nr_pages *
sizeof(unsigned long)); sizeof(unsigned long));
memblock_free(__pa(addr), size); memblock_phys_free(__pa(addr), size);
} else { } else {
xen_cleanmfnmap(addr); xen_cleanmfnmap(addr);
} }
@ -1955,7 +1955,7 @@ void __init xen_relocate_p2m(void)
pfn_end = p2m_pfn_end; pfn_end = p2m_pfn_end;
} }
memblock_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn)); memblock_phys_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn));
while (pfn < pfn_end) { while (pfn < pfn_end) {
if (pfn == p2m_pfn) { if (pfn == p2m_pfn) {
pfn = p2m_pfn_end; pfn = p2m_pfn_end;

View File

@ -153,7 +153,7 @@ static void __init xen_del_extra_mem(unsigned long start_pfn,
break; break;
} }
} }
memblock_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns)); memblock_phys_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
} }
/* /*
@ -719,7 +719,7 @@ static void __init xen_reserve_xen_mfnlist(void)
return; return;
xen_relocate_p2m(); xen_relocate_p2m();
memblock_free(start, size); memblock_phys_free(start, size);
} }
/** /**
@ -885,7 +885,7 @@ char * __init xen_memory_setup(void)
xen_phys_memcpy(new_area, start, size); xen_phys_memcpy(new_area, start, size);
pr_info("initrd moved from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n", pr_info("initrd moved from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n",
start, start + size, new_area, new_area + size); start, start + size, new_area, new_area + size);
memblock_free(start, size); memblock_phys_free(start, size);
boot_params.hdr.ramdisk_image = new_area; boot_params.hdr.ramdisk_image = new_area;
boot_params.ext_ramdisk_image = new_area >> 32; boot_params.ext_ramdisk_image = new_area >> 32;
} }

View File

@ -166,7 +166,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_fc_free(void *ptr, size_t size) static void __init pcpu_fc_free(void *ptr, size_t size)
{ {
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
#ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK #ifdef CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK

View File

@ -35,7 +35,7 @@ void __init __efi_memmap_free(u64 phys, unsigned long size, unsigned long flags)
if (slab_is_available()) if (slab_is_available())
memblock_free_late(phys, size); memblock_free_late(phys, size);
else else
memblock_free(phys, size); memblock_phys_free(phys, size);
} else if (flags & EFI_MEMMAP_SLAB) { } else if (flags & EFI_MEMMAP_SLAB) {
struct page *p = pfn_to_page(PHYS_PFN(phys)); struct page *p = pfn_to_page(PHYS_PFN(phys));
unsigned int order = get_order(size); unsigned int order = get_order(size);

View File

@ -171,8 +171,7 @@ int ima_free_kexec_buffer(void)
if (ret) if (ret)
return ret; return ret;
return memblock_free(addr, size); return memblock_phys_free(addr, size);
} }
/** /**

View File

@ -46,7 +46,7 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
if (nomap) { if (nomap) {
err = memblock_mark_nomap(base, size); err = memblock_mark_nomap(base, size);
if (err) if (err)
memblock_free(base, size); memblock_phys_free(base, size);
kmemleak_ignore_phys(base); kmemleak_ignore_phys(base);
} }
@ -284,7 +284,8 @@ void __init fdt_init_reserved_mem(void)
if (nomap) if (nomap)
memblock_clear_nomap(rmem->base, rmem->size); memblock_clear_nomap(rmem->base, rmem->size);
else else
memblock_free(rmem->base, rmem->size); memblock_phys_free(rmem->base,
rmem->size);
} }
} }
} }

View File

@ -139,7 +139,7 @@ int __init sclp_early_get_core_info(struct sclp_core_info *info)
} }
sclp_fill_core_info(info, sccb); sclp_fill_core_info(info, sccb);
out: out:
memblock_free((unsigned long)sccb, length); memblock_phys_free((unsigned long)sccb, length);
return rc; return rc;
} }

View File

@ -185,7 +185,7 @@ static void __init xdbc_free_ring(struct xdbc_ring *ring)
if (!seg) if (!seg)
return; return;
memblock_free(seg->dma, PAGE_SIZE); memblock_phys_free(seg->dma, PAGE_SIZE);
ring->segment = NULL; ring->segment = NULL;
} }
@ -665,10 +665,10 @@ int __init early_xdbc_setup_hardware(void)
xdbc_free_ring(&xdbc.in_ring); xdbc_free_ring(&xdbc.in_ring);
if (xdbc.table_dma) if (xdbc.table_dma)
memblock_free(xdbc.table_dma, PAGE_SIZE); memblock_phys_free(xdbc.table_dma, PAGE_SIZE);
if (xdbc.out_dma) if (xdbc.out_dma)
memblock_free(xdbc.out_dma, PAGE_SIZE); memblock_phys_free(xdbc.out_dma, PAGE_SIZE);
xdbc.table_base = NULL; xdbc.table_base = NULL;
xdbc.out_buf = NULL; xdbc.out_buf = NULL;
@ -987,8 +987,8 @@ free_and_quit:
xdbc_free_ring(&xdbc.evt_ring); xdbc_free_ring(&xdbc.evt_ring);
xdbc_free_ring(&xdbc.out_ring); xdbc_free_ring(&xdbc.out_ring);
xdbc_free_ring(&xdbc.in_ring); xdbc_free_ring(&xdbc.in_ring);
memblock_free(xdbc.table_dma, PAGE_SIZE); memblock_phys_free(xdbc.table_dma, PAGE_SIZE);
memblock_free(xdbc.out_dma, PAGE_SIZE); memblock_phys_free(xdbc.out_dma, PAGE_SIZE);
writel(0, &xdbc.xdbc_reg->control); writel(0, &xdbc.xdbc_reg->control);
early_iounmap(xdbc.xhci_base, xdbc.xhci_length); early_iounmap(xdbc.xhci_base, xdbc.xhci_length);

View File

@ -241,7 +241,7 @@ retry:
*/ */
rc = xen_swiotlb_fixup(start, nslabs); rc = xen_swiotlb_fixup(start, nslabs);
if (rc) { if (rc) {
memblock_free(__pa(start), PAGE_ALIGN(bytes)); memblock_phys_free(__pa(start), PAGE_ALIGN(bytes));
if (nslabs > 1024 && repeat--) { if (nslabs > 1024 && repeat--) {
/* Min is 2MB */ /* Min is 2MB */
nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));

View File

@ -103,7 +103,7 @@ void memblock_allow_resize(void);
int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid); int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
int memblock_add(phys_addr_t base, phys_addr_t size); int memblock_add(phys_addr_t base, phys_addr_t size);
int memblock_remove(phys_addr_t base, phys_addr_t size); int memblock_remove(phys_addr_t base, phys_addr_t size);
int memblock_free(phys_addr_t base, phys_addr_t size); int memblock_phys_free(phys_addr_t base, phys_addr_t size);
int memblock_reserve(phys_addr_t base, phys_addr_t size); int memblock_reserve(phys_addr_t base, phys_addr_t size);
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP #ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
int memblock_physmem_add(phys_addr_t base, phys_addr_t size); int memblock_physmem_add(phys_addr_t base, phys_addr_t size);

View File

@ -607,7 +607,7 @@ void __weak __init free_initrd_mem(unsigned long start, unsigned long end)
unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE); unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
unsigned long aligned_end = ALIGN(end, PAGE_SIZE); unsigned long aligned_end = ALIGN(end, PAGE_SIZE);
memblock_free(__pa(aligned_start), aligned_end - aligned_start); memblock_phys_free(__pa(aligned_start), aligned_end - aligned_start);
#endif #endif
free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM, free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,

View File

@ -247,7 +247,7 @@ swiotlb_init(int verbose)
return; return;
fail_free_mem: fail_free_mem:
memblock_free(__pa(tlb), bytes); memblock_phys_free(__pa(tlb), bytes);
fail: fail:
pr_warn("Cannot allocate buffer"); pr_warn("Cannot allocate buffer");
} }

View File

@ -188,7 +188,7 @@ EXPORT_SYMBOL(free_cpumask_var);
*/ */
void __init free_bootmem_cpumask_var(cpumask_var_t mask) void __init free_bootmem_cpumask_var(cpumask_var_t mask)
{ {
memblock_free(__pa(mask), cpumask_size()); memblock_phys_free(__pa(mask), cpumask_size());
} }
#endif #endif

View File

@ -378,7 +378,7 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
return 0; return 0;
free_mem: free_mem:
memblock_free(base, size); memblock_phys_free(base, size);
err: err:
pr_err("Failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M); pr_err("Failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
return ret; return ret;

View File

@ -806,18 +806,18 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
void __init_memblock memblock_free_ptr(void *ptr, size_t size) void __init_memblock memblock_free_ptr(void *ptr, size_t size)
{ {
if (ptr) if (ptr)
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
/** /**
* memblock_free - free boot memory block * memblock_phys_free - free boot memory block
* @base: phys starting address of the boot memory block * @base: phys starting address of the boot memory block
* @size: size of the boot memory block in bytes * @size: size of the boot memory block in bytes
* *
* Free boot memory block previously allocated by memblock_alloc_xx() API. * Free boot memory block previously allocated by memblock_alloc_xx() API.
* The freeing memory will not be released to the buddy allocator. * The freeing memory will not be released to the buddy allocator.
*/ */
int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size) int __init_memblock memblock_phys_free(phys_addr_t base, phys_addr_t size)
{ {
phys_addr_t end = base + size - 1; phys_addr_t end = base + size - 1;
@ -1937,7 +1937,7 @@ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn)
* memmap array. * memmap array.
*/ */
if (pg < pgend) if (pg < pgend)
memblock_free(pg, pgend - pg); memblock_phys_free(pg, pgend - pg);
} }
/* /*

View File

@ -2204,7 +2204,7 @@ static int __ref try_remove_memory(u64 start, u64 size)
arch_remove_memory(start, size, altmap); arch_remove_memory(start, size, altmap);
if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) { if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
memblock_free(start, size); memblock_phys_free(start, size);
memblock_remove(start, size); memblock_remove(start, size);
} }

View File

@ -2472,7 +2472,7 @@ struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
*/ */
void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai) void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai)
{ {
memblock_free(__pa(ai), ai->__ai_size); memblock_phys_free(__pa(ai), ai->__ai_size);
} }
/** /**
@ -3134,7 +3134,7 @@ out_free_areas:
out_free: out_free:
pcpu_free_alloc_info(ai); pcpu_free_alloc_info(ai);
if (areas) if (areas)
memblock_free(__pa(areas), areas_size); memblock_phys_free(__pa(areas), areas_size);
return rc; return rc;
} }
#endif /* BUILD_EMBED_FIRST_CHUNK */ #endif /* BUILD_EMBED_FIRST_CHUNK */
@ -3256,7 +3256,7 @@ enomem:
free_fn(page_address(pages[j]), PAGE_SIZE); free_fn(page_address(pages[j]), PAGE_SIZE);
rc = -ENOMEM; rc = -ENOMEM;
out_free_ar: out_free_ar:
memblock_free(__pa(pages), pages_size); memblock_phys_free(__pa(pages), pages_size);
pcpu_free_alloc_info(ai); pcpu_free_alloc_info(ai);
return rc; return rc;
} }
@ -3286,7 +3286,7 @@ static void * __init pcpu_dfl_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_dfl_fc_free(void *ptr, size_t size) static void __init pcpu_dfl_fc_free(void *ptr, size_t size)
{ {
memblock_free(__pa(ptr), size); memblock_phys_free(__pa(ptr), size);
} }
void __init setup_per_cpu_areas(void) void __init setup_per_cpu_areas(void)

View File

@ -451,7 +451,7 @@ static void *sparsemap_buf_end __meminitdata;
static inline void __meminit sparse_buffer_free(unsigned long size) static inline void __meminit sparse_buffer_free(unsigned long size)
{ {
WARN_ON(!sparsemap_buf || size == 0); WARN_ON(!sparsemap_buf || size == 0);
memblock_free(__pa(sparsemap_buf), size); memblock_phys_free(__pa(sparsemap_buf), size);
} }
static void __init sparse_buffer_init(unsigned long size, int nid) static void __init sparse_buffer_init(unsigned long size, int nid)