From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55413) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZBFR-0001Em-Vt for qemu-devel@nongnu.org; Tue, 08 Sep 2015 01:15:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZBFO-0004X8-Ps for qemu-devel@nongnu.org; Tue, 08 Sep 2015 01:15:13 -0400 Date: Tue, 8 Sep 2015 15:15:28 +1000 From: David Gibson Message-ID: <20150908051528.GD24774@voom.redhat.com> References: <1441046762-5788-1-git-send-email-thuth@redhat.com> <1441046762-5788-2-git-send-email-thuth@redhat.com> <20150901003808.GI11475@voom.redhat.com> <55E583A6.4000600@redhat.com> <20150908050316.GA372@tungsten.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wLAMOaPNJ0fu1fTG" Content-Disposition: inline In-Reply-To: <20150908050316.GA372@tungsten.ozlabs.ibm.com> Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH v2 1/2] spapr: Add support for hwrng when available List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Sam Bobroff Cc: Thomas Huth , armbru@redhat.com, qemu-devel@nongnu.org, michael@ellerman.id.au, qemu-ppc@nongnu.org, amit.shah@redhat.com --wLAMOaPNJ0fu1fTG Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 08, 2015 at 03:03:16PM +1000, Sam Bobroff wrote: > On Tue, Sep 01, 2015 at 12:53:26PM +0200, Thomas Huth wrote: > > On 01/09/15 02:38, David Gibson wrote: > > > On Mon, Aug 31, 2015 at 08:46:01PM +0200, Thomas Huth wrote: > > >> From: Michael Ellerman > > >> > > >> Some powerpc systems have support for a hardware random number gener= ator > > >> (hwrng). If such a hwrng is present the host kernel can provide acce= ss > > >> to it via the H_RANDOM hcall. > > >> > > >> The kernel advertises the presence of a hwrng with the KVM_CAP_PPC_H= WRNG > > >> capability. If this is detected we add the appropriate device tree b= its > > >> to advertise the presence of the hwrng to the guest kernel. > > >> > > >> Signed-off-by: Michael Ellerman > > >> [thuth: Refreshed patch so it applies to QEMU master branch] > > >> Signed-off-by: Thomas Huth > > >=20 > > > So, I'm confused by one thing. > > >=20 > > > I thought new kernel handled hcalls were supposed to be disabled by > > > default, but I don't see any calls to kvmppc_enable_hcall() to turn on > > > H_RANDOM. > >=20 > > Michael's patch was from 2013, the kvmppc_enable_hcall() stuff seems to > > be from 2014 ... so the enablement is likely missing in this patch, > > indeed. I didn't test the in-kernel hypercall yet, just my QEMU > > implementation so far, that's why I did not notice this yet. > >=20 > > Michael, do you want to rework your patch? Or shall I add an additional > > enablement patch to my queue? >=20 > If I recall correctly, it's specifically not enabled: there was quite a l= ot of > discussion about it when Michael posted the patches and I think the conse= nsus > was that it should only be enabled by QEMU, and only if the user could de= cide > if it was used or not. >=20 > What if we set up another backend that just enables the hcall in KVM? I think that's basically the right approach. It can't quite be a "backend" as such, since the in-kernel hcall can only supply H_RANDOM; it can't supply random for other purposes like virtio-rng, which the general qemu rng backends can. So I'd suggest two options controlling H_RANDOM: usekvm : boolean [default true] Whether to enable the in-kernel implementation if available backend : ref to rng backend object [no default] Backend to use if in-kernel implementation is unavailable or disabled. At this point rather than just implementing them as discrete machine options, I suspect it will be more maintainable to split out the h-random implementation as a pseudo-device with its own qdev and so forth. We already do similarly for the RTAS time of day functions (spapr-rtc). --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --wLAMOaPNJ0fu1fTG Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJV7m7wAAoJEGw4ysog2bOSuhsP/RL/1rKgvJnnc3sr1cUXDly6 SxC4ptXk7iZlyV28g6ez/yFam/76QMspH+hVRcsazsW7vdgDiPJNOrAIQ9ccHTbD MYP8QseXfhXP4Rjc9OUXAE5rzOCvF27N8Zi7Nj88sECFDBB6VvY4cOFK/5KakBuR AdJZFq7QL4AEtsejfzcgVE82fNzC3MchiS5gG97jyEKVdT25umL5iBysWP8ZXNal BvFX4qqN6hafmo/5dIEzzGsIC/97xX5fo2GMrZjalYXc1URpuzf4GLuuHTs4Y5jJ YucoeT8UAC+RfXLg/If7Ith1HUMBw8pYT7NTtbIRwdn2d9sSmJj4U4y/XalmJr8F ScxZlh5WNumoHngIA3wiqDIhJPbr9bCqBuzizVgVky0t8j6ki+7dsrhsdRS0rQ6A jkZvG7zhZv9vxPTSXM4XKTwEIm9rqb8Uwg7JbPXZerGTKY8ddGcuiXao/xB0ILM9 b3p9uIogvUXEINijTCx1TG5iA/Zhj+4peEw7pYQt/Tp/tZgA7/bbLwqjvKtECJO4 MX75K7swwHmjXaovcAZ7LD6oli/6UK5W7+LrdFYwP6DCg+bOX8tuoRUW+IxGmFDS /Vw+E6v2MKZV6AxMyqBjk68eXLsgTG7agD7PaVmMSQFAH5ZAmmDqbS4XML/R1cO8 zUO+7T2TugRqPLdcpTSX =dFIz -----END PGP SIGNATURE----- --wLAMOaPNJ0fu1fTG--