Fix phb_placement backwards compatibility
PATCH 1/1 Fix phb_placement backwards compatibility
When we added support for NVLink2 passthrough devices, we changed the phb_placement hook to handle the placement of NVLink2 bridges' specific resources. For compatibility we use a version that doesn't do this allocation for old machine types.
However, because of the delay between when the patch was posted and when it was merged, we ended up with that compatibility hook applying for machine versions 3.1 and earlier whereas it should apply for 4.0 and earlier (since the patch was applied early in the 4.1 tree).
--- hw/ppc/spapr.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)
hw/ppc/spapr.c +15 -13
@@ -4411,18 +4411,7 @@ DEFINE_SPAPR_MACHINE(4_1, "4.1", true);/* * pseries-4.0 */ -static void spapr_machine_4_0_class_options (MachineClass *mc) -{ -spapr_machine_4_1_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); -} - -DEFINE_SPAPR_MACHINE(4_0, "4.0", false); - -/* -* pseries-3.1 -*/ -static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, +static void phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, unsigned n_dma, uint32_t *liobns,
@@ -4434,6 +4423,20 @@ static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, *nv2atsd =0 ; } +static void spapr_machine_4_0_class_options (MachineClass *mc) +{ +SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); + +spapr_machine_4_1_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); + smc->phb_placement = phb_placement_4_0; +} + +DEFINE_SPAPR_MACHINE(4_0, "4.0", false); + +/* +* pseries-3.1 +*/ static void spapr_machine_3_1_class_options (MachineClass *mc) {SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc);
@@ -4449,7 +4452,6 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_OFF ; - smc->phb_placement = phb_placement_3_1; } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);
Signature · 1 line
2.21.0
Quoted 65 lines · David Gibson
When we added support for NVLink2 passthrough devices, we changed the
phb_placementhook to handle the placement of NVLink2 bridges' specific resources. For compatibility we use a version that doesn't do this allocation for old machine types.However, because of the delay between when the patch was posted and when it was merged, we ended up with that compatibility hook applying for machine versions 3.1 and earlier whereas it should apply for 4.0 and earlier (since the patch was applied early in the 4.1 tree).
Fixes ec132efaa81 "spapr: Support NVIDIA V100 GPU with NVLink2"Reported-by Laurent Vivier <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)hw/ppc/spapr.c +15
-12@@ -4411,18 +4411,7 @@ DEFINE_SPAPR_MACHINE(4_1, "4.1", true);/* * pseries-4.0 */ -static void spapr_machine_4_0_class_options (MachineClass *mc) -{ -spapr_machine_4_1_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); -} - -DEFINE_SPAPR_MACHINE(4_0, "4.0", false); - -/* -* pseries-3.1 -*/ -static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, +static void phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, unsigned n_dma, uint32_t *liobns,@@ -4434,6 +4423,20 @@ static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, *nv2atsd =0 ; } +static void spapr_machine_4_0_class_options (MachineClass *mc) +{ +SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); + +spapr_machine_4_1_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); + smc->phb_placement = phb_placement_4_0; +} + +DEFINE_SPAPR_MACHINE(4_0, "4.0", false); + +/* +* pseries-3.1 +*/ static void spapr_machine_3_1_class_options (MachineClass *mc) {SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc);
hw/ppc/spapr.c static void spapr_machine_3_1_class_options(MachineClass *mc) · line 4457
Quoted 7 lines
hw/ppc/spapr.c +0
-1@@ -4449,7 +4452,6 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_OFF ; - smc->phb_placement = phb_placement_3_1; } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);
Greg Kurz
Reviewed-byQuoted 11 lines · On Mon, 20 May 2019 08:21:32 +0200 Laurent Vivier <[email protected]> wrote:
Quoted 10 lines · David Gibson
When we added support for NVLink2 passthrough devices, we changed the
phb_placementhook to handle the placement of NVLink2 bridges' specific resources. For compatibility we use a version that doesn't do this allocation for old machine types.However, because of the delay between when the patch was posted and when it was merged, we ended up with that compatibility hook applying for machine versions 3.1 and earlier whereas it should apply for 4.0 and earlier (since the patch was applied early in the 4.1 tree).
Quoted 5 lines
Quoted 5 lines
Fixes ec132efaa81 "spapr: Support NVIDIA V100 GPU with NVLink2"Reported-by Laurent Vivier <[email protected]>Signed-off-by David Gibson <[email protected]>---
Quoted 60 lines
Quoted 50 lines
hw/ppc/spapr.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)hw/ppc/spapr.c +15
-12@@ -4411,18 +4411,7 @@ DEFINE_SPAPR_MACHINE(4_1, "4.1", true);/* * pseries-4.0 */ -static void spapr_machine_4_0_class_options (MachineClass *mc) -{ -spapr_machine_4_1_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); -} - -DEFINE_SPAPR_MACHINE(4_0, "4.0", false); - -/* -* pseries-3.1 -*/ -static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, +static void phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, unsigned n_dma, uint32_t *liobns,@@ -4434,6 +4423,20 @@ static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, *nv2atsd =0 ; } +static void spapr_machine_4_0_class_options (MachineClass *mc) +{ +SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); + +spapr_machine_4_1_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); + smc->phb_placement = phb_placement_4_0; +} + +DEFINE_SPAPR_MACHINE(4_0, "4.0", false); + +/* +* pseries-3.1 +*/ static void spapr_machine_3_1_class_options (MachineClass *mc) {SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc);hw/ppc/spapr.c static void spapr_machine_3_1_class_options(MachineClass *mc) · line 4457
Quoted 7 lines
hw/ppc/spapr.c +0
-1@@ -4449,7 +4452,6 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_OFF ; - smc->phb_placement = phb_placement_3_1; } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);Reviewed-by Laurent Vivier <[email protected]>
Quoted 10 lines · David Gibson
When we added support for NVLink2 passthrough devices, we changed the
phb_placementhook to handle the placement of NVLink2 bridges' specific resources. For compatibility we use a version that doesn't do this allocation for old machine types.However, because of the delay between when the patch was posted and when it was merged, we ended up with that compatibility hook applying for machine versions 3.1 and earlier whereas it should apply for 4.0 and earlier (since the patch was applied early in the 4.1 tree).
Quoted 4 lines
Fixes ec132efaa81 "spapr: Support NVIDIA V100 GPU with NVLink2"Reported-by Laurent Vivier <[email protected]>Signed-off-by David Gibson <[email protected]>
Thanks,
C.
Quoted 58 lines
--- hw/ppc/spapr.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-)hw/ppc/spapr.c +15
-13@@ -4411,18 +4411,7 @@ DEFINE_SPAPR_MACHINE(4_1, "4.1", true);/* * pseries-4.0 */ -static void spapr_machine_4_0_class_options (MachineClass *mc) -{ -spapr_machine_4_1_class_options (mc); -compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); -} - -DEFINE_SPAPR_MACHINE(4_0, "4.0", false); - -/* -* pseries-3.1 -*/ -static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, +static void phb_placement_4_0(SpaprMachineState *spapr, uint32_t index, uint64_t *buid, hwaddr *pio, hwaddr *mmio32, hwaddr *mmio64, unsigned n_dma, uint32_t *liobns,@@ -4434,6 +4423,20 @@ static void phb_placement_3_1(SpaprMachineState *spapr, uint32_t index, *nv2atsd =0 ; } +static void spapr_machine_4_0_class_options (MachineClass *mc) +{ +SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc); + +spapr_machine_4_1_class_options (mc); +compat_props_add (mc->compat_props, hw_compat_4_0, hw_compat_4_0_len); + smc->phb_placement = phb_placement_4_0; +} + +DEFINE_SPAPR_MACHINE(4_0, "4.0", false); + +/* +* pseries-3.1 +*/ static void spapr_machine_3_1_class_options (MachineClass *mc) {SpaprMachineClass *smc =SPAPR_MACHINE_CLASS (mc);@@ -4449,7 +4452,6 @@ static void spapr_machine_3_1_class_options(MachineClass *mc) smc->default_caps.caps[SPAPR_CAP_SBBC ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_IBS ] =SPAPR_CAP_BROKEN ; smc->default_caps.caps[SPAPR_CAP_LARGE_DECREMENTER ] =SPAPR_CAP_OFF ; - smc->phb_placement = phb_placement_3_1; } DEFINE_SPAPR_MACHINE(3_1, "3.1", false);