[PATCH 1/3] kvm tools: Fix powerpc build errors caused by recent changes

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

 



Several caused by commit 8074303 "remove global kvm object",
ioport__setup_arch(), term_getc_iov() & term_getc() in the
spapr_hvcons.c code, and kvm_cpu__reboot() in rtas_power_off().

Commit 221b584 "move active_console into struct kvm_config" added
checks in h_put_term_char() & h_get_term_char() of
kvm->cfg.active_console but needs to be vcpu->kvm->cfg.active_console.

That commit also missed updates to term_putc() & term_getc() in
spapr_rtas.c, and I'm guessing that we need similar checks of
active_console in rtas_put_term_char() & rtas_get_term_char().

Signed-off-by: Michael Ellerman <michael@xxxxxxxxxxxxxx>
---
 tools/kvm/powerpc/ioport.c       |    2 +-
 tools/kvm/powerpc/spapr_hvcons.c |    6 +++---
 tools/kvm/powerpc/spapr_rtas.c   |   14 +++++++++-----
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/tools/kvm/powerpc/ioport.c b/tools/kvm/powerpc/ioport.c
index a8e4dc3..264fb7e 100644
--- a/tools/kvm/powerpc/ioport.c
+++ b/tools/kvm/powerpc/ioport.c
@@ -12,7 +12,7 @@
 
 #include <stdlib.h>
 
-void ioport__setup_arch(void)
+void ioport__setup_arch(struct kvm *kvm)
 {
 	/* PPC has no legacy ioports to set up */
 }
diff --git a/tools/kvm/powerpc/spapr_hvcons.c b/tools/kvm/powerpc/spapr_hvcons.c
index 1fe4bdb..0bdf75b 100644
--- a/tools/kvm/powerpc/spapr_hvcons.c
+++ b/tools/kvm/powerpc/spapr_hvcons.c
@@ -50,7 +50,7 @@ static unsigned long h_put_term_char(struct kvm_cpu *vcpu, unsigned long opcode,
 	do {
 		int ret;
 
-		if (kvm->cfg.active_console == CONSOLE_HV)
+		if (vcpu->kvm->cfg.active_console == CONSOLE_HV)
 			ret = term_putc_iov(&iov, 1, 0);
 		else
 			ret = 0;
@@ -74,14 +74,14 @@ static unsigned long h_get_term_char(struct kvm_cpu *vcpu, unsigned long opcode,
 	union hv_chario data;
 	struct iovec iov;
 
-	if (kvm->cfg.active_console != CONSOLE_HV)
+	if (vcpu->kvm->cfg.active_console != CONSOLE_HV)
 		return H_SUCCESS;
 
 	if (term_readable(0)) {
 		iov.iov_base = data.buf;
 		iov.iov_len = 16;
 
-		*len = term_getc_iov(&iov, 1, 0);
+		*len = term_getc_iov(vcpu->kvm, &iov, 1, 0);
 		*char0_7 = be64_to_cpu(data.a.char0_7);
 		*char8_15 = be64_to_cpu(data.a.char8_15);
 	} else {
diff --git a/tools/kvm/powerpc/spapr_rtas.c b/tools/kvm/powerpc/spapr_rtas.c
index 14a3462..c81d82b 100644
--- a/tools/kvm/powerpc/spapr_rtas.c
+++ b/tools/kvm/powerpc/spapr_rtas.c
@@ -41,7 +41,7 @@ static void rtas_display_character(struct kvm_cpu *vcpu,
                                    uint32_t nret, target_ulong rets)
 {
 	char c = rtas_ld(vcpu->kvm, args, 0);
-	term_putc(CONSOLE_HV, &c, 1, 0);
+	term_putc(&c, 1, 0);
 	rtas_st(vcpu->kvm, rets, 0, 0);
 }
 
@@ -52,7 +52,10 @@ static void rtas_put_term_char(struct kvm_cpu *vcpu,
 			       uint32_t nret, target_ulong rets)
 {
 	char c = rtas_ld(vcpu->kvm, args, 0);
-	term_putc(CONSOLE_HV, &c, 1, 0);
+
+	if (vcpu->kvm->cfg.active_console == CONSOLE_HV)
+		term_putc(&c, 1, 0);
+
 	rtas_st(vcpu->kvm, rets, 0, 0);
 }
 
@@ -62,8 +65,9 @@ static void rtas_get_term_char(struct kvm_cpu *vcpu,
 			       uint32_t nret, target_ulong rets)
 {
 	int c;
-	if (term_readable(CONSOLE_HV, 0) &&
-	    (c = term_getc(CONSOLE_HV, 0)) >= 0) {
+
+	if (vcpu->kvm->cfg.active_console == CONSOLE_HV && term_readable(0) &&
+	    (c = term_getc(vcpu->kvm, 0)) >= 0) {
 		rtas_st(vcpu->kvm, rets, 0, 0);
 		rtas_st(vcpu->kvm, rets, 1, c);
 	} else {
@@ -115,7 +119,7 @@ static void rtas_power_off(struct kvm_cpu *vcpu,
 		rtas_st(vcpu->kvm, rets, 0, -3);
 		return;
 	}
-	kvm_cpu__reboot();
+	kvm_cpu__reboot(vcpu->kvm);
 }
 
 static void rtas_query_cpu_stopped_state(struct kvm_cpu *vcpu,
-- 
1.7.9.5

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


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