From: Liu Ping Fan <kernelfans@gmail.com>
To: kvm@vger.kernel.org, qemu-devel@nongnu.org
Cc: aliguori@us.ibm.com, ryanh@us.ibm.com, jan.kiszka@web.de,
linux-kernel@vger.kernel.org, avi@redhat.com
Subject: [Qemu-devel] [PATCH 1/5] QEMU Add cpu_phyid_to_cpu() to map cpu phyid to CPUState
Date: Sun, 27 Nov 2011 10:45:33 +0800 [thread overview]
Message-ID: <1322361937-22438-1-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1322188529-11609-1-git-send-email-kernelfans@gmail.com>
From: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
The guest has different cpu logic id from qemu, but they have the
same phyid. When cpu phyid is told by guest, we need to obtain
the corresponding CPUState.
Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
---
target-i386/cpu.h | 2 ++
target-i386/helper.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index abdeb40..251e63b 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -767,6 +767,7 @@ typedef struct CPUX86State {
} CPUX86State;
CPUX86State *cpu_x86_init(const char *cpu_model);
+CPUX86State *x86_phyid_to_cpu(int phy_id);
int cpu_x86_exec(CPUX86State *s);
void cpu_x86_close(CPUX86State *s);
void x86_cpu_list (FILE *f, fprintf_function cpu_fprintf, const char *optarg);
@@ -1063,4 +1064,5 @@ void svm_check_intercept(CPUState *env1, uint32_t type);
uint32_t cpu_cc_compute_all(CPUState *env1, int op);
+#define cpu_phyid_to_cpu x86_phyid_to_cpu
#endif /* CPU_I386_H */
diff --git a/target-i386/helper.c b/target-i386/helper.c
index 5df40d4..e35a75e 100644
--- a/target-i386/helper.c
+++ b/target-i386/helper.c
@@ -1263,6 +1263,18 @@ CPUX86State *cpu_x86_init(const char *cpu_model)
return env;
}
+CPUX86State *x86_phyid_to_cpu(int phy_id)
+{
+ CPUX86State *env = first_cpu;
+ while (env) {
+ if (env->cpuid_apic_id == phy_id) {
+ break;
+ }
+ env = env->next_cpu;
+ }
+ return env;
+}
+
#if !defined(CONFIG_USER_ONLY)
void do_cpu_init(CPUState *env)
{
--
1.7.4.4
next prev parent reply other threads:[~2011-11-27 2:45 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-25 2:35 [Qemu-devel] [PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm Liu Ping Fan
2011-11-25 2:35 ` [Qemu-devel] [PATCH 1/2] kvm: make vcpu life cycle separated from kvm instance Liu Ping Fan
2011-11-27 10:36 ` Avi Kivity
2011-11-25 17:54 ` [Qemu-devel] [PATCH 0] A series patches for kvm&qemu to enable vcpu destruction in kvm Jan Kiszka
2011-11-27 3:07 ` Liu ping fan
2011-11-27 2:42 ` [Qemu-devel] [PATCH 2/2] kvm: exit to userspace with reason KVM_EXIT_VCPU_DEAD Liu Ping Fan
2011-11-27 10:36 ` Avi Kivity
2011-11-27 10:50 ` Gleb Natapov
2011-11-28 7:16 ` Liu ping fan
2011-11-28 8:46 ` Gleb Natapov
2011-11-27 2:45 ` Liu Ping Fan [this message]
2011-11-27 2:45 ` [Qemu-devel] [PATCH 2/5] QEMU Add cpu_free() to support arch related CPUState release Liu Ping Fan
2011-11-27 2:45 ` [Qemu-devel] [PATCH 3/5] QEMU Introduce a pci device "cpustate" to get CPU_DEAD event in guest Liu Ping Fan
2011-11-27 10:56 ` Gleb Natapov
2011-11-27 2:45 ` [Qemu-devel] [PATCH 4/5] QEMU Release vcpu and finally exit vcpu thread safely Liu Ping Fan
2011-11-29 5:37 ` ShaoHe Feng
2011-11-27 2:45 ` [Qemu-devel] [PATCH 5/5] QEMU tmp patches for linux-header files Liu Ping Fan
2011-11-27 2:47 ` [Qemu-devel] [PATCH] virtio: add a pci driver to notify host the CPU_DEAD event Liu Ping Fan
2011-11-27 11:10 ` Gleb Natapov
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=1322361937-22438-1-git-send-email-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=jan.kiszka@web.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=ryanh@us.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 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).