From: Thomas Huth <thuth@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
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 13:10:26 +0200 [thread overview]
Message-ID: <2bbbb695-b8a6-e7a4-72cf-2268f7f6c173@redhat.com> (raw)
In-Reply-To: <20181008005703.GQ7004@umbus.fritz.box>
[-- Attachment #1: Type: text/plain, Size: 3055 bytes --]
On 2018-10-08 02:57, David Gibson wrote:
> 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.
We could ... but stubs should IMHO only be used if there is no other
good solution. In this case, it's perfectly fine if we just move the
spapr_rng_populate_dt() function to another location. So I'll have a try
with spapr.c instead.
Thomas
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2018-10-08 11:16 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
2018-10-08 11:10 ` Thomas Huth [this message]
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=2bbbb695-b8a6-e7a4-72cf-2268f7f6c173@redhat.com \
--to=thuth@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/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).