All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-21  4:46 ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

from the kvm guest paravirt init code.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. fix the if test
2. use patch_instruction()
3. code cleanup
4. rename the files
5. make epapr paravirt user-selectable

 arch/powerpc/include/asm/epapr_hcalls.h |    2 +
 arch/powerpc/kernel/Makefile            |    1 +
 arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm.c               |   28 ++--------------
 arch/powerpc/kernel/kvm_emul.S          |   10 ------
 arch/powerpc/platforms/Kconfig          |    7 ++++
 7 files changed, 92 insertions(+), 35 deletions(-)
 create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
 create mode 100644 arch/powerpc/kernel/epapr_paravirt.c

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index f3b0c2c..0ff3f24 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -148,6 +148,8 @@
 #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
 #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
 
+extern bool epapr_para_enabled;
+extern u32 epapr_hypercall_start[];
 
 /*
  * We use "uintptr_t" to define a register because it's guaranteed to be a
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ee728e4..ba8fa43 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
 obj-y				+= ppc_save_regs.o
 endif
 
+obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
 obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
 
 # Disable GCOV in odd or sensitive code
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
new file mode 100644
index 0000000..697b390
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/threads.h>
+#include <asm/reg.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/thread_info.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+
+/* Hypercall entry point. Will be patched with device tree instructions. */
+.global epapr_hypercall_start
+epapr_hypercall_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+	blr
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
new file mode 100644
index 0000000..e601da7
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -0,0 +1,54 @@
+/*
+ * ePAPR para-virtualization support.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ */
+
+#include <linux/of.h>
+#include <asm/epapr_hcalls.h>
+#include <asm/cacheflush.h>
+#include <asm/code-patching.h>
+
+bool epapr_para_enabled = false;
+
+static int __init epapr_para_init(void)
+{
+	struct device_node *hyper_node;
+	const u32 *insts;
+	int len, i;
+
+	hyper_node = of_find_node_by_path("/hypervisor");
+	if (!hyper_node) {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor node found\n");
+		return -ENODEV;
+	}
+
+	insts = of_get_property(hyper_node, "hcall-instructions", &len);
+	if (insts && !(len % 4) && len <= (4 * 4)) {
+		for (i = 0; i < (len / 4); i++)
+			patch_instruction(epapr_hypercall_start + i, insts[i]);
+
+		epapr_para_enabled = true;
+	} else {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor inst found\n");
+	}
+
+	return 0;
+}
+
+early_initcall(epapr_para_init);
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 62bdf23..9dfc24a 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -31,6 +31,7 @@
 #include <asm/cacheflush.h>
 #include <asm/disassemble.h>
 #include <asm/ppc-opcode.h>
+#include <asm/epapr_hcalls.h>
 
 #define KVM_MAGIC_PAGE		(-4096L)
 #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
@@ -726,7 +727,7 @@ unsigned long kvm_hypercall(unsigned long *in,
 	unsigned long register r11 asm("r11") = nr;
 	unsigned long register r12 asm("r12");
 
-	asm volatile("bl	kvm_hypercall_start"
+	asm volatile("bl	epapr_hypercall_start"
 		     : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6),
 		       "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11),
 		       "=r"(r12)
@@ -747,29 +748,6 @@ unsigned long kvm_hypercall(unsigned long *in,
 }
 EXPORT_SYMBOL_GPL(kvm_hypercall);
 
-static int kvm_para_setup(void)
-{
-	extern u32 kvm_hypercall_start;
-	struct device_node *hyper_node;
-	u32 *insts;
-	int len, i;
-
-	hyper_node = of_find_node_by_path("/hypervisor");
-	if (!hyper_node)
-		return -1;
-
-	insts = (u32*)of_get_property(hyper_node, "hcall-instructions", &len);
-	if (len % 4)
-		return -1;
-	if (len > (4 * 4))
-		return -1;
-
-	for (i = 0; i < (len / 4); i++)
-		kvm_patch_ins(&(&kvm_hypercall_start)[i], insts[i]);
-
-	return 0;
-}
-
 static __init void kvm_free_tmp(void)
 {
 	unsigned long start, end;
@@ -791,7 +769,7 @@ static int __init kvm_guest_init(void)
 	if (!kvm_para_available())
 		goto free_tmp;
 
-	if (kvm_para_setup())
+	if (!epapr_para_enabled)
 		goto free_tmp;
 
 	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
diff --git a/arch/powerpc/kernel/kvm_emul.S b/arch/powerpc/kernel/kvm_emul.S
index e291cf3..62ceb2a 100644
--- a/arch/powerpc/kernel/kvm_emul.S
+++ b/arch/powerpc/kernel/kvm_emul.S
@@ -24,16 +24,6 @@
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
 
-/* Hypercall entry point. Will be patched with device tree instructions. */
-
-.global kvm_hypercall_start
-kvm_hypercall_start:
-	li	r3, -1
-	nop
-	nop
-	nop
-	blr
-
 #define KVM_MAGIC_PAGE		(-4096)
 
 #ifdef CONFIG_64BIT
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 0cfb46d..f20963c 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -26,6 +26,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
 config KVM_GUEST
 	bool "KVM Guest support"
 	default n
+	select EPAPR_PARAVIRT
 	---help---
 	  This option enables various optimizations for running under the KVM
 	  hypervisor. Overhead for the kernel when not running inside KVM should
@@ -33,6 +34,12 @@ config KVM_GUEST
 
 	  In case of doubt, say Y
 
+config EPAPR_PARAVIRT
+	bool "ePAPR para-virtualization support"
+	default n
+	help
+	  Used to enalbe ePAPR complied para-virtualization support for guest.
+
 config PPC_NATIVE
 	bool
 	depends on 6xx || PPC64
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-21  4:46 ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, Liu Yu, B07421

from the kvm guest paravirt init code.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. fix the if test
2. use patch_instruction()
3. code cleanup
4. rename the files
5. make epapr paravirt user-selectable

 arch/powerpc/include/asm/epapr_hcalls.h |    2 +
 arch/powerpc/kernel/Makefile            |    1 +
 arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm.c               |   28 ++--------------
 arch/powerpc/kernel/kvm_emul.S          |   10 ------
 arch/powerpc/platforms/Kconfig          |    7 ++++
 7 files changed, 92 insertions(+), 35 deletions(-)
 create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
 create mode 100644 arch/powerpc/kernel/epapr_paravirt.c

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index f3b0c2c..0ff3f24 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -148,6 +148,8 @@
 #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
 #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
 
+extern bool epapr_para_enabled;
+extern u32 epapr_hypercall_start[];
 
 /*
  * We use "uintptr_t" to define a register because it's guaranteed to be a
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ee728e4..ba8fa43 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
 obj-y				+= ppc_save_regs.o
 endif
 
+obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
 obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
 
 # Disable GCOV in odd or sensitive code
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
new file mode 100644
index 0000000..697b390
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/threads.h>
+#include <asm/reg.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/thread_info.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+
+/* Hypercall entry point. Will be patched with device tree instructions. */
+.global epapr_hypercall_start
+epapr_hypercall_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+	blr
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
new file mode 100644
index 0000000..e601da7
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -0,0 +1,54 @@
+/*
+ * ePAPR para-virtualization support.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ */
+
+#include <linux/of.h>
+#include <asm/epapr_hcalls.h>
+#include <asm/cacheflush.h>
+#include <asm/code-patching.h>
+
+bool epapr_para_enabled = false;
+
+static int __init epapr_para_init(void)
+{
+	struct device_node *hyper_node;
+	const u32 *insts;
+	int len, i;
+
+	hyper_node = of_find_node_by_path("/hypervisor");
+	if (!hyper_node) {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor node found\n");
+		return -ENODEV;
+	}
+
+	insts = of_get_property(hyper_node, "hcall-instructions", &len);
+	if (insts && !(len % 4) && len <= (4 * 4)) {
+		for (i = 0; i < (len / 4); i++)
+			patch_instruction(epapr_hypercall_start + i, insts[i]);
+
+		epapr_para_enabled = true;
+	} else {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor inst found\n");
+	}
+
+	return 0;
+}
+
+early_initcall(epapr_para_init);
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 62bdf23..9dfc24a 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -31,6 +31,7 @@
 #include <asm/cacheflush.h>
 #include <asm/disassemble.h>
 #include <asm/ppc-opcode.h>
+#include <asm/epapr_hcalls.h>
 
 #define KVM_MAGIC_PAGE		(-4096L)
 #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
@@ -726,7 +727,7 @@ unsigned long kvm_hypercall(unsigned long *in,
 	unsigned long register r11 asm("r11") = nr;
 	unsigned long register r12 asm("r12");
 
-	asm volatile("bl	kvm_hypercall_start"
+	asm volatile("bl	epapr_hypercall_start"
 		     : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6),
 		       "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11),
 		       "=r"(r12)
@@ -747,29 +748,6 @@ unsigned long kvm_hypercall(unsigned long *in,
 }
 EXPORT_SYMBOL_GPL(kvm_hypercall);
 
-static int kvm_para_setup(void)
-{
-	extern u32 kvm_hypercall_start;
-	struct device_node *hyper_node;
-	u32 *insts;
-	int len, i;
-
-	hyper_node = of_find_node_by_path("/hypervisor");
-	if (!hyper_node)
-		return -1;
-
-	insts = (u32*)of_get_property(hyper_node, "hcall-instructions", &len);
-	if (len % 4)
-		return -1;
-	if (len > (4 * 4))
-		return -1;
-
-	for (i = 0; i < (len / 4); i++)
-		kvm_patch_ins(&(&kvm_hypercall_start)[i], insts[i]);
-
-	return 0;
-}
-
 static __init void kvm_free_tmp(void)
 {
 	unsigned long start, end;
@@ -791,7 +769,7 @@ static int __init kvm_guest_init(void)
 	if (!kvm_para_available())
 		goto free_tmp;
 
-	if (kvm_para_setup())
+	if (!epapr_para_enabled)
 		goto free_tmp;
 
 	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
diff --git a/arch/powerpc/kernel/kvm_emul.S b/arch/powerpc/kernel/kvm_emul.S
index e291cf3..62ceb2a 100644
--- a/arch/powerpc/kernel/kvm_emul.S
+++ b/arch/powerpc/kernel/kvm_emul.S
@@ -24,16 +24,6 @@
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
 
-/* Hypercall entry point. Will be patched with device tree instructions. */
-
-.global kvm_hypercall_start
-kvm_hypercall_start:
-	li	r3, -1
-	nop
-	nop
-	nop
-	blr
-
 #define KVM_MAGIC_PAGE		(-4096)
 
 #ifdef CONFIG_64BIT
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 0cfb46d..f20963c 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -26,6 +26,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
 config KVM_GUEST
 	bool "KVM Guest support"
 	default n
+	select EPAPR_PARAVIRT
 	---help---
 	  This option enables various optimizations for running under the KVM
 	  hypervisor. Overhead for the kernel when not running inside KVM should
@@ -33,6 +34,12 @@ config KVM_GUEST
 
 	  In case of doubt, say Y
 
+config EPAPR_PARAVIRT
+	bool "ePAPR para-virtualization support"
+	default n
+	help
+	  Used to enalbe ePAPR complied para-virtualization support for guest.
+
 config PPC_NATIVE
 	bool
 	depends on 6xx || PPC64
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-21  4:46 ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

from the kvm guest paravirt init code.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. fix the if test
2. use patch_instruction()
3. code cleanup
4. rename the files
5. make epapr paravirt user-selectable

 arch/powerpc/include/asm/epapr_hcalls.h |    2 +
 arch/powerpc/kernel/Makefile            |    1 +
 arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm.c               |   28 ++--------------
 arch/powerpc/kernel/kvm_emul.S          |   10 ------
 arch/powerpc/platforms/Kconfig          |    7 ++++
 7 files changed, 92 insertions(+), 35 deletions(-)
 create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
 create mode 100644 arch/powerpc/kernel/epapr_paravirt.c

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index f3b0c2c..0ff3f24 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -148,6 +148,8 @@
 #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
 #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
 
+extern bool epapr_para_enabled;
+extern u32 epapr_hypercall_start[];
 
 /*
  * We use "uintptr_t" to define a register because it's guaranteed to be a
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index ee728e4..ba8fa43 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
 obj-y				+= ppc_save_regs.o
 endif
 
+obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
 obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
 
 # Disable GCOV in odd or sensitive code
diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
new file mode 100644
index 0000000..697b390
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/threads.h>
+#include <asm/reg.h>
+#include <asm/page.h>
+#include <asm/cputable.h>
+#include <asm/thread_info.h>
+#include <asm/ppc_asm.h>
+#include <asm/asm-offsets.h>
+
+/* Hypercall entry point. Will be patched with device tree instructions. */
+.global epapr_hypercall_start
+epapr_hypercall_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+	blr
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
new file mode 100644
index 0000000..e601da7
--- /dev/null
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -0,0 +1,54 @@
+/*
+ * ePAPR para-virtualization support.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ */
+
+#include <linux/of.h>
+#include <asm/epapr_hcalls.h>
+#include <asm/cacheflush.h>
+#include <asm/code-patching.h>
+
+bool epapr_para_enabled = false;
+
+static int __init epapr_para_init(void)
+{
+	struct device_node *hyper_node;
+	const u32 *insts;
+	int len, i;
+
+	hyper_node = of_find_node_by_path("/hypervisor");
+	if (!hyper_node) {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor node found\n");
+		return -ENODEV;
+	}
+
+	insts = of_get_property(hyper_node, "hcall-instructions", &len);
+	if (insts && !(len % 4) && len <= (4 * 4)) {
+		for (i = 0; i < (len / 4); i++)
+			patch_instruction(epapr_hypercall_start + i, insts[i]);
+
+		epapr_para_enabled = true;
+	} else {
+		printk(KERN_WARNING
+		       "ePAPR paravirt disabled: No hypervisor inst found\n");
+	}
+
+	return 0;
+}
+
+early_initcall(epapr_para_init);
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index 62bdf23..9dfc24a 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -31,6 +31,7 @@
 #include <asm/cacheflush.h>
 #include <asm/disassemble.h>
 #include <asm/ppc-opcode.h>
+#include <asm/epapr_hcalls.h>
 
 #define KVM_MAGIC_PAGE		(-4096L)
 #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
@@ -726,7 +727,7 @@ unsigned long kvm_hypercall(unsigned long *in,
 	unsigned long register r11 asm("r11") = nr;
 	unsigned long register r12 asm("r12");
 
-	asm volatile("bl	kvm_hypercall_start"
+	asm volatile("bl	epapr_hypercall_start"
 		     : "=r"(r0), "=r"(r3), "=r"(r4), "=r"(r5), "=r"(r6),
 		       "=r"(r7), "=r"(r8), "=r"(r9), "=r"(r10), "=r"(r11),
 		       "=r"(r12)
@@ -747,29 +748,6 @@ unsigned long kvm_hypercall(unsigned long *in,
 }
 EXPORT_SYMBOL_GPL(kvm_hypercall);
 
-static int kvm_para_setup(void)
-{
-	extern u32 kvm_hypercall_start;
-	struct device_node *hyper_node;
-	u32 *insts;
-	int len, i;
-
-	hyper_node = of_find_node_by_path("/hypervisor");
-	if (!hyper_node)
-		return -1;
-
-	insts = (u32*)of_get_property(hyper_node, "hcall-instructions", &len);
-	if (len % 4)
-		return -1;
-	if (len > (4 * 4))
-		return -1;
-
-	for (i = 0; i < (len / 4); i++)
-		kvm_patch_ins(&(&kvm_hypercall_start)[i], insts[i]);
-
-	return 0;
-}
-
 static __init void kvm_free_tmp(void)
 {
 	unsigned long start, end;
@@ -791,7 +769,7 @@ static int __init kvm_guest_init(void)
 	if (!kvm_para_available())
 		goto free_tmp;
 
-	if (kvm_para_setup())
+	if (!epapr_para_enabled)
 		goto free_tmp;
 
 	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
diff --git a/arch/powerpc/kernel/kvm_emul.S b/arch/powerpc/kernel/kvm_emul.S
index e291cf3..62ceb2a 100644
--- a/arch/powerpc/kernel/kvm_emul.S
+++ b/arch/powerpc/kernel/kvm_emul.S
@@ -24,16 +24,6 @@
 #include <asm/page.h>
 #include <asm/asm-offsets.h>
 
-/* Hypercall entry point. Will be patched with device tree instructions. */
-
-.global kvm_hypercall_start
-kvm_hypercall_start:
-	li	r3, -1
-	nop
-	nop
-	nop
-	blr
-
 #define KVM_MAGIC_PAGE		(-4096)
 
 #ifdef CONFIG_64BIT
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 0cfb46d..f20963c 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -26,6 +26,7 @@ source "arch/powerpc/platforms/wsp/Kconfig"
 config KVM_GUEST
 	bool "KVM Guest support"
 	default n
+	select EPAPR_PARAVIRT
 	---help---
 	  This option enables various optimizations for running under the KVM
 	  hypervisor. Overhead for the kernel when not running inside KVM should
@@ -33,6 +34,12 @@ config KVM_GUEST
 
 	  In case of doubt, say Y
 
+config EPAPR_PARAVIRT
+	bool "ePAPR para-virtualization support"
+	default n
+	help
+	  Used to enalbe ePAPR complied para-virtualization support for guest.
+
 config PPC_NATIVE
 	bool
 	depends on 6xx || PPC64
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 2/4] KVM: PPC: epapr: Add idle hcall support for host
  2012-02-21  4:46 ` Liu Yu
  (?)
@ 2012-02-21  4:46   ` Liu Yu
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

And add a new flag definition in kvm_ppc_pvinfo to indicate
whether host support EV_IDLE hcall.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. remove the ifdef
2. add epapr_hcalls.h into headers install list

 arch/powerpc/include/asm/Kbuild     |    1 +
 arch/powerpc/include/asm/kvm_para.h |   14 ++++++++++++--
 arch/powerpc/kvm/powerpc.c          |    6 ++++++
 include/linux/kvm.h                 |    2 ++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 7e313f1..13d6b7b 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -34,5 +34,6 @@ header-y += termios.h
 header-y += types.h
 header-y += ucontext.h
 header-y += unistd.h
+header-y += epapr_hcalls.h
 
 generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 7b754e7..81a34c9 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared {
 };
 
 #define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
-#define HC_VENDOR_KVM		(42 << 16)
+
+#include <asm/epapr_hcalls.h>
+
+/* ePAPR Hypercall Vendor ID */
+#define HC_VENDOR_EPAPR		(EV_EPAPR_VENDOR_ID << 16)
+#define HC_VENDOR_KVM		(EV_KVM_VENDOR_ID << 16)
+
+/* ePAPR Hypercall Token */
+#define HC_EV_IDLE		EV_IDLE
+
+/* ePAPR Hypercall Return Codes */
 #define HC_EV_SUCCESS		0
-#define HC_EV_UNIMPLEMENTED	12
+#define HC_EV_UNIMPLEMENTED	EV_UNIMPLEMENTED
 
 #define KVM_FEATURE_MAGIC_PAGE	1
 
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0e21d15..7098840 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
 
 		/* Second return value is in r4 */
 		break;
+	case HC_VENDOR_EPAPR | HC_EV_IDLE:
+		r = HC_EV_SUCCESS;
+		kvm_vcpu_block(vcpu);
+		break;
 	default:
 		r = HC_EV_UNIMPLEMENTED;
 		break;
@@ -746,6 +750,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 	pvinfo->hcall[2] = inst_sc;
 	pvinfo->hcall[3] = inst_nop;
 
+	pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
+
 	return 0;
 }
 
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index acbe429..6b2c70e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo {
 	__u8  pad[108];
 };
 
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
+
 #define KVMIO 0xAE
 
 /* machine type bits, to be used as argument to KVM_CREATE_VM */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 2/4] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-02-21  4:46   ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, Liu Yu, B07421

And add a new flag definition in kvm_ppc_pvinfo to indicate
whether host support EV_IDLE hcall.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. remove the ifdef
2. add epapr_hcalls.h into headers install list

 arch/powerpc/include/asm/Kbuild     |    1 +
 arch/powerpc/include/asm/kvm_para.h |   14 ++++++++++++--
 arch/powerpc/kvm/powerpc.c          |    6 ++++++
 include/linux/kvm.h                 |    2 ++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 7e313f1..13d6b7b 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -34,5 +34,6 @@ header-y += termios.h
 header-y += types.h
 header-y += ucontext.h
 header-y += unistd.h
+header-y += epapr_hcalls.h
 
 generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 7b754e7..81a34c9 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared {
 };
 
 #define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
-#define HC_VENDOR_KVM		(42 << 16)
+
+#include <asm/epapr_hcalls.h>
+
+/* ePAPR Hypercall Vendor ID */
+#define HC_VENDOR_EPAPR		(EV_EPAPR_VENDOR_ID << 16)
+#define HC_VENDOR_KVM		(EV_KVM_VENDOR_ID << 16)
+
+/* ePAPR Hypercall Token */
+#define HC_EV_IDLE		EV_IDLE
+
+/* ePAPR Hypercall Return Codes */
 #define HC_EV_SUCCESS		0
-#define HC_EV_UNIMPLEMENTED	12
+#define HC_EV_UNIMPLEMENTED	EV_UNIMPLEMENTED
 
 #define KVM_FEATURE_MAGIC_PAGE	1
 
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0e21d15..7098840 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
 
 		/* Second return value is in r4 */
 		break;
+	case HC_VENDOR_EPAPR | HC_EV_IDLE:
+		r = HC_EV_SUCCESS;
+		kvm_vcpu_block(vcpu);
+		break;
 	default:
 		r = HC_EV_UNIMPLEMENTED;
 		break;
@@ -746,6 +750,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 	pvinfo->hcall[2] = inst_sc;
 	pvinfo->hcall[3] = inst_nop;
 
+	pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
+
 	return 0;
 }
 
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index acbe429..6b2c70e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo {
 	__u8  pad[108];
 };
 
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
+
 #define KVMIO 0xAE
 
 /* machine type bits, to be used as argument to KVM_CREATE_VM */
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 2/4] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-02-21  4:46   ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

And add a new flag definition in kvm_ppc_pvinfo to indicate
whether host support EV_IDLE hcall.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5:
1. remove the ifdef
2. add epapr_hcalls.h into headers install list

 arch/powerpc/include/asm/Kbuild     |    1 +
 arch/powerpc/include/asm/kvm_para.h |   14 ++++++++++++--
 arch/powerpc/kvm/powerpc.c          |    6 ++++++
 include/linux/kvm.h                 |    2 ++
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/Kbuild b/arch/powerpc/include/asm/Kbuild
index 7e313f1..13d6b7b 100644
--- a/arch/powerpc/include/asm/Kbuild
+++ b/arch/powerpc/include/asm/Kbuild
@@ -34,5 +34,6 @@ header-y += termios.h
 header-y += types.h
 header-y += ucontext.h
 header-y += unistd.h
+header-y += epapr_hcalls.h
 
 generic-y += rwsem.h
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 7b754e7..81a34c9 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -75,9 +75,19 @@ struct kvm_vcpu_arch_shared {
 };
 
 #define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
-#define HC_VENDOR_KVM		(42 << 16)
+
+#include <asm/epapr_hcalls.h>
+
+/* ePAPR Hypercall Vendor ID */
+#define HC_VENDOR_EPAPR		(EV_EPAPR_VENDOR_ID << 16)
+#define HC_VENDOR_KVM		(EV_KVM_VENDOR_ID << 16)
+
+/* ePAPR Hypercall Token */
+#define HC_EV_IDLE		EV_IDLE
+
+/* ePAPR Hypercall Return Codes */
 #define HC_EV_SUCCESS		0
-#define HC_EV_UNIMPLEMENTED	12
+#define HC_EV_UNIMPLEMENTED	EV_UNIMPLEMENTED
 
 #define KVM_FEATURE_MAGIC_PAGE	1
 
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 0e21d15..7098840 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
 
 		/* Second return value is in r4 */
 		break;
+	case HC_VENDOR_EPAPR | HC_EV_IDLE:
+		r = HC_EV_SUCCESS;
+		kvm_vcpu_block(vcpu);
+		break;
 	default:
 		r = HC_EV_UNIMPLEMENTED;
 		break;
@@ -746,6 +750,8 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 	pvinfo->hcall[2] = inst_sc;
 	pvinfo->hcall[3] = inst_nop;
 
+	pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
+
 	return 0;
 }
 
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index acbe429..6b2c70e 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -449,6 +449,8 @@ struct kvm_ppc_pvinfo {
 	__u8  pad[108];
 };
 
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
+
 #define KVMIO 0xAE
 
 /* machine type bits, to be used as argument to KVM_CREATE_VM */
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
  2012-02-21  4:46   ` Liu Yu
  (?)
@ 2012-02-21  4:46     ` Liu Yu
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

If the guest hypervisor node contains "has-idle" property.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: no change

 arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 697b390..72fa234 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -15,6 +15,35 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
+#define HC_VENDOR_EPAPR		(1 << 16)
+#define HC_EV_IDLE		16
+
+_GLOBAL(epapr_ev_idle)
+epapr_ev_idle:
+	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
+	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
+	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
+	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
+
+	wrteei	1
+
+idle_loop:
+	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+
+	/*
+	 * Guard against spurious wakeups from a hypervisor --
+	 * only interrupt will cause us to return to LR due to
+	 * _TLF_NAPPING.
+	 */
+	b	idle_loop
+
 /* Hypercall entry point. Will be patched with device tree instructions. */
 .global epapr_hypercall_start
 epapr_hypercall_start:
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index e601da7..43d875e 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -21,6 +21,10 @@
 #include <asm/epapr_hcalls.h>
 #include <asm/cacheflush.h>
 #include <asm/code-patching.h>
+#include <asm/machdep.h>
+
+extern void epapr_ev_idle(void);
+extern u32 epapr_ev_idle_start[];
 
 bool epapr_para_enabled = false;
 
@@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
 
 	insts = of_get_property(hyper_node, "hcall-instructions", &len);
 	if (insts && !(len % 4) && len <= (4 * 4)) {
-		for (i = 0; i < (len / 4); i++)
+		for (i = 0; i < (len / 4); i++) {
 			patch_instruction(epapr_hypercall_start + i, insts[i]);
+			patch_instruction(epapr_ev_idle_start + i, insts[i]);
+		}
+
+		if (of_get_property(hyper_node, "has-idle", NULL))
+			ppc_md.power_save = epapr_ev_idle;
 
 		epapr_para_enabled = true;
 	} else {
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-21  4:46     ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, Liu Yu, B07421

If the guest hypervisor node contains "has-idle" property.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: no change

 arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 697b390..72fa234 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -15,6 +15,35 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
+#define HC_VENDOR_EPAPR		(1 << 16)
+#define HC_EV_IDLE		16
+
+_GLOBAL(epapr_ev_idle)
+epapr_ev_idle:
+	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
+	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
+	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
+	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
+
+	wrteei	1
+
+idle_loop:
+	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+
+	/*
+	 * Guard against spurious wakeups from a hypervisor --
+	 * only interrupt will cause us to return to LR due to
+	 * _TLF_NAPPING.
+	 */
+	b	idle_loop
+
 /* Hypercall entry point. Will be patched with device tree instructions. */
 .global epapr_hypercall_start
 epapr_hypercall_start:
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index e601da7..43d875e 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -21,6 +21,10 @@
 #include <asm/epapr_hcalls.h>
 #include <asm/cacheflush.h>
 #include <asm/code-patching.h>
+#include <asm/machdep.h>
+
+extern void epapr_ev_idle(void);
+extern u32 epapr_ev_idle_start[];
 
 bool epapr_para_enabled = false;
 
@@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
 
 	insts = of_get_property(hyper_node, "hcall-instructions", &len);
 	if (insts && !(len % 4) && len <= (4 * 4)) {
-		for (i = 0; i < (len / 4); i++)
+		for (i = 0; i < (len / 4); i++) {
 			patch_instruction(epapr_hypercall_start + i, insts[i]);
+			patch_instruction(epapr_ev_idle_start + i, insts[i]);
+		}
+
+		if (of_get_property(hyper_node, "has-idle", NULL))
+			ppc_md.power_save = epapr_ev_idle;
 
 		epapr_para_enabled = true;
 	} else {
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-21  4:46     ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

If the guest hypervisor node contains "has-idle" property.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: no change

 arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
 2 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
index 697b390..72fa234 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -15,6 +15,35 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
+#define HC_VENDOR_EPAPR		(1 << 16)
+#define HC_EV_IDLE		16
+
+_GLOBAL(epapr_ev_idle)
+epapr_ev_idle:
+	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
+	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
+	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
+	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
+
+	wrteei	1
+
+idle_loop:
+	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
+
+.global epapr_ev_idle_start
+epapr_ev_idle_start:
+	li	r3, -1
+	nop
+	nop
+	nop
+
+	/*
+	 * Guard against spurious wakeups from a hypervisor --
+	 * only interrupt will cause us to return to LR due to
+	 * _TLF_NAPPING.
+	 */
+	b	idle_loop
+
 /* Hypercall entry point. Will be patched with device tree instructions. */
 .global epapr_hypercall_start
 epapr_hypercall_start:
diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
index e601da7..43d875e 100644
--- a/arch/powerpc/kernel/epapr_paravirt.c
+++ b/arch/powerpc/kernel/epapr_paravirt.c
@@ -21,6 +21,10 @@
 #include <asm/epapr_hcalls.h>
 #include <asm/cacheflush.h>
 #include <asm/code-patching.h>
+#include <asm/machdep.h>
+
+extern void epapr_ev_idle(void);
+extern u32 epapr_ev_idle_start[];
 
 bool epapr_para_enabled = false;
 
@@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
 
 	insts = of_get_property(hyper_node, "hcall-instructions", &len);
 	if (insts && !(len % 4) && len <= (4 * 4)) {
-		for (i = 0; i < (len / 4); i++)
+		for (i = 0; i < (len / 4); i++) {
 			patch_instruction(epapr_hypercall_start + i, insts[i]);
+			patch_instruction(epapr_ev_idle_start + i, insts[i]);
+		}
+
+		if (of_get_property(hyper_node, "has-idle", NULL))
+			ppc_md.power_save = epapr_ev_idle;
 
 		epapr_para_enabled = true;
 	} else {
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
  2012-02-21  4:46     ` Liu Yu
  (?)
@ 2012-02-21  4:46       ` Liu Yu
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

Discard the old way that invoke hypercall,
instead, use epapr paravirt.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: new patch

 arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
 arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index 0ff3f24..42f2328 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -188,7 +188,7 @@ static inline unsigned int ev_int_set_config(unsigned int interrupt,
 	r5  = priority;
 	r6  = destination;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -217,7 +217,7 @@ static inline unsigned int ev_int_get_config(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -247,7 +247,7 @@ static inline unsigned int ev_int_set_mask(unsigned int interrupt,
 	r3 = interrupt;
 	r4 = mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -272,7 +272,7 @@ static inline unsigned int ev_int_get_mask(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -300,7 +300,7 @@ static inline unsigned int ev_int_eoi(unsigned int interrupt)
 	r11 = EV_HCALL_TOKEN(EV_INT_EOI);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -339,7 +339,7 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
 	r7 = be32_to_cpu(p[2]);
 	r8 = be32_to_cpu(p[3]);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3),
 		  "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -378,7 +378,7 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
 	r3 = handle;
 	r4 = *count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4),
 		  "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -416,7 +416,7 @@ static inline unsigned int ev_byte_channel_poll(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -449,7 +449,7 @@ static inline unsigned int ev_int_iack(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_INT_IACK);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -473,7 +473,7 @@ static inline unsigned int ev_doorbell_send(unsigned int handle)
 	r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -493,7 +493,7 @@ static inline unsigned int ev_idle(void)
 
 	r11 = EV_HCALL_TOKEN(EV_IDLE);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
diff --git a/arch/powerpc/include/asm/fsl_hcalls.h b/arch/powerpc/include/asm/fsl_hcalls.h
index 922d9b5..3abb583 100644
--- a/arch/powerpc/include/asm/fsl_hcalls.h
+++ b/arch/powerpc/include/asm/fsl_hcalls.h
@@ -96,7 +96,7 @@ static inline unsigned int fh_send_nmi(unsigned int vcpu_mask)
 	r11 = FH_HCALL_TOKEN(FH_SEND_NMI);
 	r3 = vcpu_mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -151,7 +151,7 @@ static inline unsigned int fh_partition_get_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = *propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -205,7 +205,7 @@ static inline unsigned int fh_partition_set_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -229,7 +229,7 @@ static inline unsigned int fh_partition_restart(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -262,7 +262,7 @@ static inline unsigned int fh_partition_get_status(unsigned int partition,
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -295,7 +295,7 @@ static inline unsigned int fh_partition_start(unsigned int partition,
 	r4 = entry_point;
 	r5 = load;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -317,7 +317,7 @@ static inline unsigned int fh_partition_stop(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -376,7 +376,7 @@ static inline unsigned int fh_partition_memcpy(unsigned int source,
 #endif
 	r7 = count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -399,7 +399,7 @@ static inline unsigned int fh_dma_enable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -421,7 +421,7 @@ static inline unsigned int fh_dma_disable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -447,7 +447,7 @@ static inline unsigned int fh_vmpic_get_msir(unsigned int interrupt,
 	r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -469,7 +469,7 @@ static inline unsigned int fh_system_reset(void)
 
 	r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -506,7 +506,7 @@ static inline unsigned int fh_err_get_info(int queue, uint32_t *bufsize,
 	r6 = addr_lo;
 	r7 = peek;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6),
 		  "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -542,7 +542,7 @@ static inline unsigned int fh_get_core_state(unsigned int handle,
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -572,7 +572,7 @@ static inline unsigned int fh_enter_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -597,7 +597,7 @@ static inline unsigned int fh_exit_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -618,7 +618,7 @@ static inline unsigned int fh_claim_device(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -645,7 +645,7 @@ static inline unsigned int fh_partition_stop_dma(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-21  4:46       ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, Liu Yu, B07421

Discard the old way that invoke hypercall,
instead, use epapr paravirt.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: new patch

 arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
 arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index 0ff3f24..42f2328 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -188,7 +188,7 @@ static inline unsigned int ev_int_set_config(unsigned int interrupt,
 	r5  = priority;
 	r6  = destination;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -217,7 +217,7 @@ static inline unsigned int ev_int_get_config(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -247,7 +247,7 @@ static inline unsigned int ev_int_set_mask(unsigned int interrupt,
 	r3 = interrupt;
 	r4 = mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -272,7 +272,7 @@ static inline unsigned int ev_int_get_mask(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -300,7 +300,7 @@ static inline unsigned int ev_int_eoi(unsigned int interrupt)
 	r11 = EV_HCALL_TOKEN(EV_INT_EOI);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -339,7 +339,7 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
 	r7 = be32_to_cpu(p[2]);
 	r8 = be32_to_cpu(p[3]);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3),
 		  "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -378,7 +378,7 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
 	r3 = handle;
 	r4 = *count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4),
 		  "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -416,7 +416,7 @@ static inline unsigned int ev_byte_channel_poll(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -449,7 +449,7 @@ static inline unsigned int ev_int_iack(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_INT_IACK);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -473,7 +473,7 @@ static inline unsigned int ev_doorbell_send(unsigned int handle)
 	r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -493,7 +493,7 @@ static inline unsigned int ev_idle(void)
 
 	r11 = EV_HCALL_TOKEN(EV_IDLE);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
diff --git a/arch/powerpc/include/asm/fsl_hcalls.h b/arch/powerpc/include/asm/fsl_hcalls.h
index 922d9b5..3abb583 100644
--- a/arch/powerpc/include/asm/fsl_hcalls.h
+++ b/arch/powerpc/include/asm/fsl_hcalls.h
@@ -96,7 +96,7 @@ static inline unsigned int fh_send_nmi(unsigned int vcpu_mask)
 	r11 = FH_HCALL_TOKEN(FH_SEND_NMI);
 	r3 = vcpu_mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -151,7 +151,7 @@ static inline unsigned int fh_partition_get_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = *propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -205,7 +205,7 @@ static inline unsigned int fh_partition_set_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -229,7 +229,7 @@ static inline unsigned int fh_partition_restart(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -262,7 +262,7 @@ static inline unsigned int fh_partition_get_status(unsigned int partition,
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -295,7 +295,7 @@ static inline unsigned int fh_partition_start(unsigned int partition,
 	r4 = entry_point;
 	r5 = load;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -317,7 +317,7 @@ static inline unsigned int fh_partition_stop(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -376,7 +376,7 @@ static inline unsigned int fh_partition_memcpy(unsigned int source,
 #endif
 	r7 = count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -399,7 +399,7 @@ static inline unsigned int fh_dma_enable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -421,7 +421,7 @@ static inline unsigned int fh_dma_disable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -447,7 +447,7 @@ static inline unsigned int fh_vmpic_get_msir(unsigned int interrupt,
 	r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -469,7 +469,7 @@ static inline unsigned int fh_system_reset(void)
 
 	r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -506,7 +506,7 @@ static inline unsigned int fh_err_get_info(int queue, uint32_t *bufsize,
 	r6 = addr_lo;
 	r7 = peek;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6),
 		  "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -542,7 +542,7 @@ static inline unsigned int fh_get_core_state(unsigned int handle,
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -572,7 +572,7 @@ static inline unsigned int fh_enter_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -597,7 +597,7 @@ static inline unsigned int fh_exit_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -618,7 +618,7 @@ static inline unsigned int fh_claim_device(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -645,7 +645,7 @@ static inline unsigned int fh_partition_stop_dma(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
-- 
1.7.0.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-21  4:46       ` Liu Yu
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu @ 2012-02-21  4:46 UTC (permalink / raw)
  To: agraf, kvm-ppc, kvm; +Cc: linuxppc-dev, B07421, Liu Yu

Discard the old way that invoke hypercall,
instead, use epapr paravirt.

Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
v5: new patch

 arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
 arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
 2 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index 0ff3f24..42f2328 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -188,7 +188,7 @@ static inline unsigned int ev_int_set_config(unsigned int interrupt,
 	r5  = priority;
 	r6  = destination;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -217,7 +217,7 @@ static inline unsigned int ev_int_get_config(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_CONFIG);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5), "=r" (r6)
 		: : EV_HCALL_CLOBBERS4
 	);
@@ -247,7 +247,7 @@ static inline unsigned int ev_int_set_mask(unsigned int interrupt,
 	r3 = interrupt;
 	r4 = mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -272,7 +272,7 @@ static inline unsigned int ev_int_get_mask(unsigned int interrupt,
 	r11 = EV_HCALL_TOKEN(EV_INT_GET_MASK);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -300,7 +300,7 @@ static inline unsigned int ev_int_eoi(unsigned int interrupt)
 	r11 = EV_HCALL_TOKEN(EV_INT_EOI);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -339,7 +339,7 @@ static inline unsigned int ev_byte_channel_send(unsigned int handle,
 	r7 = be32_to_cpu(p[2]);
 	r8 = be32_to_cpu(p[3]);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3),
 		  "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7), "+r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -378,7 +378,7 @@ static inline unsigned int ev_byte_channel_receive(unsigned int handle,
 	r3 = handle;
 	r4 = *count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4),
 		  "=r" (r5), "=r" (r6), "=r" (r7), "=r" (r8)
 		: : EV_HCALL_CLOBBERS6
@@ -416,7 +416,7 @@ static inline unsigned int ev_byte_channel_poll(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_BYTE_CHANNEL_POLL);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4), "=r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -449,7 +449,7 @@ static inline unsigned int ev_int_iack(unsigned int handle,
 	r11 = EV_HCALL_TOKEN(EV_INT_IACK);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -473,7 +473,7 @@ static inline unsigned int ev_doorbell_send(unsigned int handle)
 	r11 = EV_HCALL_TOKEN(EV_DOORBELL_SEND);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -493,7 +493,7 @@ static inline unsigned int ev_idle(void)
 
 	r11 = EV_HCALL_TOKEN(EV_IDLE);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
diff --git a/arch/powerpc/include/asm/fsl_hcalls.h b/arch/powerpc/include/asm/fsl_hcalls.h
index 922d9b5..3abb583 100644
--- a/arch/powerpc/include/asm/fsl_hcalls.h
+++ b/arch/powerpc/include/asm/fsl_hcalls.h
@@ -96,7 +96,7 @@ static inline unsigned int fh_send_nmi(unsigned int vcpu_mask)
 	r11 = FH_HCALL_TOKEN(FH_SEND_NMI);
 	r3 = vcpu_mask;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -151,7 +151,7 @@ static inline unsigned int fh_partition_get_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = *propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -205,7 +205,7 @@ static inline unsigned int fh_partition_set_dtprop(int handle,
 	r9 = (uint32_t)propvalue_addr;
 	r10 = propvalue_len;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7),
 		  "+r" (r8), "+r" (r9), "+r" (r10)
@@ -229,7 +229,7 @@ static inline unsigned int fh_partition_restart(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_RESTART);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -262,7 +262,7 @@ static inline unsigned int fh_partition_get_status(unsigned int partition,
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_GET_STATUS);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -295,7 +295,7 @@ static inline unsigned int fh_partition_start(unsigned int partition,
 	r4 = entry_point;
 	r5 = load;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5)
 		: : EV_HCALL_CLOBBERS3
 	);
@@ -317,7 +317,7 @@ static inline unsigned int fh_partition_stop(unsigned int partition)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP);
 	r3 = partition;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -376,7 +376,7 @@ static inline unsigned int fh_partition_memcpy(unsigned int source,
 #endif
 	r7 = count;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11),
 		  "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6), "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -399,7 +399,7 @@ static inline unsigned int fh_dma_enable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_ENABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -421,7 +421,7 @@ static inline unsigned int fh_dma_disable(unsigned int liodn)
 	r11 = FH_HCALL_TOKEN(FH_DMA_DISABLE);
 	r3 = liodn;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -447,7 +447,7 @@ static inline unsigned int fh_vmpic_get_msir(unsigned int interrupt,
 	r11 = FH_HCALL_TOKEN(FH_VMPIC_GET_MSIR);
 	r3 = interrupt;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "=r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -469,7 +469,7 @@ static inline unsigned int fh_system_reset(void)
 
 	r11 = FH_HCALL_TOKEN(FH_SYSTEM_RESET);
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "=r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -506,7 +506,7 @@ static inline unsigned int fh_err_get_info(int queue, uint32_t *bufsize,
 	r6 = addr_lo;
 	r7 = peek;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4), "+r" (r5), "+r" (r6),
 		  "+r" (r7)
 		: : EV_HCALL_CLOBBERS5
@@ -542,7 +542,7 @@ static inline unsigned int fh_get_core_state(unsigned int handle,
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -572,7 +572,7 @@ static inline unsigned int fh_enter_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -597,7 +597,7 @@ static inline unsigned int fh_exit_nap(unsigned int handle, unsigned int vcpu)
 	r3 = handle;
 	r4 = vcpu;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3), "+r" (r4)
 		: : EV_HCALL_CLOBBERS2
 	);
@@ -618,7 +618,7 @@ static inline unsigned int fh_claim_device(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_CLAIM_DEVICE);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
@@ -645,7 +645,7 @@ static inline unsigned int fh_partition_stop_dma(unsigned int handle)
 	r11 = FH_HCALL_TOKEN(FH_PARTITION_STOP_DMA);
 	r3 = handle;
 
-	__asm__ __volatile__ ("sc 1"
+	asm volatile("bl	epapr_hypercall_start"
 		: "+r" (r11), "+r" (r3)
 		: : EV_HCALL_CLOBBERS1
 	);
-- 
1.7.0.4



^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
  2012-02-21  4:46     ` Liu Yu
  (?)
@ 2012-02-21 10:53       ` tiejun.chen
  -1 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-21 10:53 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: no change
> 
>  arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>  2 files changed, 39 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> index 697b390..72fa234 100644
> --- a/arch/powerpc/kernel/epapr_hcalls.S
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -15,6 +15,35 @@
>  #include <asm/ppc_asm.h>
>  #include <asm/asm-offsets.h>
>  
> +#define HC_VENDOR_EPAPR		(1 << 16)
> +#define HC_EV_IDLE		16

Why not use 'EV_IDLE' directly?

> +
> +_GLOBAL(epapr_ev_idle)
> +epapr_ev_idle:
> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
> +
> +	wrteei	1
> +
> +idle_loop:
> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)

And could this line be simplified as something like this:

LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))

If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.

Tiejun

> +
> +.global epapr_ev_idle_start
> +epapr_ev_idle_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +
> +	/*
> +	 * Guard against spurious wakeups from a hypervisor --
> +	 * only interrupt will cause us to return to LR due to
> +	 * _TLF_NAPPING.
> +	 */
> +	b	idle_loop
> +
>  /* Hypercall entry point. Will be patched with device tree instructions. */
>  .global epapr_hypercall_start
>  epapr_hypercall_start:
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> index e601da7..43d875e 100644
> --- a/arch/powerpc/kernel/epapr_paravirt.c
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -21,6 +21,10 @@
>  #include <asm/epapr_hcalls.h>
>  #include <asm/cacheflush.h>
>  #include <asm/code-patching.h>
> +#include <asm/machdep.h>
> +
> +extern void epapr_ev_idle(void);
> +extern u32 epapr_ev_idle_start[];
>  
>  bool epapr_para_enabled = false;
>  
> @@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
>  
>  	insts = of_get_property(hyper_node, "hcall-instructions", &len);
>  	if (insts && !(len % 4) && len <= (4 * 4)) {
> -		for (i = 0; i < (len / 4); i++)
> +		for (i = 0; i < (len / 4); i++) {
>  			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +			patch_instruction(epapr_ev_idle_start + i, insts[i]);
> +		}
> +
> +		if (of_get_property(hyper_node, "has-idle", NULL))
> +			ppc_md.power_save = epapr_ev_idle;
>  
>  		epapr_para_enabled = true;
>  	} else {

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-21 10:53       ` tiejun.chen
  0 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-21 10:53 UTC (permalink / raw)
  To: Liu Yu; +Cc: linuxppc-dev, B07421, agraf, kvm-ppc, kvm

Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: no change
> 
>  arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>  2 files changed, 39 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> index 697b390..72fa234 100644
> --- a/arch/powerpc/kernel/epapr_hcalls.S
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -15,6 +15,35 @@
>  #include <asm/ppc_asm.h>
>  #include <asm/asm-offsets.h>
>  
> +#define HC_VENDOR_EPAPR		(1 << 16)
> +#define HC_EV_IDLE		16

Why not use 'EV_IDLE' directly?

> +
> +_GLOBAL(epapr_ev_idle)
> +epapr_ev_idle:
> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
> +
> +	wrteei	1
> +
> +idle_loop:
> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)

And could this line be simplified as something like this:

LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))

If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.

Tiejun

> +
> +.global epapr_ev_idle_start
> +epapr_ev_idle_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +
> +	/*
> +	 * Guard against spurious wakeups from a hypervisor --
> +	 * only interrupt will cause us to return to LR due to
> +	 * _TLF_NAPPING.
> +	 */
> +	b	idle_loop
> +
>  /* Hypercall entry point. Will be patched with device tree instructions. */
>  .global epapr_hypercall_start
>  epapr_hypercall_start:
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> index e601da7..43d875e 100644
> --- a/arch/powerpc/kernel/epapr_paravirt.c
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -21,6 +21,10 @@
>  #include <asm/epapr_hcalls.h>
>  #include <asm/cacheflush.h>
>  #include <asm/code-patching.h>
> +#include <asm/machdep.h>
> +
> +extern void epapr_ev_idle(void);
> +extern u32 epapr_ev_idle_start[];
>  
>  bool epapr_para_enabled = false;
>  
> @@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
>  
>  	insts = of_get_property(hyper_node, "hcall-instructions", &len);
>  	if (insts && !(len % 4) && len <= (4 * 4)) {
> -		for (i = 0; i < (len / 4); i++)
> +		for (i = 0; i < (len / 4); i++) {
>  			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +			patch_instruction(epapr_ev_idle_start + i, insts[i]);
> +		}
> +
> +		if (of_get_property(hyper_node, "has-idle", NULL))
> +			ppc_md.power_save = epapr_ev_idle;
>  
>  		epapr_para_enabled = true;
>  	} else {

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-21 10:53       ` tiejun.chen
  0 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-21 10:53 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: no change
> 
>  arch/powerpc/kernel/epapr_hcalls.S   |   29 +++++++++++++++++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>  2 files changed, 39 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> index 697b390..72fa234 100644
> --- a/arch/powerpc/kernel/epapr_hcalls.S
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -15,6 +15,35 @@
>  #include <asm/ppc_asm.h>
>  #include <asm/asm-offsets.h>
>  
> +#define HC_VENDOR_EPAPR		(1 << 16)
> +#define HC_EV_IDLE		16

Why not use 'EV_IDLE' directly?

> +
> +_GLOBAL(epapr_ev_idle)
> +epapr_ev_idle:
> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
> +
> +	wrteei	1
> +
> +idle_loop:
> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)

And could this line be simplified as something like this:

LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))

If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.

Tiejun

> +
> +.global epapr_ev_idle_start
> +epapr_ev_idle_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +
> +	/*
> +	 * Guard against spurious wakeups from a hypervisor --
> +	 * only interrupt will cause us to return to LR due to
> +	 * _TLF_NAPPING.
> +	 */
> +	b	idle_loop
> +
>  /* Hypercall entry point. Will be patched with device tree instructions. */
>  .global epapr_hypercall_start
>  epapr_hypercall_start:
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> index e601da7..43d875e 100644
> --- a/arch/powerpc/kernel/epapr_paravirt.c
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -21,6 +21,10 @@
>  #include <asm/epapr_hcalls.h>
>  #include <asm/cacheflush.h>
>  #include <asm/code-patching.h>
> +#include <asm/machdep.h>
> +
> +extern void epapr_ev_idle(void);
> +extern u32 epapr_ev_idle_start[];
>  
>  bool epapr_para_enabled = false;
>  
> @@ -39,8 +43,13 @@ static int __init epapr_para_init(void)
>  
>  	insts = of_get_property(hyper_node, "hcall-instructions", &len);
>  	if (insts && !(len % 4) && len <= (4 * 4)) {
> -		for (i = 0; i < (len / 4); i++)
> +		for (i = 0; i < (len / 4); i++) {
>  			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +			patch_instruction(epapr_ev_idle_start + i, insts[i]);
> +		}
> +
> +		if (of_get_property(hyper_node, "has-idle", NULL))
> +			ppc_md.power_save = epapr_ev_idle;
>  
>  		epapr_para_enabled = true;
>  	} else {


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
  2012-02-21  4:46 ` Liu Yu
  (?)
@ 2012-02-21 21:56   ` Scott Wood
  -1 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:56 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

On 02/20/2012 10:46 PM, Liu Yu wrote:
> from the kvm guest paravirt init code.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5:
> 1. fix the if test
> 2. use patch_instruction()
> 3. code cleanup
> 4. rename the files
> 5. make epapr paravirt user-selectable
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |    2 +
>  arch/powerpc/kernel/Makefile            |    1 +
>  arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/kvm.c               |   28 ++--------------
>  arch/powerpc/kernel/kvm_emul.S          |   10 ------
>  arch/powerpc/platforms/Kconfig          |    7 ++++
>  7 files changed, 92 insertions(+), 35 deletions(-)
>  create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
>  create mode 100644 arch/powerpc/kernel/epapr_paravirt.c
> 
> diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
> index f3b0c2c..0ff3f24 100644
> --- a/arch/powerpc/include/asm/epapr_hcalls.h
> +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> @@ -148,6 +148,8 @@
>  #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
>  #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
>  
> +extern bool epapr_para_enabled;
> +extern u32 epapr_hypercall_start[];

I asked for s/epapr_para/epapr_paravirt/, at least in anything that is
exposed beyond a single file.

>  /*
>   * We use "uintptr_t" to define a register because it's guaranteed to be a
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index ee728e4..ba8fa43 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
>  obj-y				+= ppc_save_regs.o
>  endif
>  
> +obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
>  obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
>  
>  # Disable GCOV in odd or sensitive code
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> new file mode 100644
> index 0000000..697b390
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/threads.h>
> +#include <asm/reg.h>
> +#include <asm/page.h>
> +#include <asm/cputable.h>
> +#include <asm/thread_info.h>
> +#include <asm/ppc_asm.h>
> +#include <asm/asm-offsets.h>
> +
> +/* Hypercall entry point. Will be patched with device tree instructions. */
> +.global epapr_hypercall_start
> +epapr_hypercall_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +	blr
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> new file mode 100644
> index 0000000..e601da7
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -0,0 +1,54 @@
> +/*
> + * ePAPR para-virtualization support.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
> + *
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + */
> +
> +#include <linux/of.h>
> +#include <asm/epapr_hcalls.h>
> +#include <asm/cacheflush.h>
> +#include <asm/code-patching.h>
> +
> +bool epapr_para_enabled = false;

No need to explicitly initialize to false.

> +static int __init epapr_para_init(void)
> +{
> +	struct device_node *hyper_node;
> +	const u32 *insts;
> +	int len, i;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node) {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor node found\n");
> +		return -ENODEV;
> +	}
> +
> +	insts = of_get_property(hyper_node, "hcall-instructions", &len);
> +	if (insts && !(len % 4) && len <= (4 * 4)) {
> +		for (i = 0; i < (len / 4); i++)
> +			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +
> +		epapr_para_enabled = true;
> +	} else {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor inst found\n");
> +	}

Do not warn just because there's no hypervisor or hcall-instructions.
There's nothing wrong with that.  Only warn if they are present but wrong.

-Scott


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-21 21:56   ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:56 UTC (permalink / raw)
  To: Liu Yu; +Cc: linuxppc-dev, B07421, agraf, kvm-ppc, kvm

On 02/20/2012 10:46 PM, Liu Yu wrote:
> from the kvm guest paravirt init code.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5:
> 1. fix the if test
> 2. use patch_instruction()
> 3. code cleanup
> 4. rename the files
> 5. make epapr paravirt user-selectable
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |    2 +
>  arch/powerpc/kernel/Makefile            |    1 +
>  arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/kvm.c               |   28 ++--------------
>  arch/powerpc/kernel/kvm_emul.S          |   10 ------
>  arch/powerpc/platforms/Kconfig          |    7 ++++
>  7 files changed, 92 insertions(+), 35 deletions(-)
>  create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
>  create mode 100644 arch/powerpc/kernel/epapr_paravirt.c
> 
> diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
> index f3b0c2c..0ff3f24 100644
> --- a/arch/powerpc/include/asm/epapr_hcalls.h
> +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> @@ -148,6 +148,8 @@
>  #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
>  #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
>  
> +extern bool epapr_para_enabled;
> +extern u32 epapr_hypercall_start[];

I asked for s/epapr_para/epapr_paravirt/, at least in anything that is
exposed beyond a single file.

>  /*
>   * We use "uintptr_t" to define a register because it's guaranteed to be a
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index ee728e4..ba8fa43 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
>  obj-y				+= ppc_save_regs.o
>  endif
>  
> +obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
>  obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
>  
>  # Disable GCOV in odd or sensitive code
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> new file mode 100644
> index 0000000..697b390
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/threads.h>
> +#include <asm/reg.h>
> +#include <asm/page.h>
> +#include <asm/cputable.h>
> +#include <asm/thread_info.h>
> +#include <asm/ppc_asm.h>
> +#include <asm/asm-offsets.h>
> +
> +/* Hypercall entry point. Will be patched with device tree instructions. */
> +.global epapr_hypercall_start
> +epapr_hypercall_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +	blr
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> new file mode 100644
> index 0000000..e601da7
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -0,0 +1,54 @@
> +/*
> + * ePAPR para-virtualization support.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
> + *
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + */
> +
> +#include <linux/of.h>
> +#include <asm/epapr_hcalls.h>
> +#include <asm/cacheflush.h>
> +#include <asm/code-patching.h>
> +
> +bool epapr_para_enabled = false;

No need to explicitly initialize to false.

> +static int __init epapr_para_init(void)
> +{
> +	struct device_node *hyper_node;
> +	const u32 *insts;
> +	int len, i;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node) {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor node found\n");
> +		return -ENODEV;
> +	}
> +
> +	insts = of_get_property(hyper_node, "hcall-instructions", &len);
> +	if (insts && !(len % 4) && len <= (4 * 4)) {
> +		for (i = 0; i < (len / 4); i++)
> +			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +
> +		epapr_para_enabled = true;
> +	} else {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor inst found\n");
> +	}

Do not warn just because there's no hypervisor or hcall-instructions.
There's nothing wrong with that.  Only warn if they are present but wrong.

-Scott

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-21 21:56   ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:56 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

On 02/20/2012 10:46 PM, Liu Yu wrote:
> from the kvm guest paravirt init code.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5:
> 1. fix the if test
> 2. use patch_instruction()
> 3. code cleanup
> 4. rename the files
> 5. make epapr paravirt user-selectable
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |    2 +
>  arch/powerpc/kernel/Makefile            |    1 +
>  arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
>  arch/powerpc/kernel/epapr_paravirt.c    |   54 +++++++++++++++++++++++++++++++
>  arch/powerpc/kernel/kvm.c               |   28 ++--------------
>  arch/powerpc/kernel/kvm_emul.S          |   10 ------
>  arch/powerpc/platforms/Kconfig          |    7 ++++
>  7 files changed, 92 insertions(+), 35 deletions(-)
>  create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
>  create mode 100644 arch/powerpc/kernel/epapr_paravirt.c
> 
> diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
> index f3b0c2c..0ff3f24 100644
> --- a/arch/powerpc/include/asm/epapr_hcalls.h
> +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> @@ -148,6 +148,8 @@
>  #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
>  #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
>  
> +extern bool epapr_para_enabled;
> +extern u32 epapr_hypercall_start[];

I asked for s/epapr_para/epapr_paravirt/, at least in anything that is
exposed beyond a single file.

>  /*
>   * We use "uintptr_t" to define a register because it's guaranteed to be a
> diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
> index ee728e4..ba8fa43 100644
> --- a/arch/powerpc/kernel/Makefile
> +++ b/arch/powerpc/kernel/Makefile
> @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
>  obj-y				+= ppc_save_regs.o
>  endif
>  
> +obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
>  obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
>  
>  # Disable GCOV in odd or sensitive code
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S b/arch/powerpc/kernel/epapr_hcalls.S
> new file mode 100644
> index 0000000..697b390
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +
> +#include <linux/threads.h>
> +#include <asm/reg.h>
> +#include <asm/page.h>
> +#include <asm/cputable.h>
> +#include <asm/thread_info.h>
> +#include <asm/ppc_asm.h>
> +#include <asm/asm-offsets.h>
> +
> +/* Hypercall entry point. Will be patched with device tree instructions. */
> +.global epapr_hypercall_start
> +epapr_hypercall_start:
> +	li	r3, -1
> +	nop
> +	nop
> +	nop
> +	blr
> diff --git a/arch/powerpc/kernel/epapr_paravirt.c b/arch/powerpc/kernel/epapr_paravirt.c
> new file mode 100644
> index 0000000..e601da7
> --- /dev/null
> +++ b/arch/powerpc/kernel/epapr_paravirt.c
> @@ -0,0 +1,54 @@
> +/*
> + * ePAPR para-virtualization support.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License, version 2, as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
> + *
> + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> + */
> +
> +#include <linux/of.h>
> +#include <asm/epapr_hcalls.h>
> +#include <asm/cacheflush.h>
> +#include <asm/code-patching.h>
> +
> +bool epapr_para_enabled = false;

No need to explicitly initialize to false.

> +static int __init epapr_para_init(void)
> +{
> +	struct device_node *hyper_node;
> +	const u32 *insts;
> +	int len, i;
> +
> +	hyper_node = of_find_node_by_path("/hypervisor");
> +	if (!hyper_node) {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor node found\n");
> +		return -ENODEV;
> +	}
> +
> +	insts = of_get_property(hyper_node, "hcall-instructions", &len);
> +	if (insts && !(len % 4) && len <= (4 * 4)) {
> +		for (i = 0; i < (len / 4); i++)
> +			patch_instruction(epapr_hypercall_start + i, insts[i]);
> +
> +		epapr_para_enabled = true;
> +	} else {
> +		printk(KERN_WARNING
> +		       "ePAPR paravirt disabled: No hypervisor inst found\n");
> +	}

Do not warn just because there's no hypervisor or hcall-instructions.
There's nothing wrong with that.  Only warn if they are present but wrong.

-Scott


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
  2012-02-21  4:46       ` Liu Yu
  (?)
@ 2012-02-21 21:57         ` Scott Wood
  -1 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:57 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

On 02/20/2012 10:46 PM, Liu Yu wrote:
> Discard the old way that invoke hypercall,
> instead, use epapr paravirt.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: new patch
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
>  arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
>  2 files changed, 29 insertions(+), 29 deletions(-)

Make sure all the Topaz/ePAPR drivers that use this select EPAPR_PARAVIRT.

Have you tested with Topaz?

-Scott

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-21 21:57         ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:57 UTC (permalink / raw)
  To: Liu Yu; +Cc: linuxppc-dev, B07421, agraf, kvm-ppc, kvm

On 02/20/2012 10:46 PM, Liu Yu wrote:
> Discard the old way that invoke hypercall,
> instead, use epapr paravirt.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: new patch
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
>  arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
>  2 files changed, 29 insertions(+), 29 deletions(-)

Make sure all the Topaz/ePAPR drivers that use this select EPAPR_PARAVIRT.

Have you tested with Topaz?

-Scott

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-21 21:57         ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-21 21:57 UTC (permalink / raw)
  To: Liu Yu; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, B07421

On 02/20/2012 10:46 PM, Liu Yu wrote:
> Discard the old way that invoke hypercall,
> instead, use epapr paravirt.
> 
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> v5: new patch
> 
>  arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
>  arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
>  2 files changed, 29 insertions(+), 29 deletions(-)

Make sure all the Topaz/ePAPR drivers that use this select EPAPR_PARAVIRT.

Have you tested with Topaz?

-Scott


^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
  2012-02-21 10:53       ` tiejun.chen
@ 2012-02-22  2:29         ` Liu Yu-B13201
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:29 UTC (permalink / raw)
  To: tiejun.chen; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm



> -----Original Message-----
> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
> Sent: Tuesday, February 21, 2012 6:54 PM
> To: Liu Yu-B13201
> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
> linuxppc-dev@ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for
> e500 guest
> 
> Liu Yu wrote:
> > If the guest hypervisor node contains "has-idle" property.
> >
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > v5: no change
> >
> >  arch/powerpc/kernel/epapr_hcalls.S   |   29
> +++++++++++++++++++++++++++++
> >  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
> >  2 files changed, 39 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/epapr_hcalls.S
> > b/arch/powerpc/kernel/epapr_hcalls.S
> > index 697b390..72fa234 100644
> > --- a/arch/powerpc/kernel/epapr_hcalls.S
> > +++ b/arch/powerpc/kernel/epapr_hcalls.S
> > @@ -15,6 +15,35 @@
> >  #include <asm/ppc_asm.h>
> >  #include <asm/asm-offsets.h>
> >
> > +#define HC_VENDOR_EPAPR		(1 << 16)
> > +#define HC_EV_IDLE		16
> 
> Why not use 'EV_IDLE' directly?
> 
> > +
> > +_GLOBAL(epapr_ev_idle)
> > +epapr_ev_idle:
> > +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
> > +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
> > +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
> > +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
> > +
> > +	wrteei	1
> > +
> > +idle_loop:
> > +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
> 
> And could this line be simplified as something like this:
> 
> LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
> 
> If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.
> 

Because the epapr_hcalls.h contains C functions,
so it cannot be included by assembly code.

Thanks,
Yu

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-22  2:29         ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:29 UTC (permalink / raw)
  To: tiejun.chen; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogdGllanVuLmNoZW4gW21h
aWx0bzp0aWVqdW4uY2hlbkB3aW5kcml2ZXIuY29tXQ0KPiBTZW50OiBUdWVzZGF5LCBGZWJydWFy
eSAyMSwgMjAxMiA2OjU0IFB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RSkpDQo+IA0K
PiBJZiBzbywgZXZlbiB3ZSBjYW4gcmVtb3ZlIHRoZSBwcmV2aW91cyBIQ19WRU5ET1JfRVBBUFIg
ZGVmaW5pdGlvbiBhcyB3ZWxsLg0KPiANCg0KQmVjYXVzZSB0aGUgZXBhcHJfaGNhbGxzLmggY29u
dGFpbnMgQyBmdW5jdGlvbnMsDQpzbyBpdCBjYW5ub3QgYmUgaW5jbHVkZWQgYnkgYXNzZW1ibHkg
Y29kZS4NCg0KVGhhbmtzLA0KWXUNCg==

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
  2012-02-21 21:56   ` Scott Wood
  (?)
@ 2012-02-22  2:33     ` Liu Yu-B13201
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:33 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev



> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, February 22, 2012 5:56 AM
> To: Liu Yu-B13201
> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
> linuxppc-dev@ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
> 
> On 02/20/2012 10:46 PM, Liu Yu wrote:
> > from the kvm guest paravirt init code.
> >
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > v5:
> > 1. fix the if test
> > 2. use patch_instruction()
> > 3. code cleanup
> > 4. rename the files
> > 5. make epapr paravirt user-selectable
> >
> >  arch/powerpc/include/asm/epapr_hcalls.h |    2 +
> >  arch/powerpc/kernel/Makefile            |    1 +
> >  arch/powerpc/kernel/epapr_hcalls.S      |   25 ++++++++++++++
> >  arch/powerpc/kernel/epapr_paravirt.c    |   54
> +++++++++++++++++++++++++++++++
> >  arch/powerpc/kernel/kvm.c               |   28 ++--------------
> >  arch/powerpc/kernel/kvm_emul.S          |   10 ------
> >  arch/powerpc/platforms/Kconfig          |    7 ++++
> >  7 files changed, 92 insertions(+), 35 deletions(-)  create mode
> > 100644 arch/powerpc/kernel/epapr_hcalls.S
> >  create mode 100644 arch/powerpc/kernel/epapr_paravirt.c
> >
> > diff --git a/arch/powerpc/include/asm/epapr_hcalls.h
> > b/arch/powerpc/include/asm/epapr_hcalls.h
> > index f3b0c2c..0ff3f24 100644
> > --- a/arch/powerpc/include/asm/epapr_hcalls.h
> > +++ b/arch/powerpc/include/asm/epapr_hcalls.h
> > @@ -148,6 +148,8 @@
> >  #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
> >  #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
> >
> > +extern bool epapr_para_enabled;
> > +extern u32 epapr_hypercall_start[];
> 
> I asked for s/epapr_para/epapr_paravirt/, at least in anything that is
> exposed beyond a single file.
> 
> >  /*
> >   * We use "uintptr_t" to define a register because it's guaranteed to
> > be a diff --git a/arch/powerpc/kernel/Makefile
> > b/arch/powerpc/kernel/Makefile index ee728e4..ba8fa43 100644
> > --- a/arch/powerpc/kernel/Makefile
> > +++ b/arch/powerpc/kernel/Makefile
> > @@ -136,6 +136,7 @@ ifneq ($(CONFIG_XMON)$(CONFIG_KEXEC),)
> >  obj-y				+= ppc_save_regs.o
> >  endif
> >
> > +obj-$(CONFIG_EPAPR_PARAVIRT)	+= epapr_paravirt.o epapr_hcalls.o
> >  obj-$(CONFIG_KVM_GUEST)		+= kvm.o kvm_emul.o
> >
> >  # Disable GCOV in odd or sensitive code diff --git
> > a/arch/powerpc/kernel/epapr_hcalls.S
> > b/arch/powerpc/kernel/epapr_hcalls.S
> > new file mode 100644
> > index 0000000..697b390
> > --- /dev/null
> > +++ b/arch/powerpc/kernel/epapr_hcalls.S
> > @@ -0,0 +1,25 @@
> > +/*
> > + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > + * modify it under the terms of the GNU General Public License
> > + * as published by the Free Software Foundation; either version
> > + * 2 of the License, or (at your option) any later version.
> > + */
> > +
> > +#include <linux/threads.h>
> > +#include <asm/reg.h>
> > +#include <asm/page.h>
> > +#include <asm/cputable.h>
> > +#include <asm/thread_info.h>
> > +#include <asm/ppc_asm.h>
> > +#include <asm/asm-offsets.h>
> > +
> > +/* Hypercall entry point. Will be patched with device tree
> > +instructions. */ .global epapr_hypercall_start
> > +epapr_hypercall_start:
> > +	li	r3, -1
> > +	nop
> > +	nop
> > +	nop
> > +	blr
> > diff --git a/arch/powerpc/kernel/epapr_paravirt.c
> > b/arch/powerpc/kernel/epapr_paravirt.c
> > new file mode 100644
> > index 0000000..e601da7
> > --- /dev/null
> > +++ b/arch/powerpc/kernel/epapr_paravirt.c
> > @@ -0,0 +1,54 @@
> > +/*
> > + * ePAPR para-virtualization support.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > +modify
> > + * it under the terms of the GNU General Public License, version 2,
> > +as
> > + * published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > + * GNU General Public License for more details.
> > + *
> > + * You should have received a copy of the GNU General Public License
> > + * along with this program; if not, write to the Free Software
> > + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
> USA.
> > + *
> > + * Copyright (C) 2012 Freescale Semiconductor, Inc.
> > + */
> > +
> > +#include <linux/of.h>
> > +#include <asm/epapr_hcalls.h>
> > +#include <asm/cacheflush.h>
> > +#include <asm/code-patching.h>
> > +
> > +bool epapr_para_enabled = false;
> 
> No need to explicitly initialize to false.

Why not make code more readable?

> 
> > +static int __init epapr_para_init(void) {
> > +	struct device_node *hyper_node;
> > +	const u32 *insts;
> > +	int len, i;
> > +
> > +	hyper_node = of_find_node_by_path("/hypervisor");
> > +	if (!hyper_node) {
> > +		printk(KERN_WARNING
> > +		       "ePAPR paravirt disabled: No hypervisor node found\n");
> > +		return -ENODEV;
> > +	}
> > +
> > +	insts = of_get_property(hyper_node, "hcall-instructions", &len);
> > +	if (insts && !(len % 4) && len <= (4 * 4)) {
> > +		for (i = 0; i < (len / 4); i++)
> > +			patch_instruction(epapr_hypercall_start + i, insts[i]);
> > +
> > +		epapr_para_enabled = true;
> > +	} else {
> > +		printk(KERN_WARNING
> > +		       "ePAPR paravirt disabled: No hypervisor inst found\n");
> > +	}
> 
> Do not warn just because there's no hypervisor or hcall-instructions.
> There's nothing wrong with that.  Only warn if they are present but wrong.
> 

I see that it's not proper to warn in host.
But if user forget to add hypervisor node or inst, how can he know something is wrong?

Thanks,
Yu

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-22  2:33     ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:33 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev, agraf, kvm-ppc, kvm

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogV2VkbmVzZGF5LCBGZWJydWFyeSAyMiwgMjAxMiA1OjU2IEFNDQo+IFRvOiBM
aXUgWXUtQjEzMjAxDQo+IENjOiBhZ3JhZkBzdXNlLmRlOyBrdm0tcHBjQHZnZXIua2VybmVsLm9y
Zzsga3ZtQHZnZXIua2VybmVsLm9yZzsNCj4gbGludXhwcGMtZGV2QG96bGFicy5vcmc7IFdvb2Qg
U2NvdHQtQjA3NDIxDQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggdjUgMS80XSBLVk06IFBQQzogZXBh
cHI6IEZhY3RvciBvdXQgdGhlIGVwYXByIGluaXQNCj4gDQo+IE9uIDAyLzIwLzIwMTIgMTA6NDYg
UE0s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pdCdzIG5vdCBwcm9wZXIgdG8gd2FybiBpbiBo
b3N0Lg0KQnV0IGlmIHVzZXIgZm9yZ2V0IHRvIGFkZCBoeXBlcnZpc29yIG5vZGUgb3IgaW5zdCwg
aG93IGNhbiBoZSBrbm93IHNvbWV0aGluZyBpcyB3cm9uZz8NCg0KVGhhbmtzLA0KWXUNCg==

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-22  2:33     ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:33 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogV2VkbmVzZGF5LCBGZWJydWFyeSAyMiwgMjAxMiA1OjU2IEFNDQo+IFRvOiBM
aXUgWXUtQjEzMjAxDQo+IENjOiBhZ3JhZkBzdXNlLmRlOyBrdm0tcHBjQHZnZXIua2VybmVsLm9y
Zzsga3ZtQHZnZXIua2VybmVsLm9yZzsNCj4gbGludXhwcGMtZGV2QG96bGFicy5vcmc7IFdvb2Qg
U2NvdHQtQjA3NDIxDQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggdjUgMS80XSBLVk06IFBQQzogZXBh
cHI6IEZhY3RvciBvdXQgdGhlIGVwYXByIGluaXQNCj4gDQo+IE9uIDAyLzIwLzIwMTIgMTA6NDYg
UE0sIExpdSBZdSB3cm90ZToNCj4gPiBmcm9tIHRoZSBrdm0gZ3Vlc3QgcGFyYXZpcnQgaW5pdCBj
b2RlLg0KPiA+DQo+ID4gU2lnbmVkLW9mZi1ieTogTGl1IFl1IDx5dS5saXVAZnJlZXNjYWxlLmNv
bT4NCj4gPiAtLS0NCj4gPiB2NToNCj4gPiAxLiBmaXggdGhlI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flat|nested] 37+ messages in thread

* RE: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
  2012-02-21 21:57         ` Scott Wood
  (?)
@ 2012-02-22  2:34           ` Liu Yu-B13201
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:34 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev



> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Wednesday, February 22, 2012 5:58 AM
> To: Liu Yu-B13201
> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
> linuxppc-dev@ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall
> invoking
> 
> On 02/20/2012 10:46 PM, Liu Yu wrote:
> > Discard the old way that invoke hypercall, instead, use epapr
> > paravirt.
> >
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > v5: new patch
> >
> >  arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
> >  arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++--------
> -------
> >  2 files changed, 29 insertions(+), 29 deletions(-)
> 
> Make sure all the Topaz/ePAPR drivers that use this select EPAPR_PARAVIRT.
> 
> Have you tested with Topaz?
> 

Not yet test.

Thanks,
Yu

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-22  2:34           ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:34 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: linuxppc-dev, agraf, kvm-ppc, kvm

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogV2VkbmVzZGF5LCBGZWJydWFyeSAyMiwgMjAxMi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3Bhej8NCj4gDQoNCk5vdCB5ZXQgdGVzdC4NCg0KVGhhbmtzLA0KWXUNCg==

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking
@ 2012-02-22  2:34           ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:34 UTC (permalink / raw)
  To: Wood Scott-B07421; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogV2VkbmVzZGF5LCBGZWJydWFyeSAyMiwgMjAxMiA1OjU4IEFNDQo+IFRvOiBM
aXUgWXUtQjEzMjAxDQo+IENjOiBhZ3JhZkBzdXNlLmRlOyBrdm0tcHBjQHZnZXIua2VybmVsLm9y
Zzsga3ZtQHZnZXIua2VybmVsLm9yZzsNCj4gbGludXhwcGMtZGV2QG96bGFicy5vcmc7IFdvb2Qg
U2NvdHQtQjA3NDIxDQo+IFN1YmplY3Q6IFJlOiBbUEFUQ0ggdjUgNC80XSBLVk06IFBQQzogZXBh
cHI6IFVwZGF0ZSBvdGhlciBoeXBlcmNhbGwNCj4gaW52b2tpbmcNCj4gDQo+IE9uIDAyLzIwLzIw
MTIgMTA6NDYgUE0sIExpdSBZdSB3cm90ZToNCj4gPiBEaXNjYXJkIHRoZSBvbGQgd2F5IHRoYXQg
aW52b2tlIGh5cGVyY2FsbCwgaW5zdGVhZCwgdXNlIGVwYXByDQo+ID4gcGFyYXZpcnQuDQo+ID4N
Cj4gPiBTaWduZWQtb2ZmLWJ5OiBMaXUgWXUgPHl1LmxpdUBmcmVlc2NhbGUuY29tPg0KPiA+IC0t
LQ0KPiA+IHY1OiBuZXcgcGF0Y2gNCj4gPg0KPiA+ICBhcmNoL3Bvd2VycGMvaW5jbHVkZS9hc20v
ZXBhcHJfaGNhbGxzLmggfCAgIDIyICsrKysrKysrKy0tLS0tLS0tLQ0KPiA+ICBhcmNoL3Bvd2Vy
cGMvaW5jbHVkZS9hc20vZnNsX2hjYWxscy5oICAgfCAgIDM2ICsrKysrKysrKysrKysrKy0tLS0t
LS0tDQo+IC0tLS0tLS0NCj4gPiAgMiBmaWxlcyBjaGFuZ2VkLCAyOSBpbnNlcnRpb25zKCspLCAy
OSBkZWxldGlvbnMoLSkNCj4gDQo+IE1ha2Ugc3VyZSBhbGwgdGhlIFRvcGF6L2VQQVBSIGRyaXZl
cnMgdGhhdCB1c2UgdGhpcyBzZWxlY3QgRVBBUFJfUEFSQVZJUlQuDQo+IA0KPiBIYXZlIHlvdSB0
ZXN0ZWQgd2l0aCBUb3Bhej8NCj4gDQoNCk5vdCB5ZXQgdGVzdC4NCg0KVGhhbmtzLA0KWXUNCg=


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
  2012-02-22  2:29         ` Liu Yu-B13201
  (?)
@ 2012-02-22  2:51           ` tiejun.chen
  -1 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-22  2:51 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, Wood Scott-B07421

Liu Yu-B13201 wrote:
> 
>> -----Original Message-----
>> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
>> Sent: Tuesday, February 21, 2012 6:54 PM
>> To: Liu Yu-B13201
>> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
>> linuxppc-dev@ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for
>> e500 guest
>>
>> Liu Yu wrote:
>>> If the guest hypervisor node contains "has-idle" property.
>>>
>>> Signed-off-by: Liu Yu <yu.liu@freescale.com>
>>> ---
>>> v5: no change
>>>
>>>  arch/powerpc/kernel/epapr_hcalls.S   |   29
>> +++++++++++++++++++++++++++++
>>>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>>>  2 files changed, 39 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/epapr_hcalls.S
>>> b/arch/powerpc/kernel/epapr_hcalls.S
>>> index 697b390..72fa234 100644
>>> --- a/arch/powerpc/kernel/epapr_hcalls.S
>>> +++ b/arch/powerpc/kernel/epapr_hcalls.S
>>> @@ -15,6 +15,35 @@
>>>  #include <asm/ppc_asm.h>
>>>  #include <asm/asm-offsets.h>
>>>
>>> +#define HC_VENDOR_EPAPR		(1 << 16)
>>> +#define HC_EV_IDLE		16
>> Why not use 'EV_IDLE' directly?
>>
>>> +
>>> +_GLOBAL(epapr_ev_idle)
>>> +epapr_ev_idle:
>>> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
>>> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
>>> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
>>> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
>>> +
>>> +	wrteei	1
>>> +
>>> +idle_loop:
>>> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
>> And could this line be simplified as something like this:
>>
>> LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
>>
>> If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.
>>
> 
> Because the epapr_hcalls.h contains C functions,
> so it cannot be included by assembly code.

These common definitions are already covered in epapr_hcalls.h, but looks you
redefine the same items many times, in kvm_para.h/epapr_hcalls.S. And I think
maybe we'll also reuse these generics elsewhere lately.

So can we limit that with __ASSEMBLY__ in epapr_hcalls.h? Or other way. If so it
makes our life easy in the future.

Tiejun

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-22  2:51           ` tiejun.chen
  0 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-22  2:51 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm

Liu Yu-B13201 wrote:
> 
>> -----Original Message-----
>> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
>> Sent: Tuesday, February 21, 2012 6:54 PM
>> To: Liu Yu-B13201
>> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
>> linuxppc-dev@ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for
>> e500 guest
>>
>> Liu Yu wrote:
>>> If the guest hypervisor node contains "has-idle" property.
>>>
>>> Signed-off-by: Liu Yu <yu.liu@freescale.com>
>>> ---
>>> v5: no change
>>>
>>>  arch/powerpc/kernel/epapr_hcalls.S   |   29
>> +++++++++++++++++++++++++++++
>>>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>>>  2 files changed, 39 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/epapr_hcalls.S
>>> b/arch/powerpc/kernel/epapr_hcalls.S
>>> index 697b390..72fa234 100644
>>> --- a/arch/powerpc/kernel/epapr_hcalls.S
>>> +++ b/arch/powerpc/kernel/epapr_hcalls.S
>>> @@ -15,6 +15,35 @@
>>>  #include <asm/ppc_asm.h>
>>>  #include <asm/asm-offsets.h>
>>>
>>> +#define HC_VENDOR_EPAPR		(1 << 16)
>>> +#define HC_EV_IDLE		16
>> Why not use 'EV_IDLE' directly?
>>
>>> +
>>> +_GLOBAL(epapr_ev_idle)
>>> +epapr_ev_idle:
>>> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
>>> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
>>> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
>>> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
>>> +
>>> +	wrteei	1
>>> +
>>> +idle_loop:
>>> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
>> And could this line be simplified as something like this:
>>
>> LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
>>
>> If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.
>>
> 
> Because the epapr_hcalls.h contains C functions,
> so it cannot be included by assembly code.

These common definitions are already covered in epapr_hcalls.h, but looks you
redefine the same items many times, in kvm_para.h/epapr_hcalls.S. And I think
maybe we'll also reuse these generics elsewhere lately.

So can we limit that with __ASSEMBLY__ in epapr_hcalls.h? Or other way. If so it
makes our life easy in the future.

Tiejun

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-22  2:51           ` tiejun.chen
  0 siblings, 0 replies; 37+ messages in thread
From: tiejun.chen @ 2012-02-22  2:51 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: agraf, kvm-ppc, kvm, linuxppc-dev, Wood Scott-B07421

Liu Yu-B13201 wrote:
> 
>> -----Original Message-----
>> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
>> Sent: Tuesday, February 21, 2012 6:54 PM
>> To: Liu Yu-B13201
>> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
>> linuxppc-dev@ozlabs.org; Wood Scott-B07421
>> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for
>> e500 guest
>>
>> Liu Yu wrote:
>>> If the guest hypervisor node contains "has-idle" property.
>>>
>>> Signed-off-by: Liu Yu <yu.liu@freescale.com>
>>> ---
>>> v5: no change
>>>
>>>  arch/powerpc/kernel/epapr_hcalls.S   |   29
>> +++++++++++++++++++++++++++++
>>>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
>>>  2 files changed, 39 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/epapr_hcalls.S
>>> b/arch/powerpc/kernel/epapr_hcalls.S
>>> index 697b390..72fa234 100644
>>> --- a/arch/powerpc/kernel/epapr_hcalls.S
>>> +++ b/arch/powerpc/kernel/epapr_hcalls.S
>>> @@ -15,6 +15,35 @@
>>>  #include <asm/ppc_asm.h>
>>>  #include <asm/asm-offsets.h>
>>>
>>> +#define HC_VENDOR_EPAPR		(1 << 16)
>>> +#define HC_EV_IDLE		16
>> Why not use 'EV_IDLE' directly?
>>
>>> +
>>> +_GLOBAL(epapr_ev_idle)
>>> +epapr_ev_idle:
>>> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
>>> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
>>> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
>>> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
>>> +
>>> +	wrteei	1
>>> +
>>> +idle_loop:
>>> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
>> And could this line be simplified as something like this:
>>
>> LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
>>
>> If so, even we can remove the previous HC_VENDOR_EPAPR definition as well.
>>
> 
> Because the epapr_hcalls.h contains C functions,
> so it cannot be included by assembly code.

These common definitions are already covered in epapr_hcalls.h, but looks you
redefine the same items many times, in kvm_para.h/epapr_hcalls.S. And I think
maybe we'll also reuse these generics elsewhere lately.

So can we limit that with __ASSEMBLY__ in epapr_hcalls.h? Or other way. If so it
makes our life easy in the future.

Tiejun

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
  2012-02-22  2:51           ` tiejun.chen
@ 2012-02-22  2:59             ` Liu Yu-B13201
  -1 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:59 UTC (permalink / raw)
  To: tiejun.chen; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm



> -----Original Message-----
> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
> Sent: Wednesday, February 22, 2012 10:52 AM
> To: Liu Yu-B13201
> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
> linuxppc-dev@ozlabs.org; Wood Scott-B07421
> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for
> e500 guest
> 
> Liu Yu-B13201 wrote:
> >
> >> -----Original Message-----
> >> From: tiejun.chen [mailto:tiejun.chen@windriver.com]
> >> Sent: Tuesday, February 21, 2012 6:54 PM
> >> To: Liu Yu-B13201
> >> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org;
> >> linuxppc-dev@ozlabs.org; Wood Scott-B07421
> >> Subject: Re: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall
> >> for e500 guest
> >>
> >> Liu Yu wrote:
> >>> If the guest hypervisor node contains "has-idle" property.
> >>>
> >>> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> >>> ---
> >>> v5: no change
> >>>
> >>>  arch/powerpc/kernel/epapr_hcalls.S   |   29
> >> +++++++++++++++++++++++++++++
> >>>  arch/powerpc/kernel/epapr_paravirt.c |   11 ++++++++++-
> >>>  2 files changed, 39 insertions(+), 1 deletions(-)
> >>>
> >>> diff --git a/arch/powerpc/kernel/epapr_hcalls.S
> >>> b/arch/powerpc/kernel/epapr_hcalls.S
> >>> index 697b390..72fa234 100644
> >>> --- a/arch/powerpc/kernel/epapr_hcalls.S
> >>> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> >>> @@ -15,6 +15,35 @@
> >>>  #include <asm/ppc_asm.h>
> >>>  #include <asm/asm-offsets.h>
> >>>
> >>> +#define HC_VENDOR_EPAPR		(1 << 16)
> >>> +#define HC_EV_IDLE		16
> >> Why not use 'EV_IDLE' directly?
> >>
> >>> +
> >>> +_GLOBAL(epapr_ev_idle)
> >>> +epapr_ev_idle:
> >>> +	rlwinm	r3,r1,0,0,31-THREAD_SHIFT	/* current thread_info */
> >>> +	lwz	r4,TI_LOCAL_FLAGS(r3)	/* set napping bit */
> >>> +	ori	r4,r4,_TLF_NAPPING	/* so when we take an exception */
> >>> +	stw	r4,TI_LOCAL_FLAGS(r3)	/* it will return to our caller */
> >>> +
> >>> +	wrteei	1
> >>> +
> >>> +idle_loop:
> >>> +	LOAD_REG_IMMEDIATE(r11, HC_VENDOR_EPAPR | HC_EV_IDLE)
> >> And could this line be simplified as something like this:
> >>
> >> LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
> >>
> >> If so, even we can remove the previous HC_VENDOR_EPAPR definition as
> well.
> >>
> >
> > Because the epapr_hcalls.h contains C functions, so it cannot be
> > included by assembly code.
> 
> These common definitions are already covered in epapr_hcalls.h, but looks
> you redefine the same items many times, in kvm_para.h/epapr_hcalls.S. And
> I think maybe we'll also reuse these generics elsewhere lately.\

The ones in kvm_para.h are alias, not redefine.
Because kvm has its own name rule.

> 
> So can we limit that with __ASSEMBLY__ in epapr_hcalls.h? Or other way.
> If so it makes our life easy in the future.
> 

Yes. This would be helpful.

Thanks,
Yu

^ permalink raw reply	[flat|nested] 37+ messages in thread

* RE: [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest
@ 2012-02-22  2:59             ` Liu Yu-B13201
  0 siblings, 0 replies; 37+ messages in thread
From: Liu Yu-B13201 @ 2012-02-22  2:59 UTC (permalink / raw)
  To: tiejun.chen; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm

DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogdGllanVuLmNoZW4gW21h
aWx0bzp0aWVqdW4uY2hlbkB3aW5kcml2ZXIuY29tXQ0KPiBTZW50OiBXZWRuZXNkYXksIEZlYnJ1
YXJ5IDIyL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bG9va3MNCj4geW91IHJlZGVmaW5lIHRoZSBzYW1lIGl0
ZW1zIG1hbnkgdGltZXMsIGluIGt2bV9wYXJhLmgvZXBhcHJfaGNhbGxzLlMuIEFuZA0KPiBJIHRo
aW5rIG1heWJlIHdlJ2xsIGFsc28gcmV1c2UgdGhlc2UgZ2VuZXJpY3MgZWxzZXdoZXJlIGxhdGVs
eS5cDQoNClRoZSBvbmVzIGluIGt2bV9wYXJhLmggYXJlIGFsaWFzLCBub3QgcmVkZWZpbmUuDQpC
ZWNhdXNlIGt2bSBoYXMgaXRzIG93biBuYW1lIHJ1bGUuDQoNCj4gDQo+IFNvIGNhbiB3ZSBsaW1p
dCB0aGF0IHdpdGggX19BU1NFTUJMWV9fIGluIGVwYXByX2hjYWxscy5oPyBPciBvdGhlciB3YXku
DQo+IElmIHNvIGl0IG1ha2VzIG91ciBsaWZlIGVhc3kgaW4gdGhlIGZ1dHVyZS4NCj4gDQoNClll
cy4gVGhpcyB3b3VsZCBiZSBoZWxwZnVsLg0KDQpUaGFua3MsDQpZdQ0K

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
  2012-02-22  2:33     ` Liu Yu-B13201
  (?)
@ 2012-02-22 18:28       ` Scott Wood
  -1 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-22 18:28 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: Wood Scott-B07421, agraf, kvm-ppc, kvm, linuxppc-dev

On 02/21/2012 08:33 PM, Liu Yu-B13201 wrote:
>>> +bool epapr_para_enabled = false;
>>
>> No need to explicitly initialize to false.
> 
> Why not make code more readable?

It's common kernel style to not explicitly initialize global data to
zero or equivalent.  Historically this was due to toolchain issues that
are no longer relevant, but people still seem to prefer it that way.
It's subjective whether readability is enhanced by being explicit or by
being concise.

>> Do not warn just because there's no hypervisor or hcall-instructions.
>> There's nothing wrong with that.  Only warn if they are present but wrong.
>>
> 
> I see that it's not proper to warn in host.
> But if user forget to add hypervisor node or inst, how can he know something is wrong?

Print a message when paravirt is enabled (I think KVM already does
this).  This is no different than a user forgetting to add a certain
device to the device tree -- you'll silently just not get that device.

Ideally the hypervisor would take care of adding this stuff to the
device tree anyway, no user action required.

-Scott


^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-22 18:28       ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-22 18:28 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: linuxppc-dev, Wood Scott-B07421, agraf, kvm-ppc, kvm

On 02/21/2012 08:33 PM, Liu Yu-B13201 wrote:
>>> +bool epapr_para_enabled = false;
>>
>> No need to explicitly initialize to false.
> 
> Why not make code more readable?

It's common kernel style to not explicitly initialize global data to
zero or equivalent.  Historically this was due to toolchain issues that
are no longer relevant, but people still seem to prefer it that way.
It's subjective whether readability is enhanced by being explicit or by
being concise.

>> Do not warn just because there's no hypervisor or hcall-instructions.
>> There's nothing wrong with that.  Only warn if they are present but wrong.
>>
> 
> I see that it's not proper to warn in host.
> But if user forget to add hypervisor node or inst, how can he know something is wrong?

Print a message when paravirt is enabled (I think KVM already does
this).  This is no different than a user forgetting to add a certain
device to the device tree -- you'll silently just not get that device.

Ideally the hypervisor would take care of adding this stuff to the
device tree anyway, no user action required.

-Scott

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init
@ 2012-02-22 18:28       ` Scott Wood
  0 siblings, 0 replies; 37+ messages in thread
From: Scott Wood @ 2012-02-22 18:28 UTC (permalink / raw)
  To: Liu Yu-B13201; +Cc: Wood Scott-B07421, agraf, kvm-ppc, kvm, linuxppc-dev

On 02/21/2012 08:33 PM, Liu Yu-B13201 wrote:
>>> +bool epapr_para_enabled = false;
>>
>> No need to explicitly initialize to false.
> 
> Why not make code more readable?

It's common kernel style to not explicitly initialize global data to
zero or equivalent.  Historically this was due to toolchain issues that
are no longer relevant, but people still seem to prefer it that way.
It's subjective whether readability is enhanced by being explicit or by
being concise.

>> Do not warn just because there's no hypervisor or hcall-instructions.
>> There's nothing wrong with that.  Only warn if they are present but wrong.
>>
> 
> I see that it's not proper to warn in host.
> But if user forget to add hypervisor node or inst, how can he know something is wrong?

Print a message when paravirt is enabled (I think KVM already does
this).  This is no different than a user forgetting to add a certain
device to the device tree -- you'll silently just not get that device.

Ideally the hypervisor would take care of adding this stuff to the
device tree anyway, no user action required.

-Scott


^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2012-02-22 18:28 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-21  4:46 [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init Liu Yu
2012-02-21  4:46 ` Liu Yu
2012-02-21  4:46 ` Liu Yu
2012-02-21  4:46 ` [PATCH v5 2/4] KVM: PPC: epapr: Add idle hcall support for host Liu Yu
2012-02-21  4:46   ` Liu Yu
2012-02-21  4:46   ` Liu Yu
2012-02-21  4:46   ` [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest Liu Yu
2012-02-21  4:46     ` Liu Yu
2012-02-21  4:46     ` Liu Yu
2012-02-21  4:46     ` [PATCH v5 4/4] KVM: PPC: epapr: Update other hypercall invoking Liu Yu
2012-02-21  4:46       ` Liu Yu
2012-02-21  4:46       ` Liu Yu
2012-02-21 21:57       ` Scott Wood
2012-02-21 21:57         ` Scott Wood
2012-02-21 21:57         ` Scott Wood
2012-02-22  2:34         ` Liu Yu-B13201
2012-02-22  2:34           ` Liu Yu-B13201
2012-02-22  2:34           ` Liu Yu-B13201
2012-02-21 10:53     ` [PATCH v5 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest tiejun.chen
2012-02-21 10:53       ` tiejun.chen
2012-02-21 10:53       ` tiejun.chen
2012-02-22  2:29       ` Liu Yu-B13201
2012-02-22  2:29         ` Liu Yu-B13201
2012-02-22  2:51         ` tiejun.chen
2012-02-22  2:51           ` tiejun.chen
2012-02-22  2:51           ` tiejun.chen
2012-02-22  2:59           ` Liu Yu-B13201
2012-02-22  2:59             ` Liu Yu-B13201
2012-02-21 21:56 ` [PATCH v5 1/4] KVM: PPC: epapr: Factor out the epapr init Scott Wood
2012-02-21 21:56   ` Scott Wood
2012-02-21 21:56   ` Scott Wood
2012-02-22  2:33   ` Liu Yu-B13201
2012-02-22  2:33     ` Liu Yu-B13201
2012-02-22  2:33     ` Liu Yu-B13201
2012-02-22 18:28     ` Scott Wood
2012-02-22 18:28       ` Scott Wood
2012-02-22 18:28       ` Scott Wood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.