@@ -11,6 +11,22 @@
#define ARM_CPU_CTRL 3, 0, 1, 0
#define ARM_CPU_CTRL_SCTLR_EL1 0
+static inline __u64 __core_reg_id(__u64 offset)
+{
+ __u64 id = KVM_REG_ARM64 | KVM_REG_ARM_CORE | offset;
+
+ if (offset < KVM_REG_ARM_CORE_REG(fp_regs))
+ id |= KVM_REG_SIZE_U64;
+ else if (offset < KVM_REG_ARM_CORE_REG(fp_regs.fpsr))
+ id |= KVM_REG_SIZE_U128;
+ else
+ id |= KVM_REG_SIZE_U32;
+
+ return id;
+}
+
+#define ARM64_CORE_REG(x) __core_reg_id(KVM_REG_ARM_CORE_REG(x))
+
void kvm_cpu__select_features(struct kvm *kvm, struct kvm_vcpu_init *init);
int kvm_cpu__configure_features(struct kvm_cpu *vcpu);
int kvm_cpu__setup_pvtime(struct kvm_cpu *vcpu);
@@ -12,22 +12,6 @@
#define SCTLR_EL1_E0E_MASK (1 << 24)
#define SCTLR_EL1_EE_MASK (1 << 25)
-static __u64 __core_reg_id(__u64 offset)
-{
- __u64 id = KVM_REG_ARM64 | KVM_REG_ARM_CORE | offset;
-
- if (offset < KVM_REG_ARM_CORE_REG(fp_regs))
- id |= KVM_REG_SIZE_U64;
- else if (offset < KVM_REG_ARM_CORE_REG(fp_regs.fpsr))
- id |= KVM_REG_SIZE_U128;
- else
- id |= KVM_REG_SIZE_U32;
-
- return id;
-}
-
-#define ARM64_CORE_REG(x) __core_reg_id(KVM_REG_ARM_CORE_REG(x))
-
unsigned long kvm_cpu__get_vcpu_mpidr(struct kvm_cpu *vcpu)
{
struct kvm_one_reg reg;
Expose the macro such that it may be used to get SMCCC arguments in a future change. Signed-off-by: Oliver Upton <oliver.upton@linux.dev> --- arm/aarch64/include/kvm/kvm-cpu-arch.h | 16 ++++++++++++++++ arm/aarch64/kvm-cpu.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-)