Skip to content

Commit 4a3e5de

Browse files
osalvadorvilardagatorvalds
authored andcommitted
acpi,memhotplug: enable MHP_MEMMAP_ON_MEMORY when supported
Let the caller check whether it can pass MHP_MEMMAP_ON_MEMORY by checking mhp_supports_memmap_on_memory(). MHP_MEMMAP_ON_MEMORY can only be set in case ARCH_MHP_MEMMAP_ON_MEMORY_ENABLE is enabled, the architecture supports altmap, and the range to be added spans a single memory block. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Oscar Salvador <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Pavel Tatashin <[email protected]> Cc: Vlastimil Babka <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent a08a2ae commit 4a3e5de

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/acpi/acpi_memhotplug.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
171171
acpi_handle handle = mem_device->device->handle;
172172
int result, num_enabled = 0;
173173
struct acpi_memory_info *info;
174+
mhp_t mhp_flags = MHP_NONE;
174175
int node;
175176

176177
node = acpi_get_node(handle);
@@ -194,8 +195,10 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
194195
if (node < 0)
195196
node = memory_add_physaddr_to_nid(info->start_addr);
196197

198+
if (mhp_supports_memmap_on_memory(info->length))
199+
mhp_flags |= MHP_MEMMAP_ON_MEMORY;
197200
result = __add_memory(node, info->start_addr, info->length,
198-
MHP_NONE);
201+
mhp_flags);
199202

200203
/*
201204
* If the memory block has been used by the kernel, add_memory()

0 commit comments

Comments
 (0)