[RFC PATCH 4/6] KVM: PPC: Book3E: Add AltiVec support

Caraman Mihai Claudiu-B02008 B02008 at freescale.com
Wed Jun 5 19:23:00 EST 2013


> > + * 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




More information about the Linuxppc-dev mailing list