summaryrefslogtreecommitdiffstats
path: root/mm/memblock.c
diff options
context:
space:
mode:
authorBorislav Petkov <bp@suse.de>2021-10-04 17:37:22 +0200
committerBorislav Petkov <bp@suse.de>2021-10-04 17:37:22 +0200
commitc7419a6e1aa3219ff62045ab6e56e37d5ad2d292 (patch)
treea5145db864629e50196ba0f13e0b1c80f7d4331a /mm/memblock.c
parentx86: Increase exception stack sizes (diff)
parenttreewide: Replace the use of mem_encrypt_active() with cc_platform_has() (diff)
downloadlinux-c7419a6e1aa3219ff62045ab6e56e37d5ad2d292.tar.xz
linux-c7419a6e1aa3219ff62045ab6e56e37d5ad2d292.zip
Merge branch x86/cc into x86/core
Pick up dependent cc_platform_has() changes. Signed-off-by: Borislav Petkov <bp@suse.de>
Diffstat (limited to 'mm/memblock.c')
-rw-r--r--mm/memblock.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/mm/memblock.c b/mm/memblock.c
index 0ab5a749bfa6..184dcd2e5d99 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -472,7 +472,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
kfree(old_array);
else if (old_array != memblock_memory_init_regions &&
old_array != memblock_reserved_init_regions)
- memblock_free(__pa(old_array), old_alloc_size);
+ memblock_free_ptr(old_array, old_alloc_size);
/*
* Reserve the new array if that comes from the memblock. Otherwise, we
@@ -796,6 +796,20 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
}
/**
+ * memblock_free_ptr - free boot memory allocation
+ * @ptr: starting address of the boot memory allocation
+ * @size: size of the boot memory block in bytes
+ *
+ * Free boot memory block previously allocated by memblock_alloc_xx() API.
+ * The freeing memory will not be released to the buddy allocator.
+ */
+void __init_memblock memblock_free_ptr(void *ptr, size_t size)
+{
+ if (ptr)
+ memblock_free(__pa(ptr), size);
+}
+
+/**
* memblock_free - free boot memory block
* @base: phys starting address of the boot memory block
* @size: size of the boot memory block in bytes