Skip to content

Commit a26cf1c

Browse files
committed
Merge branch 'topic/ppc-kvm' into next
This brings in two series from Paul, one of which touches KVM code and may need to be merged into the kvm-ppc tree to resolve conflicts.
2 parents 78e5dfe + 681c617 commit a26cf1c

27 files changed

+842
-136
lines changed

arch/powerpc/include/asm/asm-prototypes.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,4 +138,7 @@ extern int __ucmpdi2(u64, u64);
138138
void _mcount(void);
139139
unsigned long prepare_ftrace_return(unsigned long parent, unsigned long ip);
140140

141+
void pnv_power9_force_smt4_catch(void);
142+
void pnv_power9_force_smt4_release(void);
143+
141144
#endif /* _ASM_POWERPC_ASM_PROTOTYPES_H */

arch/powerpc/include/asm/cputable.h

Lines changed: 117 additions & 113 deletions
Large diffs are not rendered by default.

arch/powerpc/include/asm/kvm_asm.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@
108108

109109
/* book3s_hv */
110110

111+
#define BOOK3S_INTERRUPT_HV_SOFTPATCH 0x1500
112+
111113
/*
112114
* Special trap used to indicate to host that this is a
113115
* passthrough interrupt that could not be handled

arch/powerpc/include/asm/kvm_book3s.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,10 @@ extern void kvmppc_update_lpcr(struct kvm *kvm, unsigned long lpcr,
241241
unsigned long mask);
242242
extern void kvmppc_set_fscr(struct kvm_vcpu *vcpu, u64 fscr);
243243

244+
extern int kvmhv_p9_tm_emulation_early(struct kvm_vcpu *vcpu);
245+
extern int kvmhv_p9_tm_emulation(struct kvm_vcpu *vcpu);
246+
extern void kvmhv_emulate_tm_rollback(struct kvm_vcpu *vcpu);
247+
244248
extern void kvmppc_entry_trampoline(void);
245249
extern void kvmppc_hv_entry_trampoline(void);
246250
extern u32 kvmppc_alignment_dsisr(struct kvm_vcpu *vcpu, unsigned int inst);

arch/powerpc/include/asm/kvm_book3s_64.h

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,49 @@ static inline void set_dirty_bits_atomic(unsigned long *map, unsigned long i,
472472
set_bit_le(i, map);
473473
}
474474

475+
static inline u64 sanitize_msr(u64 msr)
476+
{
477+
msr &= ~MSR_HV;
478+
msr |= MSR_ME;
479+
return msr;
480+
}
481+
482+
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
483+
static inline void copy_from_checkpoint(struct kvm_vcpu *vcpu)
484+
{
485+
vcpu->arch.cr = vcpu->arch.cr_tm;
486+
vcpu->arch.xer = vcpu->arch.xer_tm;
487+
vcpu->arch.lr = vcpu->arch.lr_tm;
488+
vcpu->arch.ctr = vcpu->arch.ctr_tm;
489+
vcpu->arch.amr = vcpu->arch.amr_tm;
490+
vcpu->arch.ppr = vcpu->arch.ppr_tm;
491+
vcpu->arch.dscr = vcpu->arch.dscr_tm;
492+
vcpu->arch.tar = vcpu->arch.tar_tm;
493+
memcpy(vcpu->arch.gpr, vcpu->arch.gpr_tm,
494+
sizeof(vcpu->arch.gpr));
495+
vcpu->arch.fp = vcpu->arch.fp_tm;
496+
vcpu->arch.vr = vcpu->arch.vr_tm;
497+
vcpu->arch.vrsave = vcpu->arch.vrsave_tm;
498+
}
499+
500+
static inline void copy_to_checkpoint(struct kvm_vcpu *vcpu)
501+
{
502+
vcpu->arch.cr_tm = vcpu->arch.cr;
503+
vcpu->arch.xer_tm = vcpu->arch.xer;
504+
vcpu->arch.lr_tm = vcpu->arch.lr;
505+
vcpu->arch.ctr_tm = vcpu->arch.ctr;
506+
vcpu->arch.amr_tm = vcpu->arch.amr;
507+
vcpu->arch.ppr_tm = vcpu->arch.ppr;
508+
vcpu->arch.dscr_tm = vcpu->arch.dscr;
509+
vcpu->arch.tar_tm = vcpu->arch.tar;
510+
memcpy(vcpu->arch.gpr_tm, vcpu->arch.gpr,
511+
sizeof(vcpu->arch.gpr));
512+
vcpu->arch.fp_tm = vcpu->arch.fp;
513+
vcpu->arch.vr_tm = vcpu->arch.vr;
514+
vcpu->arch.vrsave_tm = vcpu->arch.vrsave;
515+
}
516+
#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
517+
475518
#endif /* CONFIG_KVM_BOOK3S_HV_POSSIBLE */
476519

477520
#endif /* __ASM_KVM_BOOK3S_64_H__ */

arch/powerpc/include/asm/kvm_book3s_asm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ struct kvmppc_host_state {
119119
u8 host_ipi;
120120
u8 ptid; /* thread number within subcore when split */
121121
u8 tid; /* thread number within whole core */
122+
u8 fake_suspend;
122123
struct kvm_vcpu *kvm_vcpu;
123124
struct kvmppc_vcore *kvm_vcore;
124125
void __iomem *xics_phys;

arch/powerpc/include/asm/kvm_host.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,7 @@ struct kvm_vcpu_arch {
610610
u64 tfhar;
611611
u64 texasr;
612612
u64 tfiar;
613+
u64 orig_texasr;
613614

614615
u32 cr_tm;
615616
u64 xer_tm;

arch/powerpc/include/asm/paca.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <asm/accounting.h>
3333
#include <asm/hmi.h>
3434
#include <asm/cpuidle.h>
35+
#include <asm/atomic.h>
3536

3637
register struct paca_struct *local_paca asm("r13");
3738

@@ -177,6 +178,8 @@ struct paca_struct {
177178
u8 thread_mask;
178179
/* Mask to denote subcore sibling threads */
179180
u8 subcore_sibling_mask;
181+
/* Flag to request this thread not to stop */
182+
atomic_t dont_stop;
180183
/*
181184
* Pointer to an array which contains pointer
182185
* to the sibling threads' paca.

arch/powerpc/include/asm/powernv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ static inline int pnv_npu2_handle_fault(struct npu_context *context,
4040
}
4141

4242
static inline void pnv_tm_init(void) { }
43+
static inline void pnv_power9_force_smt4(void) { }
4344
#endif
4445

4546
#endif /* _ASM_POWERNV_H */

arch/powerpc/include/asm/ppc-opcode.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,15 +232,18 @@
232232
#define PPC_INST_MSGSYNC 0x7c0006ec
233233
#define PPC_INST_MSGSNDP 0x7c00011c
234234
#define PPC_INST_MSGCLRP 0x7c00015c
235+
#define PPC_INST_MTMSRD 0x7c000164
235236
#define PPC_INST_MTTMR 0x7c0003dc
236237
#define PPC_INST_NOP 0x60000000
237238
#define PPC_INST_PASTE 0x7c20070d
238239
#define PPC_INST_POPCNTB 0x7c0000f4
239240
#define PPC_INST_POPCNTB_MASK 0xfc0007fe
240241
#define PPC_INST_POPCNTD 0x7c0003f4
241242
#define PPC_INST_POPCNTW 0x7c0002f4
243+
#define PPC_INST_RFEBB 0x4c000124
242244
#define PPC_INST_RFCI 0x4c000066
243245
#define PPC_INST_RFDI 0x4c00004e
246+
#define PPC_INST_RFID 0x4c000024
244247
#define PPC_INST_RFMCI 0x4c00004c
245248
#define PPC_INST_MFSPR 0x7c0002a6
246249
#define PPC_INST_MFSPR_DSCR 0x7c1102a6
@@ -278,6 +281,7 @@
278281
#define PPC_INST_TRECHKPT 0x7c0007dd
279282
#define PPC_INST_TRECLAIM 0x7c00075d
280283
#define PPC_INST_TABORT 0x7c00071d
284+
#define PPC_INST_TSR 0x7c0005dd
281285

282286
#define PPC_INST_NAP 0x4c000364
283287
#define PPC_INST_SLEEP 0x4c0003a4

0 commit comments

Comments
 (0)