[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH V5 8/8] hw/arm/virt: Use PSCI v0.2 compatibl
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC PATCH V5 8/8] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it |
Date: |
Wed, 14 May 2014 17:41:42 +0100 |
On 12 May 2014 13:37, Pranavkumar Sawargaonkar <address@hidden> wrote:
> If we have in-kernel emulation of PSCI v0.2 for KVM ARM/ARM64 then
> we enable PSCI v0.2 for each VCPU at the time of VCPU init hence we
> need to provide PSCI v0.2 compatible string via generated DTB.
>
> This patch updates generated DTB to have PSCI v0.2 compatible string
> when we have in-kernel emulation PSCI v0.2 for KVM ARM/ARM64.
>
> Signed-off-by: Pranavkumar Sawargaonkar <address@hidden>
> Signed-off-by: Anup Patel <address@hidden>
> ---
> hw/arm/virt.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index ea4f02d..64ee630 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -183,7 +183,13 @@ static void create_fdt(VirtBoardInfo *vbi)
> /* No PSCI for TCG yet */
> if (kvm_enabled()) {
> qemu_fdt_add_subnode(fdt, "/psci");
> - qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
> + if (kvm_check_extension(kvm_state, QEMU_KVM_CAP_ARM_PSCI_0_2)) {
> + qemu_fdt_setprop(fdt, "/psci", "compatible",
> + "arm,psci-0.2\0arm,psci",
> + strlen("arm,psci-0.2") + strlen("arm,psci") +
> 2);
> + } else {
> + qemu_fdt_setprop_string(fdt, "/psci", "compatible", "arm,psci");
> + }
> qemu_fdt_setprop_string(fdt, "/psci", "method", "hvc");
> qemu_fdt_setprop_cell(fdt, "/psci", "cpu_suspend",
> PSCI_FN_CPU_SUSPEND);
I don't think we should be directly calling kvm_check_extension()
here to decide whether to emit a PSCI 0.1 or 0.2 DT node.
When Rob's TCG PSCI implementation lands then that would need
to be special cased, and if we wanted to let the user restrict
us to PSCI 0.1 (on the command line, for migration compat)
that would end up forcing changes here.
Instead I think the struct ARMCPU should have an
int psci_version;
which has the CPU's PSCI version. Then you can set that
to 0.1 or 0.2 in the KVM init code where you're already
probing for the KVM capability, and the TCG init can set
it to always 0.2.
(Use the obvious encoding of PSCI version numbers to integers,
as per the psci.h PSCI_VERSION_* macros.)
thanks
-- PMM
- Re: [Qemu-devel] [RFC PATCH V5 3/8] kvm: Handle exit reason KVM_EXIT_SYSTEM_EVENT, (continued)
- [Qemu-devel] [RFC PATCH V5 4/8] target-arm/kvm-const.h: Add QEMU_KVM_CAP_ARM_PSCI_0_2 define, Pranavkumar Sawargaonkar, 2014/05/12
- [Qemu-devel] [RFC PATCH V5 5/8] target-arm: Common kvm_arm_vcpu_init() for KVM ARM and KVM ARM64, Pranavkumar Sawargaonkar, 2014/05/12
- [Qemu-devel] [RFC PATCH V5 6/8] target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible, Pranavkumar Sawargaonkar, 2014/05/12
- [Qemu-devel] [RFC PATCH V5 7/8] target-arm: Implement kvm_arch_reset_vcpu() for KVM ARM64, Pranavkumar Sawargaonkar, 2014/05/12
- [Qemu-devel] [RFC PATCH V5 8/8] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it, Pranavkumar Sawargaonkar, 2014/05/12
- Re: [Qemu-devel] [RFC PATCH V5 8/8] hw/arm/virt: Use PSCI v0.2 compatible when kernel supports it,
Peter Maydell <=
- Re: [Qemu-devel] [RFC PATCH V5 0/8] PSCI v0.2 support for KVM ARM/ARM64, Peter Maydell, 2014/05/14