Skip to contentSkip to conversation

KVM: PPC: Add ePAPR idle hcall support

PATCH Superseded Stuart Yoder 5 participants 16 messages Mar 7, 2012 – Mar 15, 2012

Subsystems (4)

v9 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v9 cover KVM: PPC: Add ePAPR idle hcall support

From: Stuart Yoder <[email protected]>

-v9
-pad hcall instruction array with nops

Liu Yu-B13201 (4):
KVM: PPC: epapr: Factor out the epapr init
KVM: PPC: epapr: Add idle hcall support for host
KVM: PPC: epapr: install ev_idle hcall for e500 guest
KVM: PPC: epapr: Update other hypercall invoking

 arch/powerpc/include/asm/Kbuild         |    1 +
 arch/powerpc/include/asm/epapr_hcalls.h |   35 ++++++++++--------
 arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++---------
 arch/powerpc/include/asm/kvm_para.h     |   14 ++++++-
 arch/powerpc/kernel/Makefile            |    1 +
 arch/powerpc/kernel/epapr_hcalls.S      |   52 ++++++++++++++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c    |   61 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm.c               |   28 ++-------------
 arch/powerpc/kernel/kvm_emul.S          |   10 -----
 arch/powerpc/kvm/booke.c                |    6 +++
 arch/powerpc/kvm/powerpc.c              |   19 ++++++++--
 arch/powerpc/platforms/Kconfig          |   10 +++++
 drivers/tty/Kconfig                     |    1 +
 drivers/virt/Kconfig                    |    1 +
 include/linux/kvm.h                     |    2 +
 15 files changed, 203 insertions(+), 74 deletions(-)
 create mode 100644 arch/powerpc/kernel/epapr_hcalls.S
 create mode 100644 arch/powerpc/kernel/epapr_paravirt.c
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH v9 1/4 KVM: PPC: epapr: Factor out the epapr init

From: Liu Yu-B13201 <[email protected]>

from the kvm guest paravirt init code.

---
-v9: no changes

 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    |   52 +++++++++++++++++++++++++++++++
 arch/powerpc/kernel/kvm.c               |   28 ++---------------
 arch/powerpc/kernel/kvm_emul.S          |   10 ------
 arch/powerpc/platforms/Kconfig          |    9 +++++
 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
arch/powerpc/include/asm/epapr_hcalls.h +2 -0
index f3b0c2c..2173d4c 100644
@@ -148,6 +148,8 @@
 #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
 #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
 
+extern bool epapr_paravirt_enabled;
+extern u32 epapr_hypercall_start[];
 
 /*
  * We use "uintptr_t" to define a register because it's guaranteed to be a
arch/powerpc/kernel/Makefile +1 -0
index ce4f7f1..09011d6 100644
@@ -134,6 +134,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
arch/powerpc/kernel/epapr_hcalls.S new file +25 -0
new file mode 100644
index 0000000..697b390
@@ -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
arch/powerpc/kernel/epapr_paravirt.c new file +52 -0

52 lines not on this page · raw message

arch/powerpc/kernel/kvm.c +3 -25
index 9b6682e..b8a77a1 100644
@@ -30,6 +30,7 @@
 #include <asm/cacheflush.h>
 #include <asm/disassemble.h>
 #include <asm/ppc-opcode.h>
+#include <asm/epapr_hcalls.h>
 #include <asm/machdep.h>
 #include <asm/mpic.h>
 
@@ -739,7 +740,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)
@@ -760,29 +761,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;
@@ -811,7 +789,7 @@ static int __init kvm_guest_init(void)
 	if (!kvm_para_available())
 		goto free_tmp;
 
-	if (kvm_para_setup())
+	if (!epapr_paravirt_enabled)
 		goto free_tmp;
 
 	if (kvm_para_has_feature(KVM_FEATURE_MAGIC_PAGE))
arch/powerpc/kernel/kvm_emul.S +0 -10
index 3dfa890..e100ff3 100644
@@ -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
arch/powerpc/platforms/Kconfig +9 -0
index b9ba861..e0c0834 100644
@@ -25,6 +25,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
@@ -32,6 +33,14 @@ config KVM_GUEST
 
 	  In case of doubt, say Y
 
+config EPAPR_PARAVIRT
+	bool "ePAPR para-virtualization support"
+	default n
+	help
+	  Enables ePAPR para-virtualization support for guests.
+
+	  In case of doubt, say Y
+
 config PPC_NATIVE
 	bool
 	depends on 6xx || PPC64
Signature · 1 line
1.7.3.4
#2 lore raw

Re: [PATCH v9 1/4] KVM: PPC: epapr: Factor out the epapr init

Quoted 125 lines · Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

from the kvm guest paravirt init code.

---
-v9: no changes

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    |   52 +++++++++++++++++++++++++++++++
arch/powerpc/kernel/kvm.c               |   28 ++---------------
arch/powerpc/kernel/kvm_emul.S          |   10 ------
arch/powerpc/platforms/Kconfig          |    9 +++++
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

arch/powerpc/include/asm/epapr_hcalls.h +2 -0
index f3b0c2c..2173d4c 100644
@@ -148,6 +148,8 @@
 #define EV_HCALL_CLOBBERS2 EV_HCALL_CLOBBERS3, "r5"
 #define EV_HCALL_CLOBBERS1 EV_HCALL_CLOBBERS2, "r4"
 
+extern bool epapr_paravirt_enabled;
+extern u32 epapr_hypercall_start[];
 
 /*
 * We use "uintptr_t" to define a register because it's guaranteed to be a
arch/powerpc/kernel/Makefile +0 -0
index ce4f7f1..09011d6 100644
@@ -134,6 +134,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

arch/powerpc/kernel/epapr_hcalls.S new file +25 -0
new file mode 100644
index 0000000..697b390
@@ -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
arch/powerpc/kernel/epapr_paravirt.c new file +42 -0
new file mode 100644
index 0000000..028aeae
@@ -0,0 +1,52 @@
+/*
+ * 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_paravirt_enabled;
+
+static int __init epapr_paravirt_init(void)
+{
+	struct device_node *hyper_node;
+	const u32 *insts;
+	int len, i;
+
+	hyper_node = of_find_node_by_path("/hypervisor");
+	if (!hyper_node)
+		return -ENODEV;
+
+	insts = of_get_property(hyper_node, "hcall-instructions", &len);
+	if (!insts)
+		return -ENODEV;
+
+	if (len % 4 || len > (4 * 4))
+		return -ENODEV;

arch/powerpc/kernel/epapr_paravirt.c line 52

Quoted 10 lines
arch/powerpc/kernel/epapr_paravirt.c new file +10 -0
+
+	for (i = 0; i < (len / 4); i++)
+		patch_instruction(epapr_hypercall_start + i, insts[i]);
+
+	epapr_paravirt_enabled = true;
+
+	return 0;
+}
+
+early_initcall(epapr_paravirt_init);

Just want to double-check. Are you 100% sure that this gets called before kvm_guest_init()?

Alex

#3 lore raw

Re: [PATCH v9 1/4] KVM: PPC: epapr: Factor out the epapr init

Quoted 3 lines
Quoted 1 line

+early_initcall(epapr_paravirt_init);

Just want to double-check. Are you 100% sure that this gets called before kvm_guest_init()?

Yes, kvm_guest_init is a postcore_initcall, which comes after "early".
Some printks confirmed this.

Stuart

#4 lore raw

PATCH v9 2/4 KVM: PPC: epapr: Add idle hcall support for host

In reply to Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

[[email protected]: fixes for conditions allowing idle]

---
-v9: pad hcall instruction array with nops

 arch/powerpc/include/asm/Kbuild     |    1 +
 arch/powerpc/include/asm/kvm_para.h |   14 ++++++++++++--
 arch/powerpc/kvm/booke.c            |    6 ++++++
 arch/powerpc/kvm/powerpc.c          |   19 ++++++++++++++++---
 include/linux/kvm.h                 |    2 ++
 5 files changed, 37 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/Kbuild +1 -0
index d51df17..b68cb1c 100644
@@ -34,3 +34,4 @@ header-y += termios.h
 header-y += types.h
 header-y += ucontext.h
 header-y += unistd.h
+header-y += epapr_hcalls.h
arch/powerpc/include/asm/kvm_para.h +12 -2
index b3b4667..5617c8c 100644
@@ -90,9 +90,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
 
arch/powerpc/kvm/booke.c +6 -0
index f0ef0be..9fde645 100644
@@ -593,6 +593,12 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
 	unsigned int priority;
 
 	if (vcpu->requests) {
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
+
 		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
 			smp_mb();
 			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +16 -3
index ee489f4..2595916 100644
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
 {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;
 
 #ifdef CONFIG_BOOKE
@@ -100,6 +99,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;
@@ -888,9 +891,16 @@ out:
 
 static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 {
+	u32 inst_nop = 0x60000000;
+#ifdef CONFIG_KVM_BOOKE_HV
+	u32 inst_sc1 = 0x44000022;
+	pvinfo->hcall[0] = inst_sc1;
+	pvinfo->hcall[1] = inst_nop;
+	pvinfo->hcall[2] = inst_nop;
+	pvinfo->hcall[3] = inst_nop;
+#else
 	u32 inst_lis = 0x3c000000;
 	u32 inst_ori = 0x60000000;
-	u32 inst_nop = 0x60000000;
 	u32 inst_sc = 0x44000002;
 	u32 inst_imm_mask = 0xffff;
 
@@ -907,6 +917,9 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
 	pvinfo->hcall[1] = inst_ori | (KVM_SC_MAGIC_R0 & inst_imm_mask);
 	pvinfo->hcall[2] = inst_sc;
 	pvinfo->hcall[3] = inst_nop;
+#endif
+
+	pvinfo->flags = KVM_PPC_PVINFO_FLAGS_EV_IDLE;
 
 	return 0;
 }
include/linux/kvm.h +2 -0
index 28ced78..32b8f54 100644
@@ -438,6 +438,8 @@ struct kvm_ppc_pvinfo {
 	__u8  pad[108];
 };
 
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE   (1<<0)
+
 #define KVMIO 0xAE
 
 /*
Signature · 1 line
1.7.3.4
#5 lore raw

Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 40 lines · Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

[[email protected]: fixes for conditions allowing idle]

---
-v9: pad hcall instruction array with nops

arch/powerpc/include/asm/Kbuild     |    1 +
arch/powerpc/include/asm/kvm_para.h |   14 ++++++++++++--
arch/powerpc/kvm/booke.c            |    6 ++++++
arch/powerpc/kvm/powerpc.c          |   19 ++++++++++++++++---
include/linux/kvm.h                 |    2 ++
5 files changed, 37 insertions(+), 5 deletions(-)
arch/powerpc/include/asm/Kbuild +0 -0
index d51df17..b68cb1c 100644
@@ -34,3 +34,4 @@ header-y += termios.h

header-y += types.h
header-y += ucontext.h
header-y += unistd.h

arch/powerpc/include/asm/Kbuild +1 -0
+header-y += epapr_hcalls.h
arch/powerpc/include/asm/kvm_para.h +4 -1
index b3b4667..5617c8c 100644
@@ -90,9 +90,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 */

arch/powerpc/include/asm/kvm_para.h struct kvm_vcpu_arch_shared { · line 105

Quoted 10 lines
arch/powerpc/include/asm/kvm_para.h +8 -1
+#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

Shouldn't all this rather be in an epapr header file?

Quoted 8 lines
arch/powerpc/include/asm/kvm_para.h +0 -0
 #define KVM_FEATURE_MAGIC_PAGE	1
 
arch/powerpc/kvm/booke.c +0 -0
index f0ef0be..9fde645 100644

arch/powerpc/kvm/booke.c static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) · line 600

Quoted 8 lines
arch/powerpc/kvm/booke.c +5 -0
@@ -593,6 +593,12 @@ static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu)
 	unsigned int priority;
 
 	if (vcpu->requests) {
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);

Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably shouldn't be in this patch.

Quoted 9 lines
arch/powerpc/kvm/booke.c +1 -0
+
 		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
 			smp_mb();
 			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +0 -0
index ee489f4..2595916 100644

arch/powerpc/kvm/powerpc.c static unsigned int perfmon_refcount; · line 52

Quoted 7 lines
arch/powerpc/kvm/powerpc.c +1 -2
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
 {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;

Huh?

Alex

#6 lore raw

Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 10 lines · Alexander Graf

arch/powerpc/kvm/booke.c static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) · line 600

Quoted 7 lines · Stuart Yoder
	if (vcpu->requests) {
arch/powerpc/kvm/booke.c +5 -0
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);

Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably shouldn't be in this patch.

Until recently we didn't check for requests in kvm_arch_vcpu_runnable().

And yes, book3s will need this too.

Quoted 9 lines
Quoted 9 lines
		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
			smp_mb();
			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +0 -0
index ee489f4..2595916 100644
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
Quoted 8 lines

arch/powerpc/kvm/powerpc.c static unsigned int perfmon_refcount; · line 52

Quoted 6 lines
arch/powerpc/kvm/powerpc.c +1 -2
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
 {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;

Huh?

MSR_WE is not going to get set if the idle hcall is used, so this check was preventing us from blocking.

The check isn't needed anyway, as nothing can actually change MSR_WE while we're in kvm_vcpu_block(), which is the only user of kvm_arch_vcpu_runnable(), and the MSR_WE path won't call kvm_vcpu_block() if MSR_WE isn't set.

-Scott

#7 lore raw

Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 34 lines · Scott Wood
Quoted 10 lines · Alexander Graf

arch/powerpc/kvm/booke.c static void kvmppc_core_check_exceptions(struct kvm_vcpu *vcpu) · line 600

Quoted 7 lines · Stuart Yoder
	if (vcpu->requests) {
arch/powerpc/kvm/booke.c +5 -0
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);

Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably shouldn't be in this patch.

Until recently we didn't check for requests in kvm_arch_vcpu_runnable().

And yes, book3s will need this too.

Quoted 9 lines
Quoted 9 lines
		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
			smp_mb();
			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +0 -0
index ee489f4..2595916 100644
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
Quoted 8 lines

arch/powerpc/kvm/powerpc.c static unsigned int perfmon_refcount; · line 52

Quoted 6 lines
arch/powerpc/kvm/powerpc.c +1 -2
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
 {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;

Huh?

Quoted 7 lines

MSR_WE is not going to get set if the idle hcall is used, so this check was preventing us from blocking.

The check isn't needed anyway, as nothing can actually change MSR_WE while we're in kvm_vcpu_block(), which is the only user of kvm_arch_vcpu_runnable(), and the MSR_WE path won't call kvm_vcpu_block() if MSR_WE isn't set.

Ah, this is only removing the MSR_WE check. Ok.

Alex

#8 lore raw

RE: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 23 lines

-----Original Message-----
From: Alexander Graf [mailto:[email protected]]
Sent: Wednesday, March 07, 2012 5:39 PM
To: Wood Scott-B07421
Cc: Yoder Stuart-B08248; [email protected]; [email protected]
Subject: Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 11 lines · Scott Wood
Quoted 10 lines · Alexander Graf

Review

Quoted 7 lines · Stuart Yoder
	if (vcpu->requests) {
(quoted diff) +5 -0
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);

Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably

Quoted 5 lines

shouldn't be in this patch.

Quoted 4 lines

Until recently we didn't check for requests in kvm_arch_vcpu_runnable().

And yes, book3s will need this too.

Where should this go? Something like this?

arch/powerpc/kvm/book3s.c +2 -0
@@ -283,6 +283,8 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
        /* Tell the guest about our interrupt status */
        kvmppc_update_int_pending(vcpu, *pending, old_pending);
 
+       clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
+
        return 0;
 }
 
Quoted 20 lines
Quoted 20 lines
Quoted 9 lines
Quoted 9 lines
		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
			smp_mb();
			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +0 -0
index ee489f4..2595916 100644
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
Quoted 7 lines

arch/powerpc/kvm/powerpc.c static unsigned int perfmon_refcount; · line 51

Quoted 5 lines
arch/powerpc/kvm/powerpc.c +1 -2
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;

Huh?

MSR_WE is not going to get set if the idle hcall is used, so this check was preventing us from blocking.

Quoted 6 lines
Quoted 4 lines

The check isn't needed anyway, as nothing can actually change MSR_WE while we're in kvm_vcpu_block(), which is the only user of kvm_arch_vcpu_runnable(), and the MSR_WE path won't call kvm_vcpu_block() if MSR_WE isn't set.

Ah, this is only removing the MSR_WE check. Ok.

I'll add an additional comment to the patch description.

Stuart

#9 lore raw

Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 34 lines · On 08.03.2012, at 05:18, Yoder Stuart-B08248 wrote:
Quoted 23 lines

-----Original Message-----
From: Alexander Graf [mailto:[email protected]]
Sent: Wednesday, March 07, 2012 5:39 PM
To: Wood Scott-B07421
Cc: Yoder Stuart-B08248; [email protected]; [email protected]
Subject: Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

Quoted 11 lines · Scott Wood
Quoted 10 lines · Alexander Graf

Review

Quoted 7 lines · Stuart Yoder
	if (vcpu->requests) {
(quoted diff) +5 -0
+		/* kvm_vcpu_block() sets KVM_REQ_UNHALT, but it is
+ 		 * not cleared elsewhere as on x86.  Clear it here
+ 		 * for now, otherwise we never go idle.
+ 		 */
+		clear_bit(KVM_REQ_UNHALT, &vcpu->requests);

Shouldn't the same thing hit us on non-booke as well? Also, it sounds unrelated to me and probably

Quoted 5 lines

shouldn't be in this patch.

Quoted 4 lines

Until recently we didn't check for requests in kvm_arch_vcpu_runnable().

And yes, book3s will need this too.

Where should this go? Something like this?

arch/powerpc/kvm/book3s.c int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu) · line 287

Quoted 5 lines
arch/powerpc/kvm/book3s.c +2 -0
@@ -283,6 +283,8 @@ int kvmppc_core_prepare_to_enter(struct kvm_vcpu *vcpu)
       /* Tell the guest about our interrupt status */
       kvmppc_update_int_pending(vcpu, *pending, old_pending);
 
+       clear_bit(KVM_REQ_UNHALT, &vcpu->requests);
+

That should work, yes. Eventually we want to have in-kernel MPIC emulation and handle this properly, but for now that's probably the right approach :).

Quoted 24 lines
arch/powerpc/kvm/book3s.c +0 -0
       return 0;
 }
 
Quoted 21 lines
Quoted 21 lines
Quoted 10 lines
Quoted 10 lines
		if (kvm_check_request(KVM_REQ_PENDING_TIMER, vcpu)) {
			smp_mb();
			update_timer_ints(vcpu);
arch/powerpc/kvm/powerpc.c +0 -0
index ee489f4..2595916 100644
@@ -48,8 +48,7 @@ static unsigned int perfmon_refcount;
 
Quoted 7 lines

arch/powerpc/kvm/powerpc.c static unsigned int perfmon_refcount; · line 51

Quoted 5 lines
arch/powerpc/kvm/powerpc.c +1 -2
 int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) {
-	bool ret = !(v->arch.shared->msr & MSR_WE) ||
-		   !!(v->arch.pending_exceptions) ||
+	bool ret = !!(v->arch.pending_exceptions) ||
 		   v->requests;

Huh?

MSR_WE is not going to get set if the idle hcall is used, so this check was preventing us from blocking.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

The check isn't needed anyway, as nothing can actually change MSR_WE while we're in kvm_vcpu_block(), which is the only user of kvm_arch_vcpu_runnable(), and the MSR_WE path won't call kvm_vcpu_block() if MSR_WE isn't set.

Ah, this is only removing the MSR_WE check. Ok.

I'll add an additional comment to the patch description.

I was merely misreading the patch, no worries.

Alex

#10 lore raw

Re: [PATCH v9 2/4] KVM: PPC: epapr: Add idle hcall support for host

In reply to Alexander Graf
Quoted 10 lines · Alexander Graf
Quoted 10 lines

#define KVM_SC_MAGIC_R0               0x4b564d21 /* "KVM!" */

arch/powerpc/include/asm/kvm_para.h +8 -1
-#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 */
Quoted 8 lines

arch/powerpc/include/asm/kvm_para.h struct kvm_vcpu_arch_shared { · line 105

Quoted 6 lines
arch/powerpc/include/asm/kvm_para.h +3 -0
+#define HC_EV_IDLE           EV_IDLE
+
+/* ePAPR Hypercall Return Codes */

#define HC_EV_SUCCESS         0

arch/powerpc/include/asm/kvm_para.h +1 -1
-#define HC_EV_UNIMPLEMENTED  12
+#define HC_EV_UNIMPLEMENTED  EV_UNIMPLEMENTED

Shouldn't all this rather be in an epapr header file?

Think I see a cleaner way of handling this, will address in next respin.

Stuart

#11 lore raw

PATCH v9 3/4 KVM: PPC: epapr: install ev_idle hcall for e500 guest

In reply to Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

---
v9: no changes

 arch/powerpc/include/asm/epapr_hcalls.h |   11 ++++++-----
 arch/powerpc/kernel/epapr_hcalls.S      |   27 +++++++++++++++++++++++++++
 arch/powerpc/kernel/epapr_paravirt.c    |   11 ++++++++++-
 3 files changed, 43 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/epapr_hcalls.h +6 -5
index 2173d4c..78460ac 100644
@@ -50,10 +50,6 @@
 #ifndef _EPAPR_HCALLS_H
 #define _EPAPR_HCALLS_H
 
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <asm/byteorder.h>
-
 #define EV_BYTE_CHANNEL_SEND		1
 #define EV_BYTE_CHANNEL_RECEIVE		2
 #define EV_BYTE_CHANNEL_POLL		3
@@ -108,6 +104,11 @@
 #define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
 #define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
 
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <asm/byteorder.h>
+
 /*
  * Hypercall register clobber list
  *
@@ -500,5 +501,5 @@ static inline unsigned int ev_idle(void)
 
 	return r3;
 }
-
+#endif /* !__ASSEMBLY__ */
 #endif
arch/powerpc/kernel/epapr_hcalls.S +27 -0
index 697b390..bf643ed 100644
@@ -8,6 +8,7 @@
  */
 
 #include <linux/threads.h>
+#include <asm/epapr_hcalls.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/cputable.h>
@@ -15,6 +16,32 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
+_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, EV_HCALL_TOKEN(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:
arch/powerpc/kernel/epapr_paravirt.c +10 -1
index 028aeae..f3eab85 100644
@@ -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_paravirt_enabled;
 
@@ -41,8 +45,13 @@ static int __init epapr_paravirt_init(void)
 	if (len % 4 || len > (4 * 4))
 		return -ENODEV;
 
-	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_paravirt_enabled = true;
 
Signature · 1 line
1.7.3.4
#12 lore raw

Re: [PATCH v9 3/4] KVM: PPC: epapr: install ev_idle hcall for e500 guest

Quoted 3 lines · Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

Jeez those patch descriptions drive me insane. Could you please rewrite them to actually describe what the patches are about?

Quoted 57 lines

---
v9: no changes

arch/powerpc/include/asm/epapr_hcalls.h |   11 ++++++-----
arch/powerpc/kernel/epapr_hcalls.S      |   27 +++++++++++++++++++++++++++
arch/powerpc/kernel/epapr_paravirt.c    |   11 ++++++++++-
3 files changed, 43 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/epapr_hcalls.h +6 -5
index 2173d4c..78460ac 100644
@@ -50,10 +50,6 @@
 #ifndef _EPAPR_HCALLS_H
 #define _EPAPR_HCALLS_H
 
-#include <linux/types.h>
-#include <linux/errno.h>
-#include <asm/byteorder.h>
-
 #define EV_BYTE_CHANNEL_SEND		1
 #define EV_BYTE_CHANNEL_RECEIVE		2
 #define EV_BYTE_CHANNEL_POLL		3
@@ -108,6 +104,11 @@
 #define EV_UNIMPLEMENTED	12	/* Unimplemented hypercall */
 #define EV_BUFFER_OVERFLOW	13	/* Caller-supplied buffer too small */
 
+#ifndef __ASSEMBLY__
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <asm/byteorder.h>
+
 /*
 * Hypercall register clobber list
 *
@@ -500,5 +501,5 @@ static inline unsigned int ev_idle(void)
 
 	return r3;
 }
-
+#endif /* !__ASSEMBLY__ */
 #endif
arch/powerpc/kernel/epapr_hcalls.S +1 -0
index 697b390..bf643ed 100644
@@ -8,6 +8,7 @@
 */
 
 #include <linux/threads.h>
+#include <asm/epapr_hcalls.h>
 #include <asm/reg.h>
 #include <asm/page.h>
 #include <asm/cputable.h>

arch/powerpc/kernel/epapr_hcalls.S line 24

Quoted 9 lines
arch/powerpc/kernel/epapr_hcalls.S +6 -0
@@ -15,6 +16,32 @@
 #include <asm/ppc_asm.h>
 #include <asm/asm-offsets.h>
 
+_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 */

The whole block is missing spaces ;).

Also, TI_LOCAL_FLAGS is a long, so it should be treated as such. Otherwise this blows up for 64bit.

Alex

#13 lore raw

PATCH v9 4/4 KVM: PPC: epapr: Update other hypercall invoking

In reply to Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

---
v9: no changes

 arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
 arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
 arch/powerpc/platforms/Kconfig          |    1 +
 drivers/tty/Kconfig                     |    1 +
 drivers/virt/Kconfig                    |    1 +
 5 files changed, 32 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/epapr_hcalls.h +11 -11
index 78460ac..b95758d 100644
@@ -189,7 +189,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
 	);
@@ -218,7 +218,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
 	);
@@ -248,7 +248,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
 	);
@@ -273,7 +273,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
 	);
@@ -301,7 +301,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
 	);
@@ -340,7 +340,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
@@ -379,7 +379,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
@@ -417,7 +417,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
 	);
@@ -450,7 +450,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
 	);
@@ -474,7 +474,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
 	);
@@ -494,7 +494,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
 	);
arch/powerpc/include/asm/fsl_hcalls.h +18 -18
index 922d9b5..3abb583 100644
@@ -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
 	);
arch/powerpc/platforms/Kconfig +1 -0
index e0c0834..81e60e0 100644
@@ -90,6 +90,7 @@ config MPIC
 config PPC_EPAPR_HV_PIC
 	bool
 	default n
+	select EPAPR_PARAVIRT
 
 config MPIC_WEIRD
 	bool
drivers/tty/Kconfig +1 -0
index f1ea59b..9ac4bc6 100644
@@ -354,6 +354,7 @@ config TRACE_SINK
 config PPC_EPAPR_HV_BYTECHAN
 	tristate "ePAPR hypervisor byte channel driver"
 	depends on PPC
+	select EPAPR_PARAVIRT
 	help
 	  This driver creates /dev entries for each ePAPR hypervisor byte
 	  channel, thereby allowing applications to communicate with byte
drivers/virt/Kconfig +1 -0
index 2dcdbc9..99ebdde 100644
@@ -15,6 +15,7 @@ if VIRT_DRIVERS
 config FSL_HV_MANAGER
 	tristate "Freescale hypervisor management driver"
 	depends on FSL_SOC
+	select EPAPR_PARAVIRT
 	help
           The Freescale hypervisor management driver provides several services
 	  to drivers and applications related to the Freescale hypervisor:
Signature · 1 line
1.7.3.4
#14 lore raw

Re: [PATCH v9 4/4] KVM: PPC: epapr: Update other hypercall invoking

Quoted 319 lines · Stuart Yoder

From: Liu Yu-B13201 <[email protected]>

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

---
v9: no changes

arch/powerpc/include/asm/epapr_hcalls.h |   22 +++++++++---------
arch/powerpc/include/asm/fsl_hcalls.h   |   36 +++++++++++++++---------------
arch/powerpc/platforms/Kconfig          |    1 +
drivers/tty/Kconfig                     |    1 +
drivers/virt/Kconfig                    |    1 +
5 files changed, 32 insertions(+), 29 deletions(-)
arch/powerpc/include/asm/epapr_hcalls.h +11 -11
index 78460ac..b95758d 100644
@@ -189,7 +189,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
 	);
@@ -218,7 +218,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
 	);
@@ -248,7 +248,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
 	);
@@ -273,7 +273,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
 	);
@@ -301,7 +301,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
 	);
@@ -340,7 +340,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
@@ -379,7 +379,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
@@ -417,7 +417,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
 	);
@@ -450,7 +450,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
 	);
@@ -474,7 +474,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
 	);
@@ -494,7 +494,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
 	);
arch/powerpc/include/asm/fsl_hcalls.h +18 -18
index 922d9b5..3abb583 100644
@@ -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
 	);
arch/powerpc/platforms/Kconfig +0 -0
index e0c0834..81e60e0 100644
@@ -90,6 +90,7 @@ config MPIC

config PPC_EPAPR_HV_PIC
bool
default n

arch/powerpc/platforms/Kconfig +1 -0
+	select EPAPR_PARAVIRT

config MPIC_WEIRD
bool

drivers/tty/Kconfig +0 -0
index f1ea59b..9ac4bc6 100644
@@ -354,6 +354,7 @@ config TRACE_SINK

config PPC_EPAPR_HV_BYTECHAN
tristate "ePAPR hypervisor byte channel driver" depends on PPC

drivers/tty/Kconfig +1 -0
+	select EPAPR_PARAVIRT

help
This driver creates /dev entries for each ePAPR hypervisor byte channel, thereby allowing applications to communicate with byte

drivers/virt/Kconfig +0 -0
index 2dcdbc9..99ebdde 100644
@@ -15,6 +15,7 @@ if VIRT_DRIVERS

config FSL_HV_MANAGER
tristate "Freescale hypervisor management driver" depends on FSL_SOC

drivers/virt/Kconfig

Quoted 1 line
drivers/virt/Kconfig +1 -0
+	select EPAPR_PARAVIRT

Do you maybe have older versions of topaz that don't expose a /hypervisor node for which you want to have fallback code in?

Alex

#15 lore raw

Re: [PATCH v9 4/4] KVM: PPC: epapr: Update other hypercall invoking

Quoted 18 lines · Alexander Graf
Quoted 15 lines · Stuart Yoder
drivers/tty/Kconfig +0 -0
index f1ea59b..9ac4bc6 100644
@@ -354,6 +354,7 @@ config TRACE_SINK

config PPC_EPAPR_HV_BYTECHAN
tristate "ePAPR hypervisor byte channel driver" depends on PPC

drivers/tty/Kconfig +1 -0
+	select EPAPR_PARAVIRT

help
This driver creates /dev entries for each ePAPR hypervisor byte channel, thereby allowing applications to communicate with byte

drivers/virt/Kconfig +0 -1
index 2dcdbc9..99ebdde 100644
--- a/drivers/virt/Kconfig
Quoted 8 lines

drivers/virt/Kconfig

Quoted 6 lines

+++ b/drivers/virt/Kconfig

drivers/virt/Kconfig +0 -0
@@ -15,6 +15,7 @@ if VIRT_DRIVERS

config FSL_HV_MANAGER
tristate "Freescale hypervisor management driver" depends on FSL_SOC

drivers/virt/Kconfig +1 -0
+	select EPAPR_PARAVIRT

Do you maybe have older versions of topaz that don't expose a /hypervisor node for which you want to have fallback code in?

Probably not that lack a /hypervisor altogether, but it's possible someone's using a Topaz that's too old to have hcall-instructions, which was added about a year and a half ago.

-Scott