Re: bus_alloc_resource_any failing to allocate irq for vmbus in amd64
Date: Fri, 10 Jun 2022 13:36:03 UTC
On 6/10/22 15:16, Souradeep Chakrabarti wrote:
> +Warner Losh
>
>
> Thanks & Regards,
> Souradeep
>
>
>
> From: Souradeep Chakrabarti <schakrabarti@microsoft.com>
> Sent: Friday, June 10, 2022 6:44 PM
> To: freebsd-arm@FreeBSD.org <freebsd-arm@FreeBSD.org>; Andrew Turner <andrew@freebsd.org>; Li-Wen Hsu <lwhsu@freebsd.org>
> Cc: Wei Hu <weh@microsoft.com>
> Subject: bus_alloc_resource_any failing to allocate irq for vmbus in amd64
>
> Hi,
> I am trying to use bus_alloc_resource_any() to allocate a irq line for vmbus but it is failing.
>
> this is the patch :
>
> + sc->sc_vmbus_irid = 1;
> + device_t parent = device_get_parent(device_get_parent(sc->vmbus_dev));
> + sc->sc_vmbus_ires = bus_alloc_resource_any(parent,
> + SYS_RES_IRQ, &(sc->sc_vmbus_irid), RF_ACTIVE|RF_SHAREABLE);
> + if (sc->sc_vmbus_ires == NULL) {
> + device_printf(sc->vmbus_dev, "could not allocate IRQ\n");
> + return (ENXIO);
> + }
> + error = bus_setup_intr(sc->vmbus_dev, sc->sc_vmbus_ires, INTR_TYPE_NET | INTR_MPSAFE,
> + NULL, vmbus_handle_intr_new, sc, &(sc->sc_vmbus_ihand));
> + if (error) {
> + device_printf(sc->vmbus_dev, "failed to setup IRQ\n");
> + if (bus_release_resource(sc->vmbus_dev, SYS_RES_IRQ, sc->sc_vmbus_irid, sc->sc_vmbus_ires))
> + device_printf(sc->vmbus_dev, "could not release IRQ\n");
> + sc->sc_vmbus_ires = NULL;
> + return (error);
> + }
>
> What am I missing here? Any help would be greatly appreciated.
>
> Thanks & Regards,
> Souradeep
Maybe the IRQ is not sharable:
RF_SHAREABLE
--HPS