Date: Thu, 5 Sep 2019 23:54:44 +0000 (UTC) From: Warner Losh <imp@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r351915 - stable/12/sys/dev/pci Message-ID: <201909052354.x85NsiMT059387@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: imp Date: Thu Sep 5 23:54:44 2019 New Revision: 351915 URL: https://svnweb.freebsd.org/changeset/base/351915 Log: MFC r349845: Work around devices which return all zeros for reads of existing MSI-X table VCTRL registers. Note: This is confirmed to fix the nvme lost interrupt issues, seen on both virtual and real cards. PR: 211713 Modified: stable/12/sys/dev/pci/pci.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Thu Sep 5 23:40:38 2019 (r351914) +++ stable/12/sys/dev/pci/pci.c Thu Sep 5 23:54:44 2019 (r351915) @@ -1661,10 +1661,13 @@ pci_mask_msix(device_t dev, u_int index) KASSERT(msix->msix_msgnum > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (!(val & PCIM_MSIX_VCTRL_MASK)) { - val |= PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val |= PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } void @@ -1677,10 +1680,13 @@ pci_unmask_msix(device_t dev, u_int index) KASSERT(msix->msix_table_len > index, ("bogus index")); offset = msix->msix_table_offset + index * 16 + 12; val = bus_read_4(msix->msix_table_res, offset); - if (val & PCIM_MSIX_VCTRL_MASK) { - val &= ~PCIM_MSIX_VCTRL_MASK; - bus_write_4(msix->msix_table_res, offset, val); - } + val &= ~PCIM_MSIX_VCTRL_MASK; + + /* + * Some devices (e.g. Samsung PM961) do not support reads of this + * register, so always write the new value. + */ + bus_write_4(msix->msix_table_res, offset, val); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201909052354.x85NsiMT059387>