[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 05/22] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG swi
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 05/22] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c |
Date: |
Thu, 8 Nov 2018 23:16:29 +1100 |
From: Thomas Huth <address@hidden>
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 <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
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-softmmu.mak
index f550573782..aec2855750 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -18,3 +18,4 @@ CONFIG_XICS_SPAPR=$(CONFIG_PSERIES)
CONFIG_XICS_KVM=$(call land,$(CONFIG_PSERIES),$(CONFIG_KVM))
CONFIG_MEM_DEVICE=y
CONFIG_DIMM=y
+CONFIG_SPAPR_RNG=y
diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs
index 4ab5564672..4e0c1c0941 100644
--- a/hw/ppc/Makefile.objs
+++ b/hw/ppc/Makefile.objs
@@ -3,8 +3,9 @@ obj-y += ppc.o ppc_booke.o fdt.o
# IBM pSeries (sPAPR)
obj-$(CONFIG_PSERIES) += spapr.o spapr_caps.o spapr_vio.o spapr_events.o
obj-$(CONFIG_PSERIES) += spapr_hcall.o spapr_iommu.o spapr_rtas.o
-obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o spapr_rng.o
+obj-$(CONFIG_PSERIES) += spapr_pci.o spapr_rtc.o spapr_drc.o
obj-$(CONFIG_PSERIES) += spapr_cpu_core.o spapr_ovec.o spapr_irq.o
+obj-$(CONFIG_SPAPR_RNG) += spapr_rng.o
# IBM PowerNV
obj-$(CONFIG_POWERNV) += 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 c08130facb..e47b004b61 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -610,6 +610,29 @@ static void spapr_populate_cpus_dt_node(void *fdt,
sPAPRMachineState *spapr)
g_free(rev);
}
+static 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;
+}
+
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 d2acd61a15..644bac96f8 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)
}
}
-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;
-}
-
static Property spapr_rng_properties[] = {
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 ad4d7cfd97..0805ad85a1 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);
#define TYPE_SPAPR_RNG "spapr-rng"
-int spapr_rng_populate_dt(void *fdt);
-
#define SPAPR_MEMORY_BLOCK_SIZE (1 << 28) /* 256MB */
/*
--
2.19.1
- [Qemu-ppc] [PULL 03/22] ppc4xx_pci: convert SysBus init method to a realize method, (continued)
- [Qemu-ppc] [PULL 03/22] ppc4xx_pci: convert SysBus init method to a realize method, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 08/22] target/ppc: Introduce fp number classification, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 10/22] target/ppc: Split out float_invalid_op_mul, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 04/22] PPC: e500: convert SysBus init method to a realize method, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 11/22] target/ppc: Split out float_invalid_op_div, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 19/22] hw/ppc/ppc440_uc: Remove dead code in sdram_size(), David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 13/22] spapr_pci: convert g_malloc() to g_new(), David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 09/22] target/ppc: Split out float_invalid_op_addsub, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 20/22] This patch fixes processing of rfi instructions in icount mode., David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 05/22] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c,
David Gibson <=
- [Qemu-ppc] [PULL 18/22] MAINTAINERS: PPC: Remove myself, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 22/22] ppc/spapr_caps: Add SPAPR_CAP_NESTED_KVM_HV, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 12/22] target/ppc: Split out float_invalid_cvt, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 06/22] target/ppc: Split up float_invalid_op_excp, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 01/22] target/ppc: add external PID support, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 07/22] target/ppc: Remove float_check_status, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 15/22] hw/ppc/mac_newworld: Free openpic_irqs array after use, David Gibson, 2018/11/08