From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 02/10] x86/MSI-X: access MSI-X table only after having enabled MSI-X
Date: Fri, 5 Jun 2015 14:01:02 +0100 [thread overview]
Message-ID: <55719D8E.1090801@citrix.com> (raw)
In-Reply-To: <5571A2300200007800081455@mail.emea.novell.com>
On 05/06/15 12:20, Jan Beulich wrote:
> As done in Linux by f598282f51 ("PCI: Fix the NIU MSI-X problem in a
> better way") and its broken predecessor, make sure we don't access the
> MSI-X table without having enabled MSI-X first, using the mask-all flag
> instead to prevent interrupts from occurring.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, with one suggestion.
> @@ -401,35 +414,38 @@ static bool_t msi_set_mask_bit(struct ir
> }
> break;
> case PCI_CAP_ID_MSIX:
> + control = pci_conf_read16(seg, bus, slot, func,
> + msix_control_reg(entry->msi_attrib.pos));
> + if ( unlikely(!(control & PCI_MSIX_FLAGS_ENABLE)) )
> + pci_conf_write16(seg, bus, slot, func,
> + msix_control_reg(entry->msi_attrib.pos),
> + control | (PCI_MSIX_FLAGS_ENABLE |
> + PCI_MSIX_FLAGS_MASKALL));
> if ( likely(memory_decoded(pdev)) )
> {
> writel(flag, entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
> readl(entry->mask_base + PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET);
> - break;
> + if ( likely(control & PCI_MSIX_FLAGS_ENABLE) )
> + break;
> + flag = 1;
> }
> - if ( flag )
> + else if ( flag && !(control & PCI_MSIX_FLAGS_MASKALL) )
> {
> - u16 control;
> domid_t domid = pdev->domain->domain_id;
>
> - control = pci_conf_read16(seg, bus, slot, func,
> - msix_control_reg(entry->msi_attrib.pos));
> - if ( control & PCI_MSIX_FLAGS_MASKALL )
> - break;
> - pci_conf_write16(seg, bus, slot, func,
> - msix_control_reg(entry->msi_attrib.pos),
> - control | PCI_MSIX_FLAGS_MASKALL);
> + control |= PCI_MSIX_FLAGS_MASKALL;
> if ( pdev->msix->warned != domid )
> {
> pdev->msix->warned = domid;
> printk(XENLOG_G_WARNING
> - "cannot mask IRQ %d: masked MSI-X on Dom%d's %04x:%02x:%02x.%u\n",
> + "cannot mask IRQ %d: masking MSI-X on Dom%d's %04x:%02x:%02x.%u\n",
"masking all", which is a more clear statement.
~Andrew
next prev parent reply other threads:[~2015-06-05 13:01 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-05 11:09 [PATCH v3 00/10] x86/MSI-X: XSA-120, 128..131 follow-up Jan Beulich
2015-06-05 11:20 ` [PATCH v3 01/10] x86/MSI-X: be more careful during teardown Jan Beulich
2015-06-05 11:20 ` [PATCH v3 02/10] x86/MSI-X: access MSI-X table only after having enabled MSI-X Jan Beulich
2015-06-05 13:01 ` Andrew Cooper [this message]
2015-06-05 11:21 ` [PATCH v3 03/10] x86/MSI-X: reduce fiddling with control register during restore Jan Beulich
2015-06-05 11:21 ` [PATCH v3 04/10] x86/MSI-X: cleanup Jan Beulich
2015-06-05 11:22 ` [PATCH v3 05/10] x86/MSI: track host and guest masking separately Jan Beulich
2015-06-05 13:05 ` Andrew Cooper
2016-04-01 7:40 ` Li, Liang Z
2016-04-01 8:47 ` Jan Beulich
2016-04-01 9:21 ` Li, Liang Z
2016-04-01 9:33 ` Jan Beulich
2015-06-05 11:23 ` [PATCH v3 06/10] x86/vMSI-X: cleanup Jan Beulich
2015-06-05 13:07 ` Andrew Cooper
2015-06-05 11:24 ` [PATCH v3 07/10] x86/vMSI-X: support qword MMIO access Jan Beulich
2015-06-05 15:34 ` Andrew Cooper
2015-06-05 11:25 ` [PATCH v3 08/10] x86/MSI-X: use qword MMIO access for address writes Jan Beulich
2015-06-05 15:37 ` Andrew Cooper
2015-06-05 11:26 ` [PATCH v3 09/10] VT-d: use qword MMIO access for MSI " Jan Beulich
2015-06-05 15:39 ` Andrew Cooper
2015-06-05 15:46 ` Jan Beulich
2015-06-11 7:45 ` Tian, Kevin
2015-06-05 11:28 ` [PATCH v3 10/10] x86/MSI-X: provide hypercall interface for mask-all control Jan Beulich
2015-06-05 15:57 ` Andrew Cooper
2015-06-05 16:17 ` Jan Beulich
2015-06-11 8:35 ` Jan Beulich
2015-06-11 9:51 ` Andrew Cooper
2015-06-19 13:00 ` Jan Beulich
2015-06-19 13:05 ` Konrad Rzeszutek Wilk
2015-06-19 14:52 ` Jan Beulich
2015-06-19 14:07 ` Roger Pau Monné
2015-06-19 14:58 ` Jan Beulich
2015-06-22 17:02 ` Roger Pau Monné
2015-06-23 7:20 ` Jan Beulich
2015-06-23 7:29 ` Roger Pau Monné
2015-06-23 8:13 ` Jan Beulich
2015-06-22 11:25 ` Jan Beulich
2015-06-12 13:21 ` Konrad Rzeszutek Wilk
2015-06-12 13:51 ` Jan Beulich
2015-06-12 14:17 ` Konrad Rzeszutek Wilk
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=55719D8E.1090801@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=xen-devel@lists.xenproject.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 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).