[PATCH 5/5] powerpc: using reset hcall when kvm,has-reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Detect the availability of the reset hcalls by looking at kvm,has-reset
property on the /hypervisor node in the device tree passed to the VM and
patches the reset mechanism to use reset hcall.

This patch uses the reser hcall when kvm,has-reset is there in

Signed-off-by: Bharat Bhushan <bharat.bhushan@xxxxxxxxxxxxx>
---
 arch/powerpc/kernel/epapr_paravirt.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index d44a571..651d701 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -22,6 +22,8 @@
 #include <asm/cacheflush.h>
 #include <asm/code-patching.h>
 #include <asm/machdep.h>
+#include <asm/kvm_para.h>
+#include <asm/kvm_host.h>
 
 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
 extern void epapr_ev_idle(void);
@@ -30,6 +32,14 @@ extern u32 epapr_ev_idle_start[];
 
 bool epapr_paravirt_enabled;
 
+void epapr_hypercall_reset(char *cmd)
+{
+	long ret;
+	ret = kvm_hypercall0(KVM_HC_VM_RESET);
+	printk("error: system reset returned with error %ld\n", ret);
+	BUG();
+}
+
 static int __init epapr_paravirt_init(void)
 {
 	struct device_node *hyper_node;
@@ -58,6 +68,8 @@ static int __init epapr_paravirt_init(void)
 	if (of_get_property(hyper_node, "has-idle", NULL))
 		ppc_md.power_save = epapr_ev_idle;
 #endif
+	if (of_get_property(hyper_node, "kvm,has-reset", NULL))
+		ppc_md.restart = epapr_hypercall_reset;
 
 	epapr_paravirt_enabled = true;
 
-- 
1.7.0.4


--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux