From nobody Sat Mar 18 07:20:34 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Pdspq35f8z3yDlN; Sat, 18 Mar 2023 07:20:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Pdspp6TB4z3Pcg; Sat, 18 Mar 2023 07:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679124034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JJlWaoZ5p2JG8xMS5pYI3Zo+WKYqe2+4VpFzZTAFUlY=; b=CinMG0nXdV0L1IO3lH1IZYvWOmtpBWyzxS0Mu0DyLgtH8SjpfXfcMGlyqkxN+Iu1B2IN5E cZkTIHcex5cU49ourwvvPImoRaKrCMISlQAgcxrKYyOWux4SIUeFwZTAS1ErUxMJp/TDjj kotEuVT/U6lIUPYeH94ldxquSpaK56OzwXdLtd1q9m2UhEhaZM6dv+ZdQoDIU9BV/JjxZ9 bd4u9aI4yhpLvpVIIjglrsyd26q+igAZcF59RO4CZUVEnQJ2ZhpZzNTVXE/lI14ebn63DY Yv1Zw6UDx5Jvi6oxe6ux3BOfoMuSTQ02xRQ+vBN07TDZl2Cj8268ZWsyv/rUJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1679124034; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JJlWaoZ5p2JG8xMS5pYI3Zo+WKYqe2+4VpFzZTAFUlY=; b=gZaxxXWiTiafD94aET1sahMSK5YwJXCdMEBauT3tvFi+Z3NvoXQ6vMT39W5U2RPmW6E+pX hXsQqk3m/TXiyYbfUpkg3CAMX+JjqpN6pS97zuATIQB1JvHZqk1DQ3KWqztIQ87KYHiQxA 7IPui6OuxMkvfuXMR8hH97T5dYxBkhRwPAmE0OSgH260eCerTgsGgXvdRnAmThkbpDxQKO vxQpW4TnC6szIsV0aFj83om5H/uYRPFKUXaPeGHxue3D/1AJdecSGLpwH0xJq02d+bEwmP TQYXboQDOhGE3kgM0J9I9+2WFtXxLp43T61SxHvItas6/lVHoD4glxyOcqE0VQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1679124034; a=rsa-sha256; cv=none; b=Z0LyOMWIMdIUE1euEB63xRpvXKhbPWVlJCMNTp19HT69Lbg+4BFJkseQKzG2NU7ps0CfEo hQTaHBhf/U+y2YsgGBmVtGvNdlVoW+BIAlsxrasvCRK4iLW184vxx8aa2tGTvAmZCZOwZG hBltZoJJ5xvAWQQFiTLXqpQGZ5F+Hg0h8KnYNc0xAxYDyj2kmXmoh3ToevK0Nlx0T2ykwl jPbLkOPGrgeA4guDCuG/QnK/DPXLY0iJY642l9SSWc5zd6z1ri5u6bC95maNd8b+lWJtI9 ttmnRGsPx9AMnnFuH49LJFlEAcOI+cpeoHdqWpirObhZJgj9ghR+yJBmanWJnA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Pdspp5GtgzyZq; Sat, 18 Mar 2023 07:20:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32I7KYrf030633; Sat, 18 Mar 2023 07:20:34 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32I7KYlc030632; Sat, 18 Mar 2023 07:20:34 GMT (envelope-from git) Date: Sat, 18 Mar 2023 07:20:34 GMT Message-Id: <202303180720.32I7KYlc030632@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 8ea7fa16d9fe - main - uart: Don't change settings or throttle putc for Hyper-V List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8ea7fa16d9fe5acb7d42a223efbfa23627aa5e0c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=8ea7fa16d9fe5acb7d42a223efbfa23627aa5e0c commit 8ea7fa16d9fe5acb7d42a223efbfa23627aa5e0c Author: Wei Hu AuthorDate: 2023-03-14 15:49:33 +0000 Commit: Wei Hu CommitDate: 2023-03-18 07:07:54 +0000 uart: Don't change settings or throttle putc for Hyper-V Azure setup does not like it when FreeBSD overrides the settings of the UART device. When Hyper-V is detected, don't do this and also don't throttle putc() output. This is a workaround for the early boot hang of FreeBSD on Azure. Tested on Azure, ESXi (VM with serial port), and SG-8200 PR: 264267 Reviewed by: kevans, whu Tested by: whu Obtained from: Rubicon Communications, LLC (Netgate) MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (Netgate) --- sys/dev/uart/uart_dev_ns8250.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/sys/dev/uart/uart_dev_ns8250.c b/sys/dev/uart/uart_dev_ns8250.c index 475ab5d4425e..2c44e9e34b8b 100644 --- a/sys/dev/uart/uart_dev_ns8250.c +++ b/sys/dev/uart/uart_dev_ns8250.c @@ -249,6 +249,10 @@ ns8250_param(struct uart_bas *bas, int baudrate, int databits, int stopbits, int divisor; uint8_t lcr; + /* Don't change settings when running on Hyper-V */ + if (vm_guest == VM_GUEST_HV) + return (0); + lcr = 0; if (databits >= 8) lcr |= LCR_8BITS; @@ -374,9 +378,11 @@ ns8250_putc(struct uart_bas *bas, int c) { int limit; - limit = 250000; - while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0 && --limit) - DELAY(4); + if (vm_guest != VM_GUEST_HV) { + limit = 250000; + while ((uart_getreg(bas, REG_LSR) & LSR_THRE) == 0 && --limit) + DELAY(4); + } uart_setreg(bas, REG_DATA, c); uart_barrier(bas); } @@ -532,15 +538,15 @@ ns8250_bus_attach(struct uart_softc *sc) #endif if (!resource_int_value("uart", device_get_unit(sc->sc_dev), "flags", &ivar)) { - if (UART_FLAGS_FCR_RX_LOW(ivar)) + if (UART_FLAGS_FCR_RX_LOW(ivar)) ns8250->fcr |= FCR_RX_LOW; - else if (UART_FLAGS_FCR_RX_MEDL(ivar)) + else if (UART_FLAGS_FCR_RX_MEDL(ivar)) ns8250->fcr |= FCR_RX_MEDL; - else if (UART_FLAGS_FCR_RX_HIGH(ivar)) + else if (UART_FLAGS_FCR_RX_HIGH(ivar)) ns8250->fcr |= FCR_RX_HIGH; else ns8250->fcr |= FCR_RX_MEDH; - } else + } else ns8250->fcr |= FCR_RX_MEDH; /* Get IER mask */