mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 15:12:07 -06:00
hw/ppc: Implement -dtb support for PowerNV
Currently any device tree passed with -dtb option in QEMU, was ignored by the PowerNV code. Read and pass the passed -dtb to the kernel, thus enabling easier debugging with custom DTBs. The existing behaviour when -dtb is 'not' passed, is preserved as-is. But when a '-dtb' is passed, it completely overrides any dtb nodes or changes QEMU might have done, such as '-append' arguments to the kernel (which are mentioned in /chosen/bootargs in the dtb), hence add warning when -dtb is being used Reviewed-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Aditya Gupta <adityag@linux.ibm.com> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
This commit is contained in:
parent
6fb6f3096a
commit
889c5c4c7a
1 changed files with 40 additions and 11 deletions
31
hw/ppc/pnv.c
31
hw/ppc/pnv.c
|
@ -736,14 +736,19 @@ static void pnv_reset(MachineState *machine, ResetType type)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (machine->fdt) {
|
||||||
|
fdt = machine->fdt;
|
||||||
|
} else {
|
||||||
fdt = pnv_dt_create(machine);
|
fdt = pnv_dt_create(machine);
|
||||||
|
|
||||||
/* Pack resulting tree */
|
/* Pack resulting tree */
|
||||||
_FDT((fdt_pack(fdt)));
|
_FDT((fdt_pack(fdt)));
|
||||||
|
}
|
||||||
|
|
||||||
qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt));
|
qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt));
|
||||||
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
|
cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt));
|
||||||
|
|
||||||
|
/* Update machine->fdt with latest fdt */
|
||||||
|
if (machine->fdt != fdt) {
|
||||||
/*
|
/*
|
||||||
* Set machine->fdt for 'dumpdtb' QMP/HMP command. Free
|
* Set machine->fdt for 'dumpdtb' QMP/HMP command. Free
|
||||||
* the existing machine->fdt to avoid leaking it during
|
* the existing machine->fdt to avoid leaking it during
|
||||||
|
@ -752,6 +757,7 @@ static void pnv_reset(MachineState *machine, ResetType type)
|
||||||
g_free(machine->fdt);
|
g_free(machine->fdt);
|
||||||
machine->fdt = fdt;
|
machine->fdt = fdt;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)
|
static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp)
|
||||||
{
|
{
|
||||||
|
@ -952,6 +958,14 @@ static void pnv_init(MachineState *machine)
|
||||||
g_free(sz);
|
g_free(sz);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* checks for invalid option combinations */
|
||||||
|
if (machine->dtb && (strlen(machine->kernel_cmdline) != 0)) {
|
||||||
|
error_report("-append and -dtb cannot be used together, as passed"
|
||||||
|
" command line is ignored in case of custom dtb");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
|
memory_region_add_subregion(get_system_memory(), 0, machine->ram);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1003,6 +1017,21 @@ static void pnv_init(MachineState *machine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* load dtb if passed */
|
||||||
|
if (machine->dtb) {
|
||||||
|
int fdt_size;
|
||||||
|
|
||||||
|
warn_report("with manually passed dtb, some options like '-append'"
|
||||||
|
" will get ignored and the dtb passed will be used as-is");
|
||||||
|
|
||||||
|
/* read the file 'machine->dtb', and load it into 'fdt' buffer */
|
||||||
|
machine->fdt = load_device_tree(machine->dtb, &fdt_size);
|
||||||
|
if (!machine->fdt) {
|
||||||
|
error_report("Could not load dtb '%s'", machine->dtb);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* MSIs are supported on this platform */
|
/* MSIs are supported on this platform */
|
||||||
msi_nonbroken = true;
|
msi_nonbroken = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue