From nobody Thu Nov 02 09:11:24 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 4SLdR033yxz4yZLV; Thu, 2 Nov 2023 09:11:24 +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 4SLdR02cZ9z3DLP; Thu, 2 Nov 2023 09:11:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916284; 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=eh/JMoBaB70Y5iN0ovbw93757rNLFjvuKYdstLZILRo=; b=bAjee77l9BWlrEnLB57GyFMZceQruUzEqPTlDXuLy3ZcZWfpaPyHT7BbpYRv665KnOitPN jzjjy9W8W67HKt85BxwWaC+PtLKHO8uP6lXug4jc2FGV59/1HkWAlH+2J0eLKkGUQtoxDI EpSRK/MiQ8eTAXBSm6ED4Z6piwCoI4Ji3A6LMhpItCKfZfO5viOc0R0EPXKzrFJz9dRv7x 4+5pUH/8G3zn8gAyD3Gr1Cgkws43qwROzXqtyl6o4zqsQe8JQhuSopU4Z2srwtsB1gH0zz SOgCuxdM9hDRz5bg0LwS8MtD0/8GsxeY8ERleqshU3WSbXZnRb6/eDMKddtetg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1698916284; 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=eh/JMoBaB70Y5iN0ovbw93757rNLFjvuKYdstLZILRo=; b=L3S8utkH6x2KRYevOogl84AriqWcJKqCQsgrq8OkRl0wk7OKtk6+chwKuqukfUsJiCiUXP n0E1SvAKQda8rZ1AqTvIzzT177AvoJaVcvCEfjqILFt5WubYFo4R00NBpSLKvy8nvKMJa3 MXAp4cKSqADqyzVDwtegj/zxhHJsqOZ6o0fo16aTQbGFobB6SAV8HCg7LL5qgUGMHtdbz4 og0+oigUo3PoIFA1EBXV9Bn3qAY8vEpuSz6oxrRZAExeeq9JGNtW+nKjWD9jLiCl+5EHek sRmQjtOTJSNUecXiFNXgddgaNGK21M7lu7J6W1kw6ePpIOXB0dQhD+O9syjFZQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1698916284; a=rsa-sha256; cv=none; b=Iu6OtR1u3bTZiXShrJzecihGc7JdXUm+zRDU0i/ulv8zwkyWby886vRcBB+TJGYahjgYX4 X6+718JyNre13fFHa3mpKsyZcoibwNeOyQtxkhhAZDGZlyBj/S7vI/N8x/NkU1IwCcWrB2 HbHv+7Nfw5j75uNIlMLIvmdbrFdtLNRnvAu+OhS03svTrYC1sEDzbYuuqAvwLC/nh93BMY 9E1vDjXIK1RLiibyRG6ton2GS2KYRYNiPVir1katU+pwuQ7iwF2ZD+UyFx6+mOkJGl3vmr 1VOfr4ajsjJEvu8/FpaY4PMn+md7Mpt+yyrbSFVqp3QEoK66Wa2Oz3k1smLuRw== 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 4SLdR01gw2z8K9; Thu, 2 Nov 2023 09:11:24 +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 3A29BO9h087273; Thu, 2 Nov 2023 09:11:24 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3A29BOpE087270; Thu, 2 Nov 2023 09:11:24 GMT (envelope-from git) Date: Thu, 2 Nov 2023 09:11:24 GMT Message-Id: <202311020911.3A29BOpE087270@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: 1969d82fcf62 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 1969d82fcf62f80c2047a53b42f501680b140b0d Auto-Submitted: auto-generated The branch stable/14 has been updated by zlei: URL: https://cgit.FreeBSD.org/src/commit/?id=1969d82fcf62f80c2047a53b42f501680b140b0d commit 1969d82fcf62f80c2047a53b42f501680b140b0d Author: Zhenlei Huang AuthorDate: 2023-11-02 09:07:11 +0000 Commit: Zhenlei Huang CommitDate: 2023-11-02 09:10:03 +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 (cherry picked from commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5) --- 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");