[PATCH v3 29/33] KVM: PPC: Book3S HV: Handle differing endianness for H_ENTER_NESTED

Paul Mackerras paulus at ozlabs.org
Thu Oct 4 19:29:38 AEST 2018


On Wed, Oct 03, 2018 at 04:13:36PM +1000, David Gibson wrote:
> On Tue, Oct 02, 2018 at 09:31:28PM +1000, Paul Mackerras wrote:
> > From: Suraj Jitindar Singh <sjitindarsingh at gmail.com>
> > 
> > The hcall H_ENTER_NESTED takes as the two parameters the address in
> > L1 guest memory of a hv_regs struct and a pt_regs struct which the
> > L1 guest would like to use to run a L2 guest and in which are returned
> > the exit state of the L2 guest.  For efficiency, these are in the
> > endianness of the L1 guest, rather than being always big-endian as is
> > usually the case for PAPR hypercalls.
> 
> Does that actually make a difference for efficiency?  I thought the
> presence of the byte-reversing loads and stores meant byteswapping was
> basically zero-cost on POWER.

It means that the L1 hypervisor can pass a pointer to the regs struct
in the kvm_vcpu struct rather than having to make a copy, and copy the
values back after the H_ENTER_NESTED.  I'll reword the commit message
to say it's mostly about convenience and to a lesser extent about
performance.

Paul.



More information about the Linuxppc-dev mailing list