kvm: libkvm: in-kernel LAPIC get/set ioctls
    
    This patch allows save and restore of in-kernel local apics
    
    Signed-off-by: Qing He <[EMAIL PROTECTED]>
    Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>

---
 user/kvmctl.c |   26 ++++++++++++++++++++++++++
 user/kvmctl.h |   22 ++++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/user/kvmctl.c b/user/kvmctl.c
index b256707..8038245 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -460,6 +460,32 @@ int kvm_set_irqchip(kvm_context_t kvm, struct
kvm_irqchip *chip)
        return r;
 }
 
+int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state
*s)
+{
+       int r;
+       if (!kvm->irqchip_in_kernel)
+               return 0;
+       r = ioctl(kvm->vcpu_fd[vcpu], KVM_GET_LAPIC, s);
+       if (r == -1) {
+               r = -errno;
+               perror("kvm_get_lapic");
+       }
+       return r;
+}
+
+int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state
*s)
+{
+       int r;
+       if (!kvm->irqchip_in_kernel)
+               return 0;
+       r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_LAPIC, s);
+       if (r == -1) {
+               r = -errno;
+               perror("kvm_set_lapic");
+       }
+       return r;
+}
+
 static int handle_io_abi10(kvm_context_t kvm, struct kvm_run_abi10
*run,
                           int vcpu)
 {
diff --git a/user/kvmctl.h b/user/kvmctl.h
index 073ac01..aa3f9b8 100644
--- a/user/kvmctl.h
+++ b/user/kvmctl.h
@@ -444,4 +444,26 @@ int kvm_get_irqchip(kvm_context_t kvm, struct
kvm_irqchip *chip);
  */
 int kvm_set_irqchip(kvm_context_t kvm, struct kvm_irqchip *chip);
 
+/*!
+ * \brief Get in kernel local APIC for vcpu
+ * 
+ * Save the local apic state including the timer of a virtual CPU
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should be accessed
+ * \param s Local apic state of the specific virtual CPU
+ */
+int kvm_get_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state
*s);
+
+/*!
+ * \brief Set in kernel local APIC for vcpu
+ * 
+ * Restore the local apic state including the timer of a virtual CPU
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should be accessed
+ * \param s Local apic state of the specific virtual CPU
+ */
+int kvm_set_lapic(kvm_context_t kvm, int vcpu, struct kvm_lapic_state
*s);
+
 #endif

Attachment: kvm-libkvm-lapic-lm.patch
Description: kvm-libkvm-lapic-lm.patch

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

Reply via email to