From: Hamza Mahfooz <hamza@kernel.org>
To: linux-hyperv@vger.kernel.org
Cc: "Haiyang Zhang" <haiyangz@microsoft.com>,
"Wei Liu" <wei.liu@kernel.org>,
"Dexuan Cui" <decui@microsoft.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Jake Oshins" <jakeo@microsoft.com>,
linux-pci@vger.kernel.org,
"Michael Kelley" <mhklinux@outlook.com>,
"Laurence Oberman" <loberman@redhat.com>,
"Hamza Mahfooz" <hamza@kernel.org>,
stable@vger.kernel.org, "Asher Kariv" <askariv@microsoft.com>,
"Mukesh R" <mrathor@linux.microsoft.com>
Subject: [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0
Date: Wed, 2 Dec 2026 09:43:45 -0500 [thread overview]
Message-ID: <20261202144345.275647-1-hamza@kernel.org> (raw)
Hyper-V Discrete Device Assignment (DDA) does not support legacy (INTx)
interrupts.
The current code recognizes PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN
reads and forces a zero value, but only for 8 bit reads. If a 16 or 32
bit read overlaps these fields, they may be returned as a non-zero
value. Fix this by recognizing such overlap, and forcing the
PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN bytes to zero while retaining
the adjacent bytes returned by the host/HW.
Cc: stable@vger.kernel.org
Fixes: 4daace0d8ce8 ("PCI: hv: Add paravirtual PCI front-end for Microsoft Hyper-V VMs")
Co-developed-by: Asher Kariv <askariv@microsoft.com>
Signed-off-by: Asher Kariv <askariv@microsoft.com>
Signed-off-by: Mukesh R <mrathor@linux.microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Hamza Mahfooz <hamza@kernel.org>
---
v2:
- Fix a compilation error
v3:
- Capitalize "Hardwire" in the subject. (Michael)
- Add description/comment clarifications. (Michael)
- Also hardwire PCI_INTERRUPT_LINE to 0 for 16 and 32 bit reads. (Michael)
- Emulate 16 bit reads of PCI_INTERRUPT_LINE/PCI_INTERRUPT_PIN, and clear
the low 16 bits of 32 bit reads instead of writing through a char
pointer.
---
drivers/pci/controller/pci-hyperv.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
index 824cf27e85e6..05a528df7a51 100644
--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1213,8 +1213,7 @@ static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where,
PCI_CAPABILITY_LIST) {
/* ROM BARs are unimplemented */
*val = 0;
- } else if ((where >= PCI_INTERRUPT_LINE && where + size <= PCI_INTERRUPT_PIN) ||
- (where >= PCI_INTERRUPT_PIN && where + size <= PCI_MIN_GNT)) {
+ } else if (where >= PCI_INTERRUPT_LINE && where + size <= PCI_MIN_GNT) {
/*
* Interrupt Line and Interrupt PIN are hard-wired to zero
* because this front-end only supports message-signaled
@@ -1256,6 +1255,14 @@ static void _hv_pcifront_read_config(struct hv_pci_dev *hpdev, int where,
mb();
}
spin_unlock_irqrestore(&hbus->config_lock, flags);
+
+ /*
+ * Make sure PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN are
+ * hard-wired to 0, since they may be included in a 32 bit
+ * read, which is skipped by the above emulation.
+ */
+ if (where == PCI_INTERRUPT_LINE)
+ *val &= ~0xffff;
} else {
dev_err(dev, "Attempt to read beyond a function's config space.\n");
}
--
2.56.1
next reply other threads:[~2026-12-02 14:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 14:43 Hamza Mahfooz [this message]
2026-12-02 14:48 ` [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0 sashiko-bot
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=20261202144345.275647-1-hamza@kernel.org \
--to=hamza@kernel.org \
--cc=askariv@microsoft.com \
--cc=bhelgaas@google.com \
--cc=decui@microsoft.com \
--cc=haiyangz@microsoft.com \
--cc=jakeo@microsoft.com \
--cc=kwilczynski@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=loberman@redhat.com \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=mhklinux@outlook.com \
--cc=mrathor@linux.microsoft.com \
--cc=robh@kernel.org \
--cc=stable@vger.kernel.org \
--cc=wei.liu@kernel.org \
/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