From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, peter.crosthwaite@xilinx.com,
mimu@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com,
agraf@suse.de, borntraeger@de.ibm.com,
"Paolo Bonzini" <pbonzini@redhat.com>,
cornelia.huck@de.ibm.com, "Igor Mammedov" <imammedo@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
david@gibson.dropbear.id.au
Subject: [Qemu-devel] [PATCH v2 2/2] cpu: Register QOM links at /machine/cpus[<index>]
Date: Fri, 1 May 2015 11:09:07 -0300 [thread overview]
Message-ID: <1430489347-13772-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1430489347-13772-1-git-send-email-ehabkost@redhat.com>
This will provide a predictable path for the CPU objects, and a more
powerful alternative for the query-cpus QMP command, as now every QOM
property on CPU objects can be easily queried.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Changes v1 -> v2:
* Use object_property_add_const_link()
* Use "/machine/cpus[<index>]" instead of "/machine/cpus/<index>"
* Grab reference to object before adding link
Note that this doesn't replace any future topology enumeration
mechanisms we may choose to implement. It just replaces the existing
topology-unaware VCPU enumeration mechanism that is query-cpus.
References to previous discussions:
Date: Thu, 23 Apr 2015 10:17:36 -0300
From: Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] cpu modelling and hotplug (was: [PATCH RFC 0/4] target-i386: PC socket/core/thread modeling, part 1)
Message-ID: <20150423131736.GA17796@thinpad.lan.raisama.net>
Date: Tue, 31 Mar 2015 10:16:23 -0300
From: Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 11/15] target-s390x: New QMP command query-cpu-model
Message-ID: <20150331131623.GG7031@thinpad.lan.raisama.net>
Date: Fri, 16 May 2014 12:16:41 -0300
From: Eduardo Habkost <ehabkost@redhat.com>
Subject: Re: [Qemu-devel] [RFC 0/5] Allow object-add on X86CPU subclasses, for CPU model probing
Message-ID: <20140516151641.GY3302@otherpad.lan.raisama.net>
---
exec.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/exec.c b/exec.c
index ae37b98..a68f0af 100644
--- a/exec.c
+++ b/exec.c
@@ -519,6 +519,19 @@ void tcg_cpu_address_space_init(CPUState *cpu, AddressSpace *as)
}
#endif
+static void cpu_add_qom_link(CPUState *cpu)
+{
+#if !defined(CONFIG_USER_ONLY)
+ Object *obj = OBJECT(cpu);
+ char *path = g_strdup_printf("cpus[%d]", cpu->cpu_index);
+
+ object_ref(obj);
+ object_property_add_const_link(OBJECT(current_machine), path, TYPE_CPU,
+ obj, 0, &error_abort);
+ g_free(path);
+#endif
+}
+
void cpu_exec_init(CPUArchState *env)
{
CPUState *cpu = ENV_GET_CPU(env);
@@ -558,6 +571,8 @@ void cpu_exec_init(CPUArchState *env)
if (cc->vmsd != NULL) {
vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
}
+
+ cpu_add_qom_link(cpu);
}
#if defined(CONFIG_USER_ONLY)
--
2.1.0
prev parent reply other threads:[~2015-05-01 14:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 14:09 [Qemu-devel] [PATCH v2 0/2] cpu: Add /machine/cpus[<index>] links Eduardo Habkost
2015-05-01 14:09 ` [Qemu-devel] [PATCH v2 1/2] qom: Implement object_property_add_const_link() Eduardo Habkost
2015-05-01 18:15 ` Paolo Bonzini
2015-05-05 16:06 ` Eduardo Habkost
2015-05-05 16:21 ` Paolo Bonzini
2015-05-01 14:09 ` Eduardo Habkost [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430489347-13772-3-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=bharata@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=david@gibson.dropbear.id.au \
--cc=imammedo@redhat.com \
--cc=mimu@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.crosthwaite@xilinx.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).