Skip to content

Commit 45c7e8a

Browse files
committed
MIPS: Remove KVM_TE support
After removal of the guest part of KVM TE (trap and emulate), also remove the host part. Signed-off-by: Thomas Bogendoerfer <[email protected]>
1 parent a1515ec commit 45c7e8a

File tree

16 files changed

+31
-4270
lines changed

16 files changed

+31
-4270
lines changed

arch/mips/configs/loongson3_defconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ CONFIG_MIPS32_O32=y
3939
CONFIG_MIPS32_N32=y
4040
CONFIG_VIRTUALIZATION=y
4141
CONFIG_KVM=m
42-
CONFIG_KVM_MIPS_VZ=y
4342
CONFIG_MODULES=y
4443
CONFIG_MODULE_FORCE_LOAD=y
4544
CONFIG_MODULE_UNLOAD=y

arch/mips/include/asm/kvm_host.h

Lines changed: 0 additions & 238 deletions
Original file line numberDiff line numberDiff line change
@@ -88,44 +88,10 @@
8888

8989
#define KVM_HALT_POLL_NS_DEFAULT 500000
9090

91-
#ifdef CONFIG_KVM_MIPS_VZ
9291
extern unsigned long GUESTID_MASK;
9392
extern unsigned long GUESTID_FIRST_VERSION;
9493
extern unsigned long GUESTID_VERSION_MASK;
95-
#endif
96-
97-
98-
/*
99-
* Special address that contains the comm page, used for reducing # of traps
100-
* This needs to be within 32Kb of 0x0 (so the zero register can be used), but
101-
* preferably not at 0x0 so that most kernel NULL pointer dereferences can be
102-
* caught.
103-
*/
104-
#define KVM_GUEST_COMMPAGE_ADDR ((PAGE_SIZE > 0x8000) ? 0 : \
105-
(0x8000 - PAGE_SIZE))
10694

107-
#define KVM_GUEST_KERNEL_MODE(vcpu) ((kvm_read_c0_guest_status(vcpu->arch.cop0) & (ST0_EXL | ST0_ERL)) || \
108-
((kvm_read_c0_guest_status(vcpu->arch.cop0) & KSU_USER) == 0))
109-
110-
#define KVM_GUEST_KUSEG 0x00000000UL
111-
#define KVM_GUEST_KSEG0 0x40000000UL
112-
#define KVM_GUEST_KSEG1 0x40000000UL
113-
#define KVM_GUEST_KSEG23 0x60000000UL
114-
#define KVM_GUEST_KSEGX(a) ((_ACAST32_(a)) & 0xe0000000)
115-
#define KVM_GUEST_CPHYSADDR(a) ((_ACAST32_(a)) & 0x1fffffff)
116-
117-
#define KVM_GUEST_CKSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0)
118-
#define KVM_GUEST_CKSEG1ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG1)
119-
#define KVM_GUEST_CKSEG23ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG23)
120-
121-
/*
122-
* Map an address to a certain kernel segment
123-
*/
124-
#define KVM_GUEST_KSEG0ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG0)
125-
#define KVM_GUEST_KSEG1ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG1)
126-
#define KVM_GUEST_KSEG23ADDR(a) (KVM_GUEST_CPHYSADDR(a) | KVM_GUEST_KSEG23)
127-
128-
#define KVM_INVALID_PAGE 0xdeadbeef
12995
#define KVM_INVALID_ADDR 0xdeadbeef
13096

13197
/*
@@ -165,7 +131,6 @@ struct kvm_vcpu_stat {
165131
u64 fpe_exits;
166132
u64 msa_disabled_exits;
167133
u64 flush_dcache_exits;
168-
#ifdef CONFIG_KVM_MIPS_VZ
169134
u64 vz_gpsi_exits;
170135
u64 vz_gsfc_exits;
171136
u64 vz_hc_exits;
@@ -176,7 +141,6 @@ struct kvm_vcpu_stat {
176141
u64 vz_resvd_exits;
177142
#ifdef CONFIG_CPU_LOONGSON64
178143
u64 vz_cpucfg_exits;
179-
#endif
180144
#endif
181145
u64 halt_successful_poll;
182146
u64 halt_attempted_poll;
@@ -303,14 +267,6 @@ enum emulation_result {
303267
EMULATE_HYPERCALL, /* HYPCALL instruction */
304268
};
305269

306-
#define mips3_paddr_to_tlbpfn(x) \
307-
(((unsigned long)(x) >> MIPS3_PG_SHIFT) & MIPS3_PG_FRAME)
308-
#define mips3_tlbpfn_to_paddr(x) \
309-
((unsigned long)((x) & MIPS3_PG_FRAME) << MIPS3_PG_SHIFT)
310-
311-
#define MIPS3_PG_SHIFT 6
312-
#define MIPS3_PG_FRAME 0x3fffffc0
313-
314270
#if defined(CONFIG_64BIT)
315271
#define VPN2_MASK GENMASK(cpu_vmbits - 1, 13)
316272
#else
@@ -337,7 +293,6 @@ struct kvm_mips_tlb {
337293
#define KVM_MIPS_AUX_FPU 0x1
338294
#define KVM_MIPS_AUX_MSA 0x2
339295

340-
#define KVM_MIPS_GUEST_TLB_SIZE 64
341296
struct kvm_vcpu_arch {
342297
void *guest_ebase;
343298
int (*vcpu_run)(struct kvm_vcpu *vcpu);
@@ -370,9 +325,6 @@ struct kvm_vcpu_arch {
370325
/* COP0 State */
371326
struct mips_coproc *cop0;
372327

373-
/* Host KSEG0 address of the EI/DI offset */
374-
void *kseg0_commpage;
375-
376328
/* Resume PC after MMIO completion */
377329
unsigned long io_pc;
378330
/* GPR used as IO source/target */
@@ -398,19 +350,9 @@ struct kvm_vcpu_arch {
398350
/* Bitmask of pending exceptions to be cleared */
399351
unsigned long pending_exceptions_clr;
400352

401-
/* S/W Based TLB for guest */
402-
struct kvm_mips_tlb guest_tlb[KVM_MIPS_GUEST_TLB_SIZE];
403-
404-
/* Guest kernel/user [partial] mm */
405-
struct mm_struct guest_kernel_mm, guest_user_mm;
406-
407-
/* Guest ASID of last user mode execution */
408-
unsigned int last_user_gasid;
409-
410353
/* Cache some mmu pages needed inside spinlock regions */
411354
struct kvm_mmu_memory_cache mmu_page_cache;
412355

413-
#ifdef CONFIG_KVM_MIPS_VZ
414356
/* vcpu's vzguestid is different on each host cpu in an smp system */
415357
u32 vzguestid[NR_CPUS];
416358

@@ -421,7 +363,6 @@ struct kvm_vcpu_arch {
421363

422364
/* emulated guest MAAR registers */
423365
unsigned long maar[6];
424-
#endif
425366

426367
/* Last CPU the VCPU state was loaded on */
427368
int last_sched_cpu;
@@ -651,20 +592,6 @@ static inline void kvm_change_##name1(struct mips_coproc *cop0, \
651592
__BUILD_KVM_ATOMIC_SAVED(name, type, _reg, sel) \
652593
__BUILD_KVM_SET_WRAP(c0_guest_##name, sw_gc0_##name, type)
653594

654-
#ifndef CONFIG_KVM_MIPS_VZ
655-
656-
/*
657-
* T&E (trap & emulate software based virtualisation)
658-
* We generate the common accessors operating exclusively on the saved context
659-
* in RAM.
660-
*/
661-
662-
#define __BUILD_KVM_RW_HW __BUILD_KVM_RW_SW
663-
#define __BUILD_KVM_SET_HW __BUILD_KVM_SET_SW
664-
#define __BUILD_KVM_ATOMIC_HW __BUILD_KVM_ATOMIC_SW
665-
666-
#else
667-
668595
/*
669596
* VZ (hardware assisted virtualisation)
670597
* These macros use the active guest state in VZ mode (hardware registers),
@@ -697,8 +624,6 @@ static inline void kvm_change_##name1(struct mips_coproc *cop0, \
697624
*/
698625
#define __BUILD_KVM_ATOMIC_HW __BUILD_KVM_SET_HW
699626

700-
#endif
701-
702627
/*
703628
* Define accessors for CP0 registers that are accessible to the guest. These
704629
* are primarily used by common emulation code, which may need to access the
@@ -874,42 +799,9 @@ void kvm_drop_fpu(struct kvm_vcpu *vcpu);
874799
void kvm_lose_fpu(struct kvm_vcpu *vcpu);
875800

876801
/* TLB handling */
877-
u32 kvm_get_kernel_asid(struct kvm_vcpu *vcpu);
878-
879-
u32 kvm_get_user_asid(struct kvm_vcpu *vcpu);
880-
881-
u32 kvm_get_commpage_asid (struct kvm_vcpu *vcpu);
882-
883-
#ifdef CONFIG_KVM_MIPS_VZ
884802
int kvm_mips_handle_vz_root_tlb_fault(unsigned long badvaddr,
885803
struct kvm_vcpu *vcpu, bool write_fault);
886-
#endif
887-
extern int kvm_mips_handle_kseg0_tlb_fault(unsigned long badbaddr,
888-
struct kvm_vcpu *vcpu,
889-
bool write_fault);
890-
891-
extern int kvm_mips_handle_commpage_tlb_fault(unsigned long badvaddr,
892-
struct kvm_vcpu *vcpu);
893804

894-
extern int kvm_mips_handle_mapped_seg_tlb_fault(struct kvm_vcpu *vcpu,
895-
struct kvm_mips_tlb *tlb,
896-
unsigned long gva,
897-
bool write_fault);
898-
899-
extern enum emulation_result kvm_mips_handle_tlbmiss(u32 cause,
900-
u32 *opc,
901-
struct kvm_vcpu *vcpu,
902-
bool write_fault);
903-
904-
extern void kvm_mips_dump_host_tlbs(void);
905-
extern void kvm_mips_dump_guest_tlbs(struct kvm_vcpu *vcpu);
906-
extern int kvm_mips_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi,
907-
bool user, bool kernel);
908-
909-
extern int kvm_mips_guest_tlb_lookup(struct kvm_vcpu *vcpu,
910-
unsigned long entryhi);
911-
912-
#ifdef CONFIG_KVM_MIPS_VZ
913805
int kvm_vz_host_tlb_inv(struct kvm_vcpu *vcpu, unsigned long entryhi);
914806
int kvm_vz_guest_tlb_lookup(struct kvm_vcpu *vcpu, unsigned long gva,
915807
unsigned long *gpa);
@@ -923,48 +815,13 @@ void kvm_vz_load_guesttlb(const struct kvm_mips_tlb *buf, unsigned int index,
923815
void kvm_loongson_clear_guest_vtlb(void);
924816
void kvm_loongson_clear_guest_ftlb(void);
925817
#endif
926-
#endif
927-
928-
void kvm_mips_suspend_mm(int cpu);
929-
void kvm_mips_resume_mm(int cpu);
930818

931819
/* MMU handling */
932820

933-
/**
934-
* enum kvm_mips_flush - Types of MMU flushes.
935-
* @KMF_USER: Flush guest user virtual memory mappings.
936-
* Guest USeg only.
937-
* @KMF_KERN: Flush guest kernel virtual memory mappings.
938-
* Guest USeg and KSeg2/3.
939-
* @KMF_GPA: Flush guest physical memory mappings.
940-
* Also includes KSeg0 if KMF_KERN is set.
941-
*/
942-
enum kvm_mips_flush {
943-
KMF_USER = 0x0,
944-
KMF_KERN = 0x1,
945-
KMF_GPA = 0x2,
946-
};
947-
void kvm_mips_flush_gva_pt(pgd_t *pgd, enum kvm_mips_flush flags);
948821
bool kvm_mips_flush_gpa_pt(struct kvm *kvm, gfn_t start_gfn, gfn_t end_gfn);
949822
int kvm_mips_mkclean_gpa_pt(struct kvm *kvm, gfn_t start_gfn, gfn_t end_gfn);
950823
pgd_t *kvm_pgd_alloc(void);
951824
void kvm_mmu_free_memory_caches(struct kvm_vcpu *vcpu);
952-
void kvm_trap_emul_invalidate_gva(struct kvm_vcpu *vcpu, unsigned long addr,
953-
bool user);
954-
void kvm_trap_emul_gva_lockless_begin(struct kvm_vcpu *vcpu);
955-
void kvm_trap_emul_gva_lockless_end(struct kvm_vcpu *vcpu);
956-
957-
enum kvm_mips_fault_result {
958-
KVM_MIPS_MAPPED = 0,
959-
KVM_MIPS_GVA,
960-
KVM_MIPS_GPA,
961-
KVM_MIPS_TLB,
962-
KVM_MIPS_TLBINV,
963-
KVM_MIPS_TLBMOD,
964-
};
965-
enum kvm_mips_fault_result kvm_trap_emul_gva_fault(struct kvm_vcpu *vcpu,
966-
unsigned long gva,
967-
bool write);
968825

969826
#define KVM_ARCH_WANT_MMU_NOTIFIER
970827
int kvm_unmap_hva_range(struct kvm *kvm,
@@ -974,7 +831,6 @@ int kvm_age_hva(struct kvm *kvm, unsigned long start, unsigned long end);
974831
int kvm_test_age_hva(struct kvm *kvm, unsigned long hva);
975832

976833
/* Emulation */
977-
int kvm_get_inst(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
978834
enum emulation_result update_pc(struct kvm_vcpu *vcpu, u32 cause);
979835
int kvm_get_badinstr(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
980836
int kvm_get_badinstrp(u32 *opc, struct kvm_vcpu *vcpu, u32 *out);
@@ -1006,68 +862,6 @@ static inline bool kvm_is_ifetch_fault(struct kvm_vcpu_arch *vcpu)
1006862
return false;
1007863
}
1008864

1009-
extern enum emulation_result kvm_mips_emulate_inst(u32 cause,
1010-
u32 *opc,
1011-
struct kvm_vcpu *vcpu);
1012-
1013-
long kvm_mips_guest_exception_base(struct kvm_vcpu *vcpu);
1014-
1015-
extern enum emulation_result kvm_mips_emulate_syscall(u32 cause,
1016-
u32 *opc,
1017-
struct kvm_vcpu *vcpu);
1018-
1019-
extern enum emulation_result kvm_mips_emulate_tlbmiss_ld(u32 cause,
1020-
u32 *opc,
1021-
struct kvm_vcpu *vcpu);
1022-
1023-
extern enum emulation_result kvm_mips_emulate_tlbinv_ld(u32 cause,
1024-
u32 *opc,
1025-
struct kvm_vcpu *vcpu);
1026-
1027-
extern enum emulation_result kvm_mips_emulate_tlbmiss_st(u32 cause,
1028-
u32 *opc,
1029-
struct kvm_vcpu *vcpu);
1030-
1031-
extern enum emulation_result kvm_mips_emulate_tlbinv_st(u32 cause,
1032-
u32 *opc,
1033-
struct kvm_vcpu *vcpu);
1034-
1035-
extern enum emulation_result kvm_mips_emulate_tlbmod(u32 cause,
1036-
u32 *opc,
1037-
struct kvm_vcpu *vcpu);
1038-
1039-
extern enum emulation_result kvm_mips_emulate_fpu_exc(u32 cause,
1040-
u32 *opc,
1041-
struct kvm_vcpu *vcpu);
1042-
1043-
extern enum emulation_result kvm_mips_handle_ri(u32 cause,
1044-
u32 *opc,
1045-
struct kvm_vcpu *vcpu);
1046-
1047-
extern enum emulation_result kvm_mips_emulate_ri_exc(u32 cause,
1048-
u32 *opc,
1049-
struct kvm_vcpu *vcpu);
1050-
1051-
extern enum emulation_result kvm_mips_emulate_bp_exc(u32 cause,
1052-
u32 *opc,
1053-
struct kvm_vcpu *vcpu);
1054-
1055-
extern enum emulation_result kvm_mips_emulate_trap_exc(u32 cause,
1056-
u32 *opc,
1057-
struct kvm_vcpu *vcpu);
1058-
1059-
extern enum emulation_result kvm_mips_emulate_msafpe_exc(u32 cause,
1060-
u32 *opc,
1061-
struct kvm_vcpu *vcpu);
1062-
1063-
extern enum emulation_result kvm_mips_emulate_fpe_exc(u32 cause,
1064-
u32 *opc,
1065-
struct kvm_vcpu *vcpu);
1066-
1067-
extern enum emulation_result kvm_mips_emulate_msadis_exc(u32 cause,
1068-
u32 *opc,
1069-
struct kvm_vcpu *vcpu);
1070-
1071865
extern enum emulation_result kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu);
1072866

1073867
u32 kvm_mips_read_count(struct kvm_vcpu *vcpu);
@@ -1087,26 +881,9 @@ ktime_t kvm_mips_freeze_hrtimer(struct kvm_vcpu *vcpu, u32 *count);
1087881
int kvm_mips_restore_hrtimer(struct kvm_vcpu *vcpu, ktime_t before,
1088882
u32 count, int min_drift);
1089883

1090-
#ifdef CONFIG_KVM_MIPS_VZ
1091884
void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu);
1092885
void kvm_vz_lose_htimer(struct kvm_vcpu *vcpu);
1093-
#else
1094-
static inline void kvm_vz_acquire_htimer(struct kvm_vcpu *vcpu) {}
1095-
static inline void kvm_vz_lose_htimer(struct kvm_vcpu *vcpu) {}
1096-
#endif
1097-
1098-
enum emulation_result kvm_mips_check_privilege(u32 cause,
1099-
u32 *opc,
1100-
struct kvm_vcpu *vcpu);
1101886

1102-
enum emulation_result kvm_mips_emulate_cache(union mips_instruction inst,
1103-
u32 *opc,
1104-
u32 cause,
1105-
struct kvm_vcpu *vcpu);
1106-
enum emulation_result kvm_mips_emulate_CP0(union mips_instruction inst,
1107-
u32 *opc,
1108-
u32 cause,
1109-
struct kvm_vcpu *vcpu);
1110887
enum emulation_result kvm_mips_emulate_store(union mips_instruction inst,
1111888
u32 cause,
1112889
struct kvm_vcpu *vcpu);
@@ -1117,27 +894,12 @@ enum emulation_result kvm_mips_emulate_load(union mips_instruction inst,
1117894
/* COP0 */
1118895
enum emulation_result kvm_mips_emul_wait(struct kvm_vcpu *vcpu);
1119896

1120-
unsigned int kvm_mips_config1_wrmask(struct kvm_vcpu *vcpu);
1121-
unsigned int kvm_mips_config3_wrmask(struct kvm_vcpu *vcpu);
1122-
unsigned int kvm_mips_config4_wrmask(struct kvm_vcpu *vcpu);
1123-
unsigned int kvm_mips_config5_wrmask(struct kvm_vcpu *vcpu);
1124-
1125897
/* Hypercalls (hypcall.c) */
1126898

1127899
enum emulation_result kvm_mips_emul_hypcall(struct kvm_vcpu *vcpu,
1128900
union mips_instruction inst);
1129901
int kvm_mips_handle_hypcall(struct kvm_vcpu *vcpu);
1130902

1131-
/* Dynamic binary translation */
1132-
extern int kvm_mips_trans_cache_index(union mips_instruction inst,
1133-
u32 *opc, struct kvm_vcpu *vcpu);
1134-
extern int kvm_mips_trans_cache_va(union mips_instruction inst, u32 *opc,
1135-
struct kvm_vcpu *vcpu);
1136-
extern int kvm_mips_trans_mfc0(union mips_instruction inst, u32 *opc,
1137-
struct kvm_vcpu *vcpu);
1138-
extern int kvm_mips_trans_mtc0(union mips_instruction inst, u32 *opc,
1139-
struct kvm_vcpu *vcpu);
1140-
1141903
/* Misc */
1142904
extern void kvm_mips_dump_stats(struct kvm_vcpu *vcpu);
1143905
extern unsigned long kvm_mips_get_ramsize(struct kvm *kvm);

0 commit comments

Comments
 (0)