aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorJan Kiszka <jan.kiszka@web.de>2009-12-06 12:24:15 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2009-12-27 10:36:33 -0500
commitdab4b911a5327859bb8f969249c6978c26cd4853 (patch)
treea21d0ef04e3bf831b2f9e674b6266535267cc9ce /arch/x86/kvm
parent6e24a6eff4571002cd48b99a2b92dc829ce39cb9 (diff)
KVM: x86: Extend KVM_SET_VCPU_EVENTS with selective updates
User space may not want to overwrite asynchronously changing VCPU event states on write-back. So allow to skip nmi.pending and sipi_vector by setting corresponding bits in the flags field of kvm_vcpu_events. [avi: advertise the bits in KVM_GET_VCPU_EVENTS] Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/x86.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 9d068966fb2a..6651dbf58675 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1913,7 +1913,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
1913 1913
1914 events->sipi_vector = vcpu->arch.sipi_vector; 1914 events->sipi_vector = vcpu->arch.sipi_vector;
1915 1915
1916 events->flags = 0; 1916 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING
1917 | KVM_VCPUEVENT_VALID_SIPI_VECTOR);
1917 1918
1918 vcpu_put(vcpu); 1919 vcpu_put(vcpu);
1919} 1920}
@@ -1921,7 +1922,8 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
1921static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, 1922static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
1922 struct kvm_vcpu_events *events) 1923 struct kvm_vcpu_events *events)
1923{ 1924{
1924 if (events->flags) 1925 if (events->flags & ~(KVM_VCPUEVENT_VALID_NMI_PENDING
1926 | KVM_VCPUEVENT_VALID_SIPI_VECTOR))
1925 return -EINVAL; 1927 return -EINVAL;
1926 1928
1927 vcpu_load(vcpu); 1929 vcpu_load(vcpu);
@@ -1938,10 +1940,12 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
1938 kvm_pic_clear_isr_ack(vcpu->kvm); 1940 kvm_pic_clear_isr_ack(vcpu->kvm);
1939 1941
1940 vcpu->arch.nmi_injected = events->nmi.injected; 1942 vcpu->arch.nmi_injected = events->nmi.injected;
1941 vcpu->arch.nmi_pending = events->nmi.pending; 1943 if (events->flags & KVM_VCPUEVENT_VALID_NMI_PENDING)
1944 vcpu->arch.nmi_pending = events->nmi.pending;
1942 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked); 1945 kvm_x86_ops->set_nmi_mask(vcpu, events->nmi.masked);
1943 1946
1944 vcpu->arch.sipi_vector = events->sipi_vector; 1947 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR)
1948 vcpu->arch.sipi_vector = events->sipi_vector;
1945 1949
1946 vcpu_put(vcpu); 1950 vcpu_put(vcpu);
1947 1951