From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: <xen-devel@lists.xensource.com>
Cc: <linux-kernel@vger.kernel.org>,
<Stefano.Stabellini@eu.citrix.com>, <david.vrabel@citrix.com>,
<konrad.wilk@oracle.com>, <boris.ostrovsky@oracle.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests
Date: Thu, 25 Feb 2016 12:10:39 +0000 [thread overview]
Message-ID: <1456402239-4179-3-git-send-email-stefano.stabellini@eu.citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1602251206500.17248@kaball.uk.xensource.com>
Refactor the existing code in xen_raw_console_write to get the generic
early_printk console work with HVM guests.
Take the opportunity to replace the outb loop with a single outsb call
to reduce the number of vmexit.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
---
drivers/tty/hvc/hvc_xen.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index bf787aa..a1c3746 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -605,6 +605,16 @@ static int xen_cons_init(void)
}
console_initcall(xen_cons_init);
+#ifdef CONFIG_X86
+static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len)
+{
+ if (xen_cpuid_base())
+ outsb(0xe9, str, len);
+}
+#else
+static void xen_hvm_early_write(uint32_t vtermno, const char *str, int len) { }
+#endif
+
#ifdef CONFIG_EARLY_PRINTK
static int __init xenboot_setup_console(struct console *console, char *string)
{
@@ -624,8 +634,10 @@ static void xenboot_write_console(struct console *console, const char *string,
unsigned int linelen, off = 0;
const char *pos;
- if (!xen_pv_domain())
+ if (!xen_pv_domain()) {
+ xen_hvm_early_write(0, string, len);
return;
+ }
dom0_write_console(0, string, len);
@@ -661,17 +673,10 @@ void xen_raw_console_write(const char *str)
if (xen_domain()) {
rc = dom0_write_console(0, str, len);
-#ifdef CONFIG_X86
- if (rc == -ENOSYS && xen_hvm_domain())
- goto outb_print;
-
- } else if (xen_cpuid_base()) {
- int i;
-outb_print:
- for (i = 0; i < len; i++)
- outb(str[i], 0xe9);
-#endif
+ if (rc != -ENOSYS || !xen_hvm_domain())
+ return;
}
+ xen_hvm_early_write(0, str, len);
}
void xen_raw_printk(const char *fmt, ...)
--
1.7.10.4
next prev parent reply other threads:[~2016-02-25 12:11 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 12:09 [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
2016-02-25 12:10 ` [PATCH v2 1/3] hvc_xen: add earlycon support Stefano Stabellini
2016-02-25 15:00 ` Boris Ostrovsky
2016-02-25 12:10 ` [PATCH v2 2/3] hvc_xen: fix xenboot for DomUs Stefano Stabellini
2016-02-25 15:04 ` Boris Ostrovsky
2016-02-26 15:39 ` Stefano Stabellini
2016-02-26 16:09 ` Boris Ostrovsky
2016-02-26 16:57 ` Stefano Stabellini
2016-02-25 12:10 ` Stefano Stabellini [this message]
2016-02-25 15:13 ` [PATCH v2 3/3] hvc_xen: make early_printk work with HVM guests Boris Ostrovsky
2016-02-26 14:28 ` [PATCH v2 0/3] hvc_xen: fix xenboot on x86 and export to ARM Stefano Stabellini
2016-02-26 14:41 ` David Vrabel
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=1456402239-4179-3-git-send-email-stefano.stabellini@eu.citrix.com \
--to=stefano.stabellini@eu.citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xensource.com \
/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;
as well as URLs for NNTP newsgroup(s).