> > + * Simulate AltiVec unavailable fault to load guest state
> > + * from thread to AltiVec unit.
> > + * It requires to be called with preemption disabled.
> > + */
> > +static inline void kvmppc_load_guest_altivec(struct kvm_vcpu *vcpu)
> > +{
> > +#ifdef CONFIG_ALTIVEC
> > +   if (cpu_has_feature(CPU_FTR_ALTIVEC)) {
> > +           if (!(current->thread.regs->msr & MSR_VEC)) {
> > +                   load_up_altivec(NULL);
> > +                   current->thread.regs->msr |= MSR_VEC;
> > +           }
> > +   }
> > +#endif
> 
> Why not use kvmppc_supports_altivec()?  In fact, there's nothing
> KVM-specific about these functions...

I will do so, I had this code before kvmppc_supports_altivec() :)

> >  static inline bool kvmppc_supports_spe(void)
> >  {
> >  #ifdef CONFIG_SPE
> > @@ -947,7 +1016,7 @@ int kvmppc_handle_exit(struct kvm_run *run,
> > struct kvm_vcpu *vcpu,
> >              */
> >             bool handled = false;
> >
> > -           if (kvmppc_supports_spe()) {
> > +           if (kvmppc_supports_altivec() || kvmppc_supports_spe())
> > {
> >  #ifdef CONFIG_SPE
> >                     if (cpu_has_feature(CPU_FTR_SPE))
> >                             if (vcpu->arch.shared->msr & MSR_SPE) {
> 
> The distinction between how you're handling SPE and Altivec here
> doesn't really have anything to do with SPE versus Altivec -- it's
> PR-mode versus HV-mode.

I was mislead by MSR_SPE bit, we should rename it as MSR_SPV.

-Mike


_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Reply via email to