From: David Gibson <david@gibson.dropbear.id.au>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c
Date: Mon, 8 Oct 2018 11:57:03 +1100 [thread overview]
Message-ID: <20181008005703.GQ7004@umbus.fritz.box> (raw)
In-Reply-To: <1322d08f-9612-99d6-7ace-7b470beafa9a@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2932 bytes --]
On Fri, Oct 05, 2018 at 08:12:12AM +0200, Thomas Huth wrote:
> On 2018-10-05 06:25, David Gibson wrote:
> > On Thu, Oct 04, 2018 at 12:07:01PM +0200, Thomas Huth wrote:
> >> The spapr-rng device is suboptimal when compared to virtio-rng, so
> >> users might want to disable it in their builds. Thus let's introduce
> >> a proper CONFIG switch to allow us to compile QEMU without this device.
> >>
> >> Signed-off-by: Thomas Huth <thuth@redhat.com>
> >
> > Uh, sure, I guess so.
>
> Yes, we definitely want this for the QEMU in RHEL :-)
>
> >> diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c
> >> index d2acd61..dec8434 100644
> >> --- a/hw/ppc/spapr_rng.c
> >> +++ b/hw/ppc/spapr_rng.c
> >> @@ -27,6 +27,7 @@
> >> #include "sysemu/rng.h"
> >> #include "hw/ppc/spapr.h"
> >> #include "kvm_ppc.h"
> >> +#include "spapr_rng.h"
> >>
> >> #define SPAPR_RNG(obj) \
> >> OBJECT_CHECK(sPAPRRngState, (obj), TYPE_SPAPR_RNG)
> >> @@ -132,29 +133,6 @@ static void spapr_rng_realize(DeviceState *dev, Error **errp)
> >> }
> >> }
> >>
> >> -int spapr_rng_populate_dt(void *fdt)
> >> -{
> >> - int node;
> >> - int ret;
> >> -
> >> - node = qemu_fdt_add_subnode(fdt, "/ibm,platform-facilities");
> >> - if (node <= 0) {
> >> - return -1;
> >> - }
> >> - ret = fdt_setprop_string(fdt, node, "device_type",
> >> - "ibm,platform-facilities");
> >> - ret |= fdt_setprop_cell(fdt, node, "#address-cells", 0x1);
> >> - ret |= fdt_setprop_cell(fdt, node, "#size-cells", 0x0);
> >> -
> >> - node = fdt_add_subnode(fdt, node, "ibm,random-v1");
> >> - if (node <= 0) {
> >> - return -1;
> >> - }
> >> - ret |= fdt_setprop_string(fdt, node, "compatible", "ibm,random");
> >> -
> >> - return ret ? -1 : 0;
> >> -}
> >> -
> >
> > Moving this to an inline doesn't seem right to me though - it's a more
> > complex function that we usually want in a .h inline, and I don't
> > really see a good reason for it to be there (rather than an #ifdeffed
> > stub).
>
> An #ifdef is not possible here - the CONFIG switches for the targets are
> *not* turned into pre-processor macros, only the CONFIG switches for the
> host settings.
Ah, right.
> So putting this function as static inline into a separate
> header seems to be the best option to me right now. Alternatively, I
> could also put it directly into spapr.c directly, but that file is
> already very big... well, I don't mind, let me know what you prefer.
I'd prefer spapr.c to the inline.
But.. couldn't you put a stub version in stubs? That would make a
weak symbol that would be overridden when SPAPR_RNG is compiled in.
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2018-10-08 1:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-04 10:07 [Qemu-devel] [PATCH] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c Thomas Huth
2018-10-05 4:25 ` David Gibson
2018-10-05 6:12 ` Thomas Huth
2018-10-08 0:57 ` David Gibson [this message]
2018-10-08 11:10 ` Thomas Huth
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181008005703.GQ7004@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).