mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-19 13:38:24 -05:00
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 <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20200612051238.1007764-19-nathanl@linux.ibm.com
This commit is contained in:
committed by
Michael Ellerman
parent
38c392cef1
commit
e978a3ccaa
@@ -22,8 +22,6 @@
|
||||
#include <asm/drmem.h>
|
||||
#include "pseries.h"
|
||||
|
||||
static bool rtas_hp_event;
|
||||
|
||||
unsigned long pseries_memory_block_size(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
@@ -871,11 +869,8 @@ int dlpar_memory(struct pseries_hp_errorlog *hp_elog)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!rc) {
|
||||
rtas_hp_event = true;
|
||||
if (!rc)
|
||||
rc = drmem_update_dt();
|
||||
rtas_hp_event = false;
|
||||
}
|
||||
|
||||
unlock_device_hotplug();
|
||||
return rc;
|
||||
@@ -911,60 +906,6 @@ static int pseries_add_mem_node(struct device_node *np)
|
||||
return (ret < 0) ? -EINVAL : 0;
|
||||
}
|
||||
|
||||
static int pseries_update_drconf_memory(struct of_reconfig_data *pr)
|
||||
{
|
||||
struct of_drconf_cell_v1 *new_drmem, *old_drmem;
|
||||
unsigned long memblock_size;
|
||||
u32 entries;
|
||||
__be32 *p;
|
||||
int i, rc = -EINVAL;
|
||||
|
||||
if (rtas_hp_event)
|
||||
return 0;
|
||||
|
||||
memblock_size = pseries_memory_block_size();
|
||||
if (!memblock_size)
|
||||
return -EINVAL;
|
||||
|
||||
if (!pr->old_prop)
|
||||
return 0;
|
||||
|
||||
p = (__be32 *) pr->old_prop->value;
|
||||
if (!p)
|
||||
return -EINVAL;
|
||||
|
||||
/* The first int of the property is the number of lmb's described
|
||||
* by the property. This is followed by an array of of_drconf_cell
|
||||
* entries. Get the number of entries and skip to the array of
|
||||
* of_drconf_cell's.
|
||||
*/
|
||||
entries = be32_to_cpu(*p++);
|
||||
old_drmem = (struct of_drconf_cell_v1 *)p;
|
||||
|
||||
p = (__be32 *)pr->prop->value;
|
||||
p++;
|
||||
new_drmem = (struct of_drconf_cell_v1 *)p;
|
||||
|
||||
for (i = 0; i < entries; i++) {
|
||||
if ((be32_to_cpu(old_drmem[i].flags) & DRCONF_MEM_ASSIGNED) &&
|
||||
(!(be32_to_cpu(new_drmem[i].flags) & DRCONF_MEM_ASSIGNED))) {
|
||||
rc = pseries_remove_memblock(
|
||||
be64_to_cpu(old_drmem[i].base_addr),
|
||||
memblock_size);
|
||||
break;
|
||||
} else if ((!(be32_to_cpu(old_drmem[i].flags) &
|
||||
DRCONF_MEM_ASSIGNED)) &&
|
||||
(be32_to_cpu(new_drmem[i].flags) &
|
||||
DRCONF_MEM_ASSIGNED)) {
|
||||
rc = memblock_add(be64_to_cpu(old_drmem[i].base_addr),
|
||||
memblock_size);
|
||||
rc = (rc < 0) ? -EINVAL : 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int pseries_memory_notifier(struct notifier_block *nb,
|
||||
unsigned long action, void *data)
|
||||
{
|
||||
@@ -978,10 +919,6 @@ static int pseries_memory_notifier(struct notifier_block *nb,
|
||||
case OF_RECONFIG_DETACH_NODE:
|
||||
err = pseries_remove_mem_node(rd->dn);
|
||||
break;
|
||||
case OF_RECONFIG_UPDATE_PROPERTY:
|
||||
if (!strcmp(rd->prop->name, "ibm,dynamic-memory"))
|
||||
err = pseries_update_drconf_memory(rd);
|
||||
break;
|
||||
}
|
||||
return notifier_from_errno(err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user