Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-10]: src/sys/arch Pull up following revision(s) (requested by bou...
details: https://anonhg.NetBSD.org/src/rev/456dc081ec06
branches: netbsd-10
changeset: 374070:456dc081ec06
user: martin <martin%NetBSD.org@localhost>
date: Thu Mar 30 11:45:34 2023 +0000
description:
Pull up following revision(s) (requested by bouyer in ticket #131):
sys/arch/x86/x86/consinit.c: revision 1.36
sys/arch/xen/x86/pvh_consinit.c: revision 1.3
sys/arch/xen/include/xen.h: revision 1.48
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 d0bdc9ed426a -r 456dc081ec06 sys/arch/x86/x86/consinit.c
--- a/sys/arch/x86/x86/consinit.c Thu Mar 30 11:43:17 2023 +0000
+++ b/sys/arch/x86/x86/consinit.c Thu Mar 30 11:45:34 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.35.4.1 2023/03/30 11:45:34 martin 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.35.4.1 2023/03/30 11:45:34 martin 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 d0bdc9ed426a -r 456dc081ec06 sys/arch/xen/include/xen.h
--- a/sys/arch/xen/include/xen.h Thu Mar 30 11:43:17 2023 +0000
+++ b/sys/arch/xen/include/xen.h Thu Mar 30 11:45:34 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.47.20.1 2023/03/30 11:45:34 martin 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 d0bdc9ed426a -r 456dc081ec06 sys/arch/xen/x86/pvh_consinit.c
--- a/sys/arch/xen/x86/pvh_consinit.c Thu Mar 30 11:43:17 2023 +0000
+++ b/sys/arch/xen/x86/pvh_consinit.c Thu Mar 30 11:45:34 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.2.20.1 2023/03/30 11:45:34 martin 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.2.20.1 2023/03/30 11:45:34 martin 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