qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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: Fri, 5 Oct 2018 08:12:12 +0200	[thread overview]
Message-ID: <1322d08f-9612-99d6-7ace-7b470beafa9a@redhat.com> (raw)
In-Reply-To: <20181005042527.GN7004@umbus.fritz.box>

[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

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. 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.

 Thomas


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2018-10-05  6:12 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 [this message]
2018-10-08  0:57     ` David Gibson
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=1322d08f-9612-99d6-7ace-7b470beafa9a@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).