linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing
@ 2017-04-27  7:43 Pingfan Liu
  2017-04-27 18:06 ` Hari Bathini
  2017-04-28 10:18 ` kbuild test robot
  0 siblings, 2 replies; 5+ messages in thread
From: Pingfan Liu @ 2017-04-27  7:43 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Hari Bathini, kernelfans

E.g after fadump reserves mem regions, these regions should not be removed
before fadump explicitly free them.

Signed-off-by: Pingfan Liu <piliu@redhat.com>
---
 arch/powerpc/platforms/pseries/hotplug-memory.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index e104c71..201be23 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -346,6 +346,8 @@ static int pseries_remove_memblock(unsigned long base, unsigned int memblock_siz
 
 	if (!pfn_valid(start_pfn))
 		goto out;
+	if (memblock_is_reserved(base))
+		return -EINVAL;
 
 	block_sz = pseries_memory_block_size();
 	sections_per_block = block_sz / MIN_MEMORY_BLOCK_SIZE;
@@ -388,8 +390,7 @@ static int pseries_remove_mem_node(struct device_node *np)
 	base = be64_to_cpu(*(unsigned long *)regs);
 	lmb_size = be32_to_cpu(regs[3]);
 
-	pseries_remove_memblock(base, lmb_size);
-	return 0;
+	return pseries_remove_memblock(base, lmb_size);
 }
 
 static bool lmb_is_removable(struct of_drconf_cell *lmb)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-05-02 18:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-27  7:43 [PATCH] powerpc/pseries hotplug: prevent the reserved mem from removing Pingfan Liu
2017-04-27 18:06 ` Hari Bathini
2017-04-28  4:29   ` Liu ping fan
2017-05-02 18:37     ` Hari Bathini
2017-04-28 10:18 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).