From mboxrd@z Thu Jan 1 00:00:00 1970 From: Segher Boessenkool Date: Wed, 14 Aug 2019 18:34:32 +0000 Subject: Re: [PATCH v5 2/7] powerpc/kernel: Add ucall_norets() ultravisor call handler Message-Id: <20190814183432.GG31406@gate.crashing.org> List-Id: References: <20190808040555.2371-1-cclaudio@linux.ibm.com> <20190808040555.2371-3-cclaudio@linux.ibm.com> <87wofgqb2g.fsf@concordia.ellerman.id.au> In-Reply-To: <87wofgqb2g.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Michael Ellerman Cc: Madhavan Srinivasan , Michael Anderson , Ram Pai , Claudio Carvalho , kvm-ppc@vger.kernel.org, Bharata B Rao , linuxppc-dev@ozlabs.org, Ryan Grimm , Sukadev Bhattiprolu , Guerney Hunt , Thiago Bauermann On Wed, Aug 14, 2019 at 08:46:15PM +1000, Michael Ellerman wrote: > Claudio Carvalho writes: > > +_GLOBAL(ucall_norets) > > +EXPORT_SYMBOL_GPL(ucall_norets) > > + mfcr r0 > > + stw r0,8(r1) > > + > > + sc 2 /* Invoke the ultravisor */ > > + > > + lwz r0,8(r1) > > + mtcrf 0xff,r0 > > + blr /* Return r3 =3D status */ >=20 > Paulus points that we shouldn't need to save CR here. Our caller will > have already saved it if it needed to, and we don't use CR in this > function so we don't need to save it. >=20 > That's assuming the Ultravisor follows the hcall ABI in which CR2-4 are > non-volatile (PAPR =A7 14.5.3). And assuming the ultravisor already clears (or sets, or whatever) all CR fields it does not want to leak the contents of (which it also should, of course). > I know plpar_hcall_norets() does save CR, but it shouldn't need to, that > seems to be historical. aka. no one knows why it does it but it always > has. Segher