spapr: Move creation of ibm,architecture-vec-5 property

This is currently called from spapr_dt_cas_updates() which is a hang
over from when we created this only as a diff to the DT at CAS time.
Now that we fully rebuild the DT at CAS time, just create it along
with the rest of the properties in /chosen.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
This commit is contained in:
David Gibson 2020-01-22 15:50:42 +11:00
parent fa523f0dd3
commit 1e0e11085a
1 changed files with 68 additions and 82 deletions

View File

@ -889,22 +889,6 @@ static int spapr_rng_populate_dt(void *fdt)
return ret ? -1 : 0; return ret ? -1 : 0;
} }
static int spapr_dt_cas_updates(SpaprMachineState *spapr, void *fdt,
SpaprOptionVector *ov5_updates)
{
int offset;
offset = fdt_path_offset(fdt, "/chosen");
if (offset < 0) {
offset = fdt_add_subnode(fdt, 0, "chosen");
if (offset < 0) {
return offset;
}
}
return spapr_ovec_populate_dt(fdt, offset, spapr->ov5_cas,
"ibm,architecture-vec-5");
}
static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt) static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt)
{ {
MachineState *ms = MACHINE(spapr); MachineState *ms = MACHINE(spapr);
@ -1043,22 +1027,25 @@ static void spapr_dt_ov5_platform_support(SpaprMachineState *spapr, void *fdt,
val, sizeof(val))); val, sizeof(val)));
} }
static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt) static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool reset)
{ {
MachineState *machine = MACHINE(spapr); MachineState *machine = MACHINE(spapr);
SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine); SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(machine);
int chosen; int chosen;
_FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
if (reset) {
const char *boot_device = machine->boot_order; const char *boot_device = machine->boot_order;
char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus);
size_t cb = 0; size_t cb = 0;
char *bootlist = get_boot_devices_list(&cb); char *bootlist = get_boot_devices_list(&cb);
_FDT(chosen = fdt_add_subnode(fdt, 0, "chosen"));
if (machine->kernel_cmdline && machine->kernel_cmdline[0]) { if (machine->kernel_cmdline && machine->kernel_cmdline[0]) {
_FDT(fdt_setprop_string(fdt, chosen, "bootargs", _FDT(fdt_setprop_string(fdt, chosen, "bootargs",
machine->kernel_cmdline)); machine->kernel_cmdline));
} }
if (spapr->initrd_size) { if (spapr->initrd_size) {
_FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start", _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start",
spapr->initrd_base)); spapr->initrd_base));
@ -1100,16 +1087,20 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt)
if (!spapr->has_graphics && stdout_path) { if (!spapr->has_graphics && stdout_path) {
/* /*
* "linux,stdout-path" and "stdout" properties are deprecated by linux * "linux,stdout-path" and "stdout" properties are
* kernel. New platforms should only use the "stdout-path" property. Set * deprecated by linux kernel. New platforms should only
* the new property and continue using older property to remain * use the "stdout-path" property. Set the new property
* compatible with the existing firmware. * and continue using older property to remain compatible
* with the existing firmware.
*/ */
_FDT(fdt_setprop_string(fdt, chosen, "linux,stdout-path", stdout_path)); _FDT(fdt_setprop_string(fdt, chosen, "linux,stdout-path", stdout_path));
_FDT(fdt_setprop_string(fdt, chosen, "stdout-path", stdout_path)); _FDT(fdt_setprop_string(fdt, chosen, "stdout-path", stdout_path));
} }
/* We can deal with BAR reallocation just fine, advertise it to the guest */ /*
* We can deal with BAR reallocation just fine, advertise it
* to the guest
*/
if (smc->linux_pci_probe) { if (smc->linux_pci_probe) {
_FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0)); _FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0));
} }
@ -1120,6 +1111,10 @@ static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt)
g_free(bootlist); g_free(bootlist);
} }
_FDT(spapr_ovec_populate_dt(fdt, chosen, spapr->ov5_cas,
"ibm,architecture-vec-5"));
}
static void spapr_dt_hypervisor(SpaprMachineState *spapr, void *fdt) static void spapr_dt_hypervisor(SpaprMachineState *spapr, void *fdt)
{ {
/* The /hypervisor node isn't in PAPR - this is a hack to allow PR /* The /hypervisor node isn't in PAPR - this is a hack to allow PR
@ -1243,9 +1238,7 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
spapr_dt_rtas(spapr, fdt); spapr_dt_rtas(spapr, fdt);
/* /chosen */ /* /chosen */
if (reset) { spapr_dt_chosen(spapr, fdt, reset);
spapr_dt_chosen(spapr, fdt);
}
/* /hypervisor */ /* /hypervisor */
if (kvm_enabled()) { if (kvm_enabled()) {
@ -1264,13 +1257,6 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool reset, size_t space)
} }
} }
/* ibm,client-architecture-support updates */
ret = spapr_dt_cas_updates(spapr, fdt, spapr->ov5_cas);
if (ret < 0) {
error_report("couldn't setup CAS properties fdt");
exit(1);
}
if (smc->dr_phb_enabled) { if (smc->dr_phb_enabled) {
ret = spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB); ret = spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB);
if (ret < 0) { if (ret < 0) {