Skip to contentSkip to conversation

qemu-kvm.git uq/master queue

GIT PULL New Marcelo Tosatti 2 participants 17 messages Jun 21, 2011 – Jun 22, 2011

Subsystems (2)
lore
Share & tools
lore
#12 lore raw

PATCH 12/15 kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

kvm_arch_get_supported_cpuid checks for global cpuid restrictions, it does not require any CPUState reference. Changing its interface allows to call it before any VCPU is initialized.

---
 kvm.h               |    2 +-
 target-i386/cpuid.c |   20 ++++++++++++--------
 target-i386/kvm.c   |   30 +++++++++++++++---------------
 3 files changed, 28 insertions(+), 24 deletions(-)
kvm.h +1 -1
index d565dba..243b063 100644
@@ -157,7 +157,7 @@ bool kvm_arch_stop_on_emulation_error(CPUState *env);
 
 int kvm_check_extension(KVMState *s, unsigned int extension);
 
-uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
+uint32_t kvm_arch_get_supported_cpuid(KVMState *env, uint32_t function,
                                       uint32_t index, int reg);
 void kvm_cpu_synchronize_state(CPUState *env);
 void kvm_cpu_synchronize_post_reset(CPUState *env);
target-i386/cpuid.c +12 -8
index 79e7580..e1ae3af 100644
@@ -1144,10 +1144,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
         break;
     case 7:
         if (kvm_enabled()) {
-            *eax = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EAX);
-            *ebx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EBX);
-            *ecx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_ECX);
-            *edx = kvm_arch_get_supported_cpuid(env, 0x7, count, R_EDX);
+            KVMState *s = env->kvm_state;
+
+            *eax = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(s, 0x7, count, R_EDX);
         } else {
             *eax = 0;
             *ebx = 0;
@@ -1179,10 +1181,12 @@ void cpu_x86_cpuid(CPUX86State *env, uint32_t index, uint32_t count,
             break;
         }
         if (kvm_enabled()) {
-            *eax = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EAX);
-            *ebx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EBX);
-            *ecx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_ECX);
-            *edx = kvm_arch_get_supported_cpuid(env, 0xd, count, R_EDX);
+            KVMState *s = env->kvm_state;
+
+            *eax = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EAX);
+            *ebx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EBX);
+            *ecx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_ECX);
+            *edx = kvm_arch_get_supported_cpuid(s, 0xd, count, R_EDX);
         } else {
             *eax = 0;
             *ebx = 0;
target-i386/kvm.c +15 -15
index 5db33ea..938e0a3 100644
@@ -98,12 +98,12 @@ struct kvm_para_features {
     { -1, -1 }
 };
 
-static int get_para_features(CPUState *env)
+static int get_para_features(KVMState *s)
 {
     int i, features = 0;
 
     for (i = 0; i < ARRAY_SIZE(para_features) - 1; i++) {
-        if (kvm_check_extension(env->kvm_state, para_features[i].cap)) {
+        if (kvm_check_extension(s, para_features[i].cap)) {
             features |= (1 << para_features[i].feature);
         }
     }
@@ -112,7 +112,7 @@ static int get_para_features(CPUState *env)
 }
 
 
-uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
+uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
                                       uint32_t index, int reg)
 {
     struct kvm_cpuid2 *cpuid;
@@ -122,7 +122,7 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
     int has_kvm_features = 0;
 
     max = 1;
-    while ((cpuid = try_get_cpuid(env->kvm_state, max)) == NULL) {
+    while ((cpuid = try_get_cpuid(s, max)) == NULL) {
         max *= 2;
     }
 
@@ -153,7 +153,7 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
                     /* On Intel, kvm returns cpuid according to the Intel spec,
                      * so add missing bits according to the AMD spec:
                      */
-                    cpuid_1_edx = kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
+                    cpuid_1_edx = kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
                     ret |= cpuid_1_edx & 0x183f7ff;
                     break;
                 }
@@ -166,7 +166,7 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
 
     /* fallback for older kernels */
     if (!has_kvm_features && (function == KVM_CPUID_FEATURES)) {
-        ret = get_para_features(env);
+        ret = get_para_features(s);
     }
 
     return ret;
@@ -349,25 +349,25 @@ int kvm_arch_init_vcpu(CPUState *env)
         struct kvm_cpuid2 cpuid;
         struct kvm_cpuid_entry2 entries[100];
     } __attribute__((packed)) cpuid_data;
+    KVMState *s = env->kvm_state;
     uint32_t limit, i, j, cpuid_i;
     uint32_t unused;
     struct kvm_cpuid_entry2 *c;
     uint32_t signature[3];
 
-    env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
+    env->cpuid_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_EDX);
 
     i = env->cpuid_ext_features & CPUID_EXT_HYPERVISOR;
-    env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_ECX);
+    env->cpuid_ext_features &= kvm_arch_get_supported_cpuid(s, 1, 0, R_ECX);
     env->cpuid_ext_features |= i;
 
-    env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
+    env->cpuid_ext2_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
                                                              0, R_EDX);
-    env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(env, 0x80000001,
+    env->cpuid_ext3_features &= kvm_arch_get_supported_cpuid(s, 0x80000001,
                                                              0, R_ECX);
-    env->cpuid_svm_features  &= kvm_arch_get_supported_cpuid(env, 0x8000000A,
+    env->cpuid_svm_features  &= kvm_arch_get_supported_cpuid(s, 0x8000000A,
                                                              0, R_EDX);
 
-
     cpuid_i = 0;
 
     /* Paravirtualization CPUIDs */
@@ -383,8 +383,8 @@ int kvm_arch_init_vcpu(CPUState *env)
     c = &cpuid_data.entries[cpuid_i++];
     memset(c, 0, sizeof(*c));
     c->function = KVM_CPUID_FEATURES;
-    c->eax = env->cpuid_kvm_features & kvm_arch_get_supported_cpuid(env,
-                                                KVM_CPUID_FEATURES, 0, R_EAX);
+    c->eax = env->cpuid_kvm_features &
+        kvm_arch_get_supported_cpuid(s, KVM_CPUID_FEATURES, 0, R_EAX);
 
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
 
@@ -453,7 +453,7 @@ int kvm_arch_init_vcpu(CPUState *env)
     /* Call Centaur's CPUID instructions they are supported. */
     if (env->cpuid_xlevel2 > 0) {
         env->cpuid_ext4_features &=
-            kvm_arch_get_supported_cpuid(env, 0xC0000001, 0, R_EDX);
+            kvm_arch_get_supported_cpuid(s, 0xC0000001, 0, R_EDX);
         cpu_x86_cpuid(env, 0xC0000000, 0, &limit, &unused, &unused, &unused);
 
         for (i = 0xC0000000; i <= limit; i++) {
Signature · 1 line
1.7.5.4
#13 lore raw

PATCH 13/15 Remove unneeded kvm.h from cpu-exec.c

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

This was obsoleted by 6792a57bf1.

---
 cpu-exec.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
cpu-exec.c +0 -1
index e1de56b..7aa1d00 100644
@@ -20,7 +20,6 @@
 #include "exec.h"
 #include "disas.h"
 #include "tcg.h"
-#include "kvm.h"
 #include "qemu-barrier.h"
 
 #if defined(__sparc__) && !defined(CONFIG_SOLARIS)
Signature · 1 line
1.7.5.4
#15 lore raw

PATCH 15/15 kvm: fix FPU state subsection

In reply to Marcelo Tosatti

There is no need to specify version on the subsection fields.

---
 target-i386/machine.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
target-i386/machine.c +3 -3
index d22a731..7662aa2 100644
@@ -303,9 +303,9 @@ static const VMStateDescription vmstate_fpop_ip_dp = {
     .minimum_version_id = 1,
     .minimum_version_id_old = 1,
     .fields      = (VMStateField []) {
-        VMSTATE_UINT16_V(fpop, CPUState, 13),
-        VMSTATE_UINT64_V(fpip, CPUState, 13),
-        VMSTATE_UINT64_V(fpdp, CPUState, 13),
+        VMSTATE_UINT16(fpop, CPUState),
+        VMSTATE_UINT64(fpip, CPUState),
+        VMSTATE_UINT64(fpdp, CPUState),
         VMSTATE_END_OF_LIST()
     }
 };
Signature · 1 line
1.7.5.4
#6 lore raw

PATCH 6/15 kvm: ppc: Drop CONFIG_KVM_PPC_PVR

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Required header support is now unconditionally available.

---
 configure        |    1 -
 target-ppc/kvm.c |    9 ---------
 2 files changed, 0 insertions(+), 10 deletions(-)
configure +0 -1
index ebd5d56..3286e33 100755
@@ -3226,7 +3226,6 @@ case "$target_arch2" in
       if test $vhost_net = "yes" ; then
         echo "CONFIG_VHOST_NET=y" >> $config_target_mak
       fi
-      echo "CONFIG_KVM_PPC_PVR=y" >> $config_target_mak
     fi
 esac
 if test "$target_bigendian" = "yes" ; then
target-ppc/kvm.c +0 -9
index e7b1b10..0500e3f 100644
@@ -104,21 +104,12 @@ static int kvm_arch_sync_sregs(CPUState *cenv)
         }
     }
 
-#if !defined(CONFIG_KVM_PPC_PVR)
-    if (1) {
-        fprintf(stderr, "kvm error: missing PVR setting capability\n");
-        return -ENOSYS;
-    }
-#endif
-
     ret = kvm_vcpu_ioctl(cenv, KVM_GET_SREGS, &sregs);
     if (ret) {
         return ret;
     }
 
-#ifdef CONFIG_KVM_PPC_PVR
     sregs.pvr = cenv->spr[SPR_PVR];
-#endif
     return kvm_vcpu_ioctl(cenv, KVM_SET_SREGS, &sregs);
 }
 
Signature · 1 line
1.7.5.4
#11 lore raw

PATCH 11/15 kvm: Clean up stubs

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

No one references kvm_check_extension, kvm_has_vcpu_events, and kvm_has_robust_singlestep outside KVM code.

kvm_update_guest_debug is never called, thus has no job besides returning an error.

---
 kvm-stub.c |   18 +-----------------
 1 files changed, 1 insertions(+), 17 deletions(-)
kvm-stub.c +1 -17
index 1c95452..1e835c6 100644
@@ -42,11 +42,6 @@ int kvm_uncoalesce_mmio_region(target_phys_addr_t start, ram_addr_t size)
     return -ENOSYS;
 }
 
-int kvm_check_extension(KVMState *s, unsigned int extension)
-{
-    return 0;
-}
-
 int kvm_init(void)
 {
     return -ENOSYS;
@@ -78,16 +73,6 @@ int kvm_has_sync_mmu(void)
     return 0;
 }
 
-int kvm_has_vcpu_events(void)
-{
-    return 0;
-}
-
-int kvm_has_robust_singlestep(void)
-{
-    return 0;
-}
-
 int kvm_has_many_ioeventfds(void)
 {
     return 0;
@@ -99,8 +84,7 @@ void kvm_setup_guest_memory(void *start, size_t size)
 
 int kvm_update_guest_debug(CPUState *env, unsigned long reinject_trap)
 {
-    tb_flush(env);
-    return 0;
+    return -ENOSYS;
 }
 
 int kvm_insert_breakpoint(CPUState *current_env, target_ulong addr,
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH 7/15 kvm: Drop useless zero-initializations

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

Backing KVMState is alreay zero-initialized.

---
 kvm-all.c |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
kvm-all.c +0 -5
index 106eb3a..4a9910a 100644
@@ -764,28 +764,23 @@ int kvm_init(void)
     }
 #endif
 
-    s->vcpu_events = 0;
 #ifdef KVM_CAP_VCPU_EVENTS
     s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
 #endif
 
-    s->robust_singlestep = 0;
 #ifdef KVM_CAP_X86_ROBUST_SINGLESTEP
     s->robust_singlestep =
         kvm_check_extension(s, KVM_CAP_X86_ROBUST_SINGLESTEP);
 #endif
 
-    s->debugregs = 0;
 #ifdef KVM_CAP_DEBUGREGS
     s->debugregs = kvm_check_extension(s, KVM_CAP_DEBUGREGS);
 #endif
 
-    s->xsave = 0;
 #ifdef KVM_CAP_XSAVE
     s->xsave = kvm_check_extension(s, KVM_CAP_XSAVE);
 #endif
 
-    s->xcrs = 0;
 #ifdef KVM_CAP_XCRS
     s->xcrs = kvm_check_extension(s, KVM_CAP_XCRS);
 #endif
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/15 Import kernel headers

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

These kernel headers and the COPYING file were automatically imported from current Linux git, cb0a02ecf9 (post 3.0-rc2).

Licensing:
asm-powerpc GPLv2
asm-s390 GPLv2
asm-x86 Linux top-level license (GPLv2 with exception)
linux/kvm*: Linux top-level license (GPLv2 with exception)
linux/vhost: Linux top-level license (GPLv2 with exception)
linux/virtio*: 3-clause BSB

---
 linux-headers/COPYING                |  356 +++++++++++++++
 linux-headers/asm-powerpc/kvm.h      |  275 ++++++++++++
 linux-headers/asm-powerpc/kvm_para.h |   53 +++
 linux-headers/asm-s390/kvm.h         |   44 ++
 linux-headers/asm-s390/kvm_para.h    |   17 +
 linux-headers/asm-x86/hyperv.h       |  193 ++++++++
 linux-headers/asm-x86/kvm.h          |  324 ++++++++++++++
 linux-headers/asm-x86/kvm_para.h     |   79 ++++
 linux-headers/linux/kvm.h            |  804 ++++++++++++++++++++++++++++++++++
 linux-headers/linux/kvm_para.h       |   28 ++
 linux-headers/linux/vhost.h          |  130 ++++++
 linux-headers/linux/virtio_config.h  |   54 +++
 linux-headers/linux/virtio_ring.h    |  163 +++++++
 13 files changed, 2520 insertions(+), 0 deletions(-)
 create mode 100644 linux-headers/COPYING
 create mode 100644 linux-headers/asm-powerpc/kvm.h
 create mode 100644 linux-headers/asm-powerpc/kvm_para.h
 create mode 100644 linux-headers/asm-s390/kvm.h
 create mode 100644 linux-headers/asm-s390/kvm_para.h
 create mode 100644 linux-headers/asm-x86/hyperv.h
 create mode 100644 linux-headers/asm-x86/kvm.h
 create mode 100644 linux-headers/asm-x86/kvm_para.h
 create mode 100644 linux-headers/linux/kvm.h
 create mode 100644 linux-headers/linux/kvm_para.h
 create mode 100644 linux-headers/linux/vhost.h
 create mode 100644 linux-headers/linux/virtio_config.h
 create mode 100644 linux-headers/linux/virtio_ring.h
linux-headers/COPYING new file +74 -0
new file mode 100644
index 0000000..ca442d3
@@ -0,0 +1,356 @@
+
+   NOTE! This copyright does *not* cover user programs that use kernel
+ services by normal system calls - this is merely considered normal use
+ of the kernel, and does *not* fall under the heading of "derived work".
+ Also note that the GPL below is copyrighted by the Free Software
+ Foundation, but the instance of code that it refers to (the Linux
+ kernel) is copyrighted by me and others who actually wrote it.
+
+ Also note that the only valid version of the GPL as far as the kernel
+ is concerned is _this_ particular version of the license (ie v2, not
+ v2.2 or v3.x or whatever), unless explicitly otherwise stated.
+
+			Linus Torvalds
+
+----------------------------------------
+
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+

+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". +
+Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. +
+ 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+

+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)

+

+These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. +
+Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following:
+

+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)

+
+The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable.
+
+If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code.
+

+ 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances.
+
+It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice.
+
+This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License.
+

+ 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+

+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. +
+ To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. +
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+

+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

+
+
+Also add information on how to contact you by electronic and paper mail. +
+If the program is interactive, make it output a short notice like this +when it starts in an interactive mode:
+

+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.

+
+The hypothetical commands show w' and show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than show w' and show c'; they could even be +mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker. +
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License.

linux-headers/asm-powerpc/kvm.h new file +275 -0

275 lines not on this page · raw message

linux-headers/asm-powerpc/kvm_para.h new file +53 -0

53 lines not on this page · raw message

linux-headers/asm-s390/kvm.h new file +44 -0

44 lines not on this page · raw message

linux-headers/asm-s390/kvm_para.h new file +17 -0
new file mode 100644
index 0000000..8e2dd67
@@ -0,0 +1,17 @@
+/*
+ * asm-s390/kvm_para.h - definition for paravirtual devices on s390
+ *
+ * Copyright IBM Corp. 2008
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License (version 2 only)
+ * as published by the Free Software Foundation.
+ *
+ *    Author(s): Christian Borntraeger <[email protected]>
+ */
+
+#ifndef __S390_KVM_PARA_H
+#define __S390_KVM_PARA_H
+
+
+#endif /* __S390_KVM_PARA_H */
linux-headers/asm-x86/hyperv.h new file +193 -0

193 lines not on this page · raw message

linux-headers/asm-x86/kvm.h new file +324 -0

324 lines not on this page · raw message

linux-headers/asm-x86/kvm_para.h new file +79 -0

79 lines not on this page · raw message

linux-headers/linux/kvm.h new file +804 -0

804 lines not on this page · raw message

linux-headers/linux/kvm_para.h new file +28 -0
new file mode 100644
index 0000000..7bdcf93
@@ -0,0 +1,28 @@
+#ifndef __LINUX_KVM_PARA_H
+#define __LINUX_KVM_PARA_H
+
+/*
+ * This header file provides a method for making a hypercall to the host
+ * Architectures should define:
+ * - kvm_hypercall0, kvm_hypercall1...
+ * - kvm_arch_para_features
+ * - kvm_para_available
+ */
+
+/* Return values for hypercalls */
+#define KVM_ENOSYS		1000
+#define KVM_EFAULT		EFAULT
+#define KVM_E2BIG		E2BIG
+#define KVM_EPERM		EPERM
+
+#define KVM_HC_VAPIC_POLL_IRQ		1
+#define KVM_HC_MMU_OP			2
+#define KVM_HC_FEATURES			3
+#define KVM_HC_PPC_MAP_MAGIC_PAGE	4
+
+/*
+ * hypercalls use architecture specific
+ */
+#include <asm/kvm_para.h>
+
+#endif /* __LINUX_KVM_PARA_H */
linux-headers/linux/vhost.h new file +130 -0

130 lines not on this page · raw message

linux-headers/linux/virtio_config.h new file +54 -0

54 lines not on this page · raw message

linux-headers/linux/virtio_ring.h new file +163 -0

163 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 10/15 kvm: ppc: Drop KVM_CAP build dependencies

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

No longer needed with accompanied kernel headers.

---
 target-ppc/kvm.c |   14 --------------
 1 files changed, 0 insertions(+), 14 deletions(-)
target-ppc/kvm.c +0 -14
index 0500e3f..21f35af7 100644
@@ -65,18 +65,10 @@ static void kvm_kick_env(void *env)
 
 int kvm_arch_init(KVMState *s)
 {
-#ifdef KVM_CAP_PPC_UNSET_IRQ
     cap_interrupt_unset = kvm_check_extension(s, KVM_CAP_PPC_UNSET_IRQ);
-#endif
-#ifdef KVM_CAP_PPC_IRQ_LEVEL
     cap_interrupt_level = kvm_check_extension(s, KVM_CAP_PPC_IRQ_LEVEL);
-#endif
-#ifdef KVM_CAP_PPC_SEGSTATE
     cap_segstate = kvm_check_extension(s, KVM_CAP_PPC_SEGSTATE);
-#endif
-#ifdef KVM_CAP_PPC_BOOKE_SREGS
     cap_booke_sregs = kvm_check_extension(s, KVM_CAP_PPC_BOOKE_SREGS);
-#endif
 
     if (!cap_interrupt_level) {
         fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
@@ -217,7 +209,6 @@ int kvm_arch_get_registers(CPUState *env)
             return ret;
         }
 
-#ifdef KVM_CAP_PPC_BOOKE_SREGS
         if (sregs.u.e.features & KVM_SREGS_E_BASE) {
             env->spr[SPR_BOOKE_CSRR0] = sregs.u.e.csrr0;
             env->spr[SPR_BOOKE_CSRR1] = sregs.u.e.csrr1;
@@ -314,7 +305,6 @@ int kvm_arch_get_registers(CPUState *env)
                 env->spr[SPR_BOOKE_PID2] = sregs.u.e.impl.fsl.pid2;
             }
         }
-#endif
     }
 
     if (cap_segstate) {
@@ -323,7 +313,6 @@ int kvm_arch_get_registers(CPUState *env)
             return ret;
         }
 
-#ifdef KVM_CAP_PPC_SEGSTATE
         ppc_store_sdr1(env, sregs.u.s.sdr1);
 
         /* Sync SLB */
@@ -346,7 +335,6 @@ int kvm_arch_get_registers(CPUState *env)
             env->IBAT[0][i] = sregs.u.s.ppc32.ibat[i] & 0xffffffff;
             env->IBAT[1][i] = sregs.u.s.ppc32.ibat[i] >> 32;
         }
-#endif
     }
 
     return 0;
@@ -525,7 +513,6 @@ int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
 {
     uint32_t *hc = (uint32_t*)buf;
 
-#ifdef KVM_CAP_PPC_GET_PVINFO
     struct kvm_ppc_pvinfo pvinfo;
 
     if (kvm_check_extension(env->kvm_state, KVM_CAP_PPC_GET_PVINFO) &&
@@ -534,7 +521,6 @@ int kvmppc_get_hypercall(CPUState *env, uint8_t *buf, int buf_len)
 
         return 0;
     }
-#endif
 
     /*
      * Fallback to always fail hypercalls:
Signature · 1 line
1.7.5.4
#0 lore raw

The following changes since commit eb47d7c5d96060040931c42773ee07e61e547af9:

hw/9118.c: Implement active-low interrupt support (2011-06-15 13:23:37 +0200)

are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master

Andre Przywara (1):
KVM: Fix XSAVE feature bit enumeration

Jan Kiszka (13):
kvm: x86: Save/restore FPU OP, IP and DP
Add kernel header update script
Import kernel headers
Switch build system to accompanied kernel headers
kvm: Drop CONFIG_KVM_PARA
kvm: ppc: Drop CONFIG_KVM_PPC_PVR
kvm: Drop useless zero-initializations
kvm: Drop KVM_CAP build dependencies
kvm: x86: Drop KVM_CAP build dependencies
kvm: ppc: Drop KVM_CAP build dependencies
kvm: Clean up stubs
kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid Remove unneeded kvm.h from cpu-exec.c

Marcelo Tosatti (1):
kvm: fix FPU state subsection

 Makefile.target                      |    4 +-
 configure                            |  149 +------
 cpu-exec.c                           |    1 -
 hw/kvmclock.c                        |    9 -
 kvm-all.c                            |   13 -
 kvm-stub.c                           |   18 +-
 kvm.h                                |    2 +-
 linux-headers/COPYING                |  356 +++++++++++++++
 linux-headers/README                 |    2 +
 linux-headers/asm-powerpc/kvm.h      |  275 ++++++++++++
 linux-headers/asm-powerpc/kvm_para.h |   53 +++
 linux-headers/asm-s390/kvm.h         |   44 ++
 linux-headers/asm-s390/kvm_para.h    |   17 +
 linux-headers/asm-x86/hyperv.h       |  193 ++++++++
 linux-headers/asm-x86/kvm.h          |  324 ++++++++++++++
 linux-headers/asm-x86/kvm_para.h     |   79 ++++
 linux-headers/linux/kvm.h            |  804 ++++++++++++++++++++++++++++++++++
 linux-headers/linux/kvm_para.h       |   28 ++
 linux-headers/linux/vhost.h          |  130 ++++++
 linux-headers/linux/virtio_config.h  |   54 +++
 linux-headers/linux/virtio_ring.h    |  163 +++++++
 scripts/update-linux-headers.sh      |   55 +++
 target-i386/cpu.h                    |    4 +
 target-i386/cpuid.c                  |   20 +-
 target-i386/kvm.c                    |  148 ++-----
 target-i386/machine.c                |   23 +
 target-ppc/kvm.c                     |   23 -
 target-s390x/cpu.h                   |   10 -
 target-s390x/op_helper.c             |    1 +
 29 files changed, 2675 insertions(+), 327 deletions(-)
 create mode 100644 linux-headers/COPYING
 create mode 100644 linux-headers/README
 create mode 100644 linux-headers/asm-powerpc/kvm.h
 create mode 100644 linux-headers/asm-powerpc/kvm_para.h
 create mode 100644 linux-headers/asm-s390/kvm.h
 create mode 100644 linux-headers/asm-s390/kvm_para.h
 create mode 100644 linux-headers/asm-x86/hyperv.h
 create mode 100644 linux-headers/asm-x86/kvm.h
 create mode 100644 linux-headers/asm-x86/kvm_para.h
 create mode 100644 linux-headers/linux/kvm.h
 create mode 100644 linux-headers/linux/kvm_para.h
 create mode 100644 linux-headers/linux/vhost.h
 create mode 100644 linux-headers/linux/virtio_config.h
 create mode 100644 linux-headers/linux/virtio_ring.h
 create mode 100755 scripts/update-linux-headers.sh
#8 lore raw

PATCH 8/15 kvm: Drop KVM_CAP build dependencies

From: Jan Kiszka <[email protected]>

No longer needed with accompanied kernel headers. We are only left with build dependencies that are controlled by kvm arch headers.

---
 kvm-all.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)
kvm-all.c +0 -8
index 4a9910a..cbc2532 100644
@@ -757,21 +757,17 @@ int kvm_init(void)
     s->coalesced_mmio = kvm_check_extension(s, KVM_CAP_COALESCED_MMIO);
 
     s->broken_set_mem_region = 1;
-#ifdef KVM_CAP_JOIN_MEMORY_REGIONS_WORKS
     ret = kvm_check_extension(s, KVM_CAP_JOIN_MEMORY_REGIONS_WORKS);
     if (ret > 0) {
         s->broken_set_mem_region = 0;
     }
-#endif
 
 #ifdef KVM_CAP_VCPU_EVENTS
     s->vcpu_events = kvm_check_extension(s, KVM_CAP_VCPU_EVENTS);
 #endif
 
-#ifdef KVM_CAP_X86_ROBUST_SINGLESTEP
     s->robust_singlestep =
         kvm_check_extension(s, KVM_CAP_X86_ROBUST_SINGLESTEP);
-#endif
 
 #ifdef KVM_CAP_DEBUGREGS
     s->debugregs = kvm_check_extension(s, KVM_CAP_DEBUGREGS);
@@ -850,7 +846,6 @@ static void kvm_handle_io(uint16_t port, void *data, int direction, int size,
     }
 }
 
-#ifdef KVM_CAP_INTERNAL_ERROR_DATA
 static int kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
 {
     fprintf(stderr, "KVM internal error.");
@@ -877,7 +872,6 @@ static int kvm_handle_internal_error(CPUState *env, struct kvm_run *run)
      */
     return -1;
 }
-#endif
 
 void kvm_flush_coalesced_mmio_buffer(void)
 {
@@ -1008,11 +1002,9 @@ int kvm_cpu_exec(CPUState *env)
                     (uint64_t)run->hw.hardware_exit_reason);
             ret = -1;
             break;
-#ifdef KVM_CAP_INTERNAL_ERROR_DATA
         case KVM_EXIT_INTERNAL_ERROR:
             ret = kvm_handle_internal_error(env, run);
             break;
-#endif
         default:
             DPRINTF("kvm_arch_handle_exit\n");
             ret = kvm_arch_handle_exit(env, run);
Signature · 1 line
1.7.5.4
#14 lore raw

PATCH 14/15 KVM: Fix XSAVE feature bit enumeration

In reply to Marcelo Tosatti

From: Andre Przywara <[email protected]>

When iterating through the XSAVE feature enumeration CPUID leaf (0xD) we should not stop at the first zero EAX, but instead keep scanning since there are gaps in the enumeration (ECX=1 for instance). This fixes the proper usage of AVX in KVM guests.

---
 target-i386/kvm.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
target-i386/kvm.c +4 -1
index 938e0a3..10fb2c4 100644
@@ -416,6 +416,9 @@ int kvm_arch_init_vcpu(CPUState *env)
         case 0xb:
         case 0xd:
             for (j = 0; ; j++) {
+                if (i == 0xd && j == 64) {
+                    break;
+                }
                 c->function = i;
                 c->flags = KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
                 c->index = j;
@@ -428,7 +431,7 @@ int kvm_arch_init_vcpu(CPUState *env)
                     break;
                 }
                 if (i == 0xd && c->eax == 0) {
-                    break;
+                    continue;
                 }
                 c = &cpuid_data.entries[cpuid_i++];
             }
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 5/15 kvm: Drop CONFIG_KVM_PARA

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

The kvm_para.h header is now always available.

---
 configure         |    1 -
 hw/kvmclock.c     |    9 ---------
 target-i386/kvm.c |   26 +-------------------------
 3 files changed, 1 insertions(+), 35 deletions(-)
configure +0 -1
index 8df6485..ebd5d56 100755
@@ -3223,7 +3223,6 @@ case "$target_arch2" in
       \( "$target_arch2" = "x86_64" -a "$cpu" = "i386"   \) -o \
       \( "$target_arch2" = "i386"   -a "$cpu" = "x86_64" \) \) ; then
       echo "CONFIG_KVM=y" >> $config_target_mak
-      echo "CONFIG_KVM_PARA=y" >> $config_target_mak
       if test $vhost_net = "yes" ; then
         echo "CONFIG_VHOST_NET=y" >> $config_target_mak
       fi
hw/kvmclock.c +0 -9
index 004c4ad..692ad18 100644
@@ -17,8 +17,6 @@
 #include "kvm.h"
 #include "kvmclock.h"
 
-#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ADJUST_CLOCK)
-
 #include <linux/kvm.h>
 #include <linux/kvm_para.h>
 
@@ -120,10 +118,3 @@ static void kvmclock_register_device(void)
 }
 
 device_init(kvmclock_register_device);
-
-#else /* !(CONFIG_KVM_PARA && KVM_CAP_ADJUST_CLOCK) */
-
-void kvmclock_create(void)
-{
-}
-#endif /* !(CONFIG_KVM_PARA && KVM_CAP_ADJUST_CLOCK) */
target-i386/kvm.c +1 -25
index 16e8213..eb36e9f 100644
@@ -18,6 +18,7 @@
 #include <sys/utsname.h>
 
 #include <linux/kvm.h>
+#include <linux/kvm_para.h>
 
 #include "qemu-common.h"
 #include "sysemu.h"
@@ -29,10 +30,6 @@
 #include "hw/apic.h"
 #include "ioport.h"
 
-#ifdef CONFIG_KVM_PARA
-#include <linux/kvm_para.h>
-#endif
-//
 //#define DEBUG_KVM
 
 #ifdef DEBUG_KVM
@@ -62,9 +59,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
 
 static bool has_msr_star;
 static bool has_msr_hsave_pa;
-#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF)
 static bool has_msr_async_pf_en;
-#endif
 static int lm_capable_kernel;
 
 static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
@@ -92,7 +87,6 @@ static struct kvm_cpuid2 *try_get_cpuid(KVMState *s, int max)
     return cpuid;
 }
 
-#ifdef CONFIG_KVM_PARA
 struct kvm_para_features {
     int cap;
     int feature;
@@ -118,7 +112,6 @@ static int get_para_features(CPUState *env)
 
     return features;
 }
-#endif
 
 
 uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
@@ -128,9 +121,7 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
     int i, max;
     uint32_t ret = 0;
     uint32_t cpuid_1_edx;
-#ifdef CONFIG_KVM_PARA
     int has_kvm_features = 0;
-#endif
 
     max = 1;
     while ((cpuid = try_get_cpuid(env->kvm_state, max)) == NULL) {
@@ -140,11 +131,9 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
     for (i = 0; i < cpuid->nent; ++i) {
         if (cpuid->entries[i].function == function &&
             cpuid->entries[i].index == index) {
-#ifdef CONFIG_KVM_PARA
             if (cpuid->entries[i].function == KVM_CPUID_FEATURES) {
                 has_kvm_features = 1;
             }
-#endif
             switch (reg) {
             case R_EAX:
                 ret = cpuid->entries[i].eax;
@@ -177,12 +166,10 @@ uint32_t kvm_arch_get_supported_cpuid(CPUState *env, uint32_t function,
 
     qemu_free(cpuid);
 
-#ifdef CONFIG_KVM_PARA
     /* fallback for older kernels */
     if (!has_kvm_features && (function == KVM_CPUID_FEATURES)) {
         ret = get_para_features(env);
     }
-#endif
 
     return ret;
 }
@@ -377,9 +364,7 @@ int kvm_arch_init_vcpu(CPUState *env)
     uint32_t limit, i, j, cpuid_i;
     uint32_t unused;
     struct kvm_cpuid_entry2 *c;
-#ifdef CONFIG_KVM_PARA
     uint32_t signature[3];
-#endif
 
     env->cpuid_features &= kvm_arch_get_supported_cpuid(env, 1, 0, R_EDX);
 
@@ -397,7 +382,6 @@ int kvm_arch_init_vcpu(CPUState *env)
 
     cpuid_i = 0;
 
-#ifdef CONFIG_KVM_PARA
     /* Paravirtualization CPUIDs */
     memcpy(signature, "KVMKVMKVM\0\0\0", 12);
     c = &cpuid_data.entries[cpuid_i++];
@@ -418,8 +402,6 @@ int kvm_arch_init_vcpu(CPUState *env)
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
 #endif
 
-#endif
-
     cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
 
     for (i = 0; i <= limit; i++) {
@@ -936,12 +918,10 @@ static int kvm_put_msrs(CPUState *env, int level)
         kvm_msr_entry_set(&msrs[n++], MSR_KVM_SYSTEM_TIME,
                           env->system_time_msr);
         kvm_msr_entry_set(&msrs[n++], MSR_KVM_WALL_CLOCK, env->wall_clock_msr);
-#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF)
         if (has_msr_async_pf_en) {
             kvm_msr_entry_set(&msrs[n++], MSR_KVM_ASYNC_PF_EN,
                               env->async_pf_en_msr);
         }
-#endif
     }
 #ifdef KVM_CAP_MCE
     if (env->mcg_cap) {
@@ -1182,11 +1162,9 @@ static int kvm_get_msrs(CPUState *env)
 #endif
     msrs[n++].index = MSR_KVM_SYSTEM_TIME;
     msrs[n++].index = MSR_KVM_WALL_CLOCK;
-#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF)
     if (has_msr_async_pf_en) {
         msrs[n++].index = MSR_KVM_ASYNC_PF_EN;
     }
-#endif
 
 #ifdef KVM_CAP_MCE
     if (env->mcg_cap) {
@@ -1263,11 +1241,9 @@ static int kvm_get_msrs(CPUState *env)
             }
 #endif
             break;
-#if defined(CONFIG_KVM_PARA) && defined(KVM_CAP_ASYNC_PF)
         case MSR_KVM_ASYNC_PF_EN:
             env->async_pf_en_msr = msrs[i].data;
             break;
-#endif
         }
     }
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/15 kvm: x86: Save/restore FPU OP, IP and DP

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

These FPU states are properly maintained by KVM but not yet by TCG. So far we unconditionally set them to 0 in the guest which may cause state corruptions, though not with modern guests.

To avoid breaking backward migration, use a conditional subsection that is only written if any of the three fields is non-zero. The guest's FNINIT clears them frequently, and cleared IA32_MISC_ENABLE MSR[2] reduces the probability of non-zero values further so that this subsection is not expected to restrict migration in any common scenario.

---
 target-i386/cpu.h     |    4 ++++
 target-i386/kvm.c     |   20 +++++++++++++++-----
 target-i386/machine.c |   23 +++++++++++++++++++++++
 3 files changed, 42 insertions(+), 5 deletions(-)
target-i386/cpu.h +4 -0
index 9c3340d..cdf68ff 100644
@@ -641,6 +641,10 @@ typedef struct CPUX86State {
     uint16_t fpuc;
     uint8_t fptags[8];   /* 0 = valid, 1 = empty */
     FPReg fpregs[8];
+    /* KVM-only so far */
+    uint16_t fpop;
+    uint64_t fpip;
+    uint64_t fpdp;
 
     /* emulator internal variables */
     float_status fp_status;
target-i386/kvm.c +15 -5
index 1ae2d61..16e8213 100644
@@ -753,6 +753,9 @@ static int kvm_put_fpu(CPUState *env)
     fpu.fsw = env->fpus & ~(7 << 11);
     fpu.fsw |= (env->fpstt & 7) << 11;
     fpu.fcw = env->fpuc;
+    fpu.last_opcode = env->fpop;
+    fpu.last_ip = env->fpip;
+    fpu.last_dp = env->fpdp;
     for (i = 0; i < 8; ++i) {
         fpu.ftwx |= (!env->fptags[i]) << i;
     }
@@ -778,7 +781,7 @@ static int kvm_put_xsave(CPUState *env)
 #ifdef KVM_CAP_XSAVE
     int i, r;
     struct kvm_xsave* xsave;
-    uint16_t cwd, swd, twd, fop;
+    uint16_t cwd, swd, twd;
 
     if (!kvm_has_xsave()) {
         return kvm_put_fpu(env);
@@ -786,7 +789,7 @@ static int kvm_put_xsave(CPUState *env)
 
     xsave = qemu_memalign(4096, sizeof(struct kvm_xsave));
     memset(xsave, 0, sizeof(struct kvm_xsave));
-    cwd = swd = twd = fop = 0;
+    cwd = swd = twd = 0;
     swd = env->fpus & ~(7 << 11);
     swd |= (env->fpstt & 7) << 11;
     cwd = env->fpuc;
@@ -794,7 +797,9 @@ static int kvm_put_xsave(CPUState *env)
         twd |= (!env->fptags[i]) << i;
     }
     xsave->region[0] = (uint32_t)(swd << 16) + cwd;
-    xsave->region[1] = (uint32_t)(fop << 16) + twd;
+    xsave->region[1] = (uint32_t)(env->fpop << 16) + twd;
+    memcpy(&xsave->region[XSAVE_CWD_RIP], &env->fpip, sizeof(env->fpip));
+    memcpy(&xsave->region[XSAVE_CWD_RDP], &env->fpdp, sizeof(env->fpdp));
     memcpy(&xsave->region[XSAVE_ST_SPACE], env->fpregs,
             sizeof env->fpregs);
     memcpy(&xsave->region[XSAVE_XMM_SPACE], env->xmm_regs,
@@ -970,6 +975,9 @@ static int kvm_get_fpu(CPUState *env)
     env->fpstt = (fpu.fsw >> 11) & 7;
     env->fpus = fpu.fsw;
     env->fpuc = fpu.fcw;
+    env->fpop = fpu.last_opcode;
+    env->fpip = fpu.last_ip;
+    env->fpdp = fpu.last_dp;
     for (i = 0; i < 8; ++i) {
         env->fptags[i] = !((fpu.ftwx >> i) & 1);
     }
@@ -985,7 +993,7 @@ static int kvm_get_xsave(CPUState *env)
 #ifdef KVM_CAP_XSAVE
     struct kvm_xsave* xsave;
     int ret, i;
-    uint16_t cwd, swd, twd, fop;
+    uint16_t cwd, swd, twd;
 
     if (!kvm_has_xsave()) {
         return kvm_get_fpu(env);
@@ -1001,13 +1009,15 @@ static int kvm_get_xsave(CPUState *env)
     cwd = (uint16_t)xsave->region[0];
     swd = (uint16_t)(xsave->region[0] >> 16);
     twd = (uint16_t)xsave->region[1];
-    fop = (uint16_t)(xsave->region[1] >> 16);
+    env->fpop = (uint16_t)(xsave->region[1] >> 16);
     env->fpstt = (swd >> 11) & 7;
     env->fpus = swd;
     env->fpuc = cwd;
     for (i = 0; i < 8; ++i) {
         env->fptags[i] = !((twd >> i) & 1);
     }
+    memcpy(&env->fpip, &xsave->region[XSAVE_CWD_RIP], sizeof(env->fpip));
+    memcpy(&env->fpdp, &xsave->region[XSAVE_CWD_RDP], sizeof(env->fpdp));
     env->mxcsr = xsave->region[XSAVE_MXCSR];
     memcpy(env->fpregs, &xsave->region[XSAVE_ST_SPACE],
             sizeof env->fpregs);
target-i386/machine.c +23 -0
index bbeae88..d22a731 100644
@@ -290,6 +290,26 @@ static const VMStateDescription vmstate_async_pf_msr = {
     }
 };
 
+static bool fpop_ip_dp_needed(void *opaque)
+{
+    CPUState *env = opaque;
+
+    return env->fpop != 0 || env->fpip != 0 || env->fpdp != 0;
+}
+
+static const VMStateDescription vmstate_fpop_ip_dp = {
+    .name = "cpu/fpop_ip_dp",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_UINT16_V(fpop, CPUState, 13),
+        VMSTATE_UINT64_V(fpip, CPUState, 13),
+        VMSTATE_UINT64_V(fpdp, CPUState, 13),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static const VMStateDescription vmstate_cpu = {
     .name = "cpu",
     .version_id = CPU_SAVE_VERSION,
@@ -398,6 +418,9 @@ static const VMStateDescription vmstate_cpu = {
             .vmsd = &vmstate_async_pf_msr,
             .needed = async_pf_msr_needed,
         } , {
+            .vmsd = &vmstate_fpop_ip_dp,
+            .needed = fpop_ip_dp_needed,
+        } , {
             /* empty */
         }
     }
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/15 Switch build system to accompanied kernel headers

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

This helps reducing our build-time checks for feature support in the available Linux kernel headers. And it helps users that do not have sufficiently recent headers installed on their build machine.

Consequently, the patch removes and build-time checks for kvm and vhost in configure, the --kerneldir switch, and KVM_CFLAGS. Kernel headers are supposed to be provided by QEMU only.

s390 needs some extra love as it carries redefinitions from kernel headers.

---
 Makefile.target          |    4 +-
 configure                |  151 ++++++----------------------------------------
 target-s390x/cpu.h       |   10 ---
 target-s390x/op_helper.c |    1 +
 4 files changed, 21 insertions(+), 145 deletions(-)
Makefile.target +1 -3
index b1a0f6d..db2fa6e 100644
@@ -14,7 +14,7 @@ endif
 
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_BASE_ARCH)
 $(call set-vpath, $(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw)
-QEMU_CFLAGS+= -I.. -I$(TARGET_PATH) -DNEED_CPU_H
+QEMU_CFLAGS+= -I.. -I../linux-headers -I$(TARGET_PATH) -DNEED_CPU_H
 
 include $(SRC_PATH)/Makefile.objs
 
@@ -37,8 +37,6 @@ ifndef CONFIG_HAIKU
 LIBS+=-lm
 endif
 
-kvm.o kvm-all.o vhost.o vhost_net.o kvmclock.o: QEMU_CFLAGS+=$(KVM_CFLAGS)
-
 config-target.h: config-target.h-timestamp
 config-target.h-timestamp: config-target.mak
 
configure +19 -132

202 lines not on this page · raw message

target-s390x/cpu.h +0 -10
index 4e5c391..b5e587f 100644
@@ -313,16 +313,6 @@ CPUState *s390_cpu_addr2state(uint16_t cpu_addr);
 /* from s390-virtio-bus */
 extern const target_phys_addr_t virtio_size;
 
-#ifndef KVM_S390_SIGP_STOP
-#define KVM_S390_SIGP_STOP              0
-#define KVM_S390_PROGRAM_INT            0
-#define KVM_S390_SIGP_SET_PREFIX        0
-#define KVM_S390_RESTART                0
-#define KVM_S390_INT_VIRTIO             0
-#define KVM_S390_INT_SERVICE            0
-#define KVM_S390_INT_EMERGENCY          0
-#endif
-
 #endif
 void cpu_lock(void);
 void cpu_unlock(void);
target-s390x/op_helper.c +1 -0
index db03a79..9429698 100644
@@ -23,6 +23,7 @@
 #include "helpers.h"
 #include <string.h>
 #include "kvm.h"
+#include <linux/kvm.h>
 #include "qemu-timer.h"
 
 /*****************************************************************************/
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/15 Add kernel header update script

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

This helper pulls the required kernel headers for KVM and vhost into a specified directory. The update is triggered via

scripts/update-linux-headers.sh LINUX_PATH

and will place the output under linux-headers/linux and linux-headers/asm-*. It also imports the COPYING to care for headers without an explicit license.

CC Alexander Graf <[email protected]>
CC Christoph Hellwig <[email protected]>
CC Peter Maydell <[email protected]>
CC Andreas Färber <[email protected]>
---
 linux-headers/README            |    2 +
 scripts/update-linux-headers.sh |   55 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100644 linux-headers/README
 create mode 100755 scripts/update-linux-headers.sh
linux-headers/README new file +2 -0
new file mode 100644
index 0000000..5c9026b
@@ -0,0 +1,2 @@
+Automatically imported Linux kernel headers.
+Only use scripts/update-linux-headers.sh to update!
scripts/update-linux-headers.sh new file +55 -0

55 lines not on this page · raw message

Signature · 1 line
1.7.5.4
#9 lore raw

PATCH 9/15 kvm: x86: Drop KVM_CAP build dependencies

In reply to Marcelo Tosatti

From: Jan Kiszka <[email protected]>

No longer needed with accompanied kernel headers.

---
 target-i386/kvm.c |   67 ++--------------------------------------------------
 1 files changed, 3 insertions(+), 64 deletions(-)
target-i386/kvm.c +3 -64
index eb36e9f..5db33ea 100644
@@ -94,9 +94,7 @@ struct kvm_para_features {
     { KVM_CAP_CLOCKSOURCE, KVM_FEATURE_CLOCKSOURCE },
     { KVM_CAP_NOP_IO_DELAY, KVM_FEATURE_NOP_IO_DELAY },
     { KVM_CAP_PV_MMU, KVM_FEATURE_MMU_OP },
-#ifdef KVM_CAP_ASYNC_PF
     { KVM_CAP_ASYNC_PF, KVM_FEATURE_ASYNC_PF },
-#endif
     { -1, -1 }
 };
 
@@ -193,7 +191,6 @@ static void kvm_unpoison_all(void *param)
     }
 }
 
-#ifdef KVM_CAP_MCE
 static void kvm_hwpoison_page_add(ram_addr_t ram_addr)
 {
     HWPoisonPage *page;
@@ -239,7 +236,6 @@ static void kvm_mce_inject(CPUState *env, target_phys_addr_t paddr, int code)
                        cpu_x86_support_mca_broadcast(env) ?
                        MCE_INJECT_BROADCAST : 0);
 }
-#endif /* KVM_CAP_MCE */
 
 static void hardware_memory_error(void)
 {
@@ -249,7 +245,6 @@ static void hardware_memory_error(void)
 
 int kvm_arch_on_sigbus_vcpu(CPUState *env, int code, void *addr)
 {
-#ifdef KVM_CAP_MCE
     ram_addr_t ram_addr;
     target_phys_addr_t paddr;
 
@@ -269,9 +264,7 @@ int kvm_arch_on_sigbus_vcpu(CPUState *env, int code, void *addr)
         }
         kvm_hwpoison_page_add(ram_addr);
         kvm_mce_inject(env, paddr, code);
-    } else
-#endif /* KVM_CAP_MCE */
-    {
+    } else {
         if (code == BUS_MCEERR_AO) {
             return 0;
         } else if (code == BUS_MCEERR_AR) {
@@ -285,7 +278,6 @@ int kvm_arch_on_sigbus_vcpu(CPUState *env, int code, void *addr)
 
 int kvm_arch_on_sigbus(int code, void *addr)
 {
-#ifdef KVM_CAP_MCE
     if ((first_cpu->mcg_cap & MCG_SER_P) && addr && code == BUS_MCEERR_AO) {
         ram_addr_t ram_addr;
         target_phys_addr_t paddr;
@@ -300,9 +292,7 @@ int kvm_arch_on_sigbus(int code, void *addr)
         }
         kvm_hwpoison_page_add(ram_addr);
         kvm_mce_inject(first_cpu, paddr, code);
-    } else
-#endif /* KVM_CAP_MCE */
-    {
+    } else {
         if (code == BUS_MCEERR_AO) {
             return 0;
         } else if (code == BUS_MCEERR_AR) {
@@ -316,7 +306,6 @@ int kvm_arch_on_sigbus(int code, void *addr)
 
 static int kvm_inject_mce_oldstyle(CPUState *env)
 {
-#ifdef KVM_CAP_MCE
     if (!kvm_has_vcpu_events() && env->exception_injected == EXCP12_MCHK) {
         unsigned int bank, bank_num = env->mcg_cap & 0xff;
         struct kvm_x86_mce mce;
@@ -342,7 +331,6 @@ static int kvm_inject_mce_oldstyle(CPUState *env)
 
         return kvm_vcpu_ioctl(env, KVM_X86_SET_MCE, &mce);
     }
-#endif /* KVM_CAP_MCE */
     return 0;
 }
 
@@ -398,9 +386,7 @@ int kvm_arch_init_vcpu(CPUState *env)
     c->eax = env->cpuid_kvm_features & kvm_arch_get_supported_cpuid(env,
                                                 KVM_CPUID_FEATURES, 0, R_EAX);
 
-#ifdef KVM_CAP_ASYNC_PF
     has_msr_async_pf_en = c->eax & (1 << KVM_FEATURE_ASYNC_PF);
-#endif
 
     cpu_x86_cpuid(env, 0, 0, &limit, &unused, &unused, &unused);
 
@@ -481,7 +467,6 @@ int kvm_arch_init_vcpu(CPUState *env)
 
     cpuid_data.cpuid.nent = cpuid_i;
 
-#ifdef KVM_CAP_MCE
     if (((env->cpuid_version >> 8)&0xF) >= 6
         && (env->cpuid_features&(CPUID_MCE|CPUID_MCA)) == (CPUID_MCE|CPUID_MCA)
         && kvm_check_extension(env->kvm_state, KVM_CAP_MCE) > 0) {
@@ -508,7 +493,6 @@ int kvm_arch_init_vcpu(CPUState *env)
 
         env->mcg_cap = mcg_cap;
     }
-#endif
 
     qemu_add_vm_change_state_handler(cpu_update_state, env);
 
@@ -600,7 +584,6 @@ int kvm_arch_init(KVMState *s)
      * that case we need to stick with the default, i.e. a 256K maximum BIOS
      * size.
      */
-#ifdef KVM_CAP_SET_IDENTITY_MAP_ADDR
     if (kvm_check_extension(s, KVM_CAP_SET_IDENTITY_MAP_ADDR)) {
         /* Allows up to 16M BIOSes. */
         identity_base = 0xfeffc000;
@@ -610,7 +593,7 @@ int kvm_arch_init(KVMState *s)
             return ret;
         }
     }
-#endif
+
     /* Set TSS base one page after EPT identity map. */
     ret = kvm_vm_ioctl(s, KVM_SET_TSS_ADDR, identity_base + 0x1000);
     if (ret < 0) {
@@ -748,7 +731,6 @@ static int kvm_put_fpu(CPUState *env)
     return kvm_vcpu_ioctl(env, KVM_SET_FPU, &fpu);
 }
 
-#ifdef KVM_CAP_XSAVE
 #define XSAVE_CWD_RIP     2
 #define XSAVE_CWD_RDP     4
 #define XSAVE_MXCSR       6
@@ -756,11 +738,9 @@ static int kvm_put_fpu(CPUState *env)
 #define XSAVE_XMM_SPACE   40
 #define XSAVE_XSTATE_BV   128
 #define XSAVE_YMMH_SPACE  144
-#endif
 
 static int kvm_put_xsave(CPUState *env)
 {
-#ifdef KVM_CAP_XSAVE
     int i, r;
     struct kvm_xsave* xsave;
     uint16_t cwd, swd, twd;
@@ -793,14 +773,10 @@ static int kvm_put_xsave(CPUState *env)
     r = kvm_vcpu_ioctl(env, KVM_SET_XSAVE, xsave);
     qemu_free(xsave);
     return r;
-#else
-    return kvm_put_fpu(env);
-#endif
 }
 
 static int kvm_put_xcrs(CPUState *env)
 {
-#ifdef KVM_CAP_XCRS
     struct kvm_xcrs xcrs;
 
     if (!kvm_has_xcrs()) {
@@ -812,9 +788,6 @@ static int kvm_put_xcrs(CPUState *env)
     xcrs.xcrs[0].xcr = 0;
     xcrs.xcrs[0].value = env->xcr0;
     return kvm_vcpu_ioctl(env, KVM_SET_XCRS, &xcrs);
-#else
-    return 0;
-#endif
 }
 
 static int kvm_put_sregs(CPUState *env)
@@ -923,7 +896,6 @@ static int kvm_put_msrs(CPUState *env, int level)
                               env->async_pf_en_msr);
         }
     }
-#ifdef KVM_CAP_MCE
     if (env->mcg_cap) {
         int i;
 
@@ -933,7 +905,6 @@ static int kvm_put_msrs(CPUState *env, int level)
             kvm_msr_entry_set(&msrs[n++], MSR_MC0_CTL + i, env->mce_banks[i]);
         }
     }
-#endif
 
     msr_data.info.nmsrs = n;
 
@@ -970,7 +941,6 @@ static int kvm_get_fpu(CPUState *env)
 
 static int kvm_get_xsave(CPUState *env)
 {
-#ifdef KVM_CAP_XSAVE
     struct kvm_xsave* xsave;
     int ret, i;
     uint16_t cwd, swd, twd;
@@ -1008,14 +978,10 @@ static int kvm_get_xsave(CPUState *env)
             sizeof env->ymmh_regs);
     qemu_free(xsave);
     return 0;
-#else
-    return kvm_get_fpu(env);
-#endif
 }
 
 static int kvm_get_xcrs(CPUState *env)
 {
-#ifdef KVM_CAP_XCRS
     int i, ret;
     struct kvm_xcrs xcrs;
 
@@ -1036,9 +1002,6 @@ static int kvm_get_xcrs(CPUState *env)
         }
     }
     return 0;
-#else
-    return 0;
-#endif
 }
 
 static int kvm_get_sregs(CPUState *env)
@@ -1166,7 +1129,6 @@ static int kvm_get_msrs(CPUState *env)
         msrs[n++].index = MSR_KVM_ASYNC_PF_EN;
     }
 
-#ifdef KVM_CAP_MCE
     if (env->mcg_cap) {
         msrs[n++].index = MSR_MCG_STATUS;
         msrs[n++].index = MSR_MCG_CTL;
@@ -1174,7 +1136,6 @@ static int kvm_get_msrs(CPUState *env)
             msrs[n++].index = MSR_MC0_CTL + i;
         }
     }
-#endif
 
     msr_data.info.nmsrs = n;
     ret = kvm_vcpu_ioctl(env, KVM_GET_MSRS, &msr_data);
@@ -1225,21 +1186,17 @@ static int kvm_get_msrs(CPUState *env)
         case MSR_KVM_WALL_CLOCK:
             env->wall_clock_msr = msrs[i].data;
             break;
-#ifdef KVM_CAP_MCE
         case MSR_MCG_STATUS:
             env->mcg_status = msrs[i].data;
             break;
         case MSR_MCG_CTL:
             env->mcg_ctl = msrs[i].data;
             break;
-#endif
         default:
-#ifdef KVM_CAP_MCE
             if (msrs[i].index >= MSR_MC0_CTL &&
                 msrs[i].index < MSR_MC0_CTL + (env->mcg_cap & 0xff) * 4) {
                 env->mce_banks[msrs[i].index - MSR_MC0_CTL] = msrs[i].data;
             }
-#endif
             break;
         case MSR_KVM_ASYNC_PF_EN:
             env->async_pf_en_msr = msrs[i].data;
@@ -1275,7 +1232,6 @@ static int kvm_get_mp_state(CPUState *env)
 
 static int kvm_put_vcpu_events(CPUState *env, int level)
 {
-#ifdef KVM_CAP_VCPU_EVENTS
     struct kvm_vcpu_events events;
 
     if (!kvm_has_vcpu_events()) {
@@ -1304,14 +1260,10 @@ static int kvm_put_vcpu_events(CPUState *env, int level)
     }
 
     return kvm_vcpu_ioctl(env, KVM_SET_VCPU_EVENTS, &events);
-#else
-    return 0;
-#endif
 }
 
 static int kvm_get_vcpu_events(CPUState *env)
 {
-#ifdef KVM_CAP_VCPU_EVENTS
     struct kvm_vcpu_events events;
     int ret;
 
@@ -1341,7 +1293,6 @@ static int kvm_get_vcpu_events(CPUState *env)
     }
 
     env->sipi_vector = events.sipi_vector;
-#endif
 
     return 0;
 }
@@ -1349,7 +1300,6 @@ static int kvm_get_vcpu_events(CPUState *env)
 static int kvm_guest_debug_workarounds(CPUState *env)
 {
     int ret = 0;
-#ifdef KVM_CAP_SET_GUEST_DEBUG
     unsigned long reinject_trap = 0;
 
     if (!kvm_has_vcpu_events()) {
@@ -1373,13 +1323,11 @@ static int kvm_guest_debug_workarounds(CPUState *env)
         (!kvm_has_robust_singlestep() && env->singlestep_enabled)) {
         ret = kvm_update_guest_debug(env, reinject_trap);
     }
-#endif /* KVM_CAP_SET_GUEST_DEBUG */
     return ret;
 }
 
 static int kvm_put_debugregs(CPUState *env)
 {
-#ifdef KVM_CAP_DEBUGREGS
     struct kvm_debugregs dbgregs;
     int i;
 
@@ -1395,14 +1343,10 @@ static int kvm_put_debugregs(CPUState *env)
     dbgregs.flags = 0;
 
     return kvm_vcpu_ioctl(env, KVM_SET_DEBUGREGS, &dbgregs);
-#else
-    return 0;
-#endif
 }
 
 static int kvm_get_debugregs(CPUState *env)
 {
-#ifdef KVM_CAP_DEBUGREGS
     struct kvm_debugregs dbgregs;
     int i, ret;
 
@@ -1419,7 +1363,6 @@ static int kvm_get_debugregs(CPUState *env)
     }
     env->dr[4] = env->dr[6] = dbgregs.dr6;
     env->dr[5] = env->dr[7] = dbgregs.dr7;
-#endif
 
     return 0;
 }
@@ -1645,7 +1588,6 @@ static int kvm_handle_halt(CPUState *env)
     return 0;
 }
 
-#ifdef KVM_CAP_SET_GUEST_DEBUG
 int kvm_arch_insert_sw_breakpoint(CPUState *env, struct kvm_sw_breakpoint *bp)
 {
     static const uint8_t int3 = 0xcc;
@@ -1826,7 +1768,6 @@ void kvm_arch_update_guest_debug(CPUState *env, struct kvm_guest_debug *dbg)
         }
     }
 }
-#endif /* KVM_CAP_SET_GUEST_DEBUG */
 
 static bool host_supports_vmx(void)
 {
@@ -1873,12 +1814,10 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run)
                 run->ex.exception, run->ex.error_code);
         ret = -1;
         break;
-#ifdef KVM_CAP_SET_GUEST_DEBUG
     case KVM_EXIT_DEBUG:
         DPRINTF("kvm_exit_debug\n");
         ret = kvm_handle_debug(&run->debug.arch);
         break;
-#endif /* KVM_CAP_SET_GUEST_DEBUG */
     default:
         fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
         ret = -1;
Signature · 1 line
1.7.5.4
#16 lore raw
In reply to Marcelo Tosatti
Quoted 6 lines · Marcelo Tosatti

The following changes since commit eb47d7c5d96060040931c42773ee07e61e547af9:

   hw/9118.c: Implement active-low interrupt support (2011-06-15 13:23:37 +0200)

are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/qemu-kvm.git uq/master

Pulled. Thanks.

Regards,

Anthony Liguori

Quoted 69 lines

Andre Przywara (1):
KVM: Fix XSAVE feature bit enumeration

Jan Kiszka (13):
kvm: x86: Save/restore FPU OP, IP and DP
Add kernel header update script
Import kernel headers
Switch build system to accompanied kernel headers
kvm: Drop CONFIG_KVM_PARA
kvm: ppc: Drop CONFIG_KVM_PPC_PVR
kvm: Drop useless zero-initializations
kvm: Drop KVM_CAP build dependencies
kvm: x86: Drop KVM_CAP build dependencies
kvm: ppc: Drop KVM_CAP build dependencies
kvm: Clean up stubs
kvm: x86: Pass KVMState to kvm_arch_get_supported_cpuid Remove unneeded kvm.h from cpu-exec.c

Marcelo Tosatti (1):
kvm: fix FPU state subsection

  Makefile.target                      |    4 +-
  configure                            |  149 +------
  cpu-exec.c                           |    1 -
  hw/kvmclock.c                        |    9 -
  kvm-all.c                            |   13 -
  kvm-stub.c                           |   18 +-
  kvm.h                                |    2 +-
  linux-headers/COPYING                |  356 +++++++++++++++
  linux-headers/README                 |    2 +
  linux-headers/asm-powerpc/kvm.h      |  275 ++++++++++++
  linux-headers/asm-powerpc/kvm_para.h |   53 +++
  linux-headers/asm-s390/kvm.h         |   44 ++
  linux-headers/asm-s390/kvm_para.h    |   17 +
  linux-headers/asm-x86/hyperv.h       |  193 ++++++++
  linux-headers/asm-x86/kvm.h          |  324 ++++++++++++++
  linux-headers/asm-x86/kvm_para.h     |   79 ++++
  linux-headers/linux/kvm.h            |  804 ++++++++++++++++++++++++++++++++++
  linux-headers/linux/kvm_para.h       |   28 ++
  linux-headers/linux/vhost.h          |  130 ++++++
  linux-headers/linux/virtio_config.h  |   54 +++
  linux-headers/linux/virtio_ring.h    |  163 +++++++
  scripts/update-linux-headers.sh      |   55 +++
  target-i386/cpu.h                    |    4 +
  target-i386/cpuid.c                  |   20 +-
  target-i386/kvm.c                    |  148 ++-----
  target-i386/machine.c                |   23 +
  target-ppc/kvm.c                     |   23 -
  target-s390x/cpu.h                   |   10 -
  target-s390x/op_helper.c             |    1 +
  29 files changed, 2675 insertions(+), 327 deletions(-)

create mode 100644 linux-headers/COPYING create mode 100644 linux-headers/README
create mode 100644 linux-headers/asm-powerpc/kvm.h create mode 100644 linux-headers/asm-powerpc/kvm_para.h create mode 100644 linux-headers/asm-s390/kvm.h create mode 100644 linux-headers/asm-s390/kvm_para.h create mode 100644 linux-headers/asm-x86/hyperv.h create mode 100644 linux-headers/asm-x86/kvm.h create mode 100644 linux-headers/asm-x86/kvm_para.h create mode 100644 linux-headers/linux/kvm.h create mode 100644 linux-headers/linux/kvm_para.h create mode 100644 linux-headers/linux/vhost.h create mode 100644 linux-headers/linux/virtio_config.h create mode 100644 linux-headers/linux/virtio_ring.h create mode 100755 scripts/update-linux-headers.sh