From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796222686; b=qEuHQDDNLaGnF4nXjJcPCegAvGEg1N/Q7JuSgTkzhroJet1rdhqGwBbudRuhF5K+tITI /XiYMQz00o5AKTHrrb3Cweur9485JMQa/jv63Wxut/muNq2k5cO/FTGzlGIYZvSPzsAHs Gos4EHCtwG2sDVfNxFfC0DcjN/HVn5tt7dvo0z1GtBywuInR1QKziedkS4jzUTCLd2VKC MqlyrvldzUxoDeiEI5DRUnPt9s4cF96rpLVz3WZ6RSEkBByl+SeuvSMWh0JcOn96DA/p1 WVdNQRJcqXM77oL8Pi1I4saWDnFAd4Oh280ywHkwz/YaCib+3pUuby9CV4lS3bzG7Ow== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796222686; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Transfer-Encoding; bh=LxO1XG0fZfH8iAR8eE+zY0yo85vg3cts7MONucPLu/U=; b=gIRZNn1pZeVWnIyXwuVNqScbNynwH9vFQYKrhofYld2WuVUB2xqz+A5UxECiEnRtnkqo QkuMqG5vsJfTFjSazW4EvX1h4cl4GclTl3sGA7MQ0pTYDG/Mt16Q4qPnx8cw/Hgy2jg5F G4+VWqNf+YkyyKk17G3R7DryCeqDZ/e0jekUTERhc60goglHDqIQvGCPcfagi7Q/rduZ6 jxIr2TOo1s/Wgs/QIymg5MaBEuSh/xkIyjbgTliT8pchQhJlqqsaRYKW4b1LALf6PIuZZ wytI+N4nv0VsATgycgZlAyMkwVhyhrFwDLksaE0S5tpy7mVp0PvrQDpYILTosibq38w== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QCOOlA1s; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63062606A322; Wed, 2 Dec 2026 14:44:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=QCOOlA1s Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF0F61F000C1; Wed, 2 Dec 2026 14:44:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796222685; bh=LxO1XG0fZfH8iAR8eE+zY0yo85vg3cts7MONucPLu/U=; h=From:To:Cc:Subject:Date; b=QCOOlA1sCVtC05XLzvLGh7uLtfo7ewSvFysj1grGtR8vE0addeTXhyxvmeBX8IHzy vsZ+NgYK28q+cslX7yueoKFR7lLDhezuiMmomjg5gzBcujqEpydqggKydQMAh71uOK FEq2EQMZkoWlS8EWz6zHKF/L5qY2YfA146yQr9/rTTikly2NiPfqLLnT6AHFYfjCvA +aqBOhevQ/PKdaSLTx/cPA9G96319EYVogkNrtm/kigq4Ha68Zr3KwwfIBEHsm4v0H YnsVW7oAj4+/DcYPJR5SFztOc/9NA7OH51XUIFRFAglA1IRK4i948NJ+XWdJ0WopZX S01Y7LHekacUA== From: Hamza Mahfooz To: linux-hyperv@vger.kernel.org Cc: Haiyang Zhang , Wei Liu , Dexuan Cui , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Rob Herring , Bjorn Helgaas , Jake Oshins , linux-pci@vger.kernel.org, Michael Kelley , Laurence Oberman , Hamza Mahfooz , stable@vger.kernel.org, Asher Kariv , Mukesh R Subject: [PATCH v3] PCI: hv: Hardwire PCI_INTERRUPT_LINE and PCI_INTERRUPT_PIN to 0 Date: Wed, 2 Dec 2026 09:43:45 -0500 Message-ID: <20261202144345.275647-1-hamza@kernel.org> X-Mailer: git-send-email 2.43.7 X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Asher Kariv Signed-off-by: Mukesh R Signed-off-by: Wei Liu Signed-off-by: Hamza Mahfooz --- 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