* [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0
@ 2026-12-02 14:43 Hamza Mahfooz
2026-12-02 14:48 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Hamza Mahfooz @ 2026-12-02 14:43 UTC (permalink / raw)
To: linux-hyperv
Cc: Haiyang Zhang, Wei Liu, Dexuan Cui, Lorenzo Pieralisi,
Krzysztof Wilczyński, Manivannan Sadhasivam, Rob Herring,
Bjorn Helgaas, Jake Oshins, linux-pci, Michael Kelley,
Laurence Oberman, Hamza Mahfooz, stable, Asher Kariv, Mukesh R
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0
2026-12-02 14:43 [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0 Hamza Mahfooz
@ 2026-12-02 14:48 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-12-02 14:48 UTC (permalink / raw)
To: Hamza Mahfooz; +Cc: linux-pci
> 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>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202144345.275647-1-hamza@kernel.org?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-12-02 14:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 14:43 [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0 Hamza Mahfooz
2026-12-02 14:48 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.