From: Michael Ellerman <michael@ellerman.id.au>
To: <penberg@kernel.org>
Cc: <kvm@vger.kernel.org>, levinsasha928@gmail.com, <matt@ozlabs.org>,
<kvm-ppc@vger.kernel.org>
Subject: [PATCH 1/3] kvm tools: Fix powerpc build errors caused by recent changes
Date: Fri, 5 Oct 2012 11:15:17 +1000 [thread overview]
Message-ID: <1349399719-9317-1-git-send-email-michael@ellerman.id.au> (raw)
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@ellerman.id.au>
---
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
next reply other threads:[~2012-10-05 1:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-05 1:15 Michael Ellerman [this message]
2012-10-05 1:15 ` [PATCH 2/3] kvm tools: Fix segfault on powerpc in xics_register() Michael Ellerman
2012-10-05 1:15 ` [PATCH 3/3] kvm tools: Do setup_fdt() later, get powerpc to boot again Michael Ellerman
2012-10-05 6:30 ` [PATCH 1/3] kvm tools: Fix powerpc build errors caused by recent changes Pekka Enberg
2012-10-05 6:33 ` Michael Ellerman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349399719-9317-1-git-send-email-michael@ellerman.id.au \
--to=michael@ellerman.id.au \
--cc=kvm-ppc@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=matt@ozlabs.org \
--cc=penberg@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox