Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Copyright IBM Corp. 2008
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #ifndef __KVM_BOOKE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #define __KVM_BOOKE_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <linux/kvm_host.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/kvm_ppc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/switch_to.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include "timing.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) /* interrupt priortity ordering */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #define BOOKE_IRQPRIO_DATA_STORAGE 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #define BOOKE_IRQPRIO_INST_STORAGE 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #define BOOKE_IRQPRIO_ALIGNMENT 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #define BOOKE_IRQPRIO_PROGRAM 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #define BOOKE_IRQPRIO_FP_UNAVAIL 4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #ifdef CONFIG_SPE_POSSIBLE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #define BOOKE_IRQPRIO_SPE_UNAVAIL 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #define BOOKE_IRQPRIO_SPE_FP_DATA 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #define BOOKE_IRQPRIO_SPE_FP_ROUND 7
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #ifdef CONFIG_PPC_E500MC
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define BOOKE_IRQPRIO_ALTIVEC_UNAVAIL 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define BOOKE_IRQPRIO_ALTIVEC_ASSIST 6
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define BOOKE_IRQPRIO_SYSCALL 8
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define BOOKE_IRQPRIO_AP_UNAVAIL 9
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define BOOKE_IRQPRIO_DTLB_MISS 10
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define BOOKE_IRQPRIO_ITLB_MISS 11
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define BOOKE_IRQPRIO_MACHINE_CHECK 12
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define BOOKE_IRQPRIO_DEBUG 13
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #define BOOKE_IRQPRIO_CRITICAL 14
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) #define BOOKE_IRQPRIO_WATCHDOG 15
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define BOOKE_IRQPRIO_EXTERNAL 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) #define BOOKE_IRQPRIO_FIT 17
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) #define BOOKE_IRQPRIO_DECREMENTER 18
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) #define BOOKE_IRQPRIO_PERFORMANCE_MONITOR 19
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) /* Internal pseudo-irqprio for level triggered externals */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) #define BOOKE_IRQPRIO_EXTERNAL_LEVEL 20
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) #define BOOKE_IRQPRIO_DBELL 21
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) #define BOOKE_IRQPRIO_DBELL_CRIT 22
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define BOOKE_IRQPRIO_MAX 23
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #define BOOKE_IRQMASK_EE ((1 << BOOKE_IRQPRIO_EXTERNAL_LEVEL) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 			  (1 << BOOKE_IRQPRIO_PERFORMANCE_MONITOR) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 			  (1 << BOOKE_IRQPRIO_DBELL) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 			  (1 << BOOKE_IRQPRIO_DECREMENTER) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 			  (1 << BOOKE_IRQPRIO_FIT) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 			  (1 << BOOKE_IRQPRIO_EXTERNAL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) #define BOOKE_IRQMASK_CE ((1 << BOOKE_IRQPRIO_DBELL_CRIT) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 			  (1 << BOOKE_IRQPRIO_WATCHDOG) | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 			  (1 << BOOKE_IRQPRIO_CRITICAL))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) extern unsigned long kvmppc_booke_handlers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) extern unsigned long kvmppc_booke_handler_addr[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) void kvmppc_mmu_msr_notify(struct kvm_vcpu *vcpu, u32 old_msr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) void kvmppc_set_epcr(struct kvm_vcpu *vcpu, u32 new_epcr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) int kvmppc_booke_emulate_op(struct kvm_vcpu *vcpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74)                             unsigned int inst, int *advance);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /* low-level asm code to transfer guest state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) void kvmppc_load_guest_spe(struct kvm_vcpu *vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) void kvmppc_save_guest_spe(struct kvm_vcpu *vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) /* high-level function, manages flags, host state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) void kvmppc_vcpu_disable_spe(struct kvm_vcpu *vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) void kvmppc_booke_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) void kvmppc_booke_vcpu_put(struct kvm_vcpu *vcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) enum int_class {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	INT_CLASS_NONCRIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	INT_CLASS_CRIT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	INT_CLASS_MC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	INT_CLASS_DBG,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) extern int kvmppc_core_emulate_op_e500(struct kvm_vcpu *vcpu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 				       unsigned int inst, int *advance);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 					  ulong spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 					  ulong *spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 					  ulong spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 					  ulong *spr_val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) static inline void kvmppc_clear_dbsr(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	mtspr(SPRN_DBSR, mfspr(SPRN_DBSR));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) #endif /* __KVM_BOOKE_H__ */