All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-arm: kvm: use KVM_SET_SREGS to set target to Cortex A15
@ 2012-07-13  3:37 Rusty Russell
  2012-07-13  3:43 ` [Qemu-devel] [PATCH 2/3] target-arm: kvm: use KVM_GET_MSRS/KVM_SET_MSRS for CP15 registers Rusty Russell
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Rusty Russell @ 2012-07-13  3:37 UTC (permalink / raw)
  To: peter.maydell; +Cc: kvmarm, qemu-devel

Recent kernels use this to set the cpu and features (currently, only
the A15 is supported).

Note that this causes the registers in the CPU to be initialized, so
it's important that all CPUs are created first (they are, as it turns
out).

This code ignores errors, for backwards compatibility with older
kernels.

Signed-off-by: Rusty Russell <rusty.russell@linaro.org>

diff --git a/linux-headers/asm-arm/kvm.h b/linux-headers/asm-arm/kvm.h
index 38ff1d6..988890a 100644
--- a/linux-headers/asm-arm/kvm.h
+++ b/linux-headers/asm-arm/kvm.h
@@ -66,7 +66,13 @@ struct kvm_regs {
 
 };
 
+/* Supported Processor Types */
+#define KVM_ARM_TARGET_CORTEX_A15	(0xC0F)
+
 struct kvm_sregs {
+	__u32 target;
+	__u32 num_features;
+	__u32 features[14];
 };
 
 struct kvm_fpu {
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index 29bb51f..67d005f 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -34,7 +34,13 @@ int kvm_arch_init(KVMState *s)
 
 int kvm_arch_init_vcpu(CPUARMState *env)
 {
-    return 0;
+    struct kvm_sregs sregs;
+
+    sregs.target = KVM_ARM_TARGET_CORTEX_A15;
+    sregs.num_features = 0;
+
+    /* Ignore failure for compatibility with old kvm versions. */
+    return kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs) ? 0 : 0;
 }
 
 int kvm_arch_put_registers(CPUARMState *env, int level)

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2012-08-01  1:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-13  3:37 [Qemu-devel] [PATCH] target-arm: kvm: use KVM_SET_SREGS to set target to Cortex A15 Rusty Russell
2012-07-13  3:43 ` [Qemu-devel] [PATCH 2/3] target-arm: kvm: use KVM_GET_MSRS/KVM_SET_MSRS for CP15 registers Rusty Russell
2012-07-13 14:27   ` Blue Swirl
2012-07-13  3:43 ` [Qemu-devel] [PATCH 3/3] target-arm: kvm: remove old kernel support Rusty Russell
2012-07-13  8:06 ` [Qemu-devel] [PATCH] target-arm: kvm: use KVM_SET_SREGS to set target to Cortex A15 Peter Maydell
2012-07-16  7:22   ` Rusty Russell
2012-07-13 10:06 ` [Qemu-devel] [kvmarm] " Alexander Graf
2012-07-16  7:19   ` Rusty Russell
2012-07-16  8:08     ` Alexander Graf
2012-07-16  8:09     ` Avi Kivity
2012-07-17 17:31 ` [Qemu-devel] " Peter Maydell
2012-07-17 18:19   ` Peter Maydell
2012-07-25  6:17     ` Rusty Russell
2012-07-25 15:04       ` Peter Maydell
2012-07-31 21:52       ` [Qemu-devel] [kvmarm] " Antonios Motakis
2012-08-01  1:53         ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.