Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Allow a PVH dom0 to use VGA as console: make xen_pv...
details: https://anonhg.NetBSD.org/src/rev/98bf0a2c746c
branches: trunk
changeset: 374008:98bf0a2c746c
user: bouyer <bouyer%NetBSD.org@localhost>
date: Fri Mar 24 12:28:42 2023 +0000
description:
Allow a PVH dom0 to use VGA as console: make xen_pvh_consinit() return 1 if
it handles the console and 0 otherwise (especially when console=tty0 or
console=pc is present on the command line).
In consinit() fallback to native console selection if xen_pvh_consinit()
returns 0.
diffstat:
sys/arch/x86/x86/consinit.c | 9 +++++----
sys/arch/xen/include/xen.h | 4 ++--
sys/arch/xen/x86/pvh_consinit.c | 29 ++++++++++++++++++++++-------
3 files changed, 29 insertions(+), 13 deletions(-)
diffs (123 lines):
diff -r 567e1a9e62dd -r 98bf0a2c746c sys/arch/x86/x86/consinit.c
--- a/sys/arch/x86/x86/consinit.c Fri Mar 24 12:25:28 2023 +0000
+++ b/sys/arch/x86/x86/consinit.c Fri Mar 24 12:28:42 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: consinit.c,v 1.35 2022/09/05 14:18:51 riastradh Exp $ */
+/* $NetBSD: consinit.c,v 1.36 2023/03/24 12:28:42 bouyer Exp $ */
/*
* Copyright (c) 1998
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.35 2022/09/05 14:18:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: consinit.c,v 1.36 2023/03/24 12:28:42 bouyer Exp $");
#include "opt_kgdb.h"
#include "opt_puc.h"
@@ -173,8 +173,9 @@ consinit(void)
#ifdef XENPVHVM
if (vm_guest == VM_GUEST_XENPVH) {
- xen_pvh_consinit();
- return;
+ if (xen_pvh_consinit() != 0)
+ return;
+ /* fallback to native console selection, usefull for dom0 PVH */
}
#endif
if (initted)
diff -r 567e1a9e62dd -r 98bf0a2c746c sys/arch/xen/include/xen.h
--- a/sys/arch/xen/include/xen.h Fri Mar 24 12:25:28 2023 +0000
+++ b/sys/arch/xen/include/xen.h Fri Mar 24 12:28:42 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xen.h,v 1.47 2020/05/02 16:44:36 bouyer Exp $ */
+/* $NetBSD: xen.h,v 1.48 2023/03/24 12:28:42 bouyer Exp $ */
/*
*
@@ -60,7 +60,7 @@ void xen_parse_cmdline(int, union xen_cm
void xenconscn_attach(void);
-void xen_pvh_consinit(void);
+int xen_pvh_consinit(void);
void xenprivcmd_init(void);
diff -r 567e1a9e62dd -r 98bf0a2c746c sys/arch/xen/x86/pvh_consinit.c
--- a/sys/arch/xen/x86/pvh_consinit.c Fri Mar 24 12:25:28 2023 +0000
+++ b/sys/arch/xen/x86/pvh_consinit.c Fri Mar 24 12:28:42 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pvh_consinit.c,v 1.2 2020/05/03 17:23:14 bouyer Exp $ */
+/* $NetBSD: pvh_consinit.c,v 1.3 2023/03/24 12:28:42 bouyer Exp $ */
/*
* Copyright (c) 2020 Manuel Bouyer.
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pvh_consinit.c,v 1.2 2020/05/03 17:23:14 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pvh_consinit.c,v 1.3 2023/03/24 12:28:42 bouyer Exp $");
#include "xencons.h"
#include <sys/param.h>
@@ -51,7 +51,7 @@ static struct consdev pvh_xencons = {
};
-void
+int
xen_pvh_consinit(void)
{
/*
@@ -59,21 +59,35 @@ xen_pvh_consinit(void)
* boot stage.
*/
static int initted = 0;
+ if (xendomain_is_dom0()) {
+ union xen_cmdline_parseinfo xcp;
+ xen_parse_cmdline(XEN_PARSE_CONSOLE, &xcp);
+#ifdef CONS_OVERRIDE
+ if (strcmp(default_consinfo.devname, "tty0") == 0 ||
+ strcmp(default_consinfo.devname, "pc") == 0) {
+#else
+ if (strcmp(xcp.xcp_console, "tty0") == 0 || /* linux name */
+ strcmp(xcp.xcp_console, "pc") == 0) { /* NetBSD name */
+#endif /* CONS_OVERRIDE */
+ return 0; /* native console code will do it */
+ }
+ }
if (initted == 0 && !xendomain_is_dom0()) {
/* pmap not up yet, fall back to printk() */
cn_tab = &pvh_xencons;
initted++;
- return;
+ return 1;
} else if (initted > 1) {
- return;
+ return 1;
}
initted++;
if (xendomain_is_dom0()) {
+ /* we know we're using Xen's console at this point */
xenconscn_attach(); /* no ring in this case */
initted++; /* don't init console twice */
- return;
+ return 1;
}
-
+
#if NXENCONS > 0
/* we can now map the xencons rings. */
struct xen_hvm_param xen_hvm_param;
@@ -98,6 +112,7 @@ xen_pvh_consinit(void)
xen_start_info.console.domU.evtchn = xen_hvm_param.value;
xenconscn_attach();
#endif
+ return 1;
}
static int
Home |
Main Index |
Thread Index |
Old Index