From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: Greg Kurz <groug@kaod.org>
Cc: David Gibson <david@gibson.dropbear.id.au>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
qemu-devel@nongnu.org, Alexander Graf <agraf@suse.de>,
qemu-ppc@nongnu.org, Cedric Le Goater <clg@kaod.org>,
Scott Wood <scottwood@freescale.com>,
Igor Mammedov <imammedo@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code
Date: Sat, 2 Jul 2016 13:44:08 +0530 [thread overview]
Message-ID: <20160702081408.GI21596@in.ibm.com> (raw)
In-Reply-To: <146741292480.948.3408923676233078960.stgit@bahia.lan>
On Sat, Jul 02, 2016 at 12:42:04AM +0200, Greg Kurz wrote:
> Starting with version 2.7, pseries machine now support hotplug of
> cpu cores. The implementation requires to open code cpu creation
> and thus does not call ppc_cpu_init().
>
> This patch does all the plumbing to allow pseries machine types
> with version >= 2.7 to generate cpu DT ids out of the indexes
> of the cores and threads in their respective arrays.
>
> Suggested-by: Igor Mammedov <imammedo@redhat.com>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/ppc/ppc.c | 2 +-
> hw/ppc/spapr_cpu_core.c | 11 +++++++++--
> include/hw/ppc/ppc.h | 1 +
> 3 files changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index dbc8ac7b3a9b..12de255fb211 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -1352,7 +1352,7 @@ PowerPCCPU *ppc_get_vcpu_by_dt_id(int cpu_dt_id)
> return NULL;
> }
>
> -static void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
> +void ppc_set_vcpu_dt_id(PowerPCCPU *cpu, int cpu_index, Error **errp)
> {
> ;
> }
> diff --git a/hw/ppc/spapr_cpu_core.c b/hw/ppc/spapr_cpu_core.c
> index 70b6b0b5ee17..475c8063f086 100644
> --- a/hw/ppc/spapr_cpu_core.c
> +++ b/hw/ppc/spapr_cpu_core.c
> @@ -259,13 +259,20 @@ out:
> error_propagate(errp, local_err);
> }
>
> -static void spapr_cpu_core_realize_child(Object *child, Error **errp)
> +static void spapr_cpu_core_realize_child(Object *child, int cpu_index,
> + Error **errp)
> {
> Error *local_err = NULL;
> sPAPRMachineState *spapr = SPAPR_MACHINE(qdev_get_machine());
> CPUState *cs = CPU(child);
> PowerPCCPU *cpu = POWERPC_CPU(cs);
>
> + ppc_set_vcpu_dt_id(cpu, cpu_index, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> +
> object_property_set_bool(child, true, "realized", &local_err);
> if (local_err) {
> error_propagate(errp, local_err);
> @@ -306,7 +313,7 @@ static void spapr_cpu_core_realize(DeviceState *dev, Error **errp)
> for (j = 0; j < cc->nr_threads; j++) {
> obj = sc->threads + j * size;
>
> - spapr_cpu_core_realize_child(obj, &local_err);
> + spapr_cpu_core_realize_child(obj, cc->core_id + j, &local_err);
cc->core_id is essentially the cpu_dt_id. For boot time cores, we set this
(via core-id prop) explicitly. For hotplugged cores, we expect user to
set this mandatorily on -device/device_add. The value that the
user is expected to provide as core-id is in fact supplied by us via
query-hotpluggable-cpus. So there are two places (ppc_spapr_init &
spapr_query_hotpluggable_cpus) where we generate the cpu_dt_id by
open coding as (core_index * smt). Can we have consolidate this logic
into some well defined routine like ppc_core_index_to_dt_id() ?
Regards,
Bharata.
next prev parent reply other threads:[~2016-07-02 8:14 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-01 22:41 [Qemu-devel] [PATCH v2 0/7] ppc: compute cpu_dt_id in the machine code Greg Kurz
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 1/7] spapr: Ensure thread0 of CPU core is always realized first Greg Kurz
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 2/7] ppc: simplify max_smt initialization in ppc_cpu_realizefn() Greg Kurz
2016-07-04 3:53 ` David Gibson
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 3/7] ppc: different creation paths for cpus in system and user mode Greg Kurz
2016-07-04 7:14 ` Igor Mammedov
2016-07-04 7:40 ` Greg Kurz
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 4/7] ppc: open code cpu creation for machine types Greg Kurz
2016-07-02 8:06 ` Bharata B Rao
2016-07-02 8:33 ` Greg Kurz
2016-07-04 3:54 ` David Gibson
2016-07-04 6:32 ` Greg Kurz
2016-07-04 8:08 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2016-07-04 7:37 ` [Qemu-devel] " Igor Mammedov
2016-07-04 8:09 ` David Gibson
2016-07-01 22:41 ` [Qemu-devel] [PATCH v2 5/7] ppc: introduce ppc_set_vcpu_dt_id() Greg Kurz
2016-07-01 22:42 ` [Qemu-devel] [PATCH v2 6/7] spapr: use ppc_set_vcpu_dt_id() in CPU hotplug code Greg Kurz
2016-07-02 8:14 ` Bharata B Rao [this message]
2016-07-02 8:35 ` Greg Kurz
2016-07-01 22:42 ` [Qemu-devel] [PATCH v2 7/7] ppc: move the cpu_dt_id logic to machine code Greg Kurz
2016-07-02 8:15 ` Bharata B Rao
2016-07-02 8:42 ` Greg Kurz
2016-07-02 9:55 ` [Qemu-devel] [PATCH v2 0/7] ppc: compute cpu_dt_id in the " Bharata B Rao
2016-07-02 10:34 ` Greg Kurz
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=20160702081408.GI21596@in.ibm.com \
--to=bharata@linux.vnet.ibm.com \
--cc=agraf@suse.de \
--cc=benh@kernel.crashing.org \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=groug@kaod.org \
--cc=imammedo@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=scottwood@freescale.com \
/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).