From nobody Thu Nov 02 09:16:36 2023 X-Original-To: dev-commits-src-all@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 4SLdY153D8z4ybH7; Thu, 2 Nov 2023 09:16:37 +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 4SLdY11NwCz3F3l; Thu, 2 Nov 2023 09:16:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916597; 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=SzUdfYQH1fz8GEJmlKg6KFzu7s+YCGXeOUDAuGTxIu8=; b=YnHoaaaQFbGLW+UdUs/QZKPNFShvwNotfGNds5iLyY5G22G4yJ9A6ZlufN2SK2f/3iE4qi ftuLjuHniny/4QYGKpzdrscpp8FQ7W3DGvZgxMiqyjhD5wkJ0awn7axzVlekT1OwuxB7We QR6sEZ1IixjwkclmcYALPTb/aCCpH+wIU30eJUk3rsZjTqeWBQw5yF+e6f5Bi/9mpA8qW+ w99h4CvQVDxpUAGG2lX8CIbz51yCSlBJXcHt/dniga4EdJa4YteFyXTUgb2/rRPFNE9ILb F9IhqUR72SgURLAx2uD5egttTklcEJILzyx5Vdl6tfR73N8Z2F1K2kY23B3Qtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916597; 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=SzUdfYQH1fz8GEJmlKg6KFzu7s+YCGXeOUDAuGTxIu8=; b=um075x10YRXPz0vRVh0x9Wlm9mnF+GxnN0rB0mYRXPW9VRQQO4yPq9u8bHpjLgolQMUTGM hN77+Crg2Xa+RDCHCAxRXHMedG1bHNJjm4oZ7gakVdiS+85qZLGUhaJoRORp4Be3RHL9Bc K4oPjx/cNkuuukx6owC91pJStIedGGpQ/dzV5Au8k6vCBLwkAlAXol0dhkPG1uSyeB8qWi K6N6U/pmvkFRgm0OeIEBYRGSVDv1r7k4RIsnVrLYhuWQ4E3XlsV7s6zBe6msEDLGaJ82Nb Zry9FS6jl9L4t7MMuWE6xpTl8fP6N0soErPULr1ZpX/xroizLKY/0aoADzAcqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698916597; a=rsa-sha256; cv=none; b=icuxUAUvtPHhCHQSyvtfQL5opYhKzJU+TncWjjZw7gey0rL4Bx8U+tj1rZvQgDbJLFwLzP ZHR1/nBEycFkVzPai43isMcU3lCW+5P6zJVIOmkQ4ArrCiQ5FW7TZf3YcFV6YIs40Uzu58 RCfItrdRJMzKYAN8P4y5vgNaU2Kj1su8YbrWZVJV3iTuGf8v0mBDjgrMHd8CxQQKpNOMWp KOA0WoeWSr4rRm3ghMZaGJtuhedcNah4g903LOovN+vcvZOOySiS8NqyaXMqKEUYidGwCr vwnjQ6S0jvaeQBjlV79J7cuZhyMu2zd88F5h6yO9MAZPSrwYL6I7wzuNKF5jWw== 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 4SLdY10Ly5z8Mr; Thu, 2 Nov 2023 09:16:37 +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 3A29Ga1x092125; Thu, 2 Nov 2023 09:16:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A29GaKc092122; Thu, 2 Nov 2023 09:16:36 GMT (envelope-from git) Date: Thu, 2 Nov 2023 09:16:36 GMT Message-Id: <202311020916.3A29GaKc092122@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Zhenlei Huang Subject: git: 52dbe7401fba - releng/14.0 - Hyper-V: vmbus: Add NULL check for vmbus_res List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/releng/14.0 X-Git-Reftype: branch X-Git-Commit: 52dbe7401fba923bc18124190029e65b491a756e Auto-Submitted: auto-generated The branch releng/14.0 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=52dbe7401fba923bc18124190029e65b491a756e commit 52dbe7401fba923bc18124190029e65b491a756e Author: Zhenlei Huang AuthorDate: 2023-11-02 09:07:11 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-02 09:13:18 +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 Approved by: re (gjb) 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 (cherry picked from commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5) (cherry picked from commit 1969d82fcf62f80c2047a53b42f501680b140b0d) --- 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");