All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nadav Amit <namit@cs.technion.ac.il>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, qemu-devel@nongnu.org,
	jan.kiszka@siemens.com, bsd@redhat.com, avi.kivity@gmail.com,
	Nadav Amit <namit@cs.technion.ac.il>
Subject: [Qemu-devel][PATCH 2/2] target-i386: kvm: Disable KVM quirks
Date: Mon, 13 Apr 2015 02:32:09 +0300	[thread overview]
Message-ID: <1428881529-29459-3-git-send-email-namit@cs.technion.ac.il> (raw)
In-Reply-To: <1428881529-29459-1-git-send-email-namit@cs.technion.ac.il>

KVM has quirks to overcome legacy QEMU bugs that are already resolved.  Using a
new KVM feature for disabling these quirks.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
 linux-headers/asm-x86/kvm.h | 4 ++++
 linux-headers/linux/kvm.h   | 1 +
 target-i386/kvm.c           | 8 ++++++++
 3 files changed, 13 insertions(+)

diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index d7dcef5..f8fbb4a 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -345,4 +345,8 @@ struct kvm_xcrs {
 struct kvm_sync_regs {
 };
 
+/* KVM legacy quirks for use with KVM_CAP_DISABLE_QUIRKS */
+#define KVM_QUIRK_LINT0_DISABLED	(1 << 0)
+#define KVM_QUIRK_CD_NW_CLEARED		(1 << 1)
+
 #endif /* _ASM_X86_KVM_H */
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 60a54c8..757e869 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -760,6 +760,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_ENABLE_HCALL 104
 #define KVM_CAP_CHECK_EXTENSION_VM 105
 #define KVM_CAP_S390_USER_SIGP 106
+#define KVM_CAP_DISABLE_QUIRKS 115
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 41d09e5..3b28122 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -898,6 +898,14 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
             return ret;
         }
     }
+    if (kvm_check_extension(s, KVM_CAP_ENABLE_CAP_VM)) {
+        ret = kvm_vm_enable_cap(s, KVM_CAP_DISABLE_QUIRKS, 0,
+                                KVM_QUIRK_LINT0_DISABLED |
+                                KVM_QUIRK_CD_NW_CLEARED);
+        if (ret < 0) {
+            return ret;
+        }
+    }
     return 0;
 }
 
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Nadav Amit <namit@cs.technion.ac.il>
To: pbonzini@redhat.com
Cc: kvm@vger.kernel.org, Nadav Amit <namit@cs.technion.ac.il>,
	jan.kiszka@siemens.com, qemu-devel@nongnu.org, bsd@redhat.com,
	avi.kivity@gmail.com
Subject: [Qemu-devel] [PATCH 2/2] target-i386: kvm: Disable KVM quirks
Date: Mon, 13 Apr 2015 02:32:09 +0300	[thread overview]
Message-ID: <1428881529-29459-3-git-send-email-namit@cs.technion.ac.il> (raw)
In-Reply-To: <1428881529-29459-1-git-send-email-namit@cs.technion.ac.il>

KVM has quirks to overcome legacy QEMU bugs that are already resolved.  Using a
new KVM feature for disabling these quirks.

Signed-off-by: Nadav Amit <namit@cs.technion.ac.il>
---
 linux-headers/asm-x86/kvm.h | 4 ++++
 linux-headers/linux/kvm.h   | 1 +
 target-i386/kvm.c           | 8 ++++++++
 3 files changed, 13 insertions(+)

diff --git a/linux-headers/asm-x86/kvm.h b/linux-headers/asm-x86/kvm.h
index d7dcef5..f8fbb4a 100644
--- a/linux-headers/asm-x86/kvm.h
+++ b/linux-headers/asm-x86/kvm.h
@@ -345,4 +345,8 @@ struct kvm_xcrs {
 struct kvm_sync_regs {
 };
 
+/* KVM legacy quirks for use with KVM_CAP_DISABLE_QUIRKS */
+#define KVM_QUIRK_LINT0_DISABLED	(1 << 0)
+#define KVM_QUIRK_CD_NW_CLEARED		(1 << 1)
+
 #endif /* _ASM_X86_KVM_H */
diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 60a54c8..757e869 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -760,6 +760,7 @@ struct kvm_ppc_smmu_info {
 #define KVM_CAP_PPC_ENABLE_HCALL 104
 #define KVM_CAP_CHECK_EXTENSION_VM 105
 #define KVM_CAP_S390_USER_SIGP 106
+#define KVM_CAP_DISABLE_QUIRKS 115
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 41d09e5..3b28122 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -898,6 +898,14 @@ int kvm_arch_init(MachineState *ms, KVMState *s)
             return ret;
         }
     }
+    if (kvm_check_extension(s, KVM_CAP_ENABLE_CAP_VM)) {
+        ret = kvm_vm_enable_cap(s, KVM_CAP_DISABLE_QUIRKS, 0,
+                                KVM_QUIRK_LINT0_DISABLED |
+                                KVM_QUIRK_CD_NW_CLEARED);
+        if (ret < 0) {
+            return ret;
+        }
+    }
     return 0;
 }
 
-- 
1.9.1

  parent reply	other threads:[~2015-04-12 23:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-12 23:32 [Qemu-devel][PATCH 0/2] target-i386: disable LINT0 after reset and init Nadav Amit
2015-04-12 23:32 ` [Qemu-devel] [PATCH " Nadav Amit
2015-04-12 23:32 ` [Qemu-devel][PATCH 1/2] target-i386: disable LINT0 after reset Nadav Amit
2015-04-12 23:32   ` [Qemu-devel] [PATCH " Nadav Amit
2015-04-13 14:12   ` [Qemu-devel][PATCH " Paolo Bonzini
2015-04-13 14:12     ` [Qemu-devel] [PATCH " Paolo Bonzini
2015-09-15 21:19   ` Alex Williamson
2015-09-15 21:19     ` Alex Williamson
2015-09-16  5:23     ` Jan Kiszka
2015-09-16  5:23       ` Jan Kiszka
2015-09-16  6:22       ` Nadav Amit
2015-09-16  6:22         ` [Qemu-devel] " Nadav Amit
2015-09-16  6:47       ` Gerd Hoffmann
2015-09-16  6:47         ` Gerd Hoffmann
2015-09-16 12:52         ` Nadav Amit
2015-09-16 12:52           ` Nadav Amit
2015-04-12 23:32 ` Nadav Amit [this message]
2015-04-12 23:32   ` [Qemu-devel] [PATCH 2/2] target-i386: kvm: Disable KVM quirks Nadav Amit
2015-04-13 14:13   ` [Qemu-devel][PATCH " Paolo Bonzini
2015-04-13 14:13     ` [Qemu-devel] [PATCH " Paolo Bonzini
2015-04-13 14:17     ` Nadav Amit
2015-04-13 14:17       ` Nadav Amit
2015-04-13 14:24       ` Paolo Bonzini
2015-04-13 14:24         ` Paolo Bonzini
2015-04-13 14:33         ` Nadav Amit
2015-04-13 14:33           ` Nadav Amit
2015-04-13 14:36           ` Paolo Bonzini
2015-04-13 14:36             ` Paolo Bonzini

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=1428881529-29459-3-git-send-email-namit@cs.technion.ac.il \
    --to=namit@cs.technion.ac.il \
    --cc=avi.kivity@gmail.com \
    --cc=bsd@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.