Module Name: src
Committed By: imil
Date: Wed Feb 12 05:15:39 UTC 2025
Modified Files:
src/sys/arch/x86/x86: x86_autoconf.c
src/sys/dev/ic: com.c
Log Message:
Set a skip_attach_delay property to "true" for com port in virtual machines
to avoid a delay(10000) at attach
To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/x86/x86/x86_autoconf.c
cvs rdiff -u -r1.387 -r1.388 src/sys/dev/ic/com.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/x86/x86/x86_autoconf.c
diff -u src/sys/arch/x86/x86/x86_autoconf.c:1.89 src/sys/arch/x86/x86/x86_autoconf.c:1.90
--- src/sys/arch/x86/x86/x86_autoconf.c:1.89 Fri Dec 6 10:53:41 2024
+++ src/sys/arch/x86/x86/x86_autoconf.c Wed Feb 12 05:15:39 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_autoconf.c,v 1.89 2024/12/06 10:53:41 bouyer Exp $ */
+/* $NetBSD: x86_autoconf.c,v 1.90 2025/02/12 05:15:39 imil Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.89 2024/12/06 10:53:41 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_autoconf.c,v 1.90 2025/02/12 05:15:39 imil Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -602,6 +602,10 @@ device_register(device_t dev, void *aux)
(void)device_hyperv_register(dev, aux);
#endif
+ if (device_is_a(dev, "com") && vm_guest > VM_GUEST_NO)
+ prop_dictionary_set_bool(device_properties(dev),
+ "skip_attach_delay", true);
+
if (isaboot == NULL && pciboot == NULL)
return;
Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.387 src/sys/dev/ic/com.c:1.388
--- src/sys/dev/ic/com.c:1.387 Sun Feb 9 10:27:29 2025
+++ src/sys/dev/ic/com.c Wed Feb 12 05:15:39 2025
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.387 2025/02/09 10:27:29 skrll Exp $ */
+/* $NetBSD: com.c,v 1.388 2025/02/12 05:15:39 imil Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.387 2025/02/09 10:27:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.388 2025/02/12 05:15:39 imil Exp $");
#include "opt_com.h"
#include "opt_ddb.h"
@@ -540,12 +540,14 @@ com_attach_subr(struct com_softc *sc)
prop_dictionary_t dict;
bool is_console = true;
bool force_console = false;
+ bool skip_attach_delay = false;
aprint_naive("\n");
dict = device_properties(sc->sc_dev);
prop_dictionary_get_bool(dict, "is_console", &is_console);
prop_dictionary_get_bool(dict, "force_console", &force_console);
+ prop_dictionary_get_bool(dict, "skip_attach_delay", &skip_attach_delay);
callout_init(&sc->sc_diag_callout, 0);
callout_init(&sc->sc_poll_callout, 0);
callout_setfunc(&sc->sc_poll_callout, com_intr_poll, sc);
@@ -589,8 +591,11 @@ com_attach_subr(struct com_softc *sc)
break;
}
+ /* No need for a delay on virtual machines. */
+ if (!skip_attach_delay)
+ delay(10000); /* wait for output to finish */
+
/* Make sure the console is always "hardwired". */
- delay(10000); /* wait for output to finish */
if (is_console) {
SET(sc->sc_hwflags, COM_HW_CONSOLE);
}