| 1 |
// SPDX-License-Identifier: GPL-2.0-only |
| 2 |
/* |
| 3 |
* Copyright (C) 2012-2015 - ARM Ltd |
| 4 |
* Author: Marc Zyngier <[email protected]> |
| 5 |
*/ |
| 6 |
|
| 7 |
#include <hyp/sysreg-sr.h> |
| 8 |
|
| 9 |
#include <linux/compiler.h> |
| 10 |
#include <linux/kvm_host.h> |
| 11 |
|
| 12 |
#include <asm/kprobes.h> |
| 13 |
#include <asm/kvm_asm.h> |
| 14 |
#include <asm/kvm_emulate.h> |
| 15 |
#include <asm/kvm_hyp.h> |
| 16 |
|
| 17 |
/* |
| 18 |
* Non-VHE: Both host and guest must save everything. |
| 19 |
*/ |
| 20 |
|
| 21 |
void __sysreg_save_state_nvhe(struct kvm_cpu_context *ctxt) |
| 22 |
{ |
| 23 |
__sysreg_save_el1_state(ctxt); |
| 24 |
__sysreg_save_common_state(ctxt); |
| 25 |
__sysreg_save_user_state(ctxt); |
| 26 |
__sysreg_save_el2_return_state(ctxt); |
| 27 |
} |
| 28 |
|
| 29 |
void __sysreg_restore_state_nvhe(struct kvm_cpu_context *ctxt) |
| 30 |
{ |
| 31 |
u64 midr = ctxt_midr_el1(ctxt); |
| 32 |
|
| 33 |
__sysreg_restore_el1_state(ctxt, midr, ctxt_sys_reg(ctxt, MPIDR_EL1)); |
| 34 |
__sysreg_restore_common_state(ctxt); |
| 35 |
__sysreg_restore_user_state(ctxt); |
| 36 |
__sysreg_restore_el2_return_state(ctxt); |
| 37 |
} |