[PATCH] drmgr: Remove/add memory based on drc-index request

3 views
Skip to first unread message

Haren Myneni

<haren@linux.ibm.com>
unread,
Mar 31, 2026, 12:38:40 AMMar 31
to powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, hbabu@us.ibm.com, Haren Myneni, Shirisha G, Sourabh Jain
The user space can request to remove or add memory based on
drc-index with the following command:
drmgr -c mem [-r/-a] -s <drc-name>

The current code ignores this option unlike in DLPAR CPU code. This
patch considers drc-index if the drc-name starts with "0x" and uses
this value to add /remove the corresponding LMB.

Signed-off-by: Haren Myneni <ha...@linux.ibm.com>
Reported-by: Shirisha G <shir...@linux.ibm.com>
Tested-by: Sourabh Jain <soura...@linux.ibm.com>
---
src/drmgr/drslot_chrp_mem.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/drmgr/drslot_chrp_mem.c b/src/drmgr/drslot_chrp_mem.c
index d37ee80..55687a7 100644
--- a/src/drmgr/drslot_chrp_mem.c
+++ b/src/drmgr/drslot_chrp_mem.c
@@ -1815,8 +1815,12 @@ int drslot_chrp_mem(void)
/* The recursive nature of the routines that add/remove lmbs
* require that the quantity be non-zero.
*/
- if (usr_drc_name)
+ if (usr_drc_name) {
+ /* The -s option can specify a drc name or drc index */
+ if (!strncmp(usr_drc_name, "0x", 2))
+ usr_drc_index = strtoul(usr_drc_name, NULL, 16);
usr_drc_count = 1;
+ }

if (kernel_dlpar_exists()) {
rc = do_mem_kernel_dlpar();
--
2.50.1

Dave Marquardt

<davemarq@linux.ibm.com>
unread,
Mar 31, 2026, 10:07:15 AMMar 31
to Haren Myneni, powerpc-utils-devel@googlegroups.com, tyreld@linux.ibm.com, hbabu@us.ibm.com, Shirisha G, Sourabh Jain
Haren Myneni <ha...@linux.ibm.com> writes:

> The user space can request to remove or add memory based on
> drc-index with the following command:
> drmgr -c mem [-r/-a] -s <drc-name>
>
> The current code ignores this option unlike in DLPAR CPU code. This
> patch considers drc-index if the drc-name starts with "0x" and uses
> this value to add /remove the corresponding LMB.
>
> Signed-off-by: Haren Myneni <ha...@linux.ibm.com>
> Reported-by: Shirisha G <shir...@linux.ibm.com>
> Tested-by: Sourabh Jain <soura...@linux.ibm.com>

Reviewed-by: Dave Marquardt <dave...@linux.ibm.com>
Reply all
Reply to author
Forward
0 new messages