Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1316930
| From | Marc Zyngier <marc.zyngier@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v2 13/21] arm64: KVM: VHE: Make __fpsimd_enabled VHE aware |
| Date | 2016-01-25 17:10 +0100 |
| Message-ID | <qURSl-6uy-65@gated-at.bofh.it> (permalink) |
| References | <qURIC-68y-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
As non-VHE and VHE have different ways to express the trapping of
FPSIMD registers to EL2, make __fpsimd_enabled a patchable predicate
and provide a VHE implementation.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
arch/arm64/kvm/hyp/hyp.h | 5 +----
arch/arm64/kvm/hyp/switch.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/kvm/hyp/hyp.h b/arch/arm64/kvm/hyp/hyp.h
index 5dfa883..44eaff7 100644
--- a/arch/arm64/kvm/hyp/hyp.h
+++ b/arch/arm64/kvm/hyp/hyp.h
@@ -171,10 +171,7 @@ void __debug_cond_restore_host_state(struct kvm_vcpu *vcpu);
void __fpsimd_save_state(struct user_fpsimd_state *fp_regs);
void __fpsimd_restore_state(struct user_fpsimd_state *fp_regs);
-static inline bool __fpsimd_enabled(void)
-{
- return !(read_sysreg(cptr_el2) & CPTR_EL2_TFP);
-}
+bool __fpsimd_enabled(void);
u64 __guest_enter(struct kvm_vcpu *vcpu, struct kvm_cpu_context *host_ctxt);
void __noreturn __hyp_do_panic(unsigned long, ...);
diff --git a/arch/arm64/kvm/hyp/switch.c b/arch/arm64/kvm/hyp/switch.c
index 9071dee..6f264dc 100644
--- a/arch/arm64/kvm/hyp/switch.c
+++ b/arch/arm64/kvm/hyp/switch.c
@@ -17,6 +17,25 @@
#include "hyp.h"
+static bool __hyp_text __fpsimd_enabled_nvhe(void)
+{
+ return !(read_sysreg(cptr_el2) & CPTR_EL2_TFP);
+}
+
+static bool __hyp_text __fpsimd_enabled_vhe(void)
+{
+ return !!(read_sysreg(cpacr_el1) & (3 << 20));
+}
+
+static hyp_alternate_select(__fpsimd_is_enabled,
+ __fpsimd_enabled_nvhe, __fpsimd_enabled_vhe,
+ ARM64_HAS_VIRT_HOST_EXTN);
+
+bool __hyp_text __fpsimd_enabled(void)
+{
+ return __fpsimd_is_enabled()();
+}
+
static void __hyp_text __activate_traps(struct kvm_vcpu *vcpu)
{
u64 val;
--
2.1.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v2 00/21] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 16/21] arm64: KVM: VHE: Add fpsimd enabling on guest access Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 09/21] arm64: KVM: VHE: Differenciate host/guest sysreg save/restore Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 06/21] arm64: KVM: VHE: Patch out use of HVC Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 15/21] arm64: KVM: VHE: Use unified sysreg accessors for timer Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 21/21] arm64: Panic when VHE and non VHE CPUs coexist Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
Re: [PATCH v2 21/21] arm64: Panic when VHE and non VHE CPUs coexist "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2016-01-26 15:30 +0100
Re: [PATCH v2 21/21] arm64: Panic when VHE and non VHE CPUs coexist Marc Zyngier <marc.zyngier@arm.com> - 2016-01-26 15:40 +0100
[PATCH v2 10/21] arm64: KVM: VHE: Split save/restore of sysregs shared between EL1 and EL2 Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 20/21] arm64: VHE: Add support for running Linux in EL2 mode Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
Re: [PATCH v2 20/21] arm64: VHE: Add support for running Linux in EL2 mode "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2016-01-26 15:10 +0100
Re: [PATCH v2 20/21] arm64: VHE: Add support for running Linux in EL2 mode "Suzuki K. Poulose" <Suzuki.Poulose@arm.com> - 2016-01-26 15:40 +0100
[PATCH v2 17/21] arm64: KVM: VHE: Add alternative panic handling Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 05/21] arm64: KVM: VHE: Turn VTCR_EL2 setup into a reusable macro Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:00 +0100
[PATCH v2 11/21] arm64: KVM: VHE: Use unified system register accessors Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 03/21] arm64: Add ARM64_HAS_VIRT_HOST_EXTN feature Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 08/21] arm64: KVM: VHE: Introduce unified system register accessors Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 04/21] arm64: KVM: Skip HYP setup when already running in HYP Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 02/21] arm64: Allow the arch timer to use the HYP timer Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 13/21] arm64: KVM: VHE: Make __fpsimd_enabled VHE aware Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 14/21] arm64: KVM: VHE: Implement VHE activate/deactivate_traps Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
[PATCH v2 07/21] arm64: KVM: VHE: Patch out kern_hyp_va Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:10 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Arnd Bergmann <arnd@arndb.de> - 2016-01-25 17:20 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Arnd Bergmann <arnd@arndb.de> - 2016-01-25 17:30 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:30 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Will Deacon <will.deacon@arm.com> - 2016-01-25 17:30 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 17:40 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Will Deacon <will.deacon@arm.com> - 2016-01-25 17:50 +0100
Re: [PATCH v2 00/21] arm64: Virtualization Host Extension support Marc Zyngier <marc.zyngier@arm.com> - 2016-01-25 20:20 +0100
csiph-web