mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-18 23:52:14 -06:00
arm/virt: enable PSCI emulation support for system emulation
Now that we have PSCI emulation, enable it for the virt platform. This simplifies the virt machine a bit now that PSCI no longer needs to be a KVM only feature. Signed-off-by: Rob Herring <rob.herring@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1412865028-17725-8-git-send-email-peter.maydell@linaro.org
This commit is contained in:
parent
98128601ac
commit
211b016915
1 changed files with 37 additions and 43 deletions
|
@ -191,15 +191,12 @@ static void create_fdt(VirtBoardInfo *vbi)
|
||||||
|
|
||||||
static void fdt_add_psci_node(const VirtBoardInfo *vbi)
|
static void fdt_add_psci_node(const VirtBoardInfo *vbi)
|
||||||
{
|
{
|
||||||
void *fdt = vbi->fdt;
|
|
||||||
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0));
|
|
||||||
|
|
||||||
/* No PSCI for TCG yet */
|
|
||||||
if (kvm_enabled()) {
|
|
||||||
uint32_t cpu_suspend_fn;
|
uint32_t cpu_suspend_fn;
|
||||||
uint32_t cpu_off_fn;
|
uint32_t cpu_off_fn;
|
||||||
uint32_t cpu_on_fn;
|
uint32_t cpu_on_fn;
|
||||||
uint32_t migrate_fn;
|
uint32_t migrate_fn;
|
||||||
|
void *fdt = vbi->fdt;
|
||||||
|
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(0));
|
||||||
|
|
||||||
qemu_fdt_add_subnode(fdt, "/psci");
|
qemu_fdt_add_subnode(fdt, "/psci");
|
||||||
if (armcpu->psci_version == 2) {
|
if (armcpu->psci_version == 2) {
|
||||||
|
@ -225,13 +222,17 @@ static void fdt_add_psci_node(const VirtBoardInfo *vbi)
|
||||||
migrate_fn = QEMU_PSCI_0_1_FN_MIGRATE;
|
migrate_fn = QEMU_PSCI_0_1_FN_MIGRATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* We adopt the PSCI spec's nomenclature, and use 'conduit' to refer
|
||||||
|
* to the instruction that should be used to invoke PSCI functions.
|
||||||
|
* However, the device tree binding uses 'method' instead, so that is
|
||||||
|
* what we should use here.
|
||||||
|
*/
|
||||||
qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
|
qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
|
||||||
|
|
||||||
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend", cpu_suspend_fn);
|
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend", cpu_suspend_fn);
|
||||||
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", cpu_off_fn);
|
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_off", cpu_off_fn);
|
||||||
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", cpu_on_fn);
|
qemu_fdt_setprop_cell(fdt, "/psci", "cpu_on", cpu_on_fn);
|
||||||
qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn);
|
qemu_fdt_setprop_cell(fdt, "/psci", "migrate", migrate_fn);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
|
static void fdt_add_timer_nodes(const VirtBoardInfo *vbi)
|
||||||
|
@ -548,16 +549,6 @@ static void machvirt_init(MachineState *machine)
|
||||||
|
|
||||||
vbi->smp_cpus = smp_cpus;
|
vbi->smp_cpus = smp_cpus;
|
||||||
|
|
||||||
/*
|
|
||||||
* Only supported method of starting secondary CPUs is PSCI and
|
|
||||||
* PSCI is not yet supported with TCG, so limit smp_cpus to 1
|
|
||||||
* if we're not using KVM.
|
|
||||||
*/
|
|
||||||
if (!kvm_enabled() && smp_cpus > 1) {
|
|
||||||
error_report("mach-virt: must enable KVM to use multiple CPUs");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (machine->ram_size > vbi->memmap[VIRT_MEM].size) {
|
if (machine->ram_size > vbi->memmap[VIRT_MEM].size) {
|
||||||
error_report("mach-virt: cannot model more than 30GB RAM");
|
error_report("mach-virt: cannot model more than 30GB RAM");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -575,6 +566,9 @@ static void machvirt_init(MachineState *machine)
|
||||||
}
|
}
|
||||||
cpuobj = object_new(object_class_get_name(oc));
|
cpuobj = object_new(object_class_get_name(oc));
|
||||||
|
|
||||||
|
object_property_set_int(cpuobj, QEMU_PSCI_CONDUIT_HVC, "psci-conduit",
|
||||||
|
NULL);
|
||||||
|
|
||||||
/* Secondary CPUs start in PSCI powered-down state */
|
/* Secondary CPUs start in PSCI powered-down state */
|
||||||
if (n > 0) {
|
if (n > 0) {
|
||||||
object_property_set_bool(cpuobj, true, "start-powered-off", NULL);
|
object_property_set_bool(cpuobj, true, "start-powered-off", NULL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue