From: David Gibson <david@gibson.dropbear.id.au>
To: Sam Bobroff <sam.bobroff@au1.ibm.com>
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v2 1/1] ppc: spapr: Make VCPU ID handling private to SPAPR
Date: Tue, 8 Aug 2017 16:24:01 +1000 [thread overview]
Message-ID: <20170808062401.GD25081@umbus.fritz.box> (raw)
In-Reply-To: <2b5e13652c749b9ad2a519190396fe4160ac0dea.1502087564.git.sam.bobroff@au1.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]
On Mon, Aug 07, 2017 at 04:33:29PM +1000, Sam Bobroff wrote:
> The concept of a VCPU ID that differs from the CPU's index
> (cpu->cpu_index) exists only within SPAPR machines so, move the
> functions ppc_get_vcpu_id() and ppc_get_cpu_by_vcpu_id() into spapr.c
> and rename them appropriately.
>
> Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> ---
> Changes in v2:
>
> * Re-arranged so that spapr_vcpu_id() calls kvm_arch_vcpu_id() rather than the
> other way around.
Ah.. so close..
[snip]
> +int spapr_vcpu_id(PowerPCCPU *cpu)
> +{
> + CPUState *cs = CPU(cpu);
> +
> + if (kvm_enabled()) {
> + return kvm_arch_vcpu_id(cs);
> + } else {
> + return cs->cpu_index;
> + }
> +}
> +
> +PowerPCCPU *spapr_find_cpu(int vcpu_id)
> +{
> + CPUState *cs;
> +
> + CPU_FOREACH(cs) {
> + PowerPCCPU *cpu = POWERPC_CPU(cs);
> +
> + if (cpu->vcpu_id == vcpu_id) {
This is still reaching into vcpu_id which should really be cpu
private, not in spapr. You can use spapr_vcpu_id() which you already
defined to avoid this.
With that done, I believe it should be possible to put cpu->vcpu_id in
an ifdef CONFIG_KVM and have things work.
> + return cpu;
> + }
> + }
> +
> + return NULL;
> +}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-08-08 6:24 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-07 6:33 [Qemu-devel] [PATCH v2 0/1] Cleanup cpu_dt_id Sam Bobroff
2017-08-07 6:33 ` [Qemu-devel] [PATCH v2 1/1] ppc: spapr: Make VCPU ID handling private to SPAPR Sam Bobroff
2017-08-07 13:13 ` [Qemu-devel] [Qemu-ppc] " Greg Kurz
2017-08-08 6:24 ` David Gibson [this message]
[not found] ` <20170808062420.82867C6037@b03ledav006.gho.boulder.ibm.com>
2017-08-09 0:02 ` [Qemu-devel] " Sam Bobroff
2017-08-09 3:21 ` David Gibson
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=20170808062401.GD25081@umbus.fritz.box \
--to=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=sam.bobroff@au1.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.