From nobody Tue Feb 10 05:44:27 2026 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.zoho.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; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499151846858417.14350635745893; Tue, 4 Jul 2017 00:04:06 -0700 (PDT) Received: from localhost ([::1]:38965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHsS-0005KI-Jc for importer@patchew.org; Tue, 04 Jul 2017 03:04:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dSHZc-0004VK-49 for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dSHZb-0003DC-BV for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47820) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dSHZb-0003Cv-5c for qemu-devel@nongnu.org; Tue, 04 Jul 2017 02:44:35 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C880C0467C4 for ; Tue, 4 Jul 2017 06:44:34 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-33.pek2.redhat.com [10.72.12.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id C840C5C469; Tue, 4 Jul 2017 06:44:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2C880C0467C4 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2C880C0467C4 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 4 Jul 2017 14:43:47 +0800 Message-Id: <20170704064347.7022-21-famz@redhat.com> In-Reply-To: <20170704064347.7022-1-famz@redhat.com> References: <20170704064347.7022-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 04 Jul 2017 06:44:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v3 20/20] spapr_rng: Convert to DEFINE_PROP_LINK 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: Paolo Bonzini , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Fam Zheng --- hw/ppc/spapr_rng.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/ppc/spapr_rng.c b/hw/ppc/spapr_rng.c index 80515eb..fcffc65 100644 --- a/hw/ppc/spapr_rng.c +++ b/hw/ppc/spapr_rng.c @@ -34,7 +34,8 @@ struct sPAPRRngState { /*< private >*/ DeviceState ds; - RngBackend *backend; + /* RngBackend pointer to be fill by link property */ + Object *backend; bool use_kvm; }; typedef struct sPAPRRngState sPAPRRngState; @@ -81,7 +82,8 @@ static target_ulong h_random(PowerPCCPU *cpu, sPAPRMachin= eState *spapr, hrdata.received =3D 0; =20 while (hrdata.received < 8) { - rng_backend_request_entropy(rngstate->backend, 8 - hrdata.received, + rng_backend_request_entropy(RNG_BACKEND(rngstate->backend), + 8 - hrdata.received, random_recv, &hrdata); qemu_mutex_unlock_iothread(); qemu_sem_wait(&hrdata.sem); @@ -96,17 +98,11 @@ static target_ulong h_random(PowerPCCPU *cpu, sPAPRMach= ineState *spapr, =20 static void spapr_rng_instance_init(Object *obj) { - sPAPRRngState *rngstate =3D SPAPR_RNG(obj); - if (object_resolve_path_type("", TYPE_SPAPR_RNG, NULL) !=3D NULL) { error_report("spapr-rng can not be instantiated twice!"); return; } =20 - object_property_add_link(obj, "rng", TYPE_RNG_BACKEND, - (Object **)&rngstate->backend, - object_property_allow_set_link, - OBJ_PROP_LINK_UNREF_ON_RELEASE, NULL); object_property_set_description(obj, "rng", "ID of the random number generator bac= kend", NULL); @@ -163,6 +159,7 @@ int spapr_rng_populate_dt(void *fdt) =20 static Property spapr_rng_properties[] =3D { DEFINE_PROP_BOOL("use-kvm", sPAPRRngState, use_kvm, false), + DEFINE_PROP_LINK("rng", sPAPRRngState, backend, TYPE_RNG_BACKEND), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 2.9.4