Re: bus_alloc_resource_any failing to allocate irq for vmbus in amd64

Souradeep Chakrabarti <[email protected]>
Newsgroups gmane.os.freebsd.devel.arm
Message-ID <PSAP153MB053627262A8BC9EF3AAA21ABCCA69@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>
+Warner Losh


Thanks & Regards,
 Souradeep



From: Souradeep Chakrabarti <[email protected]>
Sent: Friday, June 10, 2022 6:44 PM
To: [email protected] <[email protected]>; Andrew Turner <[email protected]>; Li-Wen Hsu <[email protected]>
Cc: Wei Hu <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.