From nobody Thu Nov 2 09:09:28 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 4SLdNn24zfz4yYs2; Thu, 2 Nov 2023 09:09:29 +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 4SLdNn1cSnz3CB6; Thu, 2 Nov 2023 09:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916169; 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=/8p5zD9w7kS5bZ5PEY+HMJKlWHf2AVzfY52pLmm4IEo=; b=XzAbXNFYqKoWcMgt70YnXT/hkfkbUITT23LMNxxZCtXdYvmAX9N/vKs80/vV4mdA81dQ6F Fhiqz56aM29SSzMj+HakmJhLJ42Nctadx86TfbXQOJC8InCCpva9C4fvHQV1aim6piNsdE mQN+IA8SHavMM+4XcLtpsljU1jvnbTxHkfb1ke6zwWK3rgj28JjPuywGYT3vC66ELpPkdn eJQiJP0t15EfFOKRGDbYqr92AUct02xopyXd/P8kDVkn8x99isTQA0Idwztdt0fPP5utnx s5PgCINITedftEynw8EuI8/Lpk+OVCvh7AyRxUuokYv6vna9iDIbB1o9Q/uPuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916169; 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=/8p5zD9w7kS5bZ5PEY+HMJKlWHf2AVzfY52pLmm4IEo=; b=nbCeB2z9n46EQuwj/To8Z7plkB1qAphk1/lzyb84GHY8xFaVBJ0AAfAJZdyaV8S7Tw9Kcd cjrBq4qdDcXlWdrHvPiBlNXCleuLo/WrnswJ4v3fsQ6Ysp7s2AWhZaMvRh4XggbdAny254 577tZY0qqlH041aHdeNhg9px9ix8HCV4VS3sawYcZxY8bOBKAlnT16O08XU6UArhC+FZ/o vYWbqwr3q8SZf/XjEQLN//jnusoNzw8foe0ocOmAxa0EmpN2ep6Lz9Mc0gMc41dLjTPt0m vHP5D0lBfuro1kPndI85W9kplIMKWOQ9B2Ut26Flg1PySJOsjTBzgGzRKi6/wA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698916169; a=rsa-sha256; cv=none; b=QAwb0er5Wg9YJ46bGmEyLM6LA03WYAlrju9W6ntfWTbZ8OgrRlRorNpkNEFB0LcOjDgp4V ncS32pMq/2cnEklq6y0gYV5ytonrCkcG/Pg+pvf4uDPXlaUi2ibLtOvbv50HZI8D211nJb HhQEnHlD/cLav5edNVKL+xh8Yy+/FH9LxB69z8Nt5HMrDO3OXI2cB1QuWOZgEB2k+Wz+U1 t+2Y7X3T4wTywE/LN8y6dPlo9uhKTBRxHPd7jbnJGMg61hwYd2ixf0nrY0s6s+xFdr1sA3 7iLoOWZ1X5ggCDjGrV+gyQ74LpfjVF0rKxLDOBGz59ABEHdSnFZ6frymhxYjmQ== 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 4SLdNn0gLyz84Y; Thu, 2 Nov 2023 09:09:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3A299SfQ075868; Thu, 2 Nov 2023 09:09:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A299SXQ075865; Thu, 2 Nov 2023 09:09:28 GMT (envelope-from git) Date: Thu, 2 Nov 2023 09:09:28 GMT Message-Id: <202311020909.3A299SXQ075865@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Zhenlei Huang Subject: git: 63bf943d4af1 - main - Hyper-V: vmbus: Add NULL check for vmbus_res 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: zlei X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 63bf943d4af17799cef21e2bb78dd28003ce1ce5 Auto-Submitted: auto-generated The branch main has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=63bf943d4af17799cef21e2bb78dd28003ce1ce5 commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5 Author: Zhenlei Huang AuthorDate: 2023-11-02 09:07:11 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-02 09:07:11 +0000 Hyper-V: vmbus: Add NULL check for vmbus_res QEMU emulates Hyper-V [1] but lacks the emulation for vmbus_res, thus no coherence information is available. Add NULL check for it and fallback to no coherence. This will prevent FreeBSD guests from panic on QEMU with the Hyper-V enlightenment hv-synic enabled. For real Hyper-V, both gen1 and gen2 have vmbus_res then they are not affected by this change. 1. https://www.qemu.org/docs/master/system/i386/hyperv.html PR: 274810 Reviewed by: mhorne, emaste, delphij, whu Diagnosed by: mhorne Fixes: e7a9817b8d32 Hyper-V: vmbus: implementat bus_get_dma_tag in vmbus Insta-MFC approved by: re (delphij) for 14.0-RC4 Differential Revision: https://reviews.freebsd.org/D42414 --- sys/dev/hyperv/vmbus/vmbus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sys/dev/hyperv/vmbus/vmbus.c b/sys/dev/hyperv/vmbus/vmbus.c index ee412e643b4f..0ea401507b79 100644 --- a/sys/dev/hyperv/vmbus/vmbus.c +++ b/sys/dev/hyperv/vmbus/vmbus.c @@ -1393,7 +1393,7 @@ vmbus_doattach(struct vmbus_softc *sc) int ret; device_t dev_res; ACPI_HANDLE handle; - unsigned int coherent; + unsigned int coherent = 0; if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) return (0); @@ -1416,10 +1416,12 @@ vmbus_doattach(struct vmbus_softc *sc) /* Coherency attribute */ dev_res = devclass_get_device(devclass_find("vmbus_res"), 0); - handle = acpi_get_handle(dev_res); + if (dev_res != NULL) { + handle = acpi_get_handle(dev_res); - if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent))) - coherent = 0; + if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent))) + coherent = 0; + } if (bootverbose) device_printf(sc->vmbus_dev, "Bus is%s cache-coherent\n", coherent ? "" : " not");