From nobody Tue Feb 10 10:55:18 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; dkim=fail; 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 1500027665815682.6957508014392; Fri, 14 Jul 2017 03:21:05 -0700 (PDT) Received: from localhost ([::1]:36754 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVxiZ-0001ll-94 for importer@patchew.org; Fri, 14 Jul 2017 06:21:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42577) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVxYj-0000Qb-OM for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVxYi-00056C-Nt for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:53 -0400 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35089) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVxYi-00055R-33 for qemu-devel@nongnu.org; Fri, 14 Jul 2017 06:10:52 -0400 Received: by mail-wm0-x244.google.com with SMTP id u23so9970259wma.2 for ; Fri, 14 Jul 2017 03:10:52 -0700 (PDT) Received: from 640k.lan (94-39-191-51.adsl-ull.clienti.tiscali.it. [94.39.191.51]) by smtp.gmail.com with ESMTPSA id 143sm2934870wmg.9.2017.07.14.03.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Jul 2017 03:10:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=EtCUARDAnCw7nhkTSFIZd2jKmq9HyE1LQSmdOASixA0=; b=Fkv6+VY7d3ErpNRwawYYLdO93xweRcNFcVfXvpZ1acFc2zpdkOv+Ah/Mf/EredmC0P L4MGguUEcagurW/YvKJTe3qrpKOYRsAqTpCr6oUDn9fvzH24qqPCjMjT7c/1WahmQGUF tVWMDLM5pBp67xf+Y9SbDzm3GD0rGBn/WFEesYWJqtItIpHUhijKnp4sQvjYtm4S9MXW s0k14616p7Ul5qWAlSGYcwBULG3FHSj0bGds4cF53QkIStYa53fddKiLP2wqnA4V+fhk Svf0CQrFmvKOfGQ1tQ0+DOCJih/ktQi6WYb1P5Ys+RdQXWr/T4qAwzbZ6eIgXzyuRATR nYWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=EtCUARDAnCw7nhkTSFIZd2jKmq9HyE1LQSmdOASixA0=; b=fqEbtSJ0HlXp32FLKLvnc6LawTxYG16wYqOMtf++irAx3wzsIBKdvIiNthuISZSBbR hhHA4diIP9B9OH1YH3LDHt30D+HAwvl8K+xGORF/HRDnEU1FSqKrBB7rw9bvEAuMHjep 9CpAhrv0gXEkrNwmzNSW64l3PdhrqKfbfptsgPzk/yzjwCs7pn2pYC6LQW3aZm6HV1+Q on262oxK29LVbPgYz7CWIOhu+n6F5iIjtGR80zj8x73jZf0GC/mSQCcI1f+d7uUFgm26 8oUN27Y/4WpqQ+d2+qqluw8JjDBEzii2itEBmwR9LsfQztIqLLSE1pAkVWCHrul4HiX+ jlEA== X-Gm-Message-State: AIVw113no4D8gIeWjMpIzQcvrpPSKEurBajcGvWh2wvgT22FzaXbbM0z q6lKzR3yRPlQLz/j/jw= X-Received: by 10.28.211.20 with SMTP id k20mr2411687wmg.123.1500027050897; Fri, 14 Jul 2017 03:10:50 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 14 Jul 2017 12:10:27 +0200 Message-Id: <1500027028-4127-16-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1500027028-4127-1-git-send-email-pbonzini@redhat.com> References: <1500027028-4127-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::244 Subject: [Qemu-devel] [PULL 54/55] 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: Fam Zheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Signed-off-by: Fam Zheng Message-Id: <20170714021509.23681-20-famz@redhat.com> Signed-off-by: Paolo Bonzini --- 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 b3c080f..01ac21e 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" @@ -737,6 +738,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; @@ -744,18 +759,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 d3c783b..04c31e6 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -1013,6 +1013,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 1.8.3.1