mirror of
https://github.com/qemu/qemu.git
synced 2024-12-02 16:23:35 +08:00
a22ec1e682
Provide versions of the KVM PSCI constants to non-KVM code; this will allow us to avoid an ifdef in boards which set up a PSCI node in the device tree. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org> Message-id: 1385140638-10444-5-git-send-email-peter.maydell@linaro.org
54 lines
1.6 KiB
C
54 lines
1.6 KiB
C
/*
|
|
* KVM ARM ABI constant definitions
|
|
*
|
|
* Copyright (c) 2013 Linaro Limited
|
|
*
|
|
* Provide versions of KVM constant defines that can be used even
|
|
* when CONFIG_KVM is not set and we don't have access to the
|
|
* KVM headers. If CONFIG_KVM is set, we do a compile-time check
|
|
* that we haven't got out of sync somehow.
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
#ifndef ARM_KVM_CONSTS_H
|
|
#define ARM_KVM_CONSTS_H
|
|
|
|
#ifdef CONFIG_KVM
|
|
#include "qemu/compiler.h"
|
|
#include <linux/kvm.h>
|
|
|
|
#define MISMATCH_CHECK(X, Y) QEMU_BUILD_BUG_ON(X != Y)
|
|
|
|
#else
|
|
#define MISMATCH_CHECK(X, Y)
|
|
#endif
|
|
|
|
#define CP_REG_SIZE_SHIFT 52
|
|
#define CP_REG_SIZE_MASK 0x00f0000000000000ULL
|
|
#define CP_REG_SIZE_U32 0x0020000000000000ULL
|
|
#define CP_REG_SIZE_U64 0x0030000000000000ULL
|
|
#define CP_REG_ARM 0x4000000000000000ULL
|
|
|
|
MISMATCH_CHECK(CP_REG_SIZE_SHIFT, KVM_REG_SIZE_SHIFT)
|
|
MISMATCH_CHECK(CP_REG_SIZE_MASK, KVM_REG_SIZE_MASK)
|
|
MISMATCH_CHECK(CP_REG_SIZE_U32, KVM_REG_SIZE_U32)
|
|
MISMATCH_CHECK(CP_REG_SIZE_U64, KVM_REG_SIZE_U64)
|
|
MISMATCH_CHECK(CP_REG_ARM, KVM_REG_ARM)
|
|
|
|
#define PSCI_FN_BASE 0x95c1ba5e
|
|
#define PSCI_FN(n) (PSCI_FN_BASE + (n))
|
|
#define PSCI_FN_CPU_SUSPEND PSCI_FN(0)
|
|
#define PSCI_FN_CPU_OFF PSCI_FN(1)
|
|
#define PSCI_FN_CPU_ON PSCI_FN(2)
|
|
#define PSCI_FN_MIGRATE PSCI_FN(3)
|
|
|
|
MISMATCH_CHECK(PSCI_FN_CPU_SUSPEND, KVM_PSCI_FN_CPU_SUSPEND)
|
|
MISMATCH_CHECK(PSCI_FN_CPU_OFF, KVM_PSCI_FN_CPU_OFF)
|
|
MISMATCH_CHECK(PSCI_FN_CPU_ON, KVM_PSCI_FN_CPU_ON)
|
|
MISMATCH_CHECK(PSCI_FN_MIGRATE, KVM_PSCI_FN_MIGRATE)
|
|
|
|
#undef MISMATCH_CHECK
|
|
|
|
#endif
|