diff options
-rw-r--r-- | drivers/base/memory.c | 15 | ||||
-rw-r--r-- | include/linux/memory.h | 2 |
2 files changed, 12 insertions, 5 deletions
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2f8691511190..db0848e54cc6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -429,12 +429,16 @@ static inline int memory_fail_init(void) | |||
429 | * differentiation between which *physical* devices each | 429 | * differentiation between which *physical* devices each |
430 | * section belongs to... | 430 | * section belongs to... |
431 | */ | 431 | */ |
432 | int __weak arch_get_memory_phys_device(unsigned long start_pfn) | ||
433 | { | ||
434 | return 0; | ||
435 | } | ||
432 | 436 | ||
433 | static int add_memory_block(int nid, struct mem_section *section, | 437 | static int add_memory_block(int nid, struct mem_section *section, |
434 | unsigned long state, int phys_device, | 438 | unsigned long state, enum mem_add_context context) |
435 | enum mem_add_context context) | ||
436 | { | 439 | { |
437 | struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); | 440 | struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); |
441 | unsigned long start_pfn; | ||
438 | int ret = 0; | 442 | int ret = 0; |
439 | 443 | ||
440 | if (!mem) | 444 | if (!mem) |
@@ -443,7 +447,8 @@ static int add_memory_block(int nid, struct mem_section *section, | |||
443 | mem->phys_index = __section_nr(section); | 447 | mem->phys_index = __section_nr(section); |
444 | mem->state = state; | 448 | mem->state = state; |
445 | mutex_init(&mem->state_mutex); | 449 | mutex_init(&mem->state_mutex); |
446 | mem->phys_device = phys_device; | 450 | start_pfn = section_nr_to_pfn(mem->phys_index); |
451 | mem->phys_device = arch_get_memory_phys_device(start_pfn); | ||
447 | 452 | ||
448 | ret = register_memory(mem, section); | 453 | ret = register_memory(mem, section); |
449 | if (!ret) | 454 | if (!ret) |
@@ -515,7 +520,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, | |||
515 | */ | 520 | */ |
516 | int register_new_memory(int nid, struct mem_section *section) | 521 | int register_new_memory(int nid, struct mem_section *section) |
517 | { | 522 | { |
518 | return add_memory_block(nid, section, MEM_OFFLINE, 0, HOTPLUG); | 523 | return add_memory_block(nid, section, MEM_OFFLINE, HOTPLUG); |
519 | } | 524 | } |
520 | 525 | ||
521 | int unregister_memory_section(struct mem_section *section) | 526 | int unregister_memory_section(struct mem_section *section) |
@@ -548,7 +553,7 @@ int __init memory_dev_init(void) | |||
548 | if (!present_section_nr(i)) | 553 | if (!present_section_nr(i)) |
549 | continue; | 554 | continue; |
550 | err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, | 555 | err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, |
551 | 0, BOOT); | 556 | BOOT); |
552 | if (!ret) | 557 | if (!ret) |
553 | ret = err; | 558 | ret = err; |
554 | } | 559 | } |
diff --git a/include/linux/memory.h b/include/linux/memory.h index 1adfe779eb99..85582e1bcee9 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
@@ -36,6 +36,8 @@ struct memory_block { | |||
36 | struct sys_device sysdev; | 36 | struct sys_device sysdev; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | int arch_get_memory_phys_device(unsigned long start_pfn); | ||
40 | |||
39 | /* These states are exposed to userspace as text strings in sysfs */ | 41 | /* These states are exposed to userspace as text strings in sysfs */ |
40 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ | 42 | #define MEM_ONLINE (1<<0) /* exposed to userspace */ |
41 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ | 43 | #define MEM_GOING_OFFLINE (1<<1) /* exposed to userspace */ |