Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jun 2022 13:16:32 +0000
From:      Souradeep Chakrabarti <schakrabarti@microsoft.com>
To:        "freebsd-arm@FreeBSD.org" <freebsd-arm@FreeBSD.org>, Andrew Turner <andrew@freebsd.org>, Li-Wen Hsu <lwhsu@freebsd.org>, Warner Losh <imp@bsdimp.com>
Cc:        Wei Hu <weh@microsoft.com>
Subject:   Re: bus_alloc_resource_any failing to allocate irq for vmbus in amd64
Message-ID:  <PSAP153MB053627262A8BC9EF3AAA21ABCCA69@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>
In-Reply-To: <PSAP153MB05369D4402537B4FB5F6EC5FCCA69@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>
References:  <PSAP153MB05369D4402537B4FB5F6EC5FCCA69@PSAP153MB0536.APCP153.PROD.OUTLOOK.COM>

next in thread | previous in thread | raw e-mail | index | archive | help
+Warner Losh=0A=
=0A=
=0A=
Thanks & Regards,=0A=
=A0Souradeep=0A=
=0A=
=0A=
=0A=
From: Souradeep Chakrabarti <schakrabarti@microsoft.com>=0A=
Sent: Friday, June 10, 2022 6:44 PM=0A=
To: freebsd-arm@FreeBSD.org <freebsd-arm@FreeBSD.org>; Andrew Turner <andre=
w@freebsd.org>; Li-Wen Hsu <lwhsu@freebsd.org>=0A=
Cc: Wei Hu <weh@microsoft.com>=0A=
Subject: bus_alloc_resource_any failing to allocate irq for vmbus in amd64 =
=0A=
=A0=0A=
Hi,=0A=
I am trying to use bus_alloc_resource_any() to allocate a irq line for vmbu=
s but it is failing.=0A=
=0A=
this is the patch :=0A=
=0A=
+ =A0sc->sc_vmbus_irid =3D 1;=0A=
+ =A0device_t parent =3D device_get_parent(device_get_parent(sc->vmbus_dev)=
);=0A=
+ =A0sc->sc_vmbus_ires =3D bus_alloc_resource_any(parent,=0A=
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A0 =A0 =A0 SYS_RES_IRQ, &(sc->sc_vmbus_irid), RF_ACTIVE|RF=
_SHAREABLE);=0A=
+ =A0 if (sc->sc_vmbus_ires =3D=3D NULL) {=0A=
+ =A0 =A0 =A0 =A0 =A0 device_printf(sc->vmbus_dev, "could not allocate IRQ\=
n");=0A=
+ =A0 =A0 =A0 =A0 =A0 return (ENXIO);=0A=
+ =A0 }=0A=
+ =A0 error =3D bus_setup_intr(sc->vmbus_dev, sc->sc_vmbus_ires, INTR_TYPE_=
NET | INTR_MPSAFE,=0A=
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL,=
 vmbus_handle_intr_new, sc, &(sc->sc_vmbus_ihand));=0A=
+ =A0 if (error) {=0A=
+ =A0 =A0 =A0 =A0 =A0 device_printf(sc->vmbus_dev, "failed to setup IRQ\n")=
;=0A=
+ =A0 =A0 =A0 =A0 =A0 if (bus_release_resource(sc->vmbus_dev, SYS_RES_IRQ, =
sc->sc_vmbus_irid, sc->sc_vmbus_ires))=0A=
+ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_printf(sc->vmbus_dev, "could n=
ot release IRQ\n");=0A=
+ =A0 =A0 =A0 =A0 =A0 sc->sc_vmbus_ires =3D NULL;=0A=
+ =A0 =A0 =A0 =A0 =A0 return (error);=0A=
+ =A0 }=0A=
=0A=
What am I missing here? Any help would be greatly appreciated.=0A=
=0A=
Thanks & Regards,=0A=
Souradeep=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?PSAP153MB053627262A8BC9EF3AAA21ABCCA69>