From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabiano Rosas Date: Tue, 23 Mar 2021 15:53:04 +0000 Subject: Re: [PATCH v4 44/46] KVM: PPC: Book3S HV P9: implement hash guest support Message-Id: <87tup1kgtb.fsf@linux.ibm.com> List-Id: References: <20210323010305.1045293-1-npiggin@gmail.com> <20210323010305.1045293-45-npiggin@gmail.com> In-Reply-To: <20210323010305.1045293-45-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nicholas Piggin , kvm-ppc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Nicholas Piggin Nicholas Piggin writes: > Guest entry/exit has to restore and save/clear the SLB, plus several > other bits to accommodate hash guests in the P9 path. > > Radix host, hash guest support is removed from the P7/8 path. > > Signed-off-by: Nicholas Piggin > --- > diff --git a/arch/powerpc/kvm/book3s_hv_interrupt.c b/arch/powerpc/kvm/book3s_hv_interrupt.c > index cd84d2c37632..03fbfef708a8 100644 > --- a/arch/powerpc/kvm/book3s_hv_interrupt.c > +++ b/arch/powerpc/kvm/book3s_hv_interrupt.c > @@ -55,6 +55,50 @@ static void __accumulate_time(struct kvm_vcpu *vcpu, struct kvmhv_tb_accumulator > #define accumulate_time(vcpu, next) do {} while (0) > #endif > > +static inline void mfslb(unsigned int idx, u64 *slbee, u64 *slbev) > +{ > + asm volatile("slbmfev %0,%1" : "=r" (*slbev) : "r" (idx)); > + asm volatile("slbmfee %0,%1" : "=r" (*slbee) : "r" (idx)); > +} > + > +static inline void __mtslb(u64 slbee, u64 slbev) > +{ > + asm volatile("slbmte %0,%1" :: "r" (slbev), "r" (slbee)); > +} > + > +static inline void mtslb(unsigned int idx, u64 slbee, u64 slbev) > +{ > + BUG_ON((slbee & 0xfff) != idx); > + > + __mtslb(slbee, slbev); > +} > + > +static inline void slb_invalidate(unsigned int ih) > +{ > + asm volatile("slbia %0" :: "i"(ih)); > +} Fyi, in my environment the assembler complains: {standard input}: Assembler messages: {standard input}:1293: Error: junk at end of line: `6' {standard input}:2138: Error: junk at end of line: `6' make[3]: *** [../scripts/Makefile.build:271: arch/powerpc/kvm/book3s_hv_interrupt.o] Error 1 This works: - asm volatile("slbia %0" :: "i"(ih)); + asm volatile(PPC_SLBIA(%0) :: "i"(ih)); But I don't know what is going on.