LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] PCI/MSI: Skip masking MSI-X on Xen PV
@ 2021-08-26 17:03 Marek Marczykowski-Górecki
2021-08-26 20:56 ` Bjorn Helgaas
2021-08-26 22:33 ` [tip: irq/urgent] " tip-bot2 for Marek Marczykowski-Górecki
0 siblings, 2 replies; 3+ messages in thread
From: Marek Marczykowski-Górecki @ 2021-08-26 17:03 UTC (permalink / raw)
To: linux-kernel
Cc: Marek Marczykowski-Górecki, stable, xen-devel,
Bjorn Helgaas, Marc Zyngier, Thomas Gleixner,
open list:PCI SUBSYSTEM
When running as Xen PV guest, masking MSI-X is a responsibility of the
hypervisor. Guest has no write access to relevant BAR at all - when it
tries to, it results in a crash like this:
BUG: unable to handle page fault for address: ffffc9004069100c
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
PGD 18f1c067 P4D 18f1c067 PUD 4dbd067 PMD 4fba067 PTE 80100000febd4075
Oops: 0003 [#1] SMP NOPTI
CPU: 0 PID: 234 Comm: kworker/0:2 Tainted: G W 5.14.0-rc7-1.fc32.qubes.x86_64 #15
Workqueue: events work_for_cpu_fn
RIP: e030:__pci_enable_msix_range.part.0+0x26b/0x5f0
Code: 2f 96 ff 48 89 44 24 28 48 89 c7 48 85 c0 0f 84 f6 01 00 00 45 0f b7 f6 48 8d 40 0c ba 01 00 00 00 49 c1 e6 04 4a 8d 4c 37 1c <89> 10 48 83 c0 10 48 39 c1 75 f5 41 0f b6 44 24 6a 84 c0 0f 84 48
RSP: e02b:ffffc9004018bd50 EFLAGS: 00010212
RAX: ffffc9004069100c RBX: ffff88800ed412f8 RCX: ffffc9004069105c
RDX: 0000000000000001 RSI: 00000000000febd4 RDI: ffffc90040691000
RBP: 0000000000000003 R08: 0000000000000000 R09: 00000000febd404f
R10: 0000000000007ff0 R11: ffff88800ee8ae40 R12: ffff88800ed41000
R13: 0000000000000000 R14: 0000000000000040 R15: 00000000feba0000
FS: 0000000000000000(0000) GS:ffff888018400000(0000) knlGS:0000000000000000
CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: ffff8000007f5ea0 CR3: 0000000012f6a000 CR4: 0000000000000660
Call Trace:
e1000e_set_interrupt_capability+0xbf/0xd0 [e1000e]
e1000_probe+0x41f/0xdb0 [e1000e]
local_pci_probe+0x42/0x80
(...)
There is pci_msi_ignore_mask variable for bypassing MSI(-X) masking on Xen
PV, but msix_mask_all() missed checking it. Add the check there too.
Fixes: 7d5ec3d36123 ("PCI/MSI: Mask all unused MSI-X entries")
Cc: stable@vger.kernel.org
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
Cc: xen-devel@lists.xenproject.org
Changes in v2:
- update commit message (MSI -> MSI-X)
---
drivers/pci/msi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index e5e75331b415..3a9f4f8ad8f9 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -776,6 +776,9 @@ static void msix_mask_all(void __iomem *base, int tsize)
u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT;
int i;
+ if (pci_msi_ignore_mask)
+ return;
+
for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE)
writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL);
}
--
2.31.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] PCI/MSI: Skip masking MSI-X on Xen PV
2021-08-26 17:03 [PATCH v2] PCI/MSI: Skip masking MSI-X on Xen PV Marek Marczykowski-Górecki
@ 2021-08-26 20:56 ` Bjorn Helgaas
2021-08-26 22:33 ` [tip: irq/urgent] " tip-bot2 for Marek Marczykowski-Górecki
1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2021-08-26 20:56 UTC (permalink / raw)
To: Marek Marczykowski-Górecki
Cc: linux-kernel, stable, xen-devel, Bjorn Helgaas, Marc Zyngier,
Thomas Gleixner, open list:PCI SUBSYSTEM
On Thu, Aug 26, 2021 at 07:03:42PM +0200, Marek Marczykowski-Górecki wrote:
> When running as Xen PV guest, masking MSI-X is a responsibility of the
> hypervisor. Guest has no write access to relevant BAR at all - when it
> tries to, it results in a crash like this:
>
> BUG: unable to handle page fault for address: ffffc9004069100c
> #PF: supervisor write access in kernel mode
> #PF: error_code(0x0003) - permissions violation
> PGD 18f1c067 P4D 18f1c067 PUD 4dbd067 PMD 4fba067 PTE 80100000febd4075
> Oops: 0003 [#1] SMP NOPTI
> CPU: 0 PID: 234 Comm: kworker/0:2 Tainted: G W 5.14.0-rc7-1.fc32.qubes.x86_64 #15
> Workqueue: events work_for_cpu_fn
> RIP: e030:__pci_enable_msix_range.part.0+0x26b/0x5f0
> Code: 2f 96 ff 48 89 44 24 28 48 89 c7 48 85 c0 0f 84 f6 01 00 00 45 0f b7 f6 48 8d 40 0c ba 01 00 00 00 49 c1 e6 04 4a 8d 4c 37 1c <89> 10 48 83 c0 10 48 39 c1 75 f5 41 0f b6 44 24 6a 84 c0 0f 84 48
> RSP: e02b:ffffc9004018bd50 EFLAGS: 00010212
> RAX: ffffc9004069100c RBX: ffff88800ed412f8 RCX: ffffc9004069105c
> RDX: 0000000000000001 RSI: 00000000000febd4 RDI: ffffc90040691000
> RBP: 0000000000000003 R08: 0000000000000000 R09: 00000000febd404f
> R10: 0000000000007ff0 R11: ffff88800ee8ae40 R12: ffff88800ed41000
> R13: 0000000000000000 R14: 0000000000000040 R15: 00000000feba0000
> FS: 0000000000000000(0000) GS:ffff888018400000(0000) knlGS:0000000000000000
> CS: e030 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: ffff8000007f5ea0 CR3: 0000000012f6a000 CR4: 0000000000000660
> Call Trace:
> e1000e_set_interrupt_capability+0xbf/0xd0 [e1000e]
> e1000_probe+0x41f/0xdb0 [e1000e]
> local_pci_probe+0x42/0x80
> (...)
>
> There is pci_msi_ignore_mask variable for bypassing MSI(-X) masking on Xen
> PV, but msix_mask_all() missed checking it. Add the check there too.
>
> Fixes: 7d5ec3d36123 ("PCI/MSI: Mask all unused MSI-X entries")
> Cc: stable@vger.kernel.org
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> Cc: xen-devel@lists.xenproject.org
>
> Changes in v2:
> - update commit message (MSI -> MSI-X)
> ---
> drivers/pci/msi.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index e5e75331b415..3a9f4f8ad8f9 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -776,6 +776,9 @@ static void msix_mask_all(void __iomem *base, int tsize)
> u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT;
> int i;
>
> + if (pci_msi_ignore_mask)
> + return;
> +
> for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE)
> writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL);
> }
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip: irq/urgent] PCI/MSI: Skip masking MSI-X on Xen PV
2021-08-26 17:03 [PATCH v2] PCI/MSI: Skip masking MSI-X on Xen PV Marek Marczykowski-Górecki
2021-08-26 20:56 ` Bjorn Helgaas
@ 2021-08-26 22:33 ` tip-bot2 for Marek Marczykowski-Górecki
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Marek Marczykowski-Górecki @ 2021-08-26 22:33 UTC (permalink / raw)
To: linux-tip-commits
Cc: marmarek, Thomas Gleixner, Bjorn Helgaas, stable, x86, linux-kernel, maz
The following commit has been merged into the irq/urgent branch of tip:
Commit-ID: 1a519dc7a73c977547d8b5108d98c6e769c89f4b
Gitweb: https://git.kernel.org/tip/1a519dc7a73c977547d8b5108d98c6e769c89f4b
Author: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
AuthorDate: Thu, 26 Aug 2021 19:03:42 +02:00
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 27 Aug 2021 00:27:15 +02:00
PCI/MSI: Skip masking MSI-X on Xen PV
When running as Xen PV guest, masking MSI-X is a responsibility of the
hypervisor. The guest has no write access to the relevant BAR at all - when
it tries to, it results in a crash like this:
BUG: unable to handle page fault for address: ffffc9004069100c
#PF: supervisor write access in kernel mode
#PF: error_code(0x0003) - permissions violation
RIP: e030:__pci_enable_msix_range.part.0+0x26b/0x5f0
e1000e_set_interrupt_capability+0xbf/0xd0 [e1000e]
e1000_probe+0x41f/0xdb0 [e1000e]
local_pci_probe+0x42/0x80
(...)
The recently introduced function msix_mask_all() does not check the global
variable pci_msi_ignore_mask which is set by XEN PV to bypass the masking
of MSI[-X] interrupts.
Add the check to make this function XEN PV compatible.
Fixes: 7d5ec3d36123 ("PCI/MSI: Mask all unused MSI-X entries")
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20210826170342.135172-1-marmarek@invisiblethingslab.com
---
drivers/pci/msi.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
index e5e7533..3a9f4f8 100644
--- a/drivers/pci/msi.c
+++ b/drivers/pci/msi.c
@@ -776,6 +776,9 @@ static void msix_mask_all(void __iomem *base, int tsize)
u32 ctrl = PCI_MSIX_ENTRY_CTRL_MASKBIT;
int i;
+ if (pci_msi_ignore_mask)
+ return;
+
for (i = 0; i < tsize; i++, base += PCI_MSIX_ENTRY_SIZE)
writel(ctrl, base + PCI_MSIX_ENTRY_VECTOR_CTRL);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-08-26 22:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-26 17:03 [PATCH v2] PCI/MSI: Skip masking MSI-X on Xen PV Marek Marczykowski-Górecki
2021-08-26 20:56 ` Bjorn Helgaas
2021-08-26 22:33 ` [tip: irq/urgent] " tip-bot2 for Marek Marczykowski-Górecki
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).