From nobody Tue Feb 10 02:54:41 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.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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499999314118264.5825532993389; Thu, 13 Jul 2017 19:28:34 -0700 (PDT) Received: from localhost ([::1]:35054 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVqLJ-0006sN-1I for importer@patchew.org; Thu, 13 Jul 2017 22:28:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVq97-0003iM-Jk for qemu-devel@nongnu.org; Thu, 13 Jul 2017 22:15:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVq96-0001Kk-HT for qemu-devel@nongnu.org; Thu, 13 Jul 2017 22:15:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47028) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVq96-0001KI-7r for qemu-devel@nongnu.org; Thu, 13 Jul 2017 22:15:56 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 38CF164A73 for ; Fri, 14 Jul 2017 02:15:55 +0000 (UTC) Received: from lemon.redhat.com (ovpn-12-51.pek2.redhat.com [10.72.12.51]) by smtp.corp.redhat.com (Postfix) with ESMTP id C08D761F21; Fri, 14 Jul 2017 02:15:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 38CF164A73 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=famz@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 38CF164A73 From: Fam Zheng To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 10:15:08 +0800 Message-Id: <20170714021509.23681-20-famz@redhat.com> In-Reply-To: <20170714021509.23681-1-famz@redhat.com> References: <20170714021509.23681-1-famz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 14 Jul 2017 02:15:55 +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 v4 19/20] cpu: 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 --- exec.c | 27 +++++++++++++++------------ include/qom/cpu.h | 1 + qom/cpu.c | 1 + 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/exec.c b/exec.c index a083ff8..385c2d0 100644 --- a/exec.c +++ b/exec.c @@ -27,6 +27,7 @@ #include "exec/target_page.h" #include "tcg.h" #include "hw/qdev-core.h" +#include "hw/qdev-properties.h" #if !defined(CONFIG_USER_ONLY) #include "hw/boards.h" #include "hw/xen/xen.h" @@ -735,6 +736,20 @@ void cpu_exec_unrealizefn(CPUState *cpu) } } =20 +Property cpu_common_props[] =3D { +#ifndef CONFIG_USER_ONLY + /* Create a memory property for softmmu CPU object, + * so users can wire up its memory. (This can't go in qom/cpu.c + * because that file is compiled only once for both user-mode + * and system builds.) The default if no link is set up is to use + * the system address space. + */ + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, + MemoryRegion *), +#endif + DEFINE_PROP_END_OF_LIST(), +}; + void cpu_exec_initfn(CPUState *cpu) { cpu->as =3D NULL; @@ -742,18 +757,6 @@ void cpu_exec_initfn(CPUState *cpu) =20 #ifndef CONFIG_USER_ONLY cpu->thread_id =3D qemu_get_thread_id(); - - /* This is a softmmu CPU object, so create a property for it - * so users can wire up its memory. (This can't go in qom/cpu.c - * because that file is compiled only once for both user-mode - * and system builds.) The default if no link is set up is to use - * the system address space. - */ - object_property_add_link(OBJECT(cpu), "memory", TYPE_MEMORY_REGION, - (Object **)&cpu->memory, - qdev_prop_allow_set_link_before_realize, - OBJ_PROP_LINK_UNREF_ON_RELEASE, - &error_abort); cpu->memory =3D system_memory; object_ref(OBJECT(cpu->memory)); #endif diff --git a/include/qom/cpu.h b/include/qom/cpu.h index 7bfd50c..e456cef 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -1015,6 +1015,7 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, in= t asidx); =20 void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) GCC_FMT_ATTR(2, 3); +extern Property cpu_common_props[]; void cpu_exec_initfn(CPUState *cpu); void cpu_exec_realizefn(CPUState *cpu, Error **errp); void cpu_exec_unrealizefn(CPUState *cpu); diff --git a/qom/cpu.c b/qom/cpu.c index 8757f03..a39ff6c 100644 --- a/qom/cpu.c +++ b/qom/cpu.c @@ -458,6 +458,7 @@ static void cpu_class_init(ObjectClass *klass, void *da= ta) set_bit(DEVICE_CATEGORY_CPU, dc->categories); dc->realize =3D cpu_common_realizefn; dc->unrealize =3D cpu_common_unrealizefn; + dc->props =3D cpu_common_props; /* * Reason: CPUs still need special care by board code: wiring up * IRQs, adding reset handlers, halting non-first CPUs, ... --=20 2.9.4