Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1554112
| From | Jintack Lim <jintack@cs.columbia.edu> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC 05/55] KVM: arm64: Add vcpu_mode_el2 primitive to support nesting |
| Date | 2017-01-09 07:50 +0100 |
| Message-ID | <sXBWh-CV-13@gated-at.bofh.it> (permalink) |
| References | <sXBCV-wl-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Christoffer Dall <christoffer.dall@linaro.org>
When running a nested hypervisor we occasionally have to figure out if
the mode we are switching into is the virtual EL2 mode or a regular
EL0/1 mode.
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Jintack Lim <jintack@cs.columbia.edu>
---
arch/arm/include/asm/kvm_emulate.h | 6 ++++++
arch/arm64/include/asm/kvm_emulate.h | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h
index 9a8a45a..399cd75e 100644
--- a/arch/arm/include/asm/kvm_emulate.h
+++ b/arch/arm/include/asm/kvm_emulate.h
@@ -77,6 +77,12 @@ static inline bool vcpu_mode_is_32bit(const struct kvm_vcpu *vcpu)
return 1;
}
+/* We don't support nesting on arm */
+static inline bool vcpu_mode_el2(const struct kvm_vcpu *vcpu)
+{
+ return false;
+}
+
static inline unsigned long *vcpu_pc(struct kvm_vcpu *vcpu)
{
return &vcpu->arch.ctxt.gp_regs.usr_regs.ARM_pc;
diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index f5ea0ba..830be2e 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -143,6 +143,18 @@ static inline bool vcpu_mode_priv(const struct kvm_vcpu *vcpu)
return mode != PSR_MODE_EL0t;
}
+static inline bool vcpu_mode_el2(const struct kvm_vcpu *vcpu)
+{
+ u32 mode;
+
+ if (vcpu_mode_is_32bit(vcpu))
+ return false;
+
+ mode = *vcpu_cpsr(vcpu) & PSR_MODE_MASK;
+
+ return mode == PSR_MODE_EL2h || mode == PSR_MODE_EL2t;
+}
+
static inline u32 kvm_vcpu_get_hsr(const struct kvm_vcpu *vcpu)
{
return vcpu->arch.fault.esr_el2;
--
1.9.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC 00/55] Nested Virtualization on KVM/ARM Jintack Lim <jintack@cs.columbia.edu> - 2017-01-09 07:50 +0100
[RFC 05/55] KVM: arm64: Add vcpu_mode_el2 primitive to support nesting Jintack Lim <jintack@cs.columbia.edu> - 2017-01-09 07:50 +0100
[RFC 03/55] KVM: arm64: Add KVM nesting feature Jintack Lim <jintack@cs.columbia.edu> - 2017-01-09 07:50 +0100
Re: [RFC 00/55] Nested Virtualization on KVM/ARM David Hildenbrand <david@redhat.com> - 2017-01-09 16:10 +0100
Re: [RFC 00/55] Nested Virtualization on KVM/ARM Jintack Lim <jintack@cs.columbia.edu> - 2017-01-10 17:20 +0100
csiph-web