Skip to content

Commit e978a3c

Browse files
nathanlynchmpe
authored andcommitted
powerpc/pseries: remove obsolete memory hotplug DT notifier code
pseries_update_drconf_memory() runs from a DT notifier in response to an update to the ibm,dynamic-memory property of the /ibm,dynamic-reconfiguration-memory node. This property is an older less compact format than the ibm,dynamic-memory-v2 property used in most currently supported firmwares. There has never been an equivalent function for the v2 property. pseries_update_drconf_memory() compares the 'assigned' flag for each LMB in the old vs new properties and adds or removes the block accordingly. However it appears to be of no actual utility: * Partition suspension and PRRNs are specified only to change LMBs' NUMA affinity information. This notifier should be a no-op for those scenarios since the assigned flags should not change. * The memory hotplug/DLPAR path has a hack which short-circuits execution of the notifier: dlpar_memory() ... rtas_hp_event = true; drmem_update_dt() of_update_property() pseries_memory_notifier() pseries_update_drconf_memory() if (rtas_hp_event) return; So this code only makes sense as a relic of the time when more of the DLPAR workflow took place in user space. I don't see a purpose for it now. Signed-off-by: Nathan Lynch <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 38c392c commit e978a3c

File tree

1 file changed

+1
-64
lines changed

1 file changed

+1
-64
lines changed

arch/powerpc/platforms/pseries/hotplug-memory.c

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include <asm/drmem.h>
2323
#include "pseries.h"
2424

25-
static bool rtas_hp_event;
26-
2725
unsigned long pseries_memory_block_size(void)
2826
{
2927
struct device_node *np;
@@ -871,11 +869,8 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
871869
break;
872870
}
873871

874-
if (!rc) {
875-
rtas_hp_event = true;
872+
if (!rc)
876873
rc = drmem_update_dt();
877-
rtas_hp_event = false;
878-
}
879874

880875
unlock_device_hotplug();
881876
return rc;
@@ -911,60 +906,6 @@ static int pseries_add_mem_node(struct device_node *np)
911906
return (ret < 0) ? -EINVAL : 0;
912907
}
913908

914-
static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
915-
{
916-
struct of_drconf_cell_v1 *new_drmem, *old_drmem;
917-
unsigned long memblock_size;
918-
u32 entries;
919-
__be32 *p;
920-
int i, rc = -EINVAL;
921-
922-
if (rtas_hp_event)
923-
return 0;
924-
925-
memblock_size = pseries_memory_block_size();
926-
if (!memblock_size)
927-
return -EINVAL;
928-
929-
if (!pr->old_prop)
930-
return 0;
931-
932-
p = (__be32 *) pr->old_prop->value;
933-
if (!p)
934-
return -EINVAL;
935-
936-
/* The first int of the property is the number of lmb's described
937-
* by the property. This is followed by an array of of_drconf_cell
938-
* entries. Get the number of entries and skip to the array of
939-
* of_drconf_cell's.
940-
*/
941-
entries = be32_to_cpu(*p++);
942-
old_drmem = (struct of_drconf_cell_v1 *)p;
943-
944-
p = (__be32 *)pr->prop->value;
945-
p++;
946-
new_drmem = (struct of_drconf_cell_v1 *)p;
947-
948-
for (i = 0; i < entries; i++) {
949-
if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
950-
(!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) {
951-
rc = pseries_remove_memblock(
952-
be64_to_cpu(old_drmem[i].base_addr),
953-
memblock_size);
954-
break;
955-
} else if ((!(be32_to_cpu(old_drmem[i].flags) &
956-
DRCONF_MEM_ASSIGNED)) &&
957-
(be32_to_cpu(new_drmem[i].flags) &
958-
DRCONF_MEM_ASSIGNED)) {
959-
rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr),
960-
memblock_size);
961-
rc = (rc < 0) ? -EINVAL : 0;
962-
break;
963-
}
964-
}
965-
return rc;
966-
}
967-
968909
static int pseries_memory_notifier(struct notifier_block *nb,
969910
unsigned long action, void *data)
970911
{
@@ -978,10 +919,6 @@ static int pseries_memory_notifier(struct notifier_block *nb,
978919
case OF_RECONFIG_DETACH_NODE:
979920
err = pseries_remove_mem_node(rd->dn);
980921
break;
981-
case OF_RECONFIG_UPDATE_PROPERTY:
982-
if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
983-
err = pseries_update_drconf_memory(rd);
984-
break;
985922
}
986923
return notifier_from_errno(err);
987924
}

0 commit comments

Comments
 (0)