From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54871) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZwMM-0006Eo-TH for qemu-devel@nongnu.org; Thu, 10 Sep 2015 03:33:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZwMI-0001Zp-RP for qemu-devel@nongnu.org; Thu, 10 Sep 2015 03:33:30 -0400 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> <20150908051528.GD24774@voom.redhat.com> <55F0A036.2090508@redhat.com> From: Thomas Huth Message-ID: <55F13241.8040004@redhat.com> Date: Thu, 10 Sep 2015 09:33:21 +0200 MIME-Version: 1.0 In-Reply-To: <55F0A036.2090508@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="vadD1i8jG2hHmD4qIwmOilXKdFQXVu5j2" 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: David Gibson , Sam Bobroff Cc: michael@ellerman.id.au, amit.shah@redhat.com, qemu-ppc@nongnu.org, armbru@redhat.com, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --vadD1i8jG2hHmD4qIwmOilXKdFQXVu5j2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/09/15 23:10, Thomas Huth wrote: > On 08/09/15 07:15, David Gibson wrote: =2E.. >> 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 > I gave that I try, but it does not work as expected. To be able to > specify the options, I'd need to instantiate this device with the > "-device" option, right? Something like: >=20 > -device spapr-rng,backend=3Drng0,usekvm=3D0 >=20 > Now this does not work when I use TYPE_SYS_BUS_DEVICE as parent class > like it is done for spapr-rtc, since the user apparently can not plug > device to this bus on machine spapr (you can also not plug an spapr-rtc= > device this way!). >=20 > The spapr-vlan, spapr-vty, etc. devices are TYPE_VIO_SPAPR_DEVICE, so I= > also tried that instead, but then the rng device suddenly shows up unde= r > /vdevice in the device tree - that's also not what we want, I guess. I did some more tests, and I think I can get this working with one small modification to spapr_vio.c: diff --git a/hw/ppc/spapr_vio.c b/hw/ppc/spapr_vio.c index c51eb8e..8e7f6b4 100644 --- a/hw/ppc/spapr_vio.c +++ b/hw/ppc/spapr_vio.c @@ -99,6 +99,14 @@ static int vio_make_devnode(VIOsPAPRDevice *dev, int vdevice_off, node_off, ret; char *dt_name; + if (!pc->dt_name) { + ret =3D 0; + if (pc->devnode) { + ret =3D (pc->devnode)(dev, fdt, -1); + } + return ret; + } + vdevice_off =3D fdt_path_offset(fdt, "/vdevice"); if (vdevice_off < 0) { return vdevice_off; i.e. when the dt_name has not been set, the device won't be added to the /vdevice device tree node. If that's acceptable, I'll continue with this approach. Thomas --vadD1i8jG2hHmD4qIwmOilXKdFQXVu5j2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAEBAgAGBQJV8TJBAAoJEC7Z13T+cC21nNEQAIiBDbbihC0gBVZvYYhB1Gnb Uujheo7W1I1HLB/OCovHpZq/jsGcZt6gOX9/ROZ3rS/1cKl35kfunZ8m9k6Q+EOD 1RIF1nn8z1xmMjE+A3mFmEbkDy/uL67iSBCv54TjQ7HqxKELN9TzbW9tBWUAL9q6 BPeo0Jujt/J+nSjk9gmCxpH4cEEF1AHkv3i26W+UMV9BhO2skHLnSZUJjwZ46dPD BiAsChj9QylFoI42tzwWSwFtrKFXDe+1nzzFTilPY+SnzOHpqDll4EoMFx04hUAD +iss67Fj3n1//oPzYn+E4tclS15rpFKhAGVZ1Lyk7bld5utD5w1B2ImMFmXNTiLA M4v1fQkj8LXDvbKzHuMeaU4toaOL55FmP2LHyhhutrsKtS0OQnmACesHiiqQxFSD Tir1ziply2X8TdnnYx0bLFs9ac9LBM1/nexGq9n1WTjB2puD3RCpEz1nrE4pz+tt u/uHbdwYDJkhb1jonr+bDEdEUFVb2e6tSLzrMoUziewMhlUfRAsc+qs7ae54y+zD sZSZqlnp89FTwsTEZRsWQfidSGAj/5teibdZvLTuSLKthqD7rvjE3ns6mYgWghsK Af46yWtA5BL8Rsr3gp1XmBqpSSzG69SwcPibAeYBJfjULMUykav2Th/lZcLZFoc2 MxMpsOCvbkn6TZMNX66n =u4FG -----END PGP SIGNATURE----- --vadD1i8jG2hHmD4qIwmOilXKdFQXVu5j2--