[PATCH 1/4] KVM: PPC: BOOK3S: PR: Emulate virtual timebase register

Stewart Smith stewart at linux.vnet.ibm.com
Tue Jul 29 08:59:16 EST 2014


Alexander Graf <agraf at suse.de> writes:
> --- a/arch/powerpc/include/asm/reg.h
> +++ b/arch/powerpc/include/asm/reg.h
> @@ -25,7 +25,6 @@
>   #ifdef CONFIG_8xx
>   #include <asm/reg_8xx.h>
>   #endif /* CONFIG_8xx */
> -#include <asm/bug.h>
>
>   #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 <stewart at linux.vnet.ibm.com>



More information about the Linuxppc-dev mailing list