kvm: Create kvm_arch_vcpu_id() function
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> Acked-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
2969475869
commit
b164e48ed1
@ -196,6 +196,9 @@ int kvm_arch_init(KVMState *s);
|
|||||||
|
|
||||||
int kvm_arch_init_vcpu(CPUState *cpu);
|
int kvm_arch_init_vcpu(CPUState *cpu);
|
||||||
|
|
||||||
|
/* Returns VCPU ID to be used on KVM_CREATE_VCPU ioctl() */
|
||||||
|
unsigned long kvm_arch_vcpu_id(CPUState *cpu);
|
||||||
|
|
||||||
void kvm_arch_reset_vcpu(CPUState *cpu);
|
void kvm_arch_reset_vcpu(CPUState *cpu);
|
||||||
|
|
||||||
int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
||||||
|
@ -222,7 +222,7 @@ int kvm_init_vcpu(CPUState *cpu)
|
|||||||
|
|
||||||
DPRINTF("kvm_init_vcpu\n");
|
DPRINTF("kvm_init_vcpu\n");
|
||||||
|
|
||||||
ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, cpu->cpu_index);
|
ret = kvm_vm_ioctl(s, KVM_CREATE_VCPU, (void *)kvm_arch_vcpu_id(cpu));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
DPRINTF("kvm_create_vcpu failed\n");
|
DPRINTF("kvm_create_vcpu failed\n");
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -411,6 +411,11 @@ static void cpu_update_state(void *opaque, int running, RunState state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long kvm_arch_vcpu_id(CPUState *cpu)
|
||||||
|
{
|
||||||
|
return cpu->cpu_index;
|
||||||
|
}
|
||||||
|
|
||||||
int kvm_arch_init_vcpu(CPUState *cs)
|
int kvm_arch_init_vcpu(CPUState *cs)
|
||||||
{
|
{
|
||||||
struct {
|
struct {
|
||||||
|
@ -384,6 +384,11 @@ static inline void kvm_fixup_page_sizes(PowerPCCPU *cpu)
|
|||||||
|
|
||||||
#endif /* !defined (TARGET_PPC64) */
|
#endif /* !defined (TARGET_PPC64) */
|
||||||
|
|
||||||
|
unsigned long kvm_arch_vcpu_id(CPUState *cpu)
|
||||||
|
{
|
||||||
|
return cpu->cpu_index;
|
||||||
|
}
|
||||||
|
|
||||||
int kvm_arch_init_vcpu(CPUState *cs)
|
int kvm_arch_init_vcpu(CPUState *cs)
|
||||||
{
|
{
|
||||||
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
PowerPCCPU *cpu = POWERPC_CPU(cs);
|
||||||
|
@ -76,6 +76,11 @@ int kvm_arch_init(KVMState *s)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long kvm_arch_vcpu_id(CPUState *cpu)
|
||||||
|
{
|
||||||
|
return cpu->cpu_index;
|
||||||
|
}
|
||||||
|
|
||||||
int kvm_arch_init_vcpu(CPUState *cpu)
|
int kvm_arch_init_vcpu(CPUState *cpu)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user