[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] arm/virt: Use PSCI v0.2 function IDs in the DT
From: |
Zi Shen Lim |
Subject: |
Re: [Qemu-devel] [PATCH] arm/virt: Use PSCI v0.2 function IDs in the DT when KVM uses PSCI v0.2 |
Date: |
Thu, 7 Aug 2014 11:04:02 -0700 |
On Thu, Aug 7, 2014 at 9:30 AM, Christoffer Dall
<address@hidden> wrote:
>
> The current code supplies the PSCI v0.1 funciton IDs in the DT even when
> KVM uses PSCI v0.2.
>
> This will break guest kernels that only support PSCI v0.1 as they will
> use the IDs provided in the DT. Guest kernels with PSCI v0.2 support
> are not affected by this patch, because they ignore the function IDs in
> the device tree and rely on the architecture definition.
>
> Define QEMU versions of the constants and check that they correspond to
> the Linux defines on Linux build hosts. After this patch, both guest
> kernels with PSCI v0.1 support and guest kernels with PSCI v0.2 should
> work.
>
> Tested on TC2 for 32-bit and APM Mustang for 64-bit (aarch64 guest
> only). Both cases tested with 3.14 and linus/master and verified I
> could bring up 2 cpus with both guest kernels.
>
> Signed-off-by: Christoffer Dall <address@hidden>
> ---
> hw/arm/virt.c | 25 ++++++++++++++++++++++---
> target-arm/kvm-consts.h | 23 +++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 3 deletions(-)
>
> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
> index ba94298..4e882bc 100644
> --- a/hw/arm/virt.c
> +++ b/hw/arm/virt.c
> @@ -194,20 +194,39 @@ static void fdt_add_psci_node(const VirtBoardInfo *vbi)
>
> /* No PSCI for TCG yet */
> if (kvm_enabled()) {
> + uint32_t cpu_off_fn;
> + uint32_t cpu_on_fn;
> + uint32_t migrate_fn;
> +
> qemu_fdt_add_subnode(fdt, "/psci");
> if (armcpu->psci_version == 2) {
> const char comp[] = "arm,psci-0.2\0arm,psci";
> qemu_fdt_setprop(fdt, "/psci", "compatible", comp, sizeof(comp));
> +
> + if (arm_feature(&armcpu->env, ARM_FEATURE_AARCH64)) {
> + cpu_off_fn = QEMU_PSCI_0_2_FN_CPU_OFF;
Should this be QEMU_PSCI_0_2_FN64_CPU_OFF instead?
>
> + cpu_on_fn = QEMU_PSCI_0_2_FN64_CPU_ON;
> + migrate_fn = QEMU_PSCI_0_2_FN64_MIGRATE;
> + } else {
> + cpu_off_fn = QEMU_PSCI_0_2_FN_CPU_OFF;
> + cpu_on_fn = QEMU_PSCI_0_2_FN_CPU_ON;
> + migrate_fn = QEMU_PSCI_0_2_FN_MIGRATE;
> + }
<snip>