Comments
Patch
@@ -222,7 +222,7 @@ int kvm_init_vcpu(CPUArchState *env)
DPRINTF("kvm_init_vcpu\n");
- ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, env->cpu_index);
+ ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, kvm_arch_vcpu_id(env));
if (ret < 0) {
DPRINTF("kvm_create_vcpu failed\n");
goto err;
@@ -181,6 +181,9 @@ int kvm_arch_init(KVMState *s);
int kvm_arch_init_vcpu(CPUArchState *env);
+/* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */
+unsigned long kvm_arch_vcpu_id(CPUArchState *env);
+
void kvm_arch_reset_vcpu(CPUArchState *env);
int kvm_arch_on_sigbus_vcpu(CPUArchState *env, int code, void *addr);
@@ -353,6 +353,11 @@ static void cpu_update_state(void *opaque, int running, RunState state)
}
}
+unsigned long kvm_arch_vcpu_id(CPUArchState *env)
+{
+ return env->cpu_index;
+}
+
int kvm_arch_init_vcpu(CPUX86State *env)
{
struct {
@@ -371,6 +371,11 @@ static inline void kvm_fixup_page_sizes(CPUPPCState *env)
#endif /* !defined (TARGET_PPC64) */
+unsigned long kvm_arch_vcpu_id(CPUArchState *env)
+{
+ return env->cpu_index;
+}
+
int kvm_arch_init_vcpu(CPUPPCState *cenv)
{
int ret;
@@ -72,6 +72,11 @@ int kvm_arch_init(KVMState *s)
return 0;
}
+unsigned long kvm_arch_vcpu_id(CPUArchState *env)
+{
+ return env->cpu_index;
+}
+
int kvm_arch_init_vcpu(CPUS390XState *env)
{
int ret = 0;
This will allow each architecture to define how the VCPU ID is set on the KVM_CREATE_VCPU ioctl call. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> --- kvm-all.c | 2 +- kvm.h | 3 +++ target-i386/kvm.c | 5 +++++ target-ppc/kvm.c | 5 +++++ target-s390x/kvm.c | 5 +++++ 5 files changed, 19 insertions(+), 1 deletion(-)