Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Nov 2023 17:22:09 +0800
From:      Zhenlei Huang <zlei@FreeBSD.org>
To:        "src-committers@freebsd.org" <src-committers@FreeBSD.org>, "dev-commits-src-all@freebsd.org" <dev-commits-src-all@FreeBSD.org>, "dev-commits-src-main@freebsd.org" <dev-commits-src-main@FreeBSD.org>
Cc:        Souradeep Chakrabarti <schakrabarti@microsoft.com>
Subject:   Re: git: 63bf943d4af1 - main - Hyper-V: vmbus: Add NULL check for vmbus_res
Message-ID:  <2E6A685B-A8E4-48A2-B21A-422AFBEA4440@FreeBSD.org>
In-Reply-To: <202311020909.3A299SXQ075865@gitrepo.freebsd.org>
References:  <202311020909.3A299SXQ075865@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Sorry I committed too fast.

I should give credentials to Souradeep in the commit message.

Thank him for the analysis !

> On Nov 2, 2023, at 5:09 PM, Zhenlei Huang <zlei@FreeBSD.org> wrote:
>=20
> The branch main has been updated by zlei:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D63bf943d4af17799cef21e2bb78dd280=
03ce1ce5
>=20
> commit 63bf943d4af17799cef21e2bb78dd28003ce1ce5
> Author:     Zhenlei Huang <zlei@FreeBSD.org>
> AuthorDate: 2023-11-02 09:07:11 +0000
> Commit:     Zhenlei Huang <zlei@FreeBSD.org>
> CommitDate: 2023-11-02 09:07:11 +0000
>=20
>    Hyper-V: vmbus: Add NULL check for vmbus_res
>=20
>    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.
>=20
>    For real Hyper-V, both gen1 and gen2 have vmbus_res then they are =
not
>    affected by this change.
>=20
>    1. https://www.qemu.org/docs/master/system/i386/hyperv.html
>=20
>    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(-)
>=20
> 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 =3D 0;
>=20
> 	if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
> 		return (0);
> @@ -1416,10 +1416,12 @@ vmbus_doattach(struct vmbus_softc *sc)
>=20
> 	/* Coherency attribute */
> 	dev_res =3D  devclass_get_device(devclass_find("vmbus_res"), 0);
> -	handle =3D acpi_get_handle(dev_res);
> +	if (dev_res !=3D NULL) {
> +		handle =3D acpi_get_handle(dev_res);
>=20
> -	if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", &coherent)))
> -		coherent =3D 0;
> +		if (ACPI_FAILURE(acpi_GetInteger(handle, "_CCA", =
&coherent)))
> +			coherent =3D 0;
> +	}
> 	if (bootverbose)
> 		device_printf(sc->vmbus_dev, "Bus is%s =
cache-coherent\n",
> 			coherent ? "" : " not");






Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2E6A685B-A8E4-48A2-B21A-422AFBEA4440>