From: sashiko-bot@kernel.org
To: wei.liu@kernel.org
Cc: linux-hyperv@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: hv: hardwire PCI_INTERRUPT_PIN to 0
Date: Sun, 13 Sep 2026 22:19:39 +0000 [thread overview]
Message-ID: <20260913221940.05A1A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260913221039.2218950-1-wei.liu@kernel.org>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] The patch fails to hard-wire `PCI_INTERRUPT_LINE` to 0 during 16/32-bit reads, introducing inconsistent emulation behavior.
- [Medium] Modifying the returned integer via `char *` pointer arithmetic is broken on big-endian architectures.
- [Low] Extraneous closing brace causes a syntax error and breaks compilation.
--
commit 34dba20e549ad1a394e94eeb91577f3b24614432
Author: Mukesh R <mrathor@linux.microsoft.com>
PCI: hv: hardwire PCI_INTERRUPT_PIN to 0
This commit hardwires PCI_INTERRUPT_PIN to 0 for Hyper-V Discrete Device
Assignment, as it does not support legacy (INTx) interrupts. It addresses
an issue where 16-bit or 32-bit reads miss the previous 8-bit emulation
and yield non-zero values.
> diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c
> index 89816a2bd7cd3..e6db82413addb 100644
> --- a/drivers/pci/controller/pci-hyperv.c
> +++ b/drivers/pci/controller/pci-hyperv.c
> @@ -1240,6 +1240,16 @@ 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_PIN is hard-wired to 0, since it
> + * may be read using a 32bit read, which is skipped by the
> + * above emulation.
> + */
> + if (where <= PCI_INTERRUPT_PIN &&
> + PCI_INTERRUPT_PIN < (where + size))
[Severity: Medium]
Does this logic miss PCI_INTERRUPT_LINE?
The previous emulation blocks in _hv_pcifront_read_config() explicitly
hard-wire the 8-bit read of PCI_INTERRUPT_LINE to 0.
It seems a 16-bit or 32-bit config read encompassing PCI_INTERRUPT_LINE
would leak the hardware's non-zero value, violating the design intent to
hide legacy interrupts.
> + *((char *)val + PCI_INTERRUPT_PIN - where) = 0;
[Severity: Medium]
Will modifying the returned integer via char * pointer arithmetic work on
big-endian architectures?
For a 32-bit read on big-endian systems, casting a u32 * to char * and
indexing by byte offset modifies the wrong byte in memory.
This could fail to clear PCI_INTERRUPT_PIN and might accidentally zero
another byte like PCI_MIN_GNT.
> + }
[Severity: Low]
Could this extraneous closing brace cause a compilation failure?
It doesn't appear to match any opening brace in the added block, which
would break the block structure and lead to a syntax error.
> } else {
> dev_err(dev, "Attempt to read beyond a function's config space.\n");
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260913221039.2218950-1-wei.liu@kernel.org?part=1
next prev parent reply other threads:[~2026-09-13 22:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-13 22:10 [PATCH] PCI: hv: hardwire PCI_INTERRUPT_PIN to 0 wei.liu
2026-09-13 22:19 ` sashiko-bot [this message]
2026-09-13 22:51 ` Wei Liu
2026-09-13 22:52 ` Wei Liu
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=20260913221940.05A1A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--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 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.