From: Nicholas Piggin Date: Wed, 20 Oct 2021 05:35:44 +0000 Subject: Re: [PATCH v3 19/52] KVM: PPC: Book3S HV P9: Reduce mtmsrd instructions required to save host SPRs Message-Id: <1634707623.6hcz0vobiz.astroid@bobo.none> List-Id: References: <20211004160049.1338837-1-npiggin@gmail.com> <20211004160049.1338837-20-npiggin@gmail.com> <87r1clw0a7.fsf@linux.ibm.com> In-Reply-To: <87r1clw0a7.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Fabiano Rosas , kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Excerpts from Fabiano Rosas's message of October 16, 2021 11:45 pm: > Nicholas Piggin writes: > >> This reduces the number of mtmsrd required to enable facility bits when >> saving/restoring registers, by having the KVM code set all bits up front >> rather than using individual facility functions that set their particular >> MSR bits. >> >> Signed-off-by: Nicholas Piggin > > Reviewed-by: Fabiano Rosas > > Aside: at msr_check_and_set what's with MSR_VSX always being implicitly > set whenever MSR_FP is set? I get that it depends on MSR_FP, but if FP > always implies VSX, then you could stop setting MSR_VSX in this patch. Good question, this seems to come from quite old code and is carried forward. I did not immediately see why, might have been to avoid another mtmsrd operation if we later want to set VSX. But the rule seems to be to set MSR_VSX if both FP and VEC are set, so this seems a bit odd. __msr_check_and_clear similarly clears VSX if we clear FP, but not if we clear VEC. I might be good to remove that logic or turn it into warnings and make sure the callers do the right thing. Not sure. Thanks, Nick