spapr: Add H-Call H_HOME_NODE_ASSOCIATIVITY
PATCH v3 1/1 spapr: Add H-Call H_HOME_NODE_ASSOCIATIVITY
H_HOME_NODE_ASSOCIATIVITY H-Call returns the associativity domain designation associated with the identifier input parameter
This fixes a crash when we try to hotplug a CPU in memory-less and CPU-less numa node. In this case, the kernel tries to online the node, but without the information provided by this h-call, the node id, it cannot and the CPU is started while the node is not onlined.
It also removes the warning message from the kernel:
VPHN is not supported. Disabling polling..
---
Notes:
v3:
add parentheses around a and b
v2:
add hcall-vphn to ibm,hypertas-functions
correctly check flags
return H_FUNCTION rather than H_PARAMETER
update description
hw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 1 + 3 files changed, 42 insertions(+)
hw/ppc/spapr.c +1 -0
@@ -1049,6 +1049,7 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)add_str (hypertas,"hcall-sprg0" );add_str (hypertas,"hcall-copy" );add_str (hypertas,"hcall-debug" ); +add_str (hypertas,"hcall-vphn" );add_str (qemu_hypertas,"hcall-memop1" );if (!kvm_enabled () ||kvmppc_spapr_use_multitce ()) {
hw/ppc/spapr_hcall.c +40 -0
@@ -1663,6 +1663,42 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,return H_SUCCESS ; } +static target_ulong h_home_node_associativity (PowerPCCPU *cpu, +sPAPRMachineState *spapr, +target_ulong opcode, +target_ulong *args) +{ +target_ulong flags = args[0 ]; +target_ulong procno = args[1 ]; +PowerPCCPU *tcpu; +int idx; + +/* only support procno from H_REGISTER_VPA */ +if (flags !=0x1 ) { +return H_FUNCTION ; + } + + tcpu =spapr_find_cpu (procno); +if (tcpu ==NULL ) { +return H_P2 ; + } + +/* sequence is the same as in the "ibm,associativity" property */ + + idx =0 ; +#define ASSOCIATIVITY (a, b) (((uint64_t)(a) << 32) | \ + ((uint64_t)(b) & 0xffffffff)) + args[idx++] =ASSOCIATIVITY (0 ,0 ); + args[idx++] =ASSOCIATIVITY (0 , tcpu->node_id); + args[idx++] =ASSOCIATIVITY (procno,-1 ); +for ( ; idx <6 ; idx++) { + args[idx] =-1 ; + } +#undef ASSOCIATIVITY + +return H_SUCCESS ; +} + static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode,
@@ -1864,6 +1900,10 @@ static void hypercall_register_types(void)spapr_register_hypercall (KVMPPC_H_CAS , h_client_architecture_support);spapr_register_hypercall (KVMPPC_H_UPDATE_DT , h_update_dt); + +/* Virtual Processor Home Node */ +spapr_register_hypercall (H_HOME_NODE_ASSOCIATIVITY , + h_home_node_associativity); }type_init (hypercall_register_types)
include/hw/ppc/spapr.h +1 -0
@@ -447,6 +447,7 @@ struct sPAPRMachineState {#define H_GET_EM_PARMS 0x2B8#define H_SET_MPP 0x2D0#define H_GET_MPP 0x2D4 +#define H_HOME_NODE_ASSOCIATIVITY 0x2EC#define H_XIRR_X 0x2FC#define H_RANDOM 0x300#define H_SET_MODE 0x31C
Signature · 1 line
2.19.2
Quoted 8 lines · On Wed, 19 Dec 2018 17:35:41 +0100 Laurent Vivier <[email protected]> wrote:
H_HOME_NODE_ASSOCIATIVITYH-Call returns the associativity domain designation associated with the identifier input parameterThis fixes a crash when we try to hotplug a CPU in memory-less and CPU-less numa node. In this case, the kernel tries to online the node, but without the information provided by this h-call, the node id, it cannot and the CPU is started while the node is not onlined.
Quoted 6 lines
It also removes the warning message from the kernel:
VPHN is not supported. Disabling polling..Signed-off-by Laurent Vivier <[email protected]>---
Quoted 97 lines
Notes:
v3:
add parentheses around a and bv2:
add hcall-vphn to ibm,hypertas-functions
correctly check flags
returnH_FUNCTIONrather thanH_PARAMETER
update descriptionhw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 1 + 3 files changed, 42 insertions(+)hw/ppc/spapr.c +1
-0@@ -1049,6 +1049,7 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)add_str (hypertas,"hcall-sprg0" );add_str (hypertas,"hcall-copy" );add_str (hypertas,"hcall-debug" ); +add_str (hypertas,"hcall-vphn" );add_str (qemu_hypertas,"hcall-memop1" );if (!kvm_enabled () ||kvmppc_spapr_use_multitce ()) {hw/ppc/spapr_hcall.c +40
-0@@ -1663,6 +1663,42 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,return H_SUCCESS ; } +static target_ulong h_home_node_associativity (PowerPCCPU *cpu, +sPAPRMachineState *spapr, +target_ulong opcode, +target_ulong *args) +{ +target_ulong flags = args[0 ]; +target_ulong procno = args[1 ]; +PowerPCCPU *tcpu; +int idx; + +/* only support procno from H_REGISTER_VPA */ +if (flags !=0x1 ) { +return H_FUNCTION ; + } + + tcpu =spapr_find_cpu (procno); +if (tcpu ==NULL ) { +return H_P2 ; + } + +/* sequence is the same as in the "ibm,associativity" property */ + + idx =0 ; +#define ASSOCIATIVITY (a, b) (((uint64_t)(a) << 32) | \ + ((uint64_t)(b) & 0xffffffff)) + args[idx++] =ASSOCIATIVITY (0 ,0 ); + args[idx++] =ASSOCIATIVITY (0 , tcpu->node_id); + args[idx++] =ASSOCIATIVITY (procno,-1 ); +for ( ; idx <6 ; idx++) { + args[idx] =-1 ; + } +#undef ASSOCIATIVITY + +return H_SUCCESS ; +} + static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode,@@ -1864,6 +1900,10 @@ static void hypercall_register_types(void)spapr_register_hypercall (KVMPPC_H_CAS , h_client_architecture_support);spapr_register_hypercall (KVMPPC_H_UPDATE_DT , h_update_dt); + +/* Virtual Processor Home Node */ +spapr_register_hypercall (H_HOME_NODE_ASSOCIATIVITY , + h_home_node_associativity); }type_init (hypercall_register_types)include/hw/ppc/spapr.h +1
-0@@ -447,6 +447,7 @@ struct sPAPRMachineState {#define H_GET_EM_PARMS 0x2B8#define H_SET_MPP 0x2D0#define H_GET_MPP 0x2D4 +#define H_HOME_NODE_ASSOCIATIVITY 0x2EC#define H_XIRR_X 0x2FC#define H_RANDOM 0x300#define H_SET_MODE 0x31C
David Gibson
AppliedQuoted 8 lines · Laurent Vivier
H_HOME_NODE_ASSOCIATIVITYH-Call returns the associativity domain designation associated with the identifier input parameterThis fixes a crash when we try to hotplug a CPU in memory-less and CPU-less numa node. In this case, the kernel tries to online the node, but without the information provided by this h-call, the node id, it cannot and the CPU is started while the node is not onlined.
Quoted 4 lines
It also removes the warning message from the kernel:
VPHN is not supported. Disabling polling..Signed-off-by Laurent Vivier <[email protected]>
Applied to ppc-for-4.0, thanks.
Quoted 99 lines
---
Notes:
v3:
add parentheses around a and bv2:
add hcall-vphn to ibm,hypertas-functions
correctly check flags
returnH_FUNCTIONrather thanH_PARAMETER
update descriptionhw/ppc/spapr.c | 1 + hw/ppc/spapr_hcall.c | 40 ++++++++++++++++++++++++++++++++++++++++ include/hw/ppc/spapr.h | 1 + 3 files changed, 42 insertions(+)hw/ppc/spapr.c +1
-0@@ -1049,6 +1049,7 @@ static void spapr_dt_rtas(sPAPRMachineState *spapr, void *fdt)add_str (hypertas,"hcall-sprg0" );add_str (hypertas,"hcall-copy" );add_str (hypertas,"hcall-debug" ); +add_str (hypertas,"hcall-vphn" );add_str (qemu_hypertas,"hcall-memop1" );if (!kvm_enabled () ||kvmppc_spapr_use_multitce ()) {hw/ppc/spapr_hcall.c +40
-0@@ -1663,6 +1663,42 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,return H_SUCCESS ; } +static target_ulong h_home_node_associativity (PowerPCCPU *cpu, +sPAPRMachineState *spapr, +target_ulong opcode, +target_ulong *args) +{ +target_ulong flags = args[0 ]; +target_ulong procno = args[1 ]; +PowerPCCPU *tcpu; +int idx; + +/* only support procno from H_REGISTER_VPA */ +if (flags !=0x1 ) { +return H_FUNCTION ; + } + + tcpu =spapr_find_cpu (procno); +if (tcpu ==NULL ) { +return H_P2 ; + } + +/* sequence is the same as in the "ibm,associativity" property */ + + idx =0 ; +#define ASSOCIATIVITY (a, b) (((uint64_t)(a) << 32) | \ + ((uint64_t)(b) & 0xffffffff)) + args[idx++] =ASSOCIATIVITY (0 ,0 ); + args[idx++] =ASSOCIATIVITY (0 , tcpu->node_id); + args[idx++] =ASSOCIATIVITY (procno,-1 ); +for ( ; idx <6 ; idx++) { + args[idx] =-1 ; + } +#undef ASSOCIATIVITY + +return H_SUCCESS ; +} + static target_ulong h_get_cpu_characteristics(PowerPCCPU *cpu, sPAPRMachineState *spapr, target_ulong opcode,@@ -1864,6 +1900,10 @@ static void hypercall_register_types(void)spapr_register_hypercall (KVMPPC_H_CAS , h_client_architecture_support);spapr_register_hypercall (KVMPPC_H_UPDATE_DT , h_update_dt); + +/* Virtual Processor Home Node */ +spapr_register_hypercall (H_HOME_NODE_ASSOCIATIVITY , + h_home_node_associativity); }type_init (hypercall_register_types)include/hw/ppc/spapr.h +1
-0@@ -447,6 +447,7 @@ struct sPAPRMachineState {#define H_GET_EM_PARMS 0x2B8#define H_SET_MPP 0x2D0#define H_GET_MPP 0x2D4 +#define H_HOME_NODE_ASSOCIATIVITY 0x2EC#define H_XIRR_X 0x2FC#define H_RANDOM 0x300#define H_SET_MODE 0x31C
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson