Skip to content

Commit

Permalink
spapr: Drop CAS reboot flag
Browse files Browse the repository at this point in the history
The CAS reboot flag is false by default and all the locations that
could set it to true have been dropped. This means that all code
blocks depending on the flag being set is dead code and the other
code blocks should be executed always.

Just do that and drop the now uneeded CAS reboot flag. Fix a
comment on the way to make checkpatch happy.

Signed-off-by: Greg Kurz <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
gkurz authored and dgibson committed May 7, 2020
1 parent 91067db commit 087820e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 34 deletions.
18 changes: 4 additions & 14 deletions hw/ppc/spapr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1579,9 +1579,7 @@ void spapr_setup_hpt(SpaprMachineState *spapr)
{
int hpt_shift;

if ((spapr->resize_hpt == SPAPR_RESIZE_HPT_DISABLED)
|| (spapr->cas_reboot
&& !spapr_ovec_test(spapr->ov5_cas, OV5_HPT_RESIZE))) {
if (spapr->resize_hpt == SPAPR_RESIZE_HPT_DISABLED) {
hpt_shift = spapr_hpt_shift_for_ramsize(MACHINE(spapr)->maxram_size);
} else {
uint64_t current_ram_size;
Expand Down Expand Up @@ -1645,16 +1643,10 @@ static void spapr_machine_reset(MachineState *machine)

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();
spapr_ovec_cleanup(spapr->ov5_cas);
spapr->ov5_cas = spapr_ovec_new();

ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal);
}
ppc_set_compat_all(spapr->max_compat_pvr, &error_fatal);

/*
* This is fixing some of the default configuration of the XIVE
Expand Down Expand Up @@ -1707,8 +1699,6 @@ static void spapr_machine_reset(MachineState *machine)
spapr_cpu_set_entry_state(first_ppc_cpu, SPAPR_ENTRY_POINT, 0, fdt_addr, 0);
first_ppc_cpu->env.gpr[5] = 0;

spapr->cas_reboot = false;

spapr->fwnmi_system_reset_addr = -1;
spapr->fwnmi_machine_check_addr = -1;
spapr->fwnmi_machine_check_interlock = -1;
Expand Down
33 changes: 14 additions & 19 deletions hw/ppc/spapr_hcall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,7 @@ target_ulong do_client_architecture_support(PowerPCCPU *cpu,
bool raw_mode_supported = false;
bool guest_xive;
CPUState *cs;
void *fdt;

/* CAS is supposed to be called early when only the boot vCPU is active. */
CPU_FOREACH(cs) {
Expand Down Expand Up @@ -1818,27 +1819,21 @@ target_ulong do_client_architecture_support(PowerPCCPU *cpu,

spapr_handle_transient_dev_before_cas(spapr);

if (!spapr->cas_reboot) {
void *fdt;

/* If spapr_machine_reset() did not set up a HPT but one is necessary
* (because the guest isn't going to use radix) then set it up here. */
if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
/* legacy hash or new hash: */
spapr_setup_hpt(spapr);
}

fdt = spapr_build_fdt(spapr, false, fdt_bufsize);

g_free(spapr->fdt_blob);
spapr->fdt_size = fdt_totalsize(fdt);
spapr->fdt_initial_size = spapr->fdt_size;
spapr->fdt_blob = fdt;
/*
* If spapr_machine_reset() did not set up a HPT but one is necessary
* (because the guest isn't going to use radix) then set it up here.
*/
if ((spapr->patb_entry & PATE1_GR) && !guest_radix) {
/* legacy hash or new hash: */
spapr_setup_hpt(spapr);
}

if (spapr->cas_reboot) {
qemu_system_reset_request(SHUTDOWN_CAUSE_SUBSYSTEM_RESET);
}
fdt = spapr_build_fdt(spapr, false, fdt_bufsize);

g_free(spapr->fdt_blob);
spapr->fdt_size = fdt_totalsize(fdt);
spapr->fdt_initial_size = spapr->fdt_size;
spapr->fdt_blob = fdt;

return H_SUCCESS;
}
Expand Down
1 change: 0 additions & 1 deletion include/hw/ppc/spapr.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ struct SpaprMachineState {
SpaprEventSource *event_sources;

/* ibm,client-architecture-support option negotiation */
bool cas_reboot;
bool cas_pre_isa3_guest;
SpaprOptionVector *ov5; /* QEMU-supported option vectors */
SpaprOptionVector *ov5_cas; /* negotiated (via CAS) option vectors */
Expand Down

0 comments on commit 087820e

Please sign in to comment.