mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 07:31:45 +00:00
KVM: move code related to KVM_SET_BOOT_CPU_ID to x86
This is another remnant of ia64 support. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
554726d33c
commit
d71ba78834
@ -667,6 +667,7 @@ struct kvm_arch {
|
||||
#endif
|
||||
|
||||
bool boot_vcpu_runs_old_kvmclock;
|
||||
u32 bsp_vcpu_id;
|
||||
|
||||
u64 disabled_quirks;
|
||||
};
|
||||
@ -1215,5 +1216,7 @@ int __x86_set_memory_region(struct kvm *kvm,
|
||||
const struct kvm_userspace_memory_region *mem);
|
||||
int x86_set_memory_region(struct kvm *kvm,
|
||||
const struct kvm_userspace_memory_region *mem);
|
||||
bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu);
|
||||
bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu);
|
||||
|
||||
#endif /* _ASM_X86_KVM_HOST_H */
|
||||
|
@ -2461,6 +2461,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
|
||||
case KVM_CAP_TSC_DEADLINE_TIMER:
|
||||
case KVM_CAP_ENABLE_CAP_VM:
|
||||
case KVM_CAP_DISABLE_QUIRKS:
|
||||
case KVM_CAP_SET_BOOT_CPU_ID:
|
||||
#ifdef CONFIG_KVM_DEVICE_ASSIGNMENT
|
||||
case KVM_CAP_ASSIGN_DEV_IRQ:
|
||||
case KVM_CAP_PCI_2_3:
|
||||
@ -3777,6 +3778,15 @@ long kvm_arch_vm_ioctl(struct file *filp,
|
||||
r = kvm_vm_ioctl_reinject(kvm, &control);
|
||||
break;
|
||||
}
|
||||
case KVM_SET_BOOT_CPU_ID:
|
||||
r = 0;
|
||||
mutex_lock(&kvm->lock);
|
||||
if (atomic_read(&kvm->online_vcpus) != 0)
|
||||
r = -EBUSY;
|
||||
else
|
||||
kvm->arch.bsp_vcpu_id = arg;
|
||||
mutex_unlock(&kvm->lock);
|
||||
break;
|
||||
case KVM_XEN_HVM_CONFIG: {
|
||||
r = -EFAULT;
|
||||
if (copy_from_user(&kvm->arch.xen_hvm_config, argp,
|
||||
@ -7291,6 +7301,17 @@ void kvm_arch_check_processor_compat(void *rtn)
|
||||
kvm_x86_ops->check_processor_compatibility(rtn);
|
||||
}
|
||||
|
||||
bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return vcpu->kvm->arch.bsp_vcpu_id == vcpu->vcpu_id;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_vcpu_is_reset_bsp);
|
||||
|
||||
bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
|
||||
}
|
||||
|
||||
bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return irqchip_in_kernel(vcpu->kvm) == (vcpu->arch.apic != NULL);
|
||||
|
@ -364,9 +364,6 @@ struct kvm {
|
||||
struct kvm_memslots *memslots[KVM_ADDRESS_SPACE_NUM];
|
||||
struct srcu_struct srcu;
|
||||
struct srcu_struct irq_srcu;
|
||||
#ifdef CONFIG_KVM_APIC_ARCHITECTURE
|
||||
u32 bsp_vcpu_id;
|
||||
#endif
|
||||
struct kvm_vcpu *vcpus[KVM_MAX_VCPUS];
|
||||
atomic_t online_vcpus;
|
||||
int last_boosted_vcpu;
|
||||
@ -1059,22 +1056,9 @@ static inline int kvm_ioeventfd(struct kvm *kvm, struct kvm_ioeventfd *args)
|
||||
#endif /* CONFIG_HAVE_KVM_EVENTFD */
|
||||
|
||||
#ifdef CONFIG_KVM_APIC_ARCHITECTURE
|
||||
static inline bool kvm_vcpu_is_reset_bsp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return vcpu->kvm->bsp_vcpu_id == vcpu->vcpu_id;
|
||||
}
|
||||
|
||||
static inline bool kvm_vcpu_is_bsp(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
return (vcpu->arch.apic_base & MSR_IA32_APICBASE_BSP) != 0;
|
||||
}
|
||||
|
||||
bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu);
|
||||
|
||||
#else
|
||||
|
||||
static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; }
|
||||
|
||||
#endif
|
||||
|
||||
static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu)
|
||||
|
@ -2618,9 +2618,6 @@ static long kvm_vm_ioctl_check_extension_generic(struct kvm *kvm, long arg)
|
||||
case KVM_CAP_USER_MEMORY:
|
||||
case KVM_CAP_DESTROY_MEMORY_REGION_WORKS:
|
||||
case KVM_CAP_JOIN_MEMORY_REGIONS_WORKS:
|
||||
#ifdef CONFIG_KVM_APIC_ARCHITECTURE
|
||||
case KVM_CAP_SET_BOOT_CPU_ID:
|
||||
#endif
|
||||
case KVM_CAP_INTERNAL_ERROR_DATA:
|
||||
#ifdef CONFIG_HAVE_KVM_MSI
|
||||
case KVM_CAP_SIGNAL_MSI:
|
||||
@ -2716,17 +2713,6 @@ static long kvm_vm_ioctl(struct file *filp,
|
||||
r = kvm_ioeventfd(kvm, &data);
|
||||
break;
|
||||
}
|
||||
#ifdef CONFIG_KVM_APIC_ARCHITECTURE
|
||||
case KVM_SET_BOOT_CPU_ID:
|
||||
r = 0;
|
||||
mutex_lock(&kvm->lock);
|
||||
if (atomic_read(&kvm->online_vcpus) != 0)
|
||||
r = -EBUSY;
|
||||
else
|
||||
kvm->bsp_vcpu_id = arg;
|
||||
mutex_unlock(&kvm->lock);
|
||||
break;
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_KVM_MSI
|
||||
case KVM_SIGNAL_MSI: {
|
||||
struct kvm_msi msi;
|
||||
|
Loading…
Reference in New Issue
Block a user