* FAILED: patch "[PATCH] PCI/MSI: Prevent MSI hardware interrupt number truncation" failed to apply to 4.19-stable tree
@ 2024-02-26 12:32 gregkh
2024-02-26 15:03 ` [PATCH linux-4.19.y] PCI/MSI: Prevent MSI hardware interrupt number truncation Thomas Gleixner
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2024-02-26 12:32 UTC (permalink / raw)
To: vidyas, sdonthineni, tglx; +Cc: stable
The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x db744ddd59be798c2627efbfc71f707f5a935a40
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2024022609-womanless-imprison-678c@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..
Possible dependencies:
db744ddd59be ("PCI/MSI: Prevent MSI hardware interrupt number truncation")
aa423ac4221a ("PCI/MSI: Split out irqdomain code")
a01e09ef1237 ("PCI/MSI: Split out !IRQDOMAIN code")
54324c2f3d72 ("PCI/MSI: Split out CONFIG_PCI_MSI independent part")
288c81ce4be7 ("PCI/MSI: Move code into a separate directory")
29a03ada4a00 ("PCI/MSI: Cleanup include zoo")
ae72f3156729 ("PCI/MSI: Make arch_restore_msi_irqs() less horrible.")
e58f2259b91c ("genirq/msi, treewide: Use a named struct for PCI/MSI attributes")
ade044a3d0f0 ("PCI/MSI: Remove msi_desc_to_pci_sysdata()")
9e8688c5f299 ("PCI/MSI: Make pci_msi_domain_write_msg() static")
29bbc35e29d9 ("PCI/MSI: Fix pci_irq_vector()/pci_irq_get_affinity()")
c36e33e2f477 ("Merge tag 'irq-urgent-2021-11-14' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From db744ddd59be798c2627efbfc71f707f5a935a40 Mon Sep 17 00:00:00 2001
From: Vidya Sagar <vidyas@nvidia.com>
Date: Mon, 15 Jan 2024 19:26:49 +0530
Subject: [PATCH] PCI/MSI: Prevent MSI hardware interrupt number truncation
While calculating the hardware interrupt number for a MSI interrupt, the
higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI
domain number gets truncated because of the shifted value casting to return
type of pci_domain_nr() which is 'int'. This for example is resulting in
same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.
To address this cast the PCI domain number to 'irq_hw_number_t' before left
shifting it to calculate the hardware interrupt number.
Please note that this fixes the issue only on 64-bit systems and doesn't
change the behavior for 32-bit systems i.e. the 32-bit systems continue to
have the issue. Since the issue surfaces only if there are too many PCIe
controllers in the system which usually is the case in modern server
systems and they don't tend to run 32-bit kernels.
Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain")
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240115135649.708536-1-vidyas@nvidia.com
diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c
index c8be056c248d..cfd84a899c82 100644
--- a/drivers/pci/msi/irqdomain.c
+++ b/drivers/pci/msi/irqdomain.c
@@ -61,7 +61,7 @@ static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc)
return (irq_hw_number_t)desc->msi_index |
pci_dev_id(dev) << 11 |
- (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27;
+ ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27;
}
static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH linux-4.19.y] PCI/MSI: Prevent MSI hardware interrupt number truncation
2024-02-26 12:32 FAILED: patch "[PATCH] PCI/MSI: Prevent MSI hardware interrupt number truncation" failed to apply to 4.19-stable tree gregkh
@ 2024-02-26 15:03 ` Thomas Gleixner
2024-02-27 9:01 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Gleixner @ 2024-02-26 15:03 UTC (permalink / raw)
To: gregkh, vidyas, sdonthineni; +Cc: stable
From: Vidya Sagar <vidyas@nvidia.com>
Commit db744ddd59be798c2627efbfc71f707f5a935a40 upstream.
While calculating the hardware interrupt number for a MSI interrupt, the
higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI
domain number gets truncated because of the shifted value casting to return
type of pci_domain_nr() which is 'int'. This for example is resulting in
same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.
To address this cast the PCI domain number to 'irq_hw_number_t' before left
shifting it to calculate the hardware interrupt number.
Please note that this fixes the issue only on 64-bit systems and doesn't
change the behavior for 32-bit systems i.e. the 32-bit systems continue to
have the issue. Since the issue surfaces only if there are too many PCIe
controllers in the system which usually is the case in modern server
systems and they don't tend to run 32-bit kernels.
Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain")
Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
[ tglx: Backport to linux-4.19.y ]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Shanker Donthineni <sdonthineni@nvidia.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240115135649.708536-1-vidyas@nvidia.com
---
drivers/pci/msi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -1311,7 +1311,7 @@ static irq_hw_number_t pci_msi_domain_ca
return (irq_hw_number_t)desc->msi_attrib.entry_nr |
pci_dev_id(dev) << 11 |
- (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27;
+ ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27;
}
static inline bool pci_msi_desc_is_multi_msi(struct msi_desc *desc)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH linux-4.19.y] PCI/MSI: Prevent MSI hardware interrupt number truncation
2024-02-26 15:03 ` [PATCH linux-4.19.y] PCI/MSI: Prevent MSI hardware interrupt number truncation Thomas Gleixner
@ 2024-02-27 9:01 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2024-02-27 9:01 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: vidyas, sdonthineni, stable
On Mon, Feb 26, 2024 at 04:03:46PM +0100, Thomas Gleixner wrote:
>
> From: Vidya Sagar <vidyas@nvidia.com>
>
> Commit db744ddd59be798c2627efbfc71f707f5a935a40 upstream.
>
> While calculating the hardware interrupt number for a MSI interrupt, the
> higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI
> domain number gets truncated because of the shifted value casting to return
> type of pci_domain_nr() which is 'int'. This for example is resulting in
> same hardware interrupt number for devices 0019:00:00.0 and 0039:00:00.0.
>
> To address this cast the PCI domain number to 'irq_hw_number_t' before left
> shifting it to calculate the hardware interrupt number.
>
> Please note that this fixes the issue only on 64-bit systems and doesn't
> change the behavior for 32-bit systems i.e. the 32-bit systems continue to
> have the issue. Since the issue surfaces only if there are too many PCIe
> controllers in the system which usually is the case in modern server
> systems and they don't tend to run 32-bit kernels.
>
> Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain")
> Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> [ tglx: Backport to linux-4.19.y ]
Didn't apply there, are you sure this was correct?
Anyway, I fixed it up by hand...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-02-27 9:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 12:32 FAILED: patch "[PATCH] PCI/MSI: Prevent MSI hardware interrupt number truncation" failed to apply to 4.19-stable tree gregkh
2024-02-26 15:03 ` [PATCH linux-4.19.y] PCI/MSI: Prevent MSI hardware interrupt number truncation Thomas Gleixner
2024-02-27 9:01 ` Greg KH
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).