User level change to add callback to reset kernel devices.

thx,eddie



    Add user reset callback support for kernel devices.
    
    Signed-off-by: Yaozu (Eddie) Dong <[EMAIL PROTECTED]>

diff --git a/qemu/hw/pc.c b/qemu/hw/pc.c
index 4d0bb93..d81e7e1 100644
--- a/qemu/hw/pc.c
+++ b/qemu/hw/pc.c
@@ -721,6 +721,10 @@ static void pc_init1(ram_addr_t ram_size, int
vga_ram_size, int boot_device,
         vmport_init(env);
     }
 
+#ifdef USE_KVM
+    if (kvm_allowed && kvm_irqchip_in_kernel(kvm_context))
+        qemu_register_reset(kvm_reset_kernel, kvm_context);
+#endif
     /* allocate RAM */
     ram_addr = qemu_ram_alloc(ram_size);
     cpu_register_physical_memory(0, ram_size, ram_addr);
diff --git a/user/kvmctl.c b/user/kvmctl.c
index eeddb54..e1a4afb 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -1240,3 +1240,10 @@ int kvm_irqchip_in_kernel(kvm_context_t kvm)
 {
     return kvm->irqchip_in_kernel;
 }
+
+void kvm_reset_kernel(kvm_context_t kvm)
+{
+    if (kvm_irqchip_in_kernel(kvm))
+       return ioctl(kvm->vm_fd, KVM_RESET, 0);
+}
+
diff --git a/user/kvmctl.h b/user/kvmctl.h
index 09cf6d7..9f56027 100644
--- a/user/kvmctl.h
+++ b/user/kvmctl.h
@@ -453,6 +453,13 @@ int kvm_dirty_pages_log_enable_all(kvm_context_t
kvm);
 int kvm_dirty_pages_log_reset(kvm_context_t kvm);
 
 /*!
+ * \brief Reset kernel devices.
+ *
+ * \param kvm Pointer to the current kvm_context
+ */
+void kvm_reset_kernel(kvm_context_t kvm);
+
+/*!
  * \brief Query whether in kernel irqchip is used
  *
  * \param kvm Pointer to the current kvm_context

Attachment: reset-u1.patch
Description: reset-u1.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