From nobody Mon May 13 17:13:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539003405300627.0437984316836; Mon, 8 Oct 2018 05:56:45 -0700 (PDT) Received: from localhost ([::1]:46052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9V5W-0000zA-6a for importer@patchew.org; Mon, 08 Oct 2018 08:56:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47166) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9V1X-0006L7-Lw for qemu-devel@nongnu.org; Mon, 08 Oct 2018 08:52:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9UpF-0007O9-9M for qemu-devel@nongnu.org; Mon, 08 Oct 2018 08:39:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42990) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9UpD-0007Ml-HV; Mon, 08 Oct 2018 08:39:51 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D72CCC059B7A; Mon, 8 Oct 2018 12:39:47 +0000 (UTC) Received: from thuth.com (dhcp-200-199.str.redhat.com [10.33.200.199]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF1236AEB3; Mon, 8 Oct 2018 12:39:46 +0000 (UTC) From: Thomas Huth To: David Gibson , qemu-ppc@nongnu.org Date: Mon, 8 Oct 2018 14:39:42 +0200 Message-Id: <1539002382-3764-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 08 Oct 2018 12:39:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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. The function spapr_rng_populate_dt is required for linking, so move it to a different location. Signed-off-by: Thomas Huth Reviewed-by: Greg Kurz Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- v2: Put spapr_rng_populate_dt() into spapr.c instead of a header default-configs/ppc64-softmmu.mak | 1 + hw/ppc/Makefile.objs | 3 ++- hw/ppc/spapr.c | 23 +++++++++++++++++++++++ hw/ppc/spapr_rng.c | 23 ----------------------- include/hw/ppc/spapr.h | 2 -- 5 files changed, 26 insertions(+), 26 deletions(-) diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-soft= mmu.mak index b94af6c..24d4717 100644 --- a/default-configs/ppc64-softmmu.mak +++ b/default-configs/ppc64-softmmu.mak @@ -17,3 +17,4 @@ CONFIG_XICS=3D$(CONFIG_PSERIES) CONFIG_XICS_SPAPR=3D$(CONFIG_PSERIES) CONFIG_XICS_KVM=3D$(call land,$(CONFIG_PSERIES),$(CONFIG_KVM)) CONFIG_MEM_HOTPLUG=3Dy +CONFIG_SPAPR_RNG=3Dy diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index 4ab5564..4e0c1c0 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -3,8 +3,9 @@ obj-y +=3D ppc.o ppc_booke.o fdt.o # IBM pSeries (sPAPR) obj-$(CONFIG_PSERIES) +=3D spapr.o spapr_caps.o spapr_vio.o spapr_events.o obj-$(CONFIG_PSERIES) +=3D spapr_hcall.o spapr_iommu.o spapr_rtas.o -obj-$(CONFIG_PSERIES) +=3D spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o +obj-$(CONFIG_PSERIES) +=3D spapr_pci.o spapr_rtc.o spapr_drc.o obj-$(CONFIG_PSERIES) +=3D spapr_cpu_core.o spapr_ovec.o spapr_irq.o +obj-$(CONFIG_SPAPR_RNG) +=3D spapr_rng.o # IBM PowerNV obj-$(CONFIG_POWERNV) +=3D pnv.o pnv_xscom.o pnv_core.o pnv_lpc.o pnv_psi.= o pnv_occ.o pnv_bmc.o ifeq ($(CONFIG_PCI)$(CONFIG_PSERIES)$(CONFIG_LINUX), yyy) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 98868d8..e666872 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -610,6 +610,29 @@ static void spapr_populate_cpus_dt_node(void *fdt, sPA= PRMachineState *spapr) g_free(rev); } =20 +static int spapr_rng_populate_dt(void *fdt) +{ + int node; + int ret; + + node =3D qemu_fdt_add_subnode(fdt, "/ibm,platform-facilities"); + if (node <=3D 0) { + return -1; + } + ret =3D fdt_setprop_string(fdt, node, "device_type", + "ibm,platform-facilities"); + ret |=3D fdt_setprop_cell(fdt, node, "#address-cells", 0x1); + ret |=3D fdt_setprop_cell(fdt, node, "#size-cells", 0x0); + + node =3D fdt_add_subnode(fdt, node, "ibm,random-v1"); + if (node <=3D 0) { + return -1; + } + ret |=3D fdt_setprop_string(fdt, node, "compatible", "ibm,random"); + + return ret ? -1 : 0; +} + static uint32_t spapr_pc_dimm_node(MemoryDeviceInfoList *list, ram_addr_t = addr) { MemoryDeviceInfoList *info; diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index d2acd61..644bac9 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -132,29 +132,6 @@ static void spapr_rng_realize(DeviceState *dev, Error = **errp) } } =20 -int spapr_rng_populate_dt(void *fdt) -{ - int node; - int ret; - - node =3D qemu_fdt_add_subnode(fdt, "/ibm,platform-facilities"); - if (node <=3D 0) { - return -1; - } - ret =3D fdt_setprop_string(fdt, node, "device_type", - "ibm,platform-facilities"); - ret |=3D fdt_setprop_cell(fdt, node, "#address-cells", 0x1); - ret |=3D fdt_setprop_cell(fdt, node, "#size-cells", 0x0); - - node =3D fdt_add_subnode(fdt, node, "ibm,random-v1"); - if (node <=3D 0) { - return -1; - } - ret |=3D fdt_setprop_string(fdt, node, "compatible", "ibm,random"); - - return ret ? -1 : 0; -} - static Property spapr_rng_properties[] =3D { DEFINE_PROP_BOOL("use-kvm", sPAPRRngState, use_kvm, false), DEFINE_PROP_LINK("rng", sPAPRRngState, backend, TYPE_RNG_BACKEND, diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index ad4d7cf..0805ad8 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -745,8 +745,6 @@ int spapr_rtc_import_offset(sPAPRRTCState *rtc, int64_t= legacy_offset); =20 #define TYPE_SPAPR_RNG "spapr-rng" =20 -int spapr_rng_populate_dt(void *fdt); - #define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */ =20 /* --=20 1.8.3.1