spapr: CAS and reset cleanup preliminaries
cover spapr: CAS and reset cleanup preliminaries
PAPR defines a feature negotiation protocol between host and guest called ibm,client-architecture-support or CAS. When invoked by the guest this can either result in updated device tree information being given to the guest to indicate the new configuration, or it can trigger a reboot (called a CAS reboot) for more wide reaching configuration changes.
CAS changes are time consuming and irritating for the user, so we'd like to avoid them as much as possible. We hope we can avoid them in all situations, in fact, but there's some work to do to get there.
This series has some initial changes that get us closer to that mark.
Alexey Kardashevskiy (4):
spapr: Fixes a leak in CAS
spapr: Skip leading zeroes from memory@ DT node names
spapr: Do not put empty properties for -kernel/-initrd/-append
spapr: Stop providing RTAS blob
David Gibson (3):
spapr: Simplify handling of pre ISA 3.0 guest workaround handling
spapr: Move handling of special NVLink numa node from reset to init
spapr: Perform machine reset in a more sensible order
MAINTAINERS | 2 - Makefile | 2 +- configure | 6 +- hw/ppc/spapr.c | 128 ++++++++++++++------------------ hw/ppc/spapr_hcall.c | 3 +- hw/ppc/spapr_rtas.c | 41 ---------- include/hw/ppc/spapr.h | 4 +- pc-bios/spapr-rtas.bin | Bin 20 -> 0 bytes pc-bios/spapr-rtas/Makefile | 27 ------- pc-bios/spapr-rtas/spapr-rtas.S | 37 --------- 10 files changed, 58 insertions(+), 192 deletions(-) delete mode 100644 pc-bios/spapr-rtas.bin delete mode 100644 pc-bios/spapr-rtas/Makefile delete mode 100644 pc-bios/spapr-rtas/spapr-rtas.S
Signature · 1 line
2.21.0
PATCH 1/7 spapr: Simplify handling of pre ISA 3.0 guest workaround handling
Certain old guest versions don't understand the radix MMU introduced with POWER ISA 3.0, but incorrectly select it if presented with the option at CAS time. We workaround this in qemu by explicitly excluding the radix (and other ISA 3.0 linked) options if the guest doesn't explicitly note support for ISA 3.0.
This is handled by the 'cas_legacy_guest_workaround' flag, which is pretty vague. Rename it to 'cas_pre_isa3_guest' to be clearer about what it's for.
In addition, we unnecessarily call spapr_populate_pa_features() with different options when initially constructing the device tree and when adjusting it at CAS time. At the initial construct time cas_pre_isa3_guest is already false, so we can still use the flag, rather than explicitly overriding it to be false at the callsite.
--- hw/ppc/spapr.c | 10 ++++------ hw/ppc/spapr_hcall.c | 3 +-- include/hw/ppc/spapr.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-)
hw/ppc/spapr.c +4 -6
@@ -218,8 +218,7 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)/* Populate the "ibm,pa-features" property */ static void spapr_populate_pa_features (SpaprMachineState *spapr,PowerPCCPU *cpu, -void *fdt,int offset, -bool legacy_guest) +void *fdt,int offset) {uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 };
@@ -285,7 +284,7 @@ static void spapr_populate_pa_features(SpaprMachineState *spapr,if ((spapr_get_cap (spapr,SPAPR_CAP_HTM ) !=0 ) && pa_size >24 ) { pa_features[24 ] |=0x80 ;/* Transactional memory support */ } -if (legacy_guest && pa_size >40 ) { +if (spapr->cas_pre_isa3_guest && pa_size >40 ) {/* Workaround for broken kernels that attempt (guest) radix * mode when they can't handle it, if they see the radix bit set * in pa-features. So hide it from them. */
@@ -348,8 +347,7 @@ static int spapr_fixup_cpu_dt(void *fdt, SpaprMachineState *spapr)return ret; } -spapr_populate_pa_features (spapr, cpu, fdt, offset, - spapr->cas_legacy_guest_workaround); +spapr_populate_pa_features (spapr, cpu, fdt, offset); }return ret; }
@@ -551,7 +549,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, page_sizes_prop, page_sizes_prop_size))); } -spapr_populate_pa_features (spapr, cpu, fdt, offset, false); +spapr_populate_pa_features (spapr, cpu, fdt, offset);_FDT ((fdt_setprop_cell (fdt, offset,"ibm,chip-id" , cs->cpu_index / vcpus_per_socket)));
hw/ppc/spapr_hcall.c +1 -2
@@ -1765,8 +1765,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,exit (EXIT_FAILURE ); } } - spapr->cas_legacy_guest_workaround = !spapr_ovec_test (ov1_guest, -OV1_PPC_3_00 ); + spapr->cas_pre_isa3_guest = !spapr_ovec_test (ov1_guest,OV1_PPC_3_00 );spapr_ovec_cleanup (ov1_guest);if (!spapr->cas_reboot) {/* If spapr_machine_reset() did not set up a HPT but one is necessary
include/hw/ppc/spapr.h +1 -1
@@ -175,7 +175,7 @@ struct SpaprMachineState {/* ibm,client-architecture-support option negotiation */ bool cas_reboot; -bool cas_legacy_guest_workaround; +bool cas_pre_isa3_guest;SpaprOptionVector *ov5;/* QEMU-supported option vectors */ SpaprOptionVector *ov5_cas;/* negotiated (via CAS) option vectors */ uint32_t max_compat_pvr;
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 1/7] spapr: Simplify handling of pre ISA 3.0 guest workaround handling
Quoted 9 lines · David Gibson
Certain old guest versions don't understand the radix MMU introduced with POWER ISA 3.0, but incorrectly select it if presented with the option at CAS time. We workaround this in qemu by explicitly excluding the radix (and other ISA 3.0 linked) options if the guest doesn't explicitly note support for ISA 3.0.
This is handled by the '
cas_legacy_guest_workaround' flag, which is pretty vague. Rename it to 'cas_pre_isa3_guest' to be clearer about what it's for.
Quoted 7 lines
In addition, we unnecessarily call
spapr_populate_pa_features()with different options when initially constructing the device tree and when adjusting it at CAS time. At the initial construct timecas_pre_isa3_guestis already false, so we can still use the flag, rather than explicitly overriding it to be false at the callsite.Signed-off-by David Gibson <[email protected]>
Thanks,
C.
Quoted 76 lines
--- hw/ppc/spapr.c | 10 ++++------ hw/ppc/spapr_hcall.c | 3 +-- include/hw/ppc/spapr.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-)hw/ppc/spapr.c +4
-6@@ -218,8 +218,7 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)/* Populate the "ibm,pa-features" property */ static void spapr_populate_pa_features (SpaprMachineState *spapr,PowerPCCPU *cpu, -void *fdt,int offset, -bool legacy_guest) +void *fdt,int offset) {uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 };@@ -285,7 +284,7 @@ static void spapr_populate_pa_features(SpaprMachineState *spapr,if ((spapr_get_cap (spapr,SPAPR_CAP_HTM ) !=0 ) && pa_size >24 ) { pa_features[24 ] |=0x80 ;/* Transactional memory support */ } -if (legacy_guest && pa_size >40 ) { +if (spapr->cas_pre_isa3_guest && pa_size >40 ) {/* Workaround for broken kernels that attempt (guest) radix * mode when they can't handle it, if they see the radix bit set * in pa-features. So hide it from them. */ @@ -348,8 +347,7 @@ static int spapr_fixup_cpu_dt(void *fdt, SpaprMachineState *spapr)return ret; } -spapr_populate_pa_features (spapr, cpu, fdt, offset, - spapr->cas_legacy_guest_workaround); +spapr_populate_pa_features (spapr, cpu, fdt, offset); }return ret; }@@ -551,7 +549,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, page_sizes_prop, page_sizes_prop_size))); } -spapr_populate_pa_features (spapr, cpu, fdt, offset, false); +spapr_populate_pa_features (spapr, cpu, fdt, offset);_FDT ((fdt_setprop_cell (fdt, offset,"ibm,chip-id" , cs->cpu_index / vcpus_per_socket)));hw/ppc/spapr_hcall.c +1
-2@@ -1765,8 +1765,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,exit (EXIT_FAILURE ); } } - spapr->cas_legacy_guest_workaround = !spapr_ovec_test (ov1_guest, -OV1_PPC_3_00 ); + spapr->cas_pre_isa3_guest = !spapr_ovec_test (ov1_guest,OV1_PPC_3_00 );spapr_ovec_cleanup (ov1_guest);if (!spapr->cas_reboot) {/* If spapr_machine_reset() did not set up a HPT but one is necessary include/hw/ppc/spapr.h +1
-1@@ -175,7 +175,7 @@ struct SpaprMachineState {/* ibm,client-architecture-support option negotiation */ bool cas_reboot; -bool cas_legacy_guest_workaround; +bool cas_pre_isa3_guest;SpaprOptionVector *ov5;/* QEMU-supported option vectors */ SpaprOptionVector *ov5_cas;/* negotiated (via CAS) option vectors */ uint32_t max_compat_pvr;
Re: [Qemu-devel] [PATCH 1/7] spapr: Simplify handling of pre ISA 3.0 guest workaround handling
In reply to David GibsonQuoted 9 lines · On Wed, 11 Sep 2019 14:04:46 +1000 David Gibson <[email protected]>…
Certain old guest versions don't understand the radix MMU introduced with POWER ISA 3.0, but incorrectly select it if presented with the option at CAS time. We workaround this in qemu by explicitly excluding the radix (and other ISA 3.0 linked) options if the guest doesn't explicitly note support for ISA 3.0.
This is handled by the '
cas_legacy_guest_workaround' flag, which is pretty vague. Rename it to 'cas_pre_isa3_guest' to be clearer about what it's for.
Quoted 8 lines
In addition, we unnecessarily call
spapr_populate_pa_features()with different options when initially constructing the device tree and when adjusting it at CAS time. At the initial construct timecas_pre_isa3_guestis already false, so we can still use the flag, rather than explicitly overriding it to be false at the callsite.Signed-off-by David Gibson <[email protected]>---
Quoted 74 lines
hw/ppc/spapr.c | 10 ++++------ hw/ppc/spapr_hcall.c | 3 +-- include/hw/ppc/spapr.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-)hw/ppc/spapr.c +4
-6@@ -218,8 +218,7 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)/* Populate the "ibm,pa-features" property */ static void spapr_populate_pa_features (SpaprMachineState *spapr,PowerPCCPU *cpu, -void *fdt,int offset, -bool legacy_guest) +void *fdt,int offset) {uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 };@@ -285,7 +284,7 @@ static void spapr_populate_pa_features(SpaprMachineState *spapr,if ((spapr_get_cap (spapr,SPAPR_CAP_HTM ) !=0 ) && pa_size >24 ) { pa_features[24 ] |=0x80 ;/* Transactional memory support */ } -if (legacy_guest && pa_size >40 ) { +if (spapr->cas_pre_isa3_guest && pa_size >40 ) {/* Workaround for broken kernels that attempt (guest) radix * mode when they can't handle it, if they see the radix bit set * in pa-features. So hide it from them. */ @@ -348,8 +347,7 @@ static int spapr_fixup_cpu_dt(void *fdt, SpaprMachineState *spapr)return ret; } -spapr_populate_pa_features (spapr, cpu, fdt, offset, - spapr->cas_legacy_guest_workaround); +spapr_populate_pa_features (spapr, cpu, fdt, offset); }return ret; }@@ -551,7 +549,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, page_sizes_prop, page_sizes_prop_size))); } -spapr_populate_pa_features (spapr, cpu, fdt, offset, false); +spapr_populate_pa_features (spapr, cpu, fdt, offset);_FDT ((fdt_setprop_cell (fdt, offset,"ibm,chip-id" , cs->cpu_index / vcpus_per_socket)));hw/ppc/spapr_hcall.c +1
-2@@ -1765,8 +1765,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,exit (EXIT_FAILURE ); } } - spapr->cas_legacy_guest_workaround = !spapr_ovec_test (ov1_guest, -OV1_PPC_3_00 ); + spapr->cas_pre_isa3_guest = !spapr_ovec_test (ov1_guest,OV1_PPC_3_00 );spapr_ovec_cleanup (ov1_guest);if (!spapr->cas_reboot) {/* If spapr_machine_reset() did not set up a HPT but one is necessary include/hw/ppc/spapr.h +1
-1@@ -175,7 +175,7 @@ struct SpaprMachineState {/* ibm,client-architecture-support option negotiation */ bool cas_reboot; -bool cas_legacy_guest_workaround; +bool cas_pre_isa3_guest;SpaprOptionVector *ov5;/* QEMU-supported option vectors */ SpaprOptionVector *ov5_cas;/* negotiated (via CAS) option vectors */ uint32_t max_compat_pvr;
Re: [Qemu-devel] [PATCH 1/7] spapr: Simplify handling of pre ISA 3.0 guest workaround handling
In reply to David GibsonQuoted 9 lines · David Gibson
Certain old guest versions don't understand the radix MMU introduced with POWER ISA 3.0, but incorrectly select it if presented with the option at CAS time. We workaround this in qemu by explicitly excluding the radix (and other ISA 3.0 linked) options if the guest doesn't explicitly note support for ISA 3.0.
This is handled by the '
cas_legacy_guest_workaround' flag, which is pretty vague. Rename it to 'cas_pre_isa3_guest' to be clearer about what it's for.
Quoted 7 lines
In addition, we unnecessarily call
spapr_populate_pa_features()with different options when initially constructing the device tree and when adjusting it at CAS time. At the initial construct timecas_pre_isa3_guestis already false, so we can still use the flag, rather than explicitly overriding it to be false at the callsite.Signed-off-by David Gibson <[email protected]>
Quoted 76 lines
--- hw/ppc/spapr.c | 10 ++++------ hw/ppc/spapr_hcall.c | 3 +-- include/hw/ppc/spapr.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-)hw/ppc/spapr.c +4
-6@@ -218,8 +218,7 @@ static int spapr_fixup_cpu_numa_dt(void *fdt, int offset, PowerPCCPU *cpu)/* Populate the "ibm,pa-features" property */ static void spapr_populate_pa_features (SpaprMachineState *spapr,PowerPCCPU *cpu, -void *fdt,int offset, -bool legacy_guest) +void *fdt,int offset) {uint8_t pa_features_206[] = {6 ,0 ,0xf6 ,0x1f ,0xc7 ,0x00 ,0x80 ,0xc0 };@@ -285,7 +284,7 @@ static void spapr_populate_pa_features(SpaprMachineState *spapr,if ((spapr_get_cap (spapr,SPAPR_CAP_HTM ) !=0 ) && pa_size >24 ) { pa_features[24 ] |=0x80 ;/* Transactional memory support */ } -if (legacy_guest && pa_size >40 ) { +if (spapr->cas_pre_isa3_guest && pa_size >40 ) {/* Workaround for broken kernels that attempt (guest) radix * mode when they can't handle it, if they see the radix bit set * in pa-features. So hide it from them. */ @@ -348,8 +347,7 @@ static int spapr_fixup_cpu_dt(void *fdt, SpaprMachineState *spapr)return ret; } -spapr_populate_pa_features (spapr, cpu, fdt, offset, - spapr->cas_legacy_guest_workaround); +spapr_populate_pa_features (spapr, cpu, fdt, offset); }return ret; }@@ -551,7 +549,7 @@ static void spapr_populate_cpu_dt(CPUState *cs, void *fdt, int offset, page_sizes_prop, page_sizes_prop_size))); } -spapr_populate_pa_features (spapr, cpu, fdt, offset, false); +spapr_populate_pa_features (spapr, cpu, fdt, offset);_FDT ((fdt_setprop_cell (fdt, offset,"ibm,chip-id" , cs->cpu_index / vcpus_per_socket)));hw/ppc/spapr_hcall.c +1
-2@@ -1765,8 +1765,7 @@ static target_ulong h_client_architecture_support(PowerPCCPU *cpu,exit (EXIT_FAILURE ); } } - spapr->cas_legacy_guest_workaround = !spapr_ovec_test (ov1_guest, -OV1_PPC_3_00 ); + spapr->cas_pre_isa3_guest = !spapr_ovec_test (ov1_guest,OV1_PPC_3_00 );spapr_ovec_cleanup (ov1_guest);if (!spapr->cas_reboot) {/* If spapr_machine_reset() did not set up a HPT but one is necessary include/hw/ppc/spapr.h +1
-1@@ -175,7 +175,7 @@ struct SpaprMachineState {/* ibm,client-architecture-support option negotiation */ bool cas_reboot; -bool cas_legacy_guest_workaround; +bool cas_pre_isa3_guest;SpaprOptionVector *ov5;/* QEMU-supported option vectors */ SpaprOptionVector *ov5_cas;/* negotiated (via CAS) option vectors */ uint32_t max_compat_pvr;
Signature · 1 line
Alexey
PATCH 2/7 spapr: Move handling of special NVLink numa node from reset to init
In reply to David GibsonThe number of NUMA nodes in the system is fixed from the command line. Therefore, there's no need to recalculate it at reset time, and we can determine the special gpu_numa_id value used for NVLink2 devices at init time.
This simplifies the reset path a bit which will make further improvements easier.
--- hw/ppc/spapr.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
hw/ppc/spapr.c +11 -10
@@ -1737,16 +1737,6 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -/* -* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. -* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is -* called from vPHB reset handler so we initialize the counter here. -* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM -* must be equally distant from any other node. -* The final value of spapr->gpu_numa_id is going to be written to -* max-associativity-domains in spapr_build_fdt(). -*/ - spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes);qemu_devices_reset ();/*
@@ -2885,6 +2875,17 @@ static void spapr_machine_init(MachineState *machine) } +/* +* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. +* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is +* called from vPHB reset handler so we initialize the counter here. +* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM +* must be equally distant from any other node. +* The final value of spapr->gpu_numa_id is going to be written to +* max-associativity-domains in spapr_build_fdt(). +*/ + spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes); +if ((!kvm_enabled () ||kvmppc_has_cap_mmu_radix ()) &&ppc_type_check_compat (machine->cpu_type,CPU_POWERPC_LOGICAL_3_00 ,0 , spapr->max_compat_pvr)) {
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 2/7] spapr: Move handling of special NVLink numa node from reset to init
Quoted 9 lines · David Gibson
The number of NUMA nodes in the system is fixed from the command line. Therefore, there's no need to recalculate it at reset time, and we can determine the special
gpu_numa_idvalue used for NVLink2 devices at init time.This simplifies the reset path a bit which will make further improvements easier.
Signed-off-by David Gibson <[email protected]>
Thanks,
C.
Quoted 44 lines
--- hw/ppc/spapr.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)hw/ppc/spapr.c +11
-10@@ -1737,16 +1737,6 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -/* -* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. -* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is -* called from vPHB reset handler so we initialize the counter here. -* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM -* must be equally distant from any other node. -* The final value of spapr->gpu_numa_id is going to be written to -* max-associativity-domains in spapr_build_fdt(). -*/ - spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes);qemu_devices_reset ();/* @@ -2885,6 +2875,17 @@ static void spapr_machine_init(MachineState *machine) } +/* +* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. +* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is +* called from vPHB reset handler so we initialize the counter here. +* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM +* must be equally distant from any other node. +* The final value of spapr->gpu_numa_id is going to be written to +* max-associativity-domains in spapr_build_fdt(). +*/ + spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes); +if ((!kvm_enabled () ||kvmppc_has_cap_mmu_radix ()) &&ppc_type_check_compat (machine->cpu_type,CPU_POWERPC_LOGICAL_3_00 ,0 , spapr->max_compat_pvr)) {
Re: [Qemu-devel] [PATCH 2/7] spapr: Move handling of special NVLink numa node from reset to init
In reply to David GibsonQuoted 10 lines · On Wed, 11 Sep 2019 14:04:47 +1000 David Gibson <[email protected]>…
The number of NUMA nodes in the system is fixed from the command line. Therefore, there's no need to recalculate it at reset time, and we can determine the special
gpu_numa_idvalue used for NVLink2 devices at init time.This simplifies the reset path a bit which will make further improvements easier.
Signed-off-by David Gibson <[email protected]>---
Quoted 42 lines
hw/ppc/spapr.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)hw/ppc/spapr.c +11
-10@@ -1737,16 +1737,6 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -/* -* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. -* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is -* called from vPHB reset handler so we initialize the counter here. -* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM -* must be equally distant from any other node. -* The final value of spapr->gpu_numa_id is going to be written to -* max-associativity-domains in spapr_build_fdt(). -*/ - spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes);qemu_devices_reset ();/* @@ -2885,6 +2875,17 @@ static void spapr_machine_init(MachineState *machine) } +/* +* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. +* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is +* called from vPHB reset handler so we initialize the counter here. +* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM +* must be equally distant from any other node. +* The final value of spapr->gpu_numa_id is going to be written to +* max-associativity-domains in spapr_build_fdt(). +*/ + spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes); +if ((!kvm_enabled () ||kvmppc_has_cap_mmu_radix ()) &&ppc_type_check_compat (machine->cpu_type,CPU_POWERPC_LOGICAL_3_00 ,0 , spapr->max_compat_pvr)) {
Re: [Qemu-devel] [PATCH 2/7] spapr: Move handling of special NVLink numa node from reset to init
In reply to David GibsonQuoted 9 lines · David Gibson
The number of NUMA nodes in the system is fixed from the command line. Therefore, there's no need to recalculate it at reset time, and we can determine the special
gpu_numa_idvalue used for NVLink2 devices at init time.This simplifies the reset path a bit which will make further improvements easier.
Signed-off-by David Gibson <[email protected]>
Quoted 44 lines
--- hw/ppc/spapr.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)hw/ppc/spapr.c +11
-10@@ -1737,16 +1737,6 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -/* -* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. -* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is -* called from vPHB reset handler so we initialize the counter here. -* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM -* must be equally distant from any other node. -* The final value of spapr->gpu_numa_id is going to be written to -* max-associativity-domains in spapr_build_fdt(). -*/ - spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes);qemu_devices_reset ();/* @@ -2885,6 +2875,17 @@ static void spapr_machine_init(MachineState *machine) } +/* +* NVLink2-connected GPU RAM needs to be placed on a separate NUMA node. +* We assign a new numa ID per GPU in spapr_pci_collect_nvgpu() which is +* called from vPHB reset handler so we initialize the counter here. +* If no NUMA is configured from the QEMU side, we start from 1 as GPU RAM +* must be equally distant from any other node. +* The final value of spapr->gpu_numa_id is going to be written to +* max-associativity-domains in spapr_build_fdt(). +*/ + spapr->gpu_numa_id =MAX (1 , machine->numa_state->num_nodes); +if ((!kvm_enabled () ||kvmppc_has_cap_mmu_radix ()) &&ppc_type_check_compat (machine->cpu_type,CPU_POWERPC_LOGICAL_3_00 ,0 , spapr->max_compat_pvr)) {
Signature · 1 line
Alexey
PATCH 3/7 spapr: Fixes a leak in CAS
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
Add a missing g_free(fdt) if the resulting tree is bigger than the space allocated by SLOF.
--- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+)
hw/ppc/spapr.c +1 -0
@@ -1024,6 +1024,7 @@ int spapr_h_cas_compose_response(SpaprMachineState *spapr,_FDT ((fdt_pack (fdt)));if (fdt_totalsize (fdt) +sizeof (hdr) > size) { +g_free (fdt);trace_spapr_cas_failed (size);return -1 ; }
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 3/7] spapr: Fixes a leak in CAS
Quoted 7 lines · David Gibson
From: Alexey Kardashevskiy <[email protected]>
Add a missing
g_free(fdt)if the resulting tree is bigger than the space allocated by SLOF.Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>
Thanks,
C.
Quoted 17 lines
--- hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr.c +1
-0@@ -1024,6 +1024,7 @@ int spapr_h_cas_compose_response(SpaprMachineState *spapr,_FDT ((fdt_pack (fdt)));if (fdt_totalsize (fdt) +sizeof (hdr) > size) { +g_free (fdt);trace_spapr_cas_failed (size);return -1 ; }
Re: [Qemu-devel] [PATCH 3/7] spapr: Fixes a leak in CAS
In reply to David GibsonQuoted 8 lines · On Wed, 11 Sep 2019 14:04:48 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
Add a missing
g_free(fdt)if the resulting tree is bigger than the space allocated by SLOF.Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>---
Quoted 15 lines
hw/ppc/spapr.c | 1 + 1 file changed, 1 insertion(+)hw/ppc/spapr.c +1
-0@@ -1024,6 +1024,7 @@ int spapr_h_cas_compose_response(SpaprMachineState *spapr,_FDT ((fdt_pack (fdt)));if (fdt_totalsize (fdt) +sizeof (hdr) > size) { +g_free (fdt);trace_spapr_cas_failed (size);return -1 ; }
PATCH 4/7 spapr: Skip leading zeroes from memory@ DT node names
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
The device tree build by QEMU at the machine reset time is used by SLOF to build its internal device tree but the node names are not preserved exactly so when QEMU provides a device tree update in response to H_CAS, it might become tricky to match a node from the update blob to the actual node in SLOF.
This removed leading zeroes from "memory@" nodes and makes the DTC checker happy.
--- hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/ppc/spapr.c +1 -1
@@ -386,7 +386,7 @@ static int spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start, mem_reg_property[0 ] =cpu_to_be64 (start); mem_reg_property[1 ] =cpu_to_be64 (size); -sprintf (mem_name,"memory@" TARGET_FMT_lx, start); +sprintf (mem_name,"memory@%" HWADDR_PRIx, start); off =fdt_add_subnode (fdt,0 , mem_name);_FDT (off);_FDT ((fdt_setprop_string (fdt, off,"device_type" ,"memory" )));
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 4/7] spapr: Skip leading zeroes from memory@ DT node names
Quoted 8 lines · On Wed, 11 Sep 2019 14:04:49 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
The device tree build by QEMU at the machine reset time is used by SLOF to build its internal device tree but the node names are not preserved exactly so when QEMU provides a device tree update in response to
H_CAS, it might become tricky to match a node from the update blob to the actual node in SLOF.
Quoted 6 lines
This removed leading zeroes from "memory@" nodes and makes the DTC checker happy.
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>---
Quoted 16 lines
hw/ppc/spapr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/ppc/spapr.c +1
-1@@ -386,7 +386,7 @@ static int spapr_populate_memory_node(void *fdt, int nodeid, hwaddr start, mem_reg_property[0 ] =cpu_to_be64 (start); mem_reg_property[1 ] =cpu_to_be64 (size); -sprintf (mem_name,"memory@" TARGET_FMT_lx, start); +sprintf (mem_name,"memory@%" HWADDR_PRIx, start); off =fdt_add_subnode (fdt,0 , mem_name);_FDT (off);_FDT ((fdt_setprop_string (fdt, off,"device_type" ,"memory" )));
PATCH 5/7 spapr: Do not put empty properties for -kernel/-initrd/-append
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
We are going to use spapr_build_fdt() for the boot time FDT and as an update for SLOF during handling of H_CAS. SLOF will apply all properties from the QEMU's FDT which is usually ok unless there are properties changed by grub or guest kernel. The properties are:
bootargs, linux,initrd-start, linux,initrd-end, linux,stdout-path, linux,rtas-base, linux,rtas-entry. Resetting those during CAS will most likely cause grub failure.
This only creates such properties if we are booting with "-kernel" and "-initrd" so they won't get included into the DT update blob and therefore the guest is more likely to boot successfully.
--- hw/ppc/spapr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
hw/ppc/spapr.c +10 -5
@@ -1177,11 +1177,16 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt)_FDT (chosen =fdt_add_subnode (fdt,0 ,"chosen" )); -_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , machine->kernel_cmdline)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , - spapr->initrd_base)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , - spapr->initrd_base + spapr->initrd_size)); +if (machine->kernel_cmdline && machine->kernel_cmdline[0 ]) { +_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , + machine->kernel_cmdline)); + } +if (spapr->initrd_size) { +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , + spapr->initrd_base)); +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , + spapr->initrd_base + spapr->initrd_size)); + }if (spapr->kernel_size) {uint64_t kprop[2 ] = {cpu_to_be64 (KERNEL_LOAD_ADDR ),
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 5/7] spapr: Do not put empty properties for -kernel/-initrd/-append
Quoted 10 lines · On Wed, 11 Sep 2019 14:04:50 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
We are going to use
spapr_build_fdt()for the boot time FDT and as an update for SLOF during handling ofH_CAS. SLOF will apply all properties from the QEMU's FDT which is usually ok unless there are properties changed by grub or guest kernel. The properties are:
bootargs, linux,initrd-start, linux,initrd-end, linux,stdout-path, linux,rtas-base, linux,rtas-entry. Resetting those during CAS will most likely cause grub failure.
s/Resetting/Clearing ? They still get reset to the initial setup if "-kernel" and "-initrd" were passed, but it is okay since neither grub, nor the guest kernel is supposed to change them in this case, correct ?
Quoted 2 lines
This only creates such properties if we are booting with "-kernel" and "-initrd" so they won't get included into the DT update blob and
so they won't get included {if we're not booting with "-kernel" ...}
Quoted 2 lines
therefore the guest is more likely to boot successfully.
Maybe rephrase like:
Don't create such properties if we're booting without "-kernel" and "-initrd" ...
Quoted 11 lines
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)hw/ppc/spapr.c +0
-0
hw/ppc/spapr.c static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt) · line 1180
Quoted 9 lines
hw/ppc/spapr.c +1
-5@@ -1177,11 +1177,16 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt)_FDT (chosen =fdt_add_subnode (fdt,0 ,"chosen" )); -_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , machine->kernel_cmdline)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , - spapr->initrd_base)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , - spapr->initrd_base + spapr->initrd_size)); +if (machine->kernel_cmdline && machine->kernel_cmdline[0 ]) {
machine->kernel_cmdline cannot be NULL.
From vl.c:
if (!kernel_cmdline) {
kernel_cmdline = "";
current_machine->kernel_cmdline = (char *)kernel_cmdline;
}Also this doesn't check if we're booting with -kernel but rather that we're booting with -append ${some_not_empty_string}... what about checking spapr->kernel_size, pretty much like you do for the initrd ?
Quoted 12 lines
hw/ppc/spapr.c +9
-0+_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , + machine->kernel_cmdline)); + } +if (spapr->initrd_size) { +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , + spapr->initrd_base)); +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , + spapr->initrd_base + spapr->initrd_size)); + }if (spapr->kernel_size) {uint64_t kprop[2 ] = {cpu_to_be64 (KERNEL_LOAD_ADDR ),
Re: [Qemu-devel] [PATCH 5/7] spapr: Do not put empty properties for -kernel/-initrd/-append
Quoted 14 lines · Greg Kurz
Quoted 10 lines · On Wed, 11 Sep 2019 14:04:50 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
We are going to use
spapr_build_fdt()for the boot time FDT and as an update for SLOF during handling ofH_CAS. SLOF will apply all properties from the QEMU's FDT which is usually ok unless there are properties changed by grub or guest kernel. The properties are:
bootargs, linux,initrd-start, linux,initrd-end, linux,stdout-path, linux,rtas-base, linux,rtas-entry. Resetting those during CAS will most likely cause grub failure.
Quoted 3 lines
s/Resetting/Clearing ? They still get reset to the initial setup if "-kernel" and "-initrd" were passed, but it is okay since neither grub, nor the guest kernel is supposed to change them in this case, correct ?
Correct.
Quoted 36 lines
Quoted 2 lines
This only creates such properties if we are booting with "-kernel" and "-initrd" so they won't get included into the DT update blob and
so they won't get included {if we're not booting with "-kernel" ...}
Quoted 2 lines
therefore the guest is more likely to boot successfully.
Maybe rephrase like:
Don't create such properties if we're booting without "-kernel" and "-initrd" ...
Quoted 11 lines
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)hw/ppc/spapr.c +0
-0hw/ppc/spapr.c static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt) · line 1180
Quoted 9 lines
hw/ppc/spapr.c +1
-5@@ -1177,11 +1177,16 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt)_FDT (chosen =fdt_add_subnode (fdt,0 ,"chosen" )); -_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , machine->kernel_cmdline)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , - spapr->initrd_base)); -_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , - spapr->initrd_base + spapr->initrd_size)); +if (machine->kernel_cmdline && machine->kernel_cmdline[0 ]) {
machine->kernel_cmdlinecannot be NULL.
Quoted 6 lines
From
vl.c:if (!kernel_cmdline) { kernel_cmdline = ""; current_machine->kernel_cmdline = (char *)kernel_cmdline; }
I do not see the point in having an empty string instead of NULL really and probably one day somebody else will think the same so I prepared :)
Quoted 5 lines
Also this doesn't check if we're booting with -kernel but rather that we're booting with -append ${some_not_empty_string}... what about checking
spapr->kernel_size, pretty much like you do for the initrd ?
We are preserving here "bootargs" which either comes from grub or "-append" so I do just this. Having -kernel usually (always?) means there is no grub which we are fixing here but this is just a consequence of a weird command line.
Quoted 13 lines
Quoted 12 lines
hw/ppc/spapr.c +9
-0+_FDT (fdt_setprop_string (fdt, chosen,"bootargs" , + machine->kernel_cmdline)); + } +if (spapr->initrd_size) { +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-start" , + spapr->initrd_base)); +_FDT (fdt_setprop_cell (fdt, chosen,"linux,initrd-end" , + spapr->initrd_base + spapr->initrd_size)); + }if (spapr->kernel_size) {uint64_t kprop[2 ] = {cpu_to_be64 (KERNEL_LOAD_ADDR ),
Signature · 1 line
Alexey
PATCH 6/7 spapr: Stop providing RTAS blob
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
SLOF implements one itself so let's remove it from QEMU. It is one less image and simpler setup as the RTAS blob never stays in its initial place anyway as the guest OS always decides where to put it.
--- MAINTAINERS | 2 -- Makefile | 2 +- configure | 6 +---- hw/ppc/spapr.c | 32 ++----------------------- hw/ppc/spapr_rtas.c | 41 -------------------------------- include/hw/ppc/spapr.h | 2 -- pc-bios/spapr-rtas.bin | Bin 20 -> 0 bytes pc-bios/spapr-rtas/Makefile | 27 --------------------- pc-bios/spapr-rtas/spapr-rtas.S | 37 ---------------------------- 9 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 pc-bios/spapr-rtas.bin delete mode 100644 pc-bios/spapr-rtas/Makefile delete mode 100644 pc-bios/spapr-rtas/spapr-rtas.S
MAINTAINERS +0 -2
@@ -1077,8 +1077,6 @@ F: hw/*/spapr* F: include/hw/*/spapr* F: hw/*/xics* F: include/hw/*/xics* -F: pc-bios/spapr-rtas/* -F: pc-bios/spapr-rtas.bin F: pc-bios/slof.bin F: docs/specs/ppc-spapr-hcalls.txt F: docs/specs/ppc-spapr-hotplug.txt
Makefile +1 -1
@@ -764,7 +764,7 @@ qemu-nsis.bmp \ bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ s390-ccw.img s390-netboot.img \ -spapr-rtas.bin slof.bin skiboot.lid \ +slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 u-boot-sam460-20100605.bin \ qemu_vga.ndrv \
configure +1 -5
@@ -6211,9 +6211,6 @@ if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ fi done fi -if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then - roms="$roms spapr-rtas" -fi # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 if test "$cpu" = "s390x" ; then
@@ -7930,14 +7927,13 @@ fi DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" DIRS="$DIRS tests/fp tests/qgraph" DIRS="$DIRS docs docs/interop fsdev scsi" -DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" +DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" DIRS="$DIRS roms/seabios roms/vgabios" LINKS="Makefile tests/tcg/Makefile" LINKS="$LINKS tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" LINKS="$LINKS tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" LINKS="$LINKS tests/fp/Makefile" LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" -LINKS="$LINKS pc-bios/spapr-rtas/Makefile" LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" LINKS="$LINKS pc-bios/qemu-icon.bmp"
hw/ppc/spapr.c +2 -30
@@ -94,7 +94,6 @@* We load our kernel at 4M, leaving space for SLOF initial image */ #define FDT_MAX_SIZE 0x100000 -#define RTAS_MAX_SIZE 0x10000#define RTAS_MAX_ADDR 0x80000000/* RTAS must stay below that */ #define FW_MAX_SIZE 0x400000#define FW_FILE_NAME "slof.bin"
@@ -1721,8 +1720,7 @@ static void spapr_machine_reset(MachineState *machine) {SpaprMachineState *spapr =SPAPR_MACHINE (machine);PowerPCCPU *first_ppc_cpu; -uint32_t rtas_limit; -hwaddr rtas_addr, fdt_addr; +hwaddr fdt_addr;void *fdt;int rc;
@@ -1786,14 +1784,10 @@ static void spapr_machine_reset(MachineState *machine)* or just below 2GB, whichever is lower, so that it can be * processed with 32-bit real mode code if necessary */ - rtas_limit =MIN (spapr->rma_size,RTAS_MAX_ADDR ); - rtas_addr = rtas_limit -RTAS_MAX_SIZE ; - fdt_addr = rtas_addr -FDT_MAX_SIZE ; + fdt_addr =MIN (spapr->rma_size,RTAS_MAX_ADDR ) -FDT_MAX_SIZE ; fdt =spapr_build_fdt (spapr); -spapr_load_rtas (spapr, fdt, rtas_addr); - rc =fdt_pack (fdt);/* Should only fail if we've built a corrupted tree */
@@ -2953,28 +2947,6 @@ static void spapr_machine_init(MachineState *machine)spapr_create_lmb_dr_connectors (spapr); } - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS ,"spapr-rtas.bin" ); -if (!filename) { -error_report ("Could not find LPAR rtas '%s'" ,"spapr-rtas.bin" ); -exit (1 ); - } - spapr->rtas_size =get_image_size (filename); -if (spapr->rtas_size <0 ) { -error_report ("Could not get size of LPAR rtas '%s'" , filename); -exit (1 ); - } - spapr->rtas_blob =g_malloc (spapr->rtas_size); -if (load_image_size (filename, spapr->rtas_blob, spapr->rtas_size) <0 ) { -error_report ("Could not load LPAR rtas '%s'" , filename); -exit (1 ); - } -if (spapr->rtas_size >RTAS_MAX_SIZE ) { -error_report ("RTAS too big ! 0x%zx bytes (max is 0x%x)" , - (size_t )spapr->rtas_size,RTAS_MAX_SIZE ); -exit (1 ); - } -g_free (filename); -/* Set up RTAS event infrastructure */ spapr_events_init (spapr);
hw/ppc/spapr_rtas.c +0 -41
47 lines not on this page · raw message
include/hw/ppc/spapr.h +0 -2
@@ -154,8 +154,6 @@ struct SpaprMachineState {hwaddr rma_size;int vrma_adjust; -ssize_t rtas_size; -void *rtas_blob;uint32_t fdt_size;uint32_t fdt_initial_size;void *fdt_blob;
pc-bios/spapr-rtas.bin deleted binary +0 -0
pc-bios/spapr-rtas/Makefile deleted +0 -27
@@ -1,27 +0,0 @@ -all: build-all -# Dummy command so that make thinks it has done something - @true - -include ../../config-host.mak -include $(SRC_PATH)/rules.mak - -$(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas) - -.PHONY : all clean build-all - -#CFLAGS += -I$(SRC_PATH) -#QEMU_CFLAGS = $(CFLAGS) - -build-all: spapr-rtas.bin - -%.o: %.S - $(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") - -%.img: %.o - $(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@") - -%.bin: %.img - $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@") - -clean: - rm -f *.o *.d *.img *.bin *~
pc-bios/spapr-rtas/spapr-rtas.S deleted +0 -37
@@ -1,37 +0,0 @@ -/* - * QEMU PowerPC pSeries Logical Partition (aka sPAPR) hardware System Emulator - * - * Trivial in-partition RTAS implementation, based on a hypercall - * - * Copyright (c) 2010,2011 David Gibson, IBM Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#define KVMPPC_HCALL_BASE 0xf000 -#define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0) - -.globl _start -_start: - mr 4,3 - lis 3,KVMPPC_H_RTAS@h - ori 3,3,KVMPPC_H_RTAS@l - sc 1 - blr
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 6/7] spapr: Stop providing RTAS blob
Quoted 8 lines · On Wed, 11 Sep 2019 14:04:51 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
SLOF implements one itself so let's remove it from QEMU. It is one less image and simpler setup as the RTAS blob never stays in its initial place anyway as the guest OS always decides where to put it.
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>
Quoted 15 lines
--- MAINTAINERS | 2 -- Makefile | 2 +- configure | 6 +---- hw/ppc/spapr.c | 32 ++----------------------- hw/ppc/spapr_rtas.c | 41 -------------------------------- include/hw/ppc/spapr.h | 2 -- pc-bios/spapr-rtas.bin | Bin 20 -> 0 bytes pc-bios/spapr-rtas/Makefile | 27 --------------------- pc-bios/spapr-rtas/spapr-rtas.S | 37 ---------------------------- 9 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 pc-bios/spapr-rtas.bin delete mode 100644 pc-bios/spapr-rtas/Makefile delete mode 100644 pc-bios/spapr-rtas/spapr-rtas.S
Nice diffstat :)
But pwclient fails to apply it :(
[greg@bahia qemu-spapr]$ pwclient git-am 1160642
Applying patch #1160642 using 'git am'
Description: [6/7] spapr: Stop providing RTAS blob
Applying: spapr: Stop providing RTAS blob
error: cannot apply binary patch to 'pc-bios/spapr-rtas.bin' without full index line
error: pc-bios/spapr-rtas.bin: patch does not apply
Patch failed at 0001 spapr: Stop providing RTAS blob
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort". 'git am' failed with exit status 128
and
[greg@bahia qemu-spapr]$ git am --show-current-patch | patch -p1 --merge patching file MAINTAINERS
patching file Makefile
patching file configure
patching file hw/ppc/spapr.c
patching file hw/ppc/spapr_rtas.c
patching file include/hw/ppc/spapr.h
patching file pc-bios/spapr-rtas.bin
Not deleting file pc-bios/spapr-rtas.bin as content differs from patch
Not sure what's happening here...
patching file pc-bios/spapr-rtas/Makefile
patching file pc-bios/spapr-rtas/spapr-rtas.S
Quoted 268 lines
MAINTAINERS +0
-2@@ -1077,8 +1077,6 @@ F: hw/*/spapr* F: include/hw/*/spapr* F: hw/*/xics* F: include/hw/*/xics* -F: pc-bios/spapr-rtas/* -F: pc-bios/spapr-rtas.bin F: pc-bios/slof.bin F: docs/specs/ppc-spapr-hcalls.txt F: docs/specs/ppc-spapr-hotplug.txtMakefile +1
-1@@ -764,7 +764,7 @@ qemu-nsis.bmp \ bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ s390-ccw.img s390-netboot.img \ -spapr-rtas.bin slof.bin skiboot.lid \ +slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 u-boot-sam460-20100605.bin \ qemu_vga.ndrv \configure +1
-5@@ -6211,9 +6211,6 @@ if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ fi done fi -if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then - roms="$roms spapr-rtas" -fi # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 if test "$cpu" = "s390x" ; then@@ -7930,14 +7927,13 @@ fi DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" DIRS="$DIRS tests/fp tests/qgraph" DIRS="$DIRS docs docs/interop fsdev scsi" -DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" +DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" DIRS="$DIRS roms/seabios roms/vgabios" LINKS="Makefile tests/tcg/Makefile" LINKS="$LINKS tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" LINKS="$LINKS tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" LINKS="$LINKS tests/fp/Makefile" LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" -LINKS="$LINKS pc-bios/spapr-rtas/Makefile" LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" LINKS="$LINKS pc-bios/qemu-icon.bmp"hw/ppc/spapr.c +2
-30@@ -94,7 +94,6 @@* We load our kernel at 4M, leaving space for SLOF initial image */ #define FDT_MAX_SIZE 0x100000 -#define RTAS_MAX_SIZE 0x10000#define RTAS_MAX_ADDR 0x80000000/* RTAS must stay below that */ #define FW_MAX_SIZE 0x400000#define FW_FILE_NAME "slof.bin"@@ -1721,8 +1720,7 @@ static void spapr_machine_reset(MachineState *machine) {SpaprMachineState *spapr =SPAPR_MACHINE (machine);PowerPCCPU *first_ppc_cpu; -uint32_t rtas_limit; -hwaddr rtas_addr, fdt_addr; +hwaddr fdt_addr;void *fdt;int rc;@@ -1786,14 +1784,10 @@ static void spapr_machine_reset(MachineState *machine)* or just below 2GB, whichever is lower, so that it can be * processed with 32-bit real mode code if necessary */ - rtas_limit =MIN (spapr->rma_size,RTAS_MAX_ADDR ); - rtas_addr = rtas_limit -RTAS_MAX_SIZE ; - fdt_addr = rtas_addr -FDT_MAX_SIZE ; + fdt_addr =MIN (spapr->rma_size,RTAS_MAX_ADDR ) -FDT_MAX_SIZE ; fdt =spapr_build_fdt (spapr); -spapr_load_rtas (spapr, fdt, rtas_addr); - rc =fdt_pack (fdt);/* Should only fail if we've built a corrupted tree */ @@ -2953,28 +2947,6 @@ static void spapr_machine_init(MachineState *machine)spapr_create_lmb_dr_connectors (spapr); } - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS ,"spapr-rtas.bin" ); -if (!filename) { -error_report ("Could not find LPAR rtas '%s'" ,"spapr-rtas.bin" ); -exit (1 ); - } - spapr->rtas_size =get_image_size (filename); -if (spapr->rtas_size <0 ) { -error_report ("Could not get size of LPAR rtas '%s'" , filename); -exit (1 ); - } - spapr->rtas_blob =g_malloc (spapr->rtas_size); -if (load_image_size (filename, spapr->rtas_blob, spapr->rtas_size) <0 ) { -error_report ("Could not load LPAR rtas '%s'" , filename); -exit (1 ); - } -if (spapr->rtas_size >RTAS_MAX_SIZE ) { -error_report ("RTAS too big ! 0x%zx bytes (max is 0x%x)" , - (size_t )spapr->rtas_size,RTAS_MAX_SIZE ); -exit (1 ); - } -g_free (filename); -/* Set up RTAS event infrastructure */ spapr_events_init (spapr);hw/ppc/spapr_rtas.c +0
-41@@ -477,47 +477,6 @@ void spapr_dt_rtas_tokens(void *fdt, int rtas) } } -void spapr_load_rtas (SpaprMachineState *spapr,void *fdt,hwaddr addr) -{ -int rtas_node; -int ret; - -/* Copy RTAS blob into guest RAM */ -cpu_physical_memory_write (addr, spapr->rtas_blob, spapr->rtas_size); - - ret =fdt_add_mem_rsv (fdt, addr, spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add RTAS reserve entry: %s" , -fdt_strerror (ret)); -exit (1 ); - } - -/* Update the device tree with the blob's location */ - rtas_node =fdt_path_offset (fdt,"/rtas" ); -assert (rtas_node >=0 ); - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-base" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-base property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-entry" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-entry property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"rtas-size" , spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add rtas-size property: %s" , -fdt_strerror (ret)); -exit (1 ); - } -} -static void core_rtas_register_types (void ) { spapr_rtas_register(RTAS_DISPLAY_CHARACTER, "display-character",include/hw/ppc/spapr.h +0
-2@@ -154,8 +154,6 @@ struct SpaprMachineState {hwaddr rma_size;int vrma_adjust; -ssize_t rtas_size; -void *rtas_blob;uint32_t fdt_size;uint32_t fdt_initial_size;void *fdt_blob;pc-bios/spapr-rtas.bin deleted binary +0
-0pc-bios/spapr-rtas/Makefile deleted +0
-27@@ -1,27 +0,0 @@ -all: build-all -# Dummy command so that make thinks it has done something - @true - -include ../../config-host.mak -include $(SRC_PATH)/rules.mak - -$(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas) - -.PHONY : all clean build-all - -#CFLAGS += -I$(SRC_PATH) -#QEMU_CFLAGS = $(CFLAGS) - -build-all: spapr-rtas.bin - -%.o: %.S - $(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") - -%.img: %.o - $(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@") - -%.bin: %.img - $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@") - -clean: - rm -f *.o *.d *.img *.bin *~pc-bios/spapr-rtas/spapr-rtas.S deleted +0
-37@@ -1,37 +0,0 @@ -/* - * QEMU PowerPC pSeries Logical Partition (aka sPAPR) hardware System Emulator - * - * Trivial in-partition RTAS implementation, based on a hypercall - * - * Copyright (c) 2010,2011 David Gibson, IBM Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#define KVMPPC_HCALL_BASE 0xf000 -#define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0) - -.globl _start -_start: - mr 4,3 - lis 3,KVMPPC_H_RTAS@h - ori 3,3,KVMPPC_H_RTAS@l - sc 1 - blr
Re: [Qemu-devel] [PATCH 6/7] spapr: Stop providing RTAS blob
Quoted 29 lines · Greg Kurz
Quoted 8 lines · On Wed, 11 Sep 2019 14:04:51 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
SLOF implements one itself so let's remove it from QEMU. It is one less image and simpler setup as the RTAS blob never stays in its initial place anyway as the guest OS always decides where to put it.
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>Quoted 15 lines
--- MAINTAINERS | 2 -- Makefile | 2 +- configure | 6 +---- hw/ppc/spapr.c | 32 ++----------------------- hw/ppc/spapr_rtas.c | 41 -------------------------------- include/hw/ppc/spapr.h | 2 -- pc-bios/spapr-rtas.bin | Bin 20 -> 0 bytes pc-bios/spapr-rtas/Makefile | 27 --------------------- pc-bios/spapr-rtas/spapr-rtas.S | 37 ---------------------------- 9 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 pc-bios/spapr-rtas.bin delete mode 100644 pc-bios/spapr-rtas/Makefile delete mode 100644 pc-bios/spapr-rtas/spapr-rtas.SNice diffstat :)
Quoted 7 lines
But pwclient fails to apply it :(
[greg@bahia qemu-spapr]$ pwclient git-am 1160642
Applying patch #1160642 using 'git am'
Description: [6/7] spapr: Stop providing RTAS blob
Applying: spapr: Stop providing RTAS blob
error: cannot apply binary patch to 'pc-bios/spapr-rtas.bin' without full index line
Some git feature/bug with removing binaries:
https://stackoverflow.com/questions/17152171/git-cannot-apply-binary-patch-without-full-index-line
David posted with this:
===
pc-bios/spapr-rtas.bin deleted binary +0 -0
===
And my patch has a bigger chunk:
git format-patch -1 --stdout 1a5efb9283c2 (there is no additional flag needed to my git 2.17.1):
===
pc-bios/spapr-rtas.bin deleted +0 -0
index fc24c8ed8b92a3a441aed6e2bd013b2ccece9229..0000000000000000000000000000000000000000 GIT binary patch
literal 0
HcmV?d00001
literal 20
bcmb<Pk*=^wU|>i{{=neEz@X&Uz@PvCJTV0q
===
I do not know why are these different.
Thy this one:
https://patchwork.ozlabs.org/patch/1132443/
Quoted 294 lines
error: pc-bios/spapr-rtas.bin: patch does not apply
Patch failed at 0001 spapr: Stop providing RTAS blob
hint: Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". 'git am' failed with exit status 128and
[greg@bahia qemu-spapr]$ git am --show-current-patch | patch -p1 --merge patching file
MAINTAINERS
patching fileMakefile
patching file configure
patching filehw/ppc/spapr.c
patching filehw/ppc/spapr_rtas.c
patching fileinclude/hw/ppc/spapr.h
patching file pc-bios/spapr-rtas.bin
Not deleting file pc-bios/spapr-rtas.bin as content differs from patchNot sure what's happening here...
patching file pc-bios/spapr-rtas/Makefile
patching filepc-bios/spapr-rtas/spapr-rtas.SQuoted 268 lines
MAINTAINERS +0
-2@@ -1077,8 +1077,6 @@ F: hw/*/spapr* F: include/hw/*/spapr* F: hw/*/xics* F: include/hw/*/xics* -F: pc-bios/spapr-rtas/* -F: pc-bios/spapr-rtas.bin F: pc-bios/slof.bin F: docs/specs/ppc-spapr-hcalls.txt F: docs/specs/ppc-spapr-hotplug.txtMakefile +1
-1@@ -764,7 +764,7 @@ qemu-nsis.bmp \ bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ s390-ccw.img s390-netboot.img \ -spapr-rtas.bin slof.bin skiboot.lid \ +slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 u-boot-sam460-20100605.bin \ qemu_vga.ndrv \configure +1
-5@@ -6211,9 +6211,6 @@ if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ fi done fi -if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then - roms="$roms spapr-rtas" -fi # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 if test "$cpu" = "s390x" ; then@@ -7930,14 +7927,13 @@ fi DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" DIRS="$DIRS tests/fp tests/qgraph" DIRS="$DIRS docs docs/interop fsdev scsi" -DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" +DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" DIRS="$DIRS roms/seabios roms/vgabios" LINKS="Makefile tests/tcg/Makefile" LINKS="$LINKS tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" LINKS="$LINKS tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" LINKS="$LINKS tests/fp/Makefile" LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" -LINKS="$LINKS pc-bios/spapr-rtas/Makefile" LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" LINKS="$LINKS pc-bios/qemu-icon.bmp"hw/ppc/spapr.c +2
-30@@ -94,7 +94,6 @@* We load our kernel at 4M, leaving space for SLOF initial image */ #define FDT_MAX_SIZE 0x100000 -#define RTAS_MAX_SIZE 0x10000#define RTAS_MAX_ADDR 0x80000000/* RTAS must stay below that */ #define FW_MAX_SIZE 0x400000#define FW_FILE_NAME "slof.bin"@@ -1721,8 +1720,7 @@ static void spapr_machine_reset(MachineState *machine) {SpaprMachineState *spapr =SPAPR_MACHINE (machine);PowerPCCPU *first_ppc_cpu; -uint32_t rtas_limit; -hwaddr rtas_addr, fdt_addr; +hwaddr fdt_addr;void *fdt;int rc;@@ -1786,14 +1784,10 @@ static void spapr_machine_reset(MachineState *machine)* or just below 2GB, whichever is lower, so that it can be * processed with 32-bit real mode code if necessary */ - rtas_limit =MIN (spapr->rma_size,RTAS_MAX_ADDR ); - rtas_addr = rtas_limit -RTAS_MAX_SIZE ; - fdt_addr = rtas_addr -FDT_MAX_SIZE ; + fdt_addr =MIN (spapr->rma_size,RTAS_MAX_ADDR ) -FDT_MAX_SIZE ; fdt =spapr_build_fdt (spapr); -spapr_load_rtas (spapr, fdt, rtas_addr); - rc =fdt_pack (fdt);/* Should only fail if we've built a corrupted tree */ @@ -2953,28 +2947,6 @@ static void spapr_machine_init(MachineState *machine)spapr_create_lmb_dr_connectors (spapr); } - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS ,"spapr-rtas.bin" ); -if (!filename) { -error_report ("Could not find LPAR rtas '%s'" ,"spapr-rtas.bin" ); -exit (1 ); - } - spapr->rtas_size =get_image_size (filename); -if (spapr->rtas_size <0 ) { -error_report ("Could not get size of LPAR rtas '%s'" , filename); -exit (1 ); - } - spapr->rtas_blob =g_malloc (spapr->rtas_size); -if (load_image_size (filename, spapr->rtas_blob, spapr->rtas_size) <0 ) { -error_report ("Could not load LPAR rtas '%s'" , filename); -exit (1 ); - } -if (spapr->rtas_size >RTAS_MAX_SIZE ) { -error_report ("RTAS too big ! 0x%zx bytes (max is 0x%x)" , - (size_t )spapr->rtas_size,RTAS_MAX_SIZE ); -exit (1 ); - } -g_free (filename); -/* Set up RTAS event infrastructure */ spapr_events_init (spapr);hw/ppc/spapr_rtas.c +0
-41@@ -477,47 +477,6 @@ void spapr_dt_rtas_tokens(void *fdt, int rtas) } } -void spapr_load_rtas (SpaprMachineState *spapr,void *fdt,hwaddr addr) -{ -int rtas_node; -int ret; - -/* Copy RTAS blob into guest RAM */ -cpu_physical_memory_write (addr, spapr->rtas_blob, spapr->rtas_size); - - ret =fdt_add_mem_rsv (fdt, addr, spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add RTAS reserve entry: %s" , -fdt_strerror (ret)); -exit (1 ); - } - -/* Update the device tree with the blob's location */ - rtas_node =fdt_path_offset (fdt,"/rtas" ); -assert (rtas_node >=0 ); - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-base" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-base property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-entry" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-entry property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"rtas-size" , spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add rtas-size property: %s" , -fdt_strerror (ret)); -exit (1 ); - } -} -static void core_rtas_register_types (void ) { spapr_rtas_register(RTAS_DISPLAY_CHARACTER, "display-character",include/hw/ppc/spapr.h +0
-2@@ -154,8 +154,6 @@ struct SpaprMachineState {hwaddr rma_size;int vrma_adjust; -ssize_t rtas_size; -void *rtas_blob;uint32_t fdt_size;uint32_t fdt_initial_size;void *fdt_blob;pc-bios/spapr-rtas.bin deleted binary +0
-0pc-bios/spapr-rtas/Makefile deleted +0
-27@@ -1,27 +0,0 @@ -all: build-all -# Dummy command so that make thinks it has done something - @true - -include ../../config-host.mak -include $(SRC_PATH)/rules.mak - -$(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas) - -.PHONY : all clean build-all - -#CFLAGS += -I$(SRC_PATH) -#QEMU_CFLAGS = $(CFLAGS) - -build-all: spapr-rtas.bin - -%.o: %.S - $(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") - -%.img: %.o - $(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@") - -%.bin: %.img - $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@") - -clean: - rm -f *.o *.d *.img *.bin *~pc-bios/spapr-rtas/spapr-rtas.S deleted +0
-37@@ -1,37 +0,0 @@ -/* - * QEMU PowerPC pSeries Logical Partition (aka sPAPR) hardware System Emulator - * - * Trivial in-partition RTAS implementation, based on a hypercall - * - * Copyright (c) 2010,2011 David Gibson, IBM Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#define KVMPPC_HCALL_BASE 0xf000 -#define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0) - -.globl _start -_start: - mr 4,3 - lis 3,KVMPPC_H_RTAS@h - ori 3,3,KVMPPC_H_RTAS@l - sc 1 - blr
Signature · 1 line
Alexey
Greg Kurz
Reviewed-byRe: [Qemu-devel] [PATCH 6/7] spapr: Stop providing RTAS blob
Quoted 68 lines · On Thu, 12 Sep 2019 11:50:53 +1000 Alexey Kardashevskiy <[email protected]> wrote:
Quoted 29 lines · Greg Kurz
Quoted 8 lines · On Wed, 11 Sep 2019 14:04:51 +1000 David Gibson <[email protected]>…
From: Alexey Kardashevskiy <[email protected]>
SLOF implements one itself so let's remove it from QEMU. It is one less image and simpler setup as the RTAS blob never stays in its initial place anyway as the guest OS always decides where to put it.
Signed-off-by Alexey Kardashevskiy <[email protected]>Signed-off-by David Gibson <[email protected]>Quoted 15 lines
--- MAINTAINERS | 2 -- Makefile | 2 +- configure | 6 +---- hw/ppc/spapr.c | 32 ++----------------------- hw/ppc/spapr_rtas.c | 41 -------------------------------- include/hw/ppc/spapr.h | 2 -- pc-bios/spapr-rtas.bin | Bin 20 -> 0 bytes pc-bios/spapr-rtas/Makefile | 27 --------------------- pc-bios/spapr-rtas/spapr-rtas.S | 37 ---------------------------- 9 files changed, 4 insertions(+), 145 deletions(-) delete mode 100644 pc-bios/spapr-rtas.bin delete mode 100644 pc-bios/spapr-rtas/Makefile delete mode 100644 pc-bios/spapr-rtas/spapr-rtas.SNice diffstat :)
Quoted 7 lines
But pwclient fails to apply it :(
[greg@bahia qemu-spapr]$ pwclient git-am 1160642
Applying patch #1160642 using 'git am'
Description: [6/7] spapr: Stop providing RTAS blob
Applying: spapr: Stop providing RTAS blob
error: cannot apply binary patch to 'pc-bios/spapr-rtas.bin' without full index lineSome git feature/bug with removing binaries:
https://stackoverflow.com/questions/17152171/git-cannot-apply-binary-patch-without-full-index-line
David posted with this:
===pc-bios/spapr-rtas.bin deleted binary +0
-0===
And my patch has a bigger chunk:
git format-patch -1 --stdout
1a5efb9283c2(there is no additional flag needed to my git 2.17.1):===
pc-bios/spapr-rtas.bin deleted +0
-0index fc24c8ed8b92a3a441aed6e2bd013b2ccece9229..0000000000000000000000000000000000000000 GIT binary patch
literal 0
HcmV?d00001
Quoted 9 lines
literal 20
bcmb<Pk*=^wU|>i{{=neEz@X&Uz@PvCJTV0q
===I do not know why are these different.
Thy this one:
https://patchwork.ozlabs.org/patch/1132443/
This one applies cleanly.
And so does:
https://github.com/dgibson/qemu/commit/c14ffa033ea0519d235f172723dd465ab6bf9777.patch
from David's cas branch... That's confusing.
Anyway, the non-binary changes look good.
Quoted 297 lines
Quoted 296 lines
error: pc-bios/spapr-rtas.bin: patch does not apply
Patch failed at 0001 spapr: Stop providing RTAS blob
hint: Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". 'git am' failed with exit status 128and
[greg@bahia qemu-spapr]$ git am --show-current-patch | patch -p1 --merge patching file
MAINTAINERS
patching fileMakefile
patching file configure
patching filehw/ppc/spapr.c
patching filehw/ppc/spapr_rtas.c
patching fileinclude/hw/ppc/spapr.h
patching file pc-bios/spapr-rtas.bin
Not deleting file pc-bios/spapr-rtas.bin as content differs from patchNot sure what's happening here...
patching file pc-bios/spapr-rtas/Makefile
patching filepc-bios/spapr-rtas/spapr-rtas.SQuoted 268 lines
MAINTAINERS +0
-2@@ -1077,8 +1077,6 @@ F: hw/*/spapr* F: include/hw/*/spapr* F: hw/*/xics* F: include/hw/*/xics* -F: pc-bios/spapr-rtas/* -F: pc-bios/spapr-rtas.bin F: pc-bios/slof.bin F: docs/specs/ppc-spapr-hcalls.txt F: docs/specs/ppc-spapr-hotplug.txtMakefile +1
-1@@ -764,7 +764,7 @@ qemu-nsis.bmp \ bamboo.dtb canyonlands.dtb petalogix-s3adsp1800.dtb petalogix-ml605.dtb \ multiboot.bin linuxboot.bin linuxboot_dma.bin kvmvapic.bin pvh.bin \ s390-ccw.img s390-netboot.img \ -spapr-rtas.bin slof.bin skiboot.lid \ +slof.bin skiboot.lid \ palcode-clipper \ u-boot.e500 u-boot-sam460-20100605.bin \ qemu_vga.ndrv \configure +1
-5@@ -6211,9 +6211,6 @@ if { test "$cpu" = "i386" || test "$cpu" = "x86_64"; } && \ fi done fi -if test "$ARCH" = "ppc64" && test "$targetos" != "Darwin" ; then - roms="$roms spapr-rtas" -fi # Only build s390-ccw bios if we're on s390x and the compiler has -march=z900 if test "$cpu" = "s390x" ; then@@ -7930,14 +7927,13 @@ fi DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm" DIRS="$DIRS tests/fp tests/qgraph" DIRS="$DIRS docs docs/interop fsdev scsi" -DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw" +DIRS="$DIRS pc-bios/optionrom pc-bios/s390-ccw" DIRS="$DIRS roms/seabios roms/vgabios" LINKS="Makefile tests/tcg/Makefile" LINKS="$LINKS tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit" LINKS="$LINKS tests/tcg/lm32/Makefile tests/tcg/xtensa/Makefile po/Makefile" LINKS="$LINKS tests/fp/Makefile" LINKS="$LINKS pc-bios/optionrom/Makefile pc-bios/keymaps" -LINKS="$LINKS pc-bios/spapr-rtas/Makefile" LINKS="$LINKS pc-bios/s390-ccw/Makefile" LINKS="$LINKS roms/seabios/Makefile roms/vgabios/Makefile" LINKS="$LINKS pc-bios/qemu-icon.bmp"hw/ppc/spapr.c +2
-30@@ -94,7 +94,6 @@* We load our kernel at 4M, leaving space for SLOF initial image */ #define FDT_MAX_SIZE 0x100000 -#define RTAS_MAX_SIZE 0x10000#define RTAS_MAX_ADDR 0x80000000/* RTAS must stay below that */ #define FW_MAX_SIZE 0x400000#define FW_FILE_NAME "slof.bin"@@ -1721,8 +1720,7 @@ static void spapr_machine_reset(MachineState *machine) {SpaprMachineState *spapr =SPAPR_MACHINE (machine);PowerPCCPU *first_ppc_cpu; -uint32_t rtas_limit; -hwaddr rtas_addr, fdt_addr; +hwaddr fdt_addr;void *fdt;int rc;@@ -1786,14 +1784,10 @@ static void spapr_machine_reset(MachineState *machine)* or just below 2GB, whichever is lower, so that it can be * processed with 32-bit real mode code if necessary */ - rtas_limit =MIN (spapr->rma_size,RTAS_MAX_ADDR ); - rtas_addr = rtas_limit -RTAS_MAX_SIZE ; - fdt_addr = rtas_addr -FDT_MAX_SIZE ; + fdt_addr =MIN (spapr->rma_size,RTAS_MAX_ADDR ) -FDT_MAX_SIZE ; fdt =spapr_build_fdt (spapr); -spapr_load_rtas (spapr, fdt, rtas_addr); - rc =fdt_pack (fdt);/* Should only fail if we've built a corrupted tree */ @@ -2953,28 +2947,6 @@ static void spapr_machine_init(MachineState *machine)spapr_create_lmb_dr_connectors (spapr); } - filename =qemu_find_file (QEMU_FILE_TYPE_BIOS ,"spapr-rtas.bin" ); -if (!filename) { -error_report ("Could not find LPAR rtas '%s'" ,"spapr-rtas.bin" ); -exit (1 ); - } - spapr->rtas_size =get_image_size (filename); -if (spapr->rtas_size <0 ) { -error_report ("Could not get size of LPAR rtas '%s'" , filename); -exit (1 ); - } - spapr->rtas_blob =g_malloc (spapr->rtas_size); -if (load_image_size (filename, spapr->rtas_blob, spapr->rtas_size) <0 ) { -error_report ("Could not load LPAR rtas '%s'" , filename); -exit (1 ); - } -if (spapr->rtas_size >RTAS_MAX_SIZE ) { -error_report ("RTAS too big ! 0x%zx bytes (max is 0x%x)" , - (size_t )spapr->rtas_size,RTAS_MAX_SIZE ); -exit (1 ); - } -g_free (filename); -/* Set up RTAS event infrastructure */ spapr_events_init (spapr);hw/ppc/spapr_rtas.c +0
-41@@ -477,47 +477,6 @@ void spapr_dt_rtas_tokens(void *fdt, int rtas) } } -void spapr_load_rtas (SpaprMachineState *spapr,void *fdt,hwaddr addr) -{ -int rtas_node; -int ret; - -/* Copy RTAS blob into guest RAM */ -cpu_physical_memory_write (addr, spapr->rtas_blob, spapr->rtas_size); - - ret =fdt_add_mem_rsv (fdt, addr, spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add RTAS reserve entry: %s" , -fdt_strerror (ret)); -exit (1 ); - } - -/* Update the device tree with the blob's location */ - rtas_node =fdt_path_offset (fdt,"/rtas" ); -assert (rtas_node >=0 ); - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-base" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-base property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"linux,rtas-entry" , addr); -if (ret <0 ) { -error_report ("Couldn't add linux,rtas-entry property: %s" , -fdt_strerror (ret)); -exit (1 ); - } - - ret =fdt_setprop_cell (fdt, rtas_node,"rtas-size" , spapr->rtas_size); -if (ret <0 ) { -error_report ("Couldn't add rtas-size property: %s" , -fdt_strerror (ret)); -exit (1 ); - } -} -static void core_rtas_register_types (void ) { spapr_rtas_register(RTAS_DISPLAY_CHARACTER, "display-character",include/hw/ppc/spapr.h +0
-2@@ -154,8 +154,6 @@ struct SpaprMachineState {hwaddr rma_size;int vrma_adjust; -ssize_t rtas_size; -void *rtas_blob;uint32_t fdt_size;uint32_t fdt_initial_size;void *fdt_blob;pc-bios/spapr-rtas.bin deleted binary +0
-0pc-bios/spapr-rtas/Makefile deleted +0
-27@@ -1,27 +0,0 @@ -all: build-all -# Dummy command so that make thinks it has done something - @true - -include ../../config-host.mak -include $(SRC_PATH)/rules.mak - -$(call set-vpath, $(SRC_PATH)/pc-bios/spapr-rtas) - -.PHONY : all clean build-all - -#CFLAGS += -I$(SRC_PATH) -#QEMU_CFLAGS = $(CFLAGS) - -build-all: spapr-rtas.bin - -%.o: %.S - $(call quiet-command,$(CCAS) -mbig -c -o $@ $<,"CCAS","$(TARGET_DIR)$@") - -%.img: %.o - $(call quiet-command,$(CC) -nostdlib -mbig -o $@ $<,"Building","$(TARGET_DIR)$@") - -%.bin: %.img - $(call quiet-command,$(OBJCOPY) -O binary -j .text $< $@,"Building","$(TARGET_DIR)$@") - -clean: - rm -f *.o *.d *.img *.bin *~pc-bios/spapr-rtas/spapr-rtas.S deleted +0
-37@@ -1,37 +0,0 @@ -/* - * QEMU PowerPC pSeries Logical Partition (aka sPAPR) hardware System Emulator - * - * Trivial in-partition RTAS implementation, based on a hypercall - * - * Copyright (c) 2010,2011 David Gibson, IBM Corporation. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - */ - -#define KVMPPC_HCALL_BASE 0xf000 -#define KVMPPC_H_RTAS (KVMPPC_HCALL_BASE + 0x0) - -.globl _start -_start: - mr 4,3 - lis 3,KVMPPC_H_RTAS@h - ori 3,3,KVMPPC_H_RTAS@l - sc 1 - blr
PATCH 7/7 spapr: Perform machine reset in a more sensible order
In reply to David GibsonWe've made several changes in the past to the machine reset order to fix specific problems. However, we've ended up with an order that doesn't make a lot of logical sense. This is an attempt to rectify this.
First we reset global CAS options, since that should depend on nothing else. Then we reset the CPUs, which shouldn't depend on external devices. Then the irq subsystem, then the bulk of devices (which might rely on irqs). Finally we set up the entry state ready for boot, which could potentially rely on a bunch of other things.
--- hw/ppc/spapr.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)
hw/ppc/spapr.c +25 -22
@@ -1724,6 +1724,28 @@ static void spapr_machine_reset(MachineState *machine)void *fdt;int rc; +/* +* If this reset wasn't generated by CAS, we should reset our +* negotiated options and start from scratch +*/ +if (!spapr->cas_reboot) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_new (); + +ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); + } + +/* +* There is no CAS under qtest. Simulate one to please the code that +* depends on spapr->ov5_cas. This is especially needed to test device +* unplug, so we do that before resetting the DRCs. +*/ +if (qtest_enabled ()) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); + } + +/* Reset the CPUs */ spapr_caps_apply (spapr); first_ppc_cpu =POWERPC_CPU (first_cpu);
@@ -1741,34 +1763,15 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -qemu_devices_reset (); - -/* -* If this reset wasn't generated by CAS, we should reset our -* negotiated options and start from scratch -*/ -if (!spapr->cas_reboot) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_new (); - -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); - } - +/* Reset IRQ subsystem */ /* * This is fixing some of the default configuration of the XIVE * devices. To be called after the reset of the machine devices. */ spapr_irq_reset (spapr, &error_fatal); -/* -* There is no CAS under qtest. Simulate one to please the code that -* depends on spapr->ov5_cas. This is especially needed to test device -* unplug, so we do that before resetting the DRCs. -*/ -if (qtest_enabled ()) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); - } +/* Reset other devices */ +qemu_devices_reset ();/* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend
Signature · 1 line
2.21.0
Re: [Qemu-devel] [PATCH 7/7] spapr: Perform machine reset in a more sensible order
Quoted 11 lines · David Gibson
We've made several changes in the past to the machine reset order to fix specific problems. However, we've ended up with an order that doesn't make a lot of logical sense. This is an attempt to rectify this.
First we reset global CAS options, since that should depend on nothing else. Then we reset the CPUs, which shouldn't depend on external devices. Then the irq subsystem, then the bulk of devices (which might rely on irqs). Finally we set up the entry state ready for boot, which could potentially rely on a bunch of other things.
Signed-off-by David Gibson <[email protected]>
Breaks console on P8 and asserts on rebooting a P9 guest.
Quoted 76 lines
--- hw/ppc/spapr.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)hw/ppc/spapr.c +25
-22@@ -1724,6 +1724,28 @@ static void spapr_machine_reset(MachineState *machine)void *fdt;int rc; +/* +* If this reset wasn't generated by CAS, we should reset our +* negotiated options and start from scratch +*/ +if (!spapr->cas_reboot) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_new (); + +ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); + } + +/* +* There is no CAS under qtest. Simulate one to please the code that +* depends on spapr->ov5_cas. This is especially needed to test device +* unplug, so we do that before resetting the DRCs. +*/ +if (qtest_enabled ()) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); + } + +/* Reset the CPUs */ spapr_caps_apply (spapr); first_ppc_cpu =POWERPC_CPU (first_cpu);@@ -1741,34 +1763,15 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -qemu_devices_reset (); - -/* -* If this reset wasn't generated by CAS, we should reset our -* negotiated options and start from scratch -*/ -if (!spapr->cas_reboot) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_new (); - -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); - } - +/* Reset IRQ subsystem */ /* * This is fixing some of the default configuration of the XIVE * devices. To be called after the reset of the machine devices. */ spapr_irq_reset (spapr, &error_fatal); -/* -* There is no CAS under qtest. Simulate one to please the code that -* depends on spapr->ov5_cas. This is especially needed to test device -* unplug, so we do that before resetting the DRCs. -*/ -if (qtest_enabled ()) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); - } +/* Reset other devices */ +qemu_devices_reset ();/* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend
Signature · 1 line
Alexey
Re: [Qemu-devel] [PATCH 7/7] spapr: Perform machine reset in a more sensible order
Quoted 13 lines · Alexey Kardashevskiy
Quoted 10 lines · David Gibson
We've made several changes in the past to the machine reset order to fix specific problems. However, we've ended up with an order that doesn't make a lot of logical sense. This is an attempt to rectify this.
First we reset global CAS options, since that should depend on nothing else. Then we reset the CPUs, which shouldn't depend on external devices. Then the irq subsystem, then the bulk of devices (which might rely on irqs). Finally we set up the entry state ready for boot, which could potentially rely on a bunch of other things.
Quoted 4 lines
Quoted 1 line
Signed-off-by David Gibson <[email protected]>Breaks console on P8 and asserts on rebooting a P9 guest.
Yeah, I jumped the gun on this one - I need to rethink and test more thoroughly.
Quoted 80 lines
Quoted 79 lines
--- hw/ppc/spapr.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)hw/ppc/spapr.c +25
-22@@ -1724,6 +1724,28 @@ static void spapr_machine_reset(MachineState *machine)void *fdt;int rc; +/* +* If this reset wasn't generated by CAS, we should reset our +* negotiated options and start from scratch +*/ +if (!spapr->cas_reboot) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_new (); + +ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); + } + +/* +* There is no CAS under qtest. Simulate one to please the code that +* depends on spapr->ov5_cas. This is especially needed to test device +* unplug, so we do that before resetting the DRCs. +*/ +if (qtest_enabled ()) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); + } + +/* Reset the CPUs */ spapr_caps_apply (spapr); first_ppc_cpu =POWERPC_CPU (first_cpu);@@ -1741,34 +1763,15 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -qemu_devices_reset (); - -/* -* If this reset wasn't generated by CAS, we should reset our -* negotiated options and start from scratch -*/ -if (!spapr->cas_reboot) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_new (); - -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); - } - +/* Reset IRQ subsystem */ /* * This is fixing some of the default configuration of the XIVE * devices. To be called after the reset of the machine devices. */ spapr_irq_reset (spapr, &error_fatal); -/* -* There is no CAS under qtest. Simulate one to please the code that -* depends on spapr->ov5_cas. This is especially needed to test device -* unplug, so we do that before resetting the DRCs. -*/ -if (qtest_enabled ()) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); - } +/* Reset other devices */ +qemu_devices_reset ();/* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend
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
Re: [Qemu-devel] [PATCH 7/7] spapr: Perform machine reset in a more sensible order
In reply to David GibsonQuoted 3 lines · David Gibson
We've made several changes in the past to the machine reset order to fix specific problems. However, we've ended up with an order that doesn't make a lot of logical sense. This is an attempt to rectify this.
There are some more problems though. See below.
Quoted 58 lines
First we reset global CAS options, since that should depend on nothing else. Then we reset the CPUs, which shouldn't depend on external devices. Then the irq subsystem, then the bulk of devices (which might rely on irqs). Finally we set up the entry state ready for boot, which could potentially rely on a bunch of other things.
Signed-off-by David Gibson <[email protected]>--- hw/ppc/spapr.c | 47 +++++++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 22 deletions(-)hw/ppc/spapr.c +22
-9@@ -1724,6 +1724,28 @@ static void spapr_machine_reset(MachineState *machine)void *fdt;int rc; +/* +* If this reset wasn't generated by CAS, we should reset our +* negotiated options and start from scratch +*/ +if (!spapr->cas_reboot) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_new (); + +ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); + } + +/* +* There is no CAS under qtest. Simulate one to please the code that +* depends on spapr->ov5_cas. This is especially needed to test device +* unplug, so we do that before resetting the DRCs. +*/ +if (qtest_enabled ()) { +spapr_ovec_cleanup (spapr->ov5_cas); + spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); + } + +/* Reset the CPUs */ spapr_caps_apply (spapr); first_ppc_cpu =POWERPC_CPU (first_cpu);@@ -1741,34 +1763,15 @@ static void spapr_machine_reset(MachineState *machine)spapr_setup_hpt_and_vrma (spapr); } -qemu_devices_reset (); - -/* -* If this reset wasn't generated by CAS, we should reset our -* negotiated options and start from scratch -*/ -if (!spapr->cas_reboot) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_new ();
hw/ppc/spapr.c static void spapr_machine_reset(MachineState *machine) · line 1771
Quoted 10 lines
hw/ppc/spapr.c +1
-4- -ppc_set_compat_all (spapr->max_compat_pvr, &error_fatal); - } - +/* Reset IRQ subsystem */ /* * This is fixing some of the default configuration of the XIVE * devices. To be called after the reset of the machine devices. */ spapr_irq_reset (spapr, &error_fatal);
spapr_irq_reset() is now called before qemu_devices_reset(). So it will break the XIVE emulated model.
KVM P8 guests are also broken :
qemu-system-ppc64: kernel_irqchip requested but unavailable: Unable to restore KVM interrupt controller state (0x0) for CPU 0: Invalid argument
Something wrong in kvmppc_xics_set_icp(). I need to look closer.
and TCG P9 guests still do the reset after CAS.
C.
Quoted 16 lines
hw/ppc/spapr.c +2
-9-/* -* There is no CAS under qtest. Simulate one to please the code that -* depends on spapr->ov5_cas. This is especially needed to test device -* unplug, so we do that before resetting the DRCs. -*/ -if (qtest_enabled ()) { -spapr_ovec_cleanup (spapr->ov5_cas); - spapr->ov5_cas =spapr_ovec_clone (spapr->ov5); - } +/* Reset other devices */ +qemu_devices_reset ();/* DRC reset may cause a device to be unplugged. This will cause troubles * if this device is used by another device (eg, a running vhost backend