diff options
author | Avi Kivity <avi@qumranet.com> | 2007-03-04 07:24:03 -0500 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-05-03 03:52:24 -0400 |
commit | 1b19f3e61d7e1edb395dd64bf7d63621a37af8ca (patch) | |
tree | 52d90cc6e505f84ec741770950f4f07be45b7fba | |
parent | 8eb7d334bd8e693340ee198280f7d45035cdab8c (diff) |
KVM: Add a special exit reason when exiting due to an interrupt
This is redundant, as we also return -EINTR from the ioctl, but it
allows us to examine the exit_reason field on resume without seeing
old data.
Signed-off-by: Avi Kivity <avi@qumranet.com>
-rw-r--r-- | drivers/kvm/svm.c | 2 | ||||
-rw-r--r-- | drivers/kvm/vmx.c | 2 | ||||
-rw-r--r-- | include/linux/kvm.h | 3 |
3 files changed, 6 insertions, 1 deletions
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index b09928f14219..0311665e3c83 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -1619,12 +1619,14 @@ again: | |||
1619 | if (signal_pending(current)) { | 1619 | if (signal_pending(current)) { |
1620 | ++kvm_stat.signal_exits; | 1620 | ++kvm_stat.signal_exits; |
1621 | post_kvm_run_save(vcpu, kvm_run); | 1621 | post_kvm_run_save(vcpu, kvm_run); |
1622 | kvm_run->exit_reason = KVM_EXIT_INTR; | ||
1622 | return -EINTR; | 1623 | return -EINTR; |
1623 | } | 1624 | } |
1624 | 1625 | ||
1625 | if (dm_request_for_irq_injection(vcpu, kvm_run)) { | 1626 | if (dm_request_for_irq_injection(vcpu, kvm_run)) { |
1626 | ++kvm_stat.request_irq_exits; | 1627 | ++kvm_stat.request_irq_exits; |
1627 | post_kvm_run_save(vcpu, kvm_run); | 1628 | post_kvm_run_save(vcpu, kvm_run); |
1629 | kvm_run->exit_reason = KVM_EXIT_INTR; | ||
1628 | return -EINTR; | 1630 | return -EINTR; |
1629 | } | 1631 | } |
1630 | kvm_resched(vcpu); | 1632 | kvm_resched(vcpu); |
diff --git a/drivers/kvm/vmx.c b/drivers/kvm/vmx.c index cf9568fbe8a5..e69bab6d811d 100644 --- a/drivers/kvm/vmx.c +++ b/drivers/kvm/vmx.c | |||
@@ -1941,12 +1941,14 @@ again: | |||
1941 | if (signal_pending(current)) { | 1941 | if (signal_pending(current)) { |
1942 | ++kvm_stat.signal_exits; | 1942 | ++kvm_stat.signal_exits; |
1943 | post_kvm_run_save(vcpu, kvm_run); | 1943 | post_kvm_run_save(vcpu, kvm_run); |
1944 | kvm_run->exit_reason = KVM_EXIT_INTR; | ||
1944 | return -EINTR; | 1945 | return -EINTR; |
1945 | } | 1946 | } |
1946 | 1947 | ||
1947 | if (dm_request_for_irq_injection(vcpu, kvm_run)) { | 1948 | if (dm_request_for_irq_injection(vcpu, kvm_run)) { |
1948 | ++kvm_stat.request_irq_exits; | 1949 | ++kvm_stat.request_irq_exits; |
1949 | post_kvm_run_save(vcpu, kvm_run); | 1950 | post_kvm_run_save(vcpu, kvm_run); |
1951 | kvm_run->exit_reason = KVM_EXIT_INTR; | ||
1950 | return -EINTR; | 1952 | return -EINTR; |
1951 | } | 1953 | } |
1952 | 1954 | ||
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 57f47ef93829..b3af92e7bf5d 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #include <asm/types.h> | 11 | #include <asm/types.h> |
12 | #include <linux/ioctl.h> | 12 | #include <linux/ioctl.h> |
13 | 13 | ||
14 | #define KVM_API_VERSION 8 | 14 | #define KVM_API_VERSION 9 |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * Architectural interrupt line count, and the size of the bitmap needed | 17 | * Architectural interrupt line count, and the size of the bitmap needed |
@@ -45,6 +45,7 @@ enum kvm_exit_reason { | |||
45 | KVM_EXIT_IRQ_WINDOW_OPEN = 7, | 45 | KVM_EXIT_IRQ_WINDOW_OPEN = 7, |
46 | KVM_EXIT_SHUTDOWN = 8, | 46 | KVM_EXIT_SHUTDOWN = 8, |
47 | KVM_EXIT_FAIL_ENTRY = 9, | 47 | KVM_EXIT_FAIL_ENTRY = 9, |
48 | KVM_EXIT_INTR = 10, | ||
48 | }; | 49 | }; |
49 | 50 | ||
50 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ | 51 | /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */ |