From: Rusty Russell <rusty.russell@linaro.org>
To: Rusty Russell <rusty.russell@linaro.org>, peter.maydell@linaro.org
Cc: kvmarm@lists.cs.columbia.edu, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/3] target-arm: kvm: remove old kernel support.
Date: Fri, 13 Jul 2012 13:13:34 +0930 [thread overview]
Message-ID: <87394wz5p5.fsf@rustcorp.com.au> (raw)
In-Reply-To: <878veoz5yv.fsf@rustcorp.com.au>
This removes old kernel support for cp15 inside struct kvm_regs, and
assumes we have KVM_SET_SREGS support for setting the target.
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 4842e85..8d255f2 100644
--- a/linux-headers/asm-arm/kvm.h
+++ b/linux-headers/asm-arm/kvm.h
@@ -55,15 +55,6 @@ struct kvm_regs {
__u32 reg15;
__u32 cpsr;
__u32 spsr[5]; /* Banked SPSR, indexed by MODE_ */
- struct {
- __u32 c0_midr;
- __u32 c1_sys;
- __u32 c2_base0;
- __u32 c2_base1;
- __u32 c2_control;
- __u32 c3_dacr;
- } cp15;
-
};
/* Supported Processor Types */
diff --git a/target-arm/kvm.c b/target-arm/kvm.c
index 2c149bd..34741ba 100644
--- a/target-arm/kvm.c
+++ b/target-arm/kvm.c
@@ -39,17 +39,12 @@ int kvm_arch_init_vcpu(CPUARMState *env)
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;
+ return kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
}
#define MSR32_INDEX_OF(coproc, crn, opc1, crm, opc2) \
(((coproc)<<16) | ((opc1)<<11) | ((crn)<<7) | ((opc2)<<4) | (crm))
-/* A modern kernel has a smaller struct kvm_regs, so ioctls differ: */
-#define KVM_GET_REGS_MODERN 2157227649U
-#define KVM_SET_REGS_MODERN 1083485826U
-
int kvm_arch_put_registers(CPUARMState *env, int level)
{
struct kvm_regs regs;
@@ -62,8 +57,6 @@ int kvm_arch_put_registers(CPUARMState *env, int level)
ret = kvm_vcpu_ioctl(env, KVM_GET_REGS, ®s);
if (ret < 0)
- ret = kvm_vcpu_ioctl(env, KVM_GET_REGS_MODERN, ®s);
- if (ret < 0)
return ret;
/* We make sure the banked regs are properly set */
@@ -101,9 +94,6 @@ int kvm_arch_put_registers(CPUARMState *env, int level)
regs.spsr[MODE_ABT] = env->banked_spsr[2];
regs.spsr[MODE_UND] = env->banked_spsr[3];
- regs.cp15.c0_midr = env->cp15.c0_cpuid;
- regs.cp15.c1_sys = env->cp15.c1_sys;
-
cp15.hdr.nmsrs = ARRAY_SIZE(cp15.e);
cp15.e[0].index = MSR32_INDEX_OF(15, 0, 0, 0, 0); /* MIDR */
cp15.e[0].data = env->cp15.c0_cpuid;
@@ -111,11 +101,8 @@ int kvm_arch_put_registers(CPUARMState *env, int level)
cp15.e[1].data = env->cp15.c1_sys;
ret = kvm_vcpu_ioctl(env, KVM_SET_REGS, ®s);
- if (ret < 0) {
- ret = kvm_vcpu_ioctl(env, KVM_SET_REGS_MODERN, ®s);
- if (ret == 0)
- ret = kvm_vcpu_ioctl(env, KVM_SET_MSRS, &cp15);
- }
+ if (ret < 0)
+ ret = kvm_vcpu_ioctl(env, KVM_SET_MSRS, &cp15);
return ret;
}
@@ -144,6 +131,8 @@ int kvm_arch_get_registers(CPUARMState *env)
cp15.e[5].index = MSR32_INDEX_OF(15, 3, 0, 0, 0); /* DACR */
ret = kvm_vcpu_ioctl(env, KVM_GET_MSRS, &cp15);
+ if (ret < 0)
+ return ret;
/* First, let's transfer the banked state */
cpsr_write(env, regs.cpsr, 0xFFFFFFFF);
@@ -181,22 +170,6 @@ int kvm_arch_get_registers(CPUARMState *env)
env->regs[14] = env->banked_r14[bn];
env->spsr = env->banked_spsr[bn];
- /* Old KVM version. */
- if (ret != 0) {
- //env->cp15.c0_cpuid = regs.cp15.c0_midr;
- env->cp15.c1_sys = regs.cp15.c1_sys;
- env->cp15.c2_base0 = regs.cp15.c2_base0;
- env->cp15.c2_base1 = regs.cp15.c2_base1;
-
- /* This is ugly, but necessary for GDB compatibility */
- env->cp15.c2_control = regs.cp15.c2_control;
- env->cp15.c2_mask = ~(((uint32_t)0xffffffffu) >> regs.cp15.c2_control);
- env->cp15.c2_base_mask = ~((uint32_t)0x3fffu >> regs.cp15.c2_control);
-
- env->cp15.c3 = regs.cp15.c3_dacr;
- return 0;
- }
-
//env->cp15.c0_cpuid = cp15.e[0].data;
env->cp15.c1_sys = cp15.e[1].data;
env->cp15.c2_base0 = cp15.e[2].data;
next prev parent reply other threads:[~2012-07-13 3:43 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Rusty Russell [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87394wz5p5.fsf@rustcorp.com.au \
--to=rusty.russell@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.