NetBSD Problem Report #55926

From www@netbsd.org  Thu Jan 14 04:28:18 2021
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 0A1FE1A9217
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 14 Jan 2021 04:28:18 +0000 (UTC)
Message-Id: <20210114042817.0E0C31A9239@mollari.NetBSD.org>
Date: Thu, 14 Jan 2021 04:28:17 +0000 (UTC)
From: hashikaw@mail.ru
Reply-To: hashikaw@mail.ru
To: gnats-bugs@NetBSD.org
Subject: aarch64: pci_intr_alloc() return msi/msi-x count, but struct msi is not initialized.
X-Send-Pr-Version: www-1.0

>Number:         55926
>Category:       kern
>Synopsis:       aarch64: pci_intr_alloc() return msi/msi-x count, but struct msi is not initialized.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 14 04:30:00 +0000 2021
>Last-Modified:  Mon Mar 15 14:50:01 +0000 2021
>Originator:     Kouichi Hashikawa
>Release:        NetBSD-9.99.77
>Organization:
>Environment:
>Description:
Like RPi4, on system that gic_v2m_init() is not called
(struct msi is not initialized), 
pci_intr_alloc() returns msi/msi-x count (---> Patch 1).

I have a question, if a system has msi/msi-x capability,
and pci_intr_alloc() returns only intx count,
then turn off PCI_MSI_CTL_MSI_ENABLE or PCI_MSIX_CTL_ENABLE flag on
pci_msi_machdep.c? or each driver?


>How-To-Repeat:

>Fix:
(Patch 1)
--------
--- src/sys/arch/arm/pci/pci_msi_machdep.c-dist 2020-02-13 15:28:25.000000000 +0900
+++ src/sys/arch/arm/pci/pci_msi_machdep.c      2021-01-14 13:07:53.053314571 +0900
@@ -142,7 +142,7 @@
        struct arm_pci_msi *msi;

        msi = arm_pci_msi_find_frame(pih);
-       if (msi == NULL)
+       if (msi == NULL || msi->msi_intr_establish == NULL)
                return NULL;

        return msi->msi_intr_establish(msi, pih, ipl, func, arg, xname);
@@ -204,6 +204,7 @@
 pci_intr_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps, int *counts, pci_intr_type_t max_type)
 {
        int intx_count, msi_count, msix_count, error;
+       struct arm_pci_msi *msi;

        error = EINVAL;

@@ -230,20 +231,32 @@
                intx_count = msi_count = msix_count = 1;
        }

-       if (msix_count == -1)
-               msix_count = pci_msix_count(pa->pa_pc, pa->pa_tag);
-       if (msix_count > 0 && (error = pci_msix_alloc_exact(pa, ihps, msix_count)) == 0) {
-               if (counts != NULL)
-                       counts[PCI_INTR_TYPE_MSIX] = msix_count;
-               return 0;
-       }
+       msi = arm_pci_msi_lookup(pa);

-       if (msi_count == -1)
-               msi_count = pci_msi_count(pa->pa_pc, pa->pa_tag);
-       if (msi_count > 0 && (error = pci_msi_alloc_exact(pa, ihps, msi_count)) == 0) {
-               if (counts != NULL)
-                       counts[PCI_INTR_TYPE_MSI] = msi_count;
-               return 0;
+       if (msi != NULL) {
+               if (msi->msix_alloc != NULL) {
+                       if (msix_count == -1)
+                               msix_count = pci_msix_count(pa->pa_pc, 
+                                   pa->pa_tag);
+                       if (msix_count > 0 && (error = pci_msix_alloc_exact(pa, 
+                           ihps, msix_count)) == 0) {
+                               if (counts != NULL)
+                                       counts[PCI_INTR_TYPE_MSIX] = msix_count;
+                               return 0;
+                       }
+               }
+
+               if (msi->msi_alloc != NULL) {
+                       if (msi_count == -1)
+                               msi_count = pci_msi_count(pa->pa_pc, 
+                                   pa->pa_tag);
+                       if (msi_count > 0 && (error = pci_msi_alloc_exact(pa, 
+                           ihps, msi_count)) == 0) {
+                               if (counts != NULL)
+                                       counts[PCI_INTR_TYPE_MSI] = msi_count;
+                               return 0;
+                       }
+               }
        }

        if (intx_count > 0 && (error = pci_intx_alloc(pa, ihps)) == 0) {
@@ -266,6 +279,8 @@
        if ((pih[0] & (ARM_PCI_INTR_MSIX|ARM_PCI_INTR_MSI)) != 0) {
                msi = arm_pci_msi_find_frame(pih[0]);
                KASSERT(msi != NULL);
+               if (msi->msi_intr_release == NULL)
+                       return;
                msi->msi_intr_release(msi, pih, count);
        }


>Audit-Trail:
From: Kouichi Hashikawa <hashikaw@mail.ru>
To: gnats-bugs@netbsd.org
Cc: knakahara@netbsd.org
Subject: Re: kern/55926
Date: Mon, 8 Feb 2021 01:15:10 +0900

 --Apple-Mail-4648B2A4-56BD-4E84-8B8B-16F9B9293BA3
 Content-Type: text/plain;
 	charset=utf-8
 Content-Transfer-Encoding: quoted-printable

 =EF=BB=BF
  (Patch 2 after Patch 1)
 if struct msi is not initialized, turn off PCI_MSI_CTL_MSI_ENABLE or=20
 PCI_MSIX_CTL_ENABLE flag on pci_msi_machdep.c.


 --- src/sys/arch/arm/pci/pci_msi_machdep.c-1    2021-01-14 13:07:53.05331457=
 1=20
 +0900            =20
 +++ src/sys/arch/arm/pci/pci_msi_machdep.c      2021-01-15 15:43:44.51924875=
 4=20
 +0900    =20
 @@ -84,21 +84,38 @@
 {     =20
        pci_intr_handle_t *vectors;
        struct arm_pci_msi *msi;
 +       int error, off;
 +       pcireg_t ctl;=20

 -       if ((pa->pa_flags & PCI_FLAGS_MSI_OKAY) =3D=3D 0)
 -               return ENODEV;
 +       if ((pa->pa_flags & PCI_FLAGS_MSI_OKAY) =3D=3D 0) {
 +               error =3D ENODEV;
 +               goto fail;
 +       }

        msi =3D arm_pci_msi_lookup(pa);
 -       if (msi =3D=3D NULL || msi->msi_alloc =3D=3D NULL)
 -               return EINVAL;
 +       if (msi =3D=3D NULL || msi->msi_alloc =3D=3D NULL) {
 +               error =3D EINVAL;
 +               goto fail;
 +       }

        vectors =3D msi->msi_alloc(msi, count, pa, exact);
 -       if (vectors =3D=3D NULL)
 -               return ENOMEM;
 +       if (vectors =3D=3D NULL) {
 +               error =3D ENOMEM;
 +               goto fail;
 +       }

        *ihps =3D vectors;

        return 0;
 +
 + fail:
 +       if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSI, &off,
 +           NULL)) {
 +               ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag, off + PCI_MSI_C=
 TL);
 +               ctl &=3D ~PCI_MSI_CTL_MSI_ENABLE;
 +               pci_conf_write(pa->pa_pc, pa->pa_tag, off + PCI_MSI_CTL, ctl=
 );
 +       }
 +       return error;
 }

 static int
 @@ -106,21 +123,38 @@
 {
        pci_intr_handle_t *vectors;
        struct arm_pci_msi *msi;
 +       int error, off;
 +       pcireg_t ctl;

 -       if ((pa->pa_flags & PCI_FLAGS_MSIX_OKAY) =3D=3D 0)
 -               return ENODEV;
 +       if ((pa->pa_flags & PCI_FLAGS_MSIX_OKAY) =3D=3D 0) {
 +               error =3D ENODEV;
 +               goto fail;
 +       }

        msi =3D arm_pci_msi_lookup(pa);
 -       if (msi =3D=3D NULL || msi->msix_alloc =3D=3D NULL)
 -               return EINVAL;
 +       if (msi =3D=3D NULL || msi->msix_alloc =3D=3D NULL) {
 +               error =3D EINVAL;
 +               goto fail;
 +       }

        vectors =3D msi->msix_alloc(msi, table_indexes, count, pa, exact);
 -       if (vectors =3D=3D NULL)
 -               return ENOMEM;
 +       if (vectors =3D=3D NULL) {
 +               error =3D ENOMEM;
 +               goto fail;
 +       }

        *ihps =3D vectors;

        return 0;
 +
 + fail:
 +       if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSIX, &off,
 +           NULL)) {
 +               ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag, off + PCI_MSIX_=
 CTL)
 ;
 +               ctl &=3D ~PCI_MSIX_CTL_ENABLE;
 +               pci_conf_write(pa->pa_pc, pa->pa_tag, off + PCI_MSIX_CTL, ct=
 l)
 ;
 +       }
 +       return error;
 }

 /*
 @@ -203,8 +237,9 @@
 int
 pci_intr_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihps, i=
 n
 t
 *counts, pci_intr_type_t max_type)
 {
 -       int intx_count, msi_count, msix_count, error;
 +       int intx_count, msi_count, msix_count, off, error;
        struct arm_pci_msi *msi;
 +       pcireg_t ctl;

        error =3D EINVAL;

 @@ -245,6 +280,14 @@
                                return 0;
                        }
                }
 +               if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSIX,
 +                   &off, NULL)) {
 +                       ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSIX_CTL);
 +                       ctl &=3D ~PCI_MSIX_CTL_ENABLE;
 +                       pci_conf_write(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSIX_CTL, ctl);
 +               }

                if (msi->msi_alloc !=3D NULL) {
                        if (msi_count =3D=3D -1)
 @@ -257,6 +300,31 @@
                                return 0;
                        }
                }
 +               if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSI,
 +                   &off, NULL)) {
 +                       ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSI_CTL);
 +                       ctl &=3D ~PCI_MSI_CTL_MSI_ENABLE;
 +                       pci_conf_write(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSI_CTL, ctl);
 +               }
 +       } else {
 +               if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSIX,
 +                   &off, NULL)) {
 +                       ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSIX_CTL);
 +                       ctl &=3D ~PCI_MSIX_CTL_ENABLE;
 +                       pci_conf_write(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSIX_CTL, ctl);
 +               }
 +               if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSI,
 +                   &off, NULL)) {
 +                       ctl =3D pci_conf_read(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSI_CTL);
 +                       ctl &=3D ~PCI_MSI_CTL_MSI_ENABLE;
 +                       pci_conf_write(pa->pa_pc, pa->pa_tag,
 +                           off + PCI_MSI_CTL, ctl);
 +               }
        }

        if (intx_count > 0 && (error =3D pci_intx_alloc(pa, ihps)) =3D=3D 0) {=


 --=20
 Kouichi Hashikawa


 --Apple-Mail-4648B2A4-56BD-4E84-8B8B-16F9B9293BA3
 Content-Type: text/html;
 	charset=utf-8
 Content-Transfer-Encoding: quoted-printable

 <html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=3D=
 utf-8"></head><body dir=3D"auto"><div dir=3D"ltr">=EF=BB=BF</div><div dir=3D=
 "ltr"><span style=3D"caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); -webkit=
 -text-size-adjust: auto;">&nbsp;(Patch 2 after Patch 1)</span></div><span st=
 yle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb=
 (0, 0, 0);">if struct msi is not initialized, turn off PCI_MSI_CTL_MSI_ENABL=
 E or&nbsp;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: r=
 gb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">PCI_MSIX_CTL_ENABLE fl=
 ag on pci_msi_machdep.c.</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><br style=3D"-webkit-text-si=
 ze-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span styl=
 e=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0=
 , 0, 0);"></span><br style=3D"-webkit-text-size-adjust: auto; caret-color: r=
 gb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">--- src/sys/arch/arm/p=
 ci/pci_msi_machdep.c-1 &nbsp;&nbsp;&nbsp;2021-01-14 13:07:53.053314571&nbsp;=
 </span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+0</span><span style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">90=
 0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</=
 span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-=
 color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+++ src/sys/arch/arm/pci/pci_msi_=
 machdep.c &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2021-01-15 15:43:44.519248754&nbsp;<=
 /span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret=
 -color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+0</span><span style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">900=
  &nbsp;&nbsp;&nbsp;&nbsp;</span><br style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">@@ -84=
 ,21 +84,38 @@</span><br style=3D"-webkit-text-size-adjust: auto; caret-color=
 : rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjus=
 t: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">{ &nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;</span><br style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;pci_intr_handle_t *vectors;</span><br style=3D"-web=
 kit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"=
 ><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct arm_pc=
 i_msi *msi;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: r=
 gb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;int error, off;</span><br style=3D"-webkit-text-size-adjust:=
  auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pcireg_t ctl;&nbsp;</span><br style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"></span><br style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ((pa-&gt;pa_flags &amp; PCI_FLAGS_MSI_OKA=
 Y) =3D=3D 0)</span><br style=3D"-webkit-text-size-adjust: auto; caret-color:=
  rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust=
 : auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return EN=
 ODEV;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0,=
  0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;if ((pa-&gt;pa_flags &amp; PCI_FLAGS_MSI_OKAY) =3D=3D 0) {</span=
 ><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error =3D ENODEV;</span><br=
  style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: r=
 gb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rg=
 b(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goto fail;</span><br style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br sty=
 le=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(=
 0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0=
 , 0, 0); color: rgb(0, 0, 0);"></span><br style=3D"-webkit-text-size-adjust:=
  auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msi =3D arm_pci_msi_lookup(pa);</s=
 pan><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;if (msi =3D=3D NULL || msi-&gt;msi_alloc =3D=3D NULL)</span><br style=3D"=
 -webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return EINVAL;</span><br style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><sp=
 an style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (msi =3D=3D NULL |=
 | msi-&gt;msi_alloc =3D=3D NULL) {</span><br style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;error =3D EINVAL;</span><br style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;goto fail;</span><br style=3D"-webkit-text-size-adjust: auto; caret-c=
 olor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-a=
 djust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></span=
 ><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;vectors =3D msi-&gt;msi_alloc(msi, count, pa, exact);</span><br style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (vectors =3D=
 =3D NULL)</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rg=
 b(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ENOME=
 M;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0,=
  0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; ca=
 ret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;if (vectors =3D=3D NULL) {</span><br style=3D"-webkit-text-size-adj=
 ust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-=
 webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;error =3D ENOMEM;</span><br style=3D"-webkit-text-size-adjust:=
  auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;goto fail;</span><br style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-siz=
 e-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: au=
 to; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></s=
 pan><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;*ihps =3D vectors;</span><br style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></span=
 ><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;return 0;</span><br style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+</span><br style=
 =3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0,=
  0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);">+ fail:</span><br style=3D"-webkit-text-size-adj=
 ust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-=
 webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pci_get_capability(pa-&gt;pa_p=
 c, pa-&gt;pa_tag, PCI_CAP_MSI, &amp;off,</span><br style=3D"-webkit-text-siz=
 e-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=
 =3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0,=
  0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NULL)=
 ) {</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl =3D pci_conf_r=
 ead(pa-&gt;pa_pc, pa-&gt;pa_tag, off + PCI_MSI_CTL);</span><br style=3D"-web=
 kit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"=
 ><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl &amp;=3D ~PCI_MSI_CTL_MSI_ENABLE;</span><=
 br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color:=
  rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pci_conf_write(pa-&gt;pa_pc, p=
 a-&gt;pa_tag, off + PCI_MSI_CTL, ctl);</span><br style=3D"-webkit-text-size-=
 adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return error;</span><br s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);">}</span><br style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;"></span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">static int</span><br style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);">@@ -106,21 +123,38 @@</span><br style=3D"-webkit-te=
 xt-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span=
  style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: r=
 gb(0, 0, 0);">{</span><br style=3D"-webkit-text-size-adjust: auto; caret-col=
 or: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adj=
 ust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;pci_intr_handle_t *vectors;</span><br style=3D"-we=
 bkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);=
 "><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct arm_pc=
 i_msi *msi;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: r=
 gb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;int error, off;</span><br style=3D"-webkit-text-size-adjust:=
  auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 + &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pcireg_t ctl;</span><br style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 <span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); co=
 lor: rgb(0, 0, 0);"></span><br style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-siz=
 e-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;if ((pa-&gt;pa_flags &amp; PCI_FLAGS_MSIX_OKAY) =3D=
 =3D 0)</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0=
 , 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto=
 ; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ENODEV;<=
 /span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret=
 -color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;if ((pa-&gt;pa_flags &amp; PCI_FLAGS_MSIX_OKAY) =3D=3D 0) {</span><br s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;error =3D ENODEV;</span><br style=
 =3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0,=
  0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;goto fail;</span><br style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><sp=
 an style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"=
 -webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);"></span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;msi =3D arm_pci_msi_lookup(pa);</span><br s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (m=
 si =3D=3D NULL || msi-&gt;msix_alloc =3D=3D NULL)</span><br style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><s=
 pan style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); colo=
 r: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;return EINVAL;</span><br style=3D"-webkit-text-s=
 ize-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span sty=
 le=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(=
 0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (msi =3D=3D NULL || msi-=
 &gt;msix_alloc =3D=3D NULL) {</span><br style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;error =3D EINVAL;</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;goto fail;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color:=
  rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust=
 : auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-siz=
 e-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></span><br s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v=
 ectors =3D msi-&gt;msix_alloc(msi, table_indexes, count, pa, exact);</span><=
 br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color:=
  rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i=
 f (vectors =3D=3D NULL)</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;return ENOMEM;</span><br style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-ad=
 just: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;if (vectors =3D=3D NULL) {</span><br style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><s=
 pan style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); colo=
 r: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;error =3D ENOMEM;</span><br style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;goto fail;</span><br style=3D"-webkit-text-size-adjus=
 t: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-we=
 bkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);=
 ">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-si=
 ze-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span styl=
 e=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0=
 , 0, 0);"></span><br style=3D"-webkit-text-size-adjust: auto; caret-color: r=
 gb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;*ihps =3D vectors;</span><br style=3D"-webkit-text-size-=
 adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"></span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0=
 , 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto=
 ; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;return 0;</span><br style=3D"-webkit-text-size-adjust: auto=
 ; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-te=
 xt-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+</sp=
 an><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ fail:</span><br style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><sp=
 an style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pci_get_capabilit=
 y(pa-&gt;pa_pc, pa-&gt;pa_tag, PCI_CAP_MSIX, &amp;off,</span><br style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;NULL)) {</span><br style=3D"-webkit-text-size-adjust: auto; caret-c=
 olor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-a=
 djust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl =3D=
  pci_conf_read(pa-&gt;pa_pc, pa-&gt;pa_tag, off + PCI_MSIX_CTL)</span><br st=
 yle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb=
 (0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(=
 0, 0, 0); color: rgb(0, 0, 0);">;</span><br style=3D"-webkit-text-size-adjus=
 t: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-we=
 bkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);=
 ">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;ctl &amp;=3D ~PCI_MSIX_CTL_ENABLE;</span><br style=3D"-webkit-te=
 xt-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span=
  style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: r=
 gb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;pci_conf_write(pa-&gt;pa_pc, pa-&gt;pa_tag, off + PC=
 I_MSIX_CTL, ctl)</span><br style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-ad=
 just: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">;</span><br sty=
 le=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(=
 0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0=
 , 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span=
 ><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;return error;</span><br style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">}</span><br style=
 =3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0,=
  0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"></span><br style=3D"-webkit-text-size-adjust: au=
 to; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-=
 text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">/*<=
 /span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret=
 -color: rgb(0, 0, 0); color: rgb(0, 0, 0);">@@ -203,8 +237,9 @@</span><br st=
 yle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb=
 (0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(=
 0, 0, 0); color: rgb(0, 0, 0);">int</span><br style=3D"-webkit-text-size-adj=
 ust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-=
 webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );">pci_intr_alloc(const struct pci_attach_args *pa, pci_intr_handle_t **ihp=
 s, in</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0,=
  0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">t</span><br style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 <span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); co=
 lor: rgb(0, 0, 0);">*counts, pci_intr_type_t max_type)</span><br style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);">{</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">- &nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int intx_count, msi_count, msix_count, error;<=
 /span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret=
 -color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;int intx_count, msi_count, msix_count, off, error;</span><br style=3D"=
 -webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;struct arm=
 _pci_msi *msi;</span><br style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;pcireg_t ctl;</span><br style=3D"-webkit-text-size-adju=
 st: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-w=
 ebkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0)=
 ;"></span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;error =3D EINVAL;</span><br style=3D"-webkit-text-size-adjust:=
  auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webk=
 it-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">=
 </span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">@@ -245,6 +280,14 @@</span><br s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 0;=
 </span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust=
 : auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-web=
 kit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"=
 >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-ad=
 just: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (p=
 ci_get_capability(pa-&gt;pa_pc, pa-&gt;pa_tag, PCI_CAP_MSIX,</span><br style=
 =3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0,=
  0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;off, NULL=
 )) {</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl =3D pci_conf_read(pa-&gt;pa_pc, pa-&gt;pa_=
 tag,</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0=
 , 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;off + PCI_MSIX_CTL);</=
 span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-=
 color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;ctl &amp;=3D ~PCI_MSIX_CTL_ENABLE;</span><br style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;pci_conf_write(pa-&gt;pa_pc, pa-&gt;pa_tag,</span><br style=3D"-webki=
 t-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><=
 span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;off + PCI_MSIX_CTL, ctl);</span><br style=3D"-webki=
 t-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><=
 span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: a=
 uto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit=
 -text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></=
 span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0);=
  color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-=
 color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (msi-&gt;msi_all=
 oc !=3D NULL) {</span><br style=3D"-webkit-text-size-adjust: auto; caret-col=
 or: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adj=
 ust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (msi_count =3D=3D -1)</span=
 ><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-colo=
 r: rgb(0, 0, 0); color: rgb(0, 0, 0);">@@ -257,6 +300,31 @@</span><br style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return 0;</span><=
 br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color=
 : rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color:=
  rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(=
 0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: aut=
 o; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pci_get_ca=
 pability(pa-&gt;pa_pc, pa-&gt;pa_tag, PCI_CAP_MSI,</span><br style=3D"-webki=
 t-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><=
 span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); col=
 or: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;off, NULL)) {</spa=
 n><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); co=
 lor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-col=
 or: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;ctl =3D pci_conf_read(pa-&gt;pa_pc, pa-&gt;pa_tag,</sp=
 an><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;off + PCI_MSI_CTL);</span><br=
  style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: r=
 gb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rg=
 b(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;ctl &amp;=3D ~PCI_MSI_CTL_MSI_ENABLE;</span><br style=3D"-we=
 bkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);=
 "><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;pci_conf_write(pa-&gt;pa_pc, pa-&gt;pa_tag,</span><br style=3D"-webkit-te=
 xt-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span=
  style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: r=
 gb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;off + PCI_MSI_CTL, ctl);</span><br style=3D"-webkit-text=
 -size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span s=
 tyle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rg=
 b(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; c=
 aret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} else {</span><br style=3D"-webkit-text-size-=
 adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;if (pci_get_capability(pa-&gt;pa_pc, pa-&gt;pa_tag, PCI_CAP_=
 MSIX,</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0,=
  0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&amp;off, NULL)) {</span><br style=3D"-webkit-text-size-adjust: auto=
 ; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-te=
 xt-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl =3D pci_conf_read(p=
 a-&gt;pa_pc, pa-&gt;pa_tag,</span><br style=3D"-webkit-text-size-adjust: aut=
 o; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-t=
 ext-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs=
 p;off + PCI_MSIX_CTL);</span><br style=3D"-webkit-text-size-adjust: auto; ca=
 ret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-s=
 ize-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl &amp;=3D ~PCI_MSIX_CTL_=
 ENABLE;</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(=
 0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: aut=
 o; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pci_conf_write(pa-&gt;pa_pc, pa-&gt;pa_tag=
 ,</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
 sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;off + PCI_MSIX_CTL, ctl);=
 </span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0=
 ); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; care=
 t-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</span><br style=3D"=
 -webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0=
 );"><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0)=
 ; color: rgb(0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (pci_get_capability(pa-&gt;pa_pc, pa-&g=
 t;pa_tag, PCI_CAP_MSI,</span><br style=3D"-webkit-text-size-adjust: auto; ca=
 ret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-s=
 ize-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&=
 nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;&nbsp;&nbsp;&nbsp;&amp;off, NULL)) {</span><br style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span st=
 yle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb=
 (0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl =3D=
  pci_conf_read(pa-&gt;pa_pc, pa-&gt;pa_tag,</span><br style=3D"-webkit-text-=
 size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span st=
 yle=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb=
 (0, 0, 0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;off + PCI_MSI_CTL);</span><br style=3D"-webkit-text-size-a=
 djust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D=
 "-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0,=
  0);">+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ctl &amp;=3D=
  ~PCI_MSI_CTL_MSI_ENABLE;</span><br style=3D"-webkit-text-size-adjust: auto;=
  caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-tex=
 t-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pci_conf_write(pa-&gt;pa=
 _pc, pa-&gt;pa_tag,</span><br style=3D"-webkit-text-size-adjust: auto; caret=
 -color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size=
 -adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbs=
 p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
 bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;off + P=
 CI_MSI_CTL, ctl);</span><br style=3D"-webkit-text-size-adjust: auto; caret-c=
 olor: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-a=
 djust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);">+ &nbsp;&nbsp;=
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</s=
 pan><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: auto; caret-co=
 lor: rgb(0, 0, 0); color: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
 ;&nbsp;}</span><br style=3D"-webkit-text-size-adjust: auto; caret-color: rgb=
 (0, 0, 0); color: rgb(0, 0, 0);"><span style=3D"-webkit-text-size-adjust: au=
 to; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"></span><br style=3D"-we=
 bkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);=
 "><span style=3D"-webkit-text-size-adjust: auto; caret-color: rgb(0, 0, 0); c=
 olor: rgb(0, 0, 0);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (intx_coun=
 t &gt; 0 &amp;&amp; (error =3D pci_intx_alloc(pa, ihps)) =3D=3D 0) {</span><=
 div><font color=3D"#000000"><span style=3D"caret-color: rgb(0, 0, 0); -webki=
 t-text-size-adjust: auto;"><br></span></font><div dir=3D"ltr"><span>-- </spa=
 n><br><span>Kouichi Hashikawa</span><br><br><blockquote type=3D"cite"><span>=
 </span></blockquote><blockquote type=3D"cite"><span></span></blockquote><blo=
 ckquote type=3D"cite"><span></span></blockquote><blockquote type=3D"cite"><s=
 pan></span></blockquote><blockquote type=3D"cite"><span></span></blockquote>=
 <blockquote type=3D"cite"><span></span></blockquote><blockquote type=3D"cite=
 "><span></span></blockquote><blockquote type=3D"cite"><span></span></blockqu=
 ote></div></div></body></html>=

 --Apple-Mail-4648B2A4-56BD-4E84-8B8B-16F9B9293BA3--

From: Kouichi Hashikawa <hashikaw@mail.ru>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/55926
Date: Wed, 10 Feb 2021 00:16:25 +0900

 Sorry, my explanation is not enough.

 On non-acpi (fdt) environment, gic_v2m_init() is called from gic_fdt_attach_=
 v2m() at arc/sys/arch/arm/fdt/gic_fdt.c.
 But NPCI > 0 && defined(__HAVE_PCI_MSI_MSIX) is not defined, gic_fdt_attach_=
 v2m() is not defined.
 So, gic_v2m_init() is not called, then pci_intr_alloc() is called without st=
 rict msi is initialized.


From: Kouichi Hashikawa <hashikaw@mail.ru>
To: gnats-bugs@netbsd.org
Cc: mlelstv@serpens.de, gnats-admin@netbsd.org, kern-bug-people@netbsd.org
Subject: Re: kern/55926: aarch64: pci_intr_alloc() return msi/msi-x count, but struct msi is not initialized.
Date: Mon, 15 Mar 2021 23:47:37 +0900

 I found the cause of the problem.

 I use RPI4_UEFI_Firmware's start4.elf, fixup4.dat (without RPI_EFI.fd).
 When I use netbsd's one or one at rasberrypi/firmware at github,
 https://github.com/raspberrypi/firmware/tree/stable/boot

 the problem did not occurred.


 I appreciate Michael val Elast checking.

 -- 
 Kouichi Hashikawa

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.