Re: [PATCH -v5] x86/kvm: Implement HWCR support

Borislav Petkov
2019-04-08T14:57:30Z

On Mon, Apr 08, 2019 at 07:41:15AM -0700, Sean Christopherson wrote:
> > +{
> > + if (guest_cpuid_is_amd(vcpu)) {
> > + struct msr_data tmp;
> > +
> > + tmp.index = MSR_K7_HWCR;
> > +
> > + if (kvm_get_msr_common(vcpu, &tmp))
>
> No need to get through kvm_get_msr_common(), vcpu->arch.msr_hwcr can be
> queried directly. Going that route would likely eliminate the need for a
> helper func, i.e. avoid the naming confusion and the comment below.

Agree with every point except this: the helper function abstracts
the guest cpuid check and the rest of the handling nicely. If I put
everything in an already too big default: label in set_msr_mce(), then
the code there will become even more unreadable than it is.

Thx.

--
Regards/Gruss,
Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.