Re: git: 0c38e1c3383a - main - arm64: Hyper-V: vmbus: use the IRQ resource from vmbus_res

From: Andrew Turner <andrew_at_fubar.geek.nz>
Date: Fri, 21 Oct 2022 15:08:54 UTC
Why does the vmbus_res driver exist? It seems to me it should be removed and the vmbus driver attach to the VMBUS node in the ACPI tables. You may have to split it slightly to support the two attachments, one for ACPI using MMIO, and one for PCI.

Andrew

> On 21 Oct 2022, at 09:41, Wei Hu <whu@FreeBSD.org> wrote:
> 
> The branch main has been updated by whu:
> 
> URL: https://cgit.FreeBSD.org/src/commit/?id=0c38e1c3383ab540ed01284be46769263c560d96
> 
> commit 0c38e1c3383ab540ed01284be46769263c560d96
> Author:     Souradeep Chakrabarti <schakrabarti@microsoft.com>
> AuthorDate: 2022-10-21 07:49:28 +0000
> Commit:     Wei Hu <whu@FreeBSD.org>
> CommitDate: 2022-10-21 08:40:32 +0000
> 
>    arm64: Hyper-V: vmbus: use the IRQ resource from vmbus_res
> 
>    In ARM64 gen2 Hyper-V, use IRQ resource from vmbus_res, which is owning
>    the IRQ for current device tree. It allows the MMIO resource to be
>    successfully allocated for vmbus from parent acpi_syscontainer.
>    Reviewed by:    whu
>    Tested by:      Souradeep Chakrabarti <schakrabarti@microsoft.com>
>    Sponsored by:   Microsoft
>    Differential Revision:  https://reviews.freebsd.org/D37064
> ---
> sys/dev/hyperv/vmbus/aarch64/vmbus_aarch64.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/sys/dev/hyperv/vmbus/aarch64/vmbus_aarch64.c b/sys/dev/hyperv/vmbus/aarch64/vmbus_aarch64.c
> index ba4d8c9bc36e..66e605b94094 100644
> --- a/sys/dev/hyperv/vmbus/aarch64/vmbus_aarch64.c
> +++ b/sys/dev/hyperv/vmbus/aarch64/vmbus_aarch64.c
> @@ -111,8 +111,10 @@ vmbus_setup_intr1(struct vmbus_softc *sc)
> {
> 	int err;
> 	struct intr_map_data_acpi *irq_data;
> +	device_t dev;
> 
> -	sc->ires = bus_alloc_resource_any(device_get_parent(sc->vmbus_dev),
> +	dev =  devclass_get_device(devclass_find("vmbus_res"), 0);
> +	sc->ires = bus_alloc_resource_any(dev,
> 	    SYS_RES_IRQ, &sc->vector, RF_ACTIVE | RF_SHAREABLE);
> 	if (sc->ires == NULL) {
> 		device_printf(sc->vmbus_dev, "bus_alloc_resouce_any failed\n");
>