bus_alloc_resource_any failing to allocate irq for vmbus in amd64
Date: Fri, 10 Jun 2022 13:14:27 UTC
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