From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: linux-pci@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
bcm-kernel-feedback-list@broadcom.com,
jonathan.derrick@linux.dev, kw@linux.com,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org,
lpieralisi@kernel.org, marek.vasut+renesas@gmail.com,
minghuan.Lian@nxp.com, mingkai.hu@nxp.com,
m.karthikeyan@mobiveil.co.in, nirmal.patel@linux.intel.com,
rjui@broadcom.com, robh@kernel.org, roy.zang@nxp.com,
sbranden@broadcom.com, yoshihiro.shimoda.uh@renesas.com,
Zhiqiang.Hou@nxp.com, linux-kernel@vger.kernel.org
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Subject: [PATCH 1/3] PCI: vmd: Correct PCI Header Type Register's MFD bit check
Date: Tue, 3 Oct 2023 15:52:58 +0300 [thread overview]
Message-ID: <20231003125300.5541-2-ilpo.jarvinen@linux.intel.com> (raw)
In-Reply-To: <20231003125300.5541-1-ilpo.jarvinen@linux.intel.com>
vmd_domain_reset() attempts to find whether the device may contain
multiple functions by checking 0x80 (Multi-Function Device), however,
the hdr_type variable has already been masked with PCI_HEADER_TYPE_MASK
so the check can never true.
To fix the issue, don't mask the read with PCI_HEADER_TYPE_MASK.
Fixes: 6aab5622296b ("PCI: vmd: Clean up domain before enumeration")
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Cc: Nirmal Patel <nirmal.patel@linux.intel.com>
---
drivers/pci/controller/vmd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index e718a816d481..d5b97a6aae56 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -525,8 +525,7 @@ static void vmd_domain_reset(struct vmd_dev *vmd)
base = vmd->cfgbar + PCIE_ECAM_OFFSET(bus,
PCI_DEVFN(dev, 0), 0);
- hdr_type = readb(base + PCI_HEADER_TYPE) &
- PCI_HEADER_TYPE_MASK;
+ hdr_type = readb(base + PCI_HEADER_TYPE);
functions = (hdr_type & 0x80) ? 8 : 1;
for (fn = 0; fn < functions; fn++) {
--
2.30.2
next prev parent reply other threads:[~2023-10-03 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-03 12:52 [PATCH 0/3] PCI: PCI_HEADER_TYPE bugfix & cleanups Ilpo Järvinen
2023-10-03 12:52 ` Ilpo Järvinen [this message]
2023-10-03 12:52 ` [PATCH 2/3] PCI: Add PCI_HEADER_TYPE_MFD pci_regs.h Ilpo Järvinen
2023-10-03 12:53 ` [PATCH 3/3] PCI: Use PCI_HEADER_TYPE_* instead of literals Ilpo Järvinen
2023-10-03 13:07 ` Wolfram Sang
2023-10-03 16:58 ` [PATCH 0/3] PCI: PCI_HEADER_TYPE bugfix & cleanups Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231003125300.5541-2-ilpo.jarvinen@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=bhelgaas@google.com \
--cc=jonathan.derrick@linux.dev \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=lpieralisi@kernel.org \
--cc=m.karthikeyan@mobiveil.co.in \
--cc=marek.vasut+renesas@gmail.com \
--cc=minghuan.Lian@nxp.com \
--cc=mingkai.hu@nxp.com \
--cc=nirmal.patel@linux.intel.com \
--cc=rjui@broadcom.com \
--cc=robh@kernel.org \
--cc=roy.zang@nxp.com \
--cc=sbranden@broadcom.com \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).