Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 90de4a18 authored by Nadav Amit's avatar Nadav Amit Committed by Paolo Bonzini
Browse files

KVM: x86: Support for disabling quirks



Introducing KVM_CAP_DISABLE_QUIRKS for disabling x86 quirks that were previous
created in order to overcome QEMU issues. Those issue were mostly result of
invalid VM BIOS.  Currently there are two quirks that can be disabled:

1. KVM_QUIRK_LINT0_REENABLED - LINT0 was enabled after boot
2. KVM_QUIRK_CD_NW_CLEARED - CD and NW are cleared after boot

These two issues are already resolved in recent releases of QEMU, and would
therefore be disabled by QEMU.

Signed-off-by: default avatarNadav Amit <namit@cs.technion.ac.il>
Message-Id: <1428879221-29996-1-git-send-email-namit@cs.technion.ac.il>
[Report capability from KVM_CHECK_EXTENSION too. - Paolo]
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent e233d54d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -959,7 +959,8 @@ documentation when it pops into existence).
4.37 KVM_ENABLE_CAP

Capability: KVM_CAP_ENABLE_CAP, KVM_CAP_ENABLE_CAP_VM
Architectures: ppc, s390
Architectures: x86 (only KVM_CAP_ENABLE_CAP_VM),
	       mips (only KVM_CAP_ENABLE_CAP), ppc, s390
Type: vcpu ioctl, vm ioctl (with KVM_CAP_ENABLE_CAP_VM)
Parameters: struct kvm_enable_cap (in)
Returns: 0 on success; -1 on error
+2 −0
Original line number Diff line number Diff line
@@ -635,6 +635,8 @@ struct kvm_arch {
	#endif

	bool boot_vcpu_runs_old_kvmclock;

	u64 disabled_quirks;
};

struct kvm_vm_stat {
+3 −0
Original line number Diff line number Diff line
@@ -345,4 +345,7 @@ struct kvm_xcrs {
struct kvm_sync_regs {
};

#define KVM_QUIRK_LINT0_REENABLED	(1 << 0)
#define KVM_QUIRK_CD_NW_CLEARED		(1 << 1)

#endif /* _ASM_X86_KVM_H */
+3 −2
Original line number Diff line number Diff line
@@ -1577,6 +1577,7 @@ void kvm_lapic_reset(struct kvm_vcpu *vcpu)
	for (i = 0; i < APIC_LVT_NUM; i++)
		apic_set_reg(apic, APIC_LVTT + 0x10 * i, APIC_LVT_MASKED);
	apic->lapic_timer.timer_mode = 0;
	if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_LINT0_REENABLED))
		apic_set_reg(apic, APIC_LVT0,
			     SET_APIC_DELIVERY_MODE(0, APIC_MODE_EXTINT));

+2 −1
Original line number Diff line number Diff line
@@ -1575,6 +1575,7 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
	 * does not do it - this results in some delay at
	 * reboot
	 */
	if (!(vcpu->kvm->arch.disabled_quirks & KVM_QUIRK_CD_NW_CLEARED))
		cr0 &= ~(X86_CR0_CD | X86_CR0_NW);
	svm->vmcb->save.cr0 = cr0;
	mark_dirty(svm->vmcb, VMCB_CR);
Loading