[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 4/5] spapr: simplify spapr_numa_associativity_init params
From: |
Daniel Henrique Barboza |
Subject: |
[PATCH v4 4/5] spapr: simplify spapr_numa_associativity_init params |
Date: |
Fri, 27 Aug 2021 06:24:54 -0300 |
When spapr_numa_associativity_init() was introduced it was being
called from spapr_machine_init(), where we have pointers to a
SpaprMachineState and a MachineState. Having both being passed
as params spared us from calling a macro to get the MachineState.
Previous patches moved the function away from spapr_machine_init(),
and the new locations doesn't have a pointer to MachineState ready.
This resulted in MACHINE(spapr) macro calls as the second parameter
in both callers.
Simplify the function by folding the 'MACHINE(spapr)' macro into the
function body, which can now receive only a pointer to
SpaprMachineState.
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
---
hw/ppc/spapr.c | 2 +-
hw/ppc/spapr_hcall.c | 2 +-
hw/ppc/spapr_numa.c | 4 ++--
include/hw/ppc/spapr_numa.h | 3 +--
4 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a3eb33764d..63c4876415 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1800,7 +1800,7 @@ static int spapr_post_load(void *opaque, int version_id)
* initialized and hotplug operations won't fail in both before
* and after CAS migration cases.
*/
- spapr_numa_associativity_init(spapr, MACHINE(spapr));
+ spapr_numa_associativity_init(spapr);
return err;
}
diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c
index 1cc88716c1..a721d3edce 100644
--- a/hw/ppc/spapr_hcall.c
+++ b/hw/ppc/spapr_hcall.c
@@ -1199,7 +1199,7 @@ target_ulong do_client_architecture_support(PowerPCCPU
*cpu,
spapr_ovec_cleanup(ov1_guest);
/* Init numa_assoc_array */
- spapr_numa_associativity_init(spapr, MACHINE(spapr));
+ spapr_numa_associativity_init(spapr);
/*
* Ensure the guest asks for an interrupt mode we support;
diff --git a/hw/ppc/spapr_numa.c b/hw/ppc/spapr_numa.c
index 0a5fa8101e..2f261be9fd 100644
--- a/hw/ppc/spapr_numa.c
+++ b/hw/ppc/spapr_numa.c
@@ -181,9 +181,9 @@ static void
spapr_numa_FORM1_affinity_init(SpaprMachineState *spapr,
spapr_numa_define_associativity_domains(spapr);
}
-void spapr_numa_associativity_init(SpaprMachineState *spapr,
- MachineState *machine)
+void spapr_numa_associativity_init(SpaprMachineState *spapr)
{
+ MachineState *machine = MACHINE(spapr);
SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr);
int nb_numa_nodes = machine->numa_state->num_nodes;
int i, j, max_nodes_with_gpus;
diff --git a/include/hw/ppc/spapr_numa.h b/include/hw/ppc/spapr_numa.h
index 6f9f02d3de..adaec8e163 100644
--- a/include/hw/ppc/spapr_numa.h
+++ b/include/hw/ppc/spapr_numa.h
@@ -22,8 +22,7 @@
* function. spapr_machine_init() is the only caller for it, and
* it has both pointers resolved already.
*/
-void spapr_numa_associativity_init(SpaprMachineState *spapr,
- MachineState *machine);
+void spapr_numa_associativity_init(SpaprMachineState *spapr);
void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rtas);
void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt,
int offset, int nodeid);
--
2.31.1
- [PATCH v4 0/5] pSeries FORM2 affinity support, Daniel Henrique Barboza, 2021/08/27
- [PATCH v4 1/5] hw, spapr: add 6.2 compat pseries machine, Daniel Henrique Barboza, 2021/08/27
- [PATCH v4 3/5] spapr_numa.c: base FORM2 NUMA affinity support, Daniel Henrique Barboza, 2021/08/27
- [PATCH v4 2/5] spapr_numa.c: split FORM1 code into helpers, Daniel Henrique Barboza, 2021/08/27
- [PATCH v4 4/5] spapr: simplify spapr_numa_associativity_init params,
Daniel Henrique Barboza <=
- [PATCH v4 5/5] spapr: move memory/cpu less check to spapr_numa_FORM1_affinity_init(), Daniel Henrique Barboza, 2021/08/27