From: Stewart Smith Subject: Re: [PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register Date: Tue, 29 Jul 2014 08:59:16 +1000 Message-ID: References: <1401970085-14493-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <1401970085-14493-2-git-send-email-aneesh.kumar@linux.vnet.ibm.com> <53919B83.4070308@suse.de> <874mzyxati.fsf@linux.vnet.ibm.com> <53D64F4C.80208@suse.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org To: Alexander Graf , "Aneesh Kumar K.V" , benh@kernel.crashing.org, paulus@samba.org Return-path: In-Reply-To: <53D64F4C.80208@suse.de> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org Alexander Graf writes: > --- a/arch/powerpc/include/asm/reg.h > +++ b/arch/powerpc/include/asm/reg.h > @@ -25,7 +25,6 @@ > #ifdef CONFIG_8xx > #include > #endif /* CONFIG_8xx */ > -#include > > #define MSR_SF_LG 63 /* Enable 64 bit mode */ > #define MSR_ISF_LG 61 /* Interrupt 64b mode valid on > 630 */ > @@ -1210,12 +1209,6 @@ static inline unsigned long mfvtb (void) > if (cpu_has_feature(CPU_FTR_ARCH_207S)) > return mfspr(SPRN_VTB); > #endif > - /* > - * The above mfspr will be a no-op on anything before Power8 > - * That can result in random values returned. We need to > - * capture that. > - */ > - BUG(); > return 0; > } (i missed CCing aneesh on this mail in reply to the build robot, so inserting the same reply here) the only place that calls it also does the cpu_has_feature() check and returns 0 ifndef CONFIG_PPC_BOOK3S_64 or !cpu_has_feature(). Looking get_vtb (the only caller) and the places it's called (as well as PowerISA 2.07) I think in the emulation code we're missing invoking the "system privileged instruction error handler" as the VTB SPR has spr bit 0 set to 1 (page 107 of PowerISA 2.07, mfspr docs). That being said... any guest sholud do the cpu_has_feature check themselves, so this probably isn't an issue in the real world. Certainly the host really shouldn't BUG() for what is really a guest issue (actually.. this would be a good DoS attack on < Power8 host). Reviewed-by: Stewart Smith