2012-12-10 11:16:40 +00:00
/*
* Copyright ( C ) 2012 , 2013 - ARM Ltd
* Author : Marc Zyngier < marc . zyngier @ arm . com >
*
* This program is free software ; you can redistribute it and / or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation .
*
* This program is distributed in the hope that it will be useful ,
* but WITHOUT ANY WARRANTY ; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
* GNU General Public License for more details .
*
* You should have received a copy of the GNU General Public License
* along with this program . If not , see < http : //www.gnu.org/licenses/>.
*/
# ifndef __ARM_KVM_ASM_H__
# define __ARM_KVM_ASM_H__
2013-06-26 15:16:40 +01:00
# include <asm/virt.h>
2016-09-06 14:02:05 +01:00
# define ARM_EXIT_WITH_SERROR_BIT 31
# define ARM_EXCEPTION_CODE(x) ((x) & ~(1U << ARM_EXIT_WITH_SERROR_BIT))
# define ARM_SERROR_PENDING(x) !!((x) & (1U << ARM_EXIT_WITH_SERROR_BIT))
2012-12-10 11:16:40 +00:00
# define ARM_EXCEPTION_IRQ 0
2016-09-06 14:02:02 +01:00
# define ARM_EXCEPTION_EL1_SERROR 1
# define ARM_EXCEPTION_TRAP 2
2016-04-27 17:47:04 +01:00
/* The hyp-stub will return this for any kvm_call_hyp() call */
2017-04-03 19:37:37 +01:00
# define ARM_EXCEPTION_HYP_GONE HVC_STUB_ERR
2012-12-10 11:16:40 +00:00
2014-04-24 10:24:46 +01:00
# define KVM_ARM64_DEBUG_DIRTY_SHIFT 0
# define KVM_ARM64_DEBUG_DIRTY (1 << KVM_ARM64_DEBUG_DIRTY_SHIFT)
2016-03-18 17:25:59 +00:00
# define kvm_ksym_ref(sym) \
( { \
void * val = & sym ; \
if ( ! is_kernel_in_hyp_mode ( ) ) \
val = phys_to_virt ( ( u64 ) & sym - kimage_voffset ) ; \
val ; \
} )
2016-02-16 13:52:39 +01:00
2012-12-10 11:16:40 +00:00
# ifndef __ASSEMBLY__
struct kvm ;
struct kvm_vcpu ;
extern char __kvm_hyp_init [ ] ;
extern char __kvm_hyp_init_end [ ] ;
extern char __kvm_hyp_vector [ ] ;
extern void __kvm_flush_vm_context ( void ) ;
extern void __kvm_tlb_flush_vmid_ipa ( struct kvm * kvm , phys_addr_t ipa ) ;
2015-01-15 15:58:59 -08:00
extern void __kvm_tlb_flush_vmid ( struct kvm * kvm ) ;
2016-10-18 18:37:49 +01:00
extern void __kvm_tlb_flush_local_vmid ( struct kvm_vcpu * vcpu ) ;
2012-12-10 11:16:40 +00:00
2017-01-04 16:10:28 +01:00
extern void __kvm_timer_set_cntvoff ( u32 cntvoff_low , u32 cntvoff_high ) ;
2012-12-10 11:16:40 +00:00
extern int __kvm_vcpu_run ( struct kvm_vcpu * vcpu ) ;
2013-06-21 11:57:56 +01:00
2013-07-12 15:15:23 +01:00
extern u64 __vgic_v3_get_ich_vtr_el2 ( void ) ;
2016-03-24 11:21:04 +01:00
extern u64 __vgic_v3_read_vmcr ( void ) ;
extern void __vgic_v3_write_vmcr ( u32 vmcr ) ;
2016-03-03 15:43:58 +00:00
extern void __vgic_v3_init_lrs ( void ) ;
2013-07-12 15:15:23 +01:00
2015-07-07 17:29:56 +01:00
extern u32 __kvm_get_mdcr_el2 ( void ) ;
2016-04-05 16:11:47 +01:00
extern u32 __init_stage2_translation ( void ) ;
2015-01-29 13:19:45 +00:00
2018-01-05 14:28:59 -06:00
extern void __qcom_hyp_sanitize_btac_predictors ( void ) ;
2012-12-10 11:16:40 +00:00
# endif
# endif /* __ARM_KVM_ASM_H__ */