xref: /openbmc/linux/arch/arm64/kvm/hyp/nvhe/sysreg-sr.c (revision cdd38c5f1ce4398ec58fec95904b75824daab7b5)
113aeb9b4SDavid Brazdil // SPDX-License-Identifier: GPL-2.0-only
213aeb9b4SDavid Brazdil /*
313aeb9b4SDavid Brazdil  * Copyright (C) 2012-2015 - ARM Ltd
413aeb9b4SDavid Brazdil  * Author: Marc Zyngier <marc.zyngier@arm.com>
513aeb9b4SDavid Brazdil  */
613aeb9b4SDavid Brazdil 
713aeb9b4SDavid Brazdil #include <hyp/sysreg-sr.h>
813aeb9b4SDavid Brazdil 
913aeb9b4SDavid Brazdil #include <linux/compiler.h>
1013aeb9b4SDavid Brazdil #include <linux/kvm_host.h>
1113aeb9b4SDavid Brazdil 
1213aeb9b4SDavid Brazdil #include <asm/kprobes.h>
1313aeb9b4SDavid Brazdil #include <asm/kvm_asm.h>
1413aeb9b4SDavid Brazdil #include <asm/kvm_emulate.h>
1513aeb9b4SDavid Brazdil #include <asm/kvm_hyp.h>
1613aeb9b4SDavid Brazdil 
1713aeb9b4SDavid Brazdil /*
1813aeb9b4SDavid Brazdil  * Non-VHE: Both host and guest must save everything.
1913aeb9b4SDavid Brazdil  */
2013aeb9b4SDavid Brazdil 
__sysreg_save_state_nvhe(struct kvm_cpu_context * ctxt)21*c50cb043SDavid Brazdil void __sysreg_save_state_nvhe(struct kvm_cpu_context *ctxt)
2213aeb9b4SDavid Brazdil {
2313aeb9b4SDavid Brazdil 	__sysreg_save_el1_state(ctxt);
2413aeb9b4SDavid Brazdil 	__sysreg_save_common_state(ctxt);
2513aeb9b4SDavid Brazdil 	__sysreg_save_user_state(ctxt);
2613aeb9b4SDavid Brazdil 	__sysreg_save_el2_return_state(ctxt);
2713aeb9b4SDavid Brazdil }
2813aeb9b4SDavid Brazdil 
__sysreg_restore_state_nvhe(struct kvm_cpu_context * ctxt)29*c50cb043SDavid Brazdil void __sysreg_restore_state_nvhe(struct kvm_cpu_context *ctxt)
3013aeb9b4SDavid Brazdil {
3113aeb9b4SDavid Brazdil 	__sysreg_restore_el1_state(ctxt);
3213aeb9b4SDavid Brazdil 	__sysreg_restore_common_state(ctxt);
3313aeb9b4SDavid Brazdil 	__sysreg_restore_user_state(ctxt);
3413aeb9b4SDavid Brazdil 	__sysreg_restore_el2_return_state(ctxt);
3513aeb9b4SDavid Brazdil }
36