From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Roger Pau Monne <roger.pau@citrix.com>,
Jan Beulich <jbeulich@suse.com>
Subject: [PATCH v9 08/11] x86/pt: mask MSI vectors on unbind
Date: Wed, 14 Mar 2018 14:04:05 +0000 [thread overview]
Message-ID: <20180314140408.40947-9-roger.pau@citrix.com> (raw)
In-Reply-To: <20180314140408.40947-1-roger.pau@citrix.com>
When a MSI device with per-vector masking capabilities is detected or
added to Xen all the vectors are masked when initializing it. This
implies that the first time the interrupt is bound to a domain it's
masked.
This however only applies to the first time the interrupt is bound
because neither the unbind nor the pirq unmap will mask the vector
again. In order to fix this re-mask the interrupt when unbinding it
from a guest. This makes sure that pairs of bind/unbind will always
get the same masking state.
Note that no issues have been reported regarding this behavior because
QEMU always uses the newly introduced XEN_PT_GFLAGSSHIFT_UNMASKED when
binding interrupts, so it's always unmasked.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
---
Cc: Jan Beulich <jbeulich@suse.com>
---
Changes since v7:
- New in this version.
---
xen/drivers/passthrough/io.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index 8f16e6c0a5..bab3aa349a 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -645,7 +645,22 @@ int pt_irq_destroy_bind(
}
break;
case PT_IRQ_TYPE_MSI:
+ {
+ unsigned long flags;
+ struct irq_desc *desc = domain_spin_lock_irq_desc(d, machine_gsi,
+ &flags);
+
+ if ( !desc )
+ return -EINVAL;
+ /*
+ * Leave the MSI masked, so that the state when calling
+ * pt_irq_create_bind is consistent across bind/unbinds.
+ */
+ guest_mask_msi_irq(desc, true);
+ spin_unlock_irqrestore(&desc->lock, flags);
break;
+ }
+
default:
return -EOPNOTSUPP;
}
--
2.16.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-03-14 14:13 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 14:03 [PATCH v9 00/11] vpci: PCI config space emulation Roger Pau Monne
2018-03-14 14:03 ` [PATCH v9 01/11] vpci: introduce basic handlers to trap accesses to the PCI config space Roger Pau Monne
2018-03-14 14:31 ` Jan Beulich
2018-03-15 9:50 ` Roger Pau Monné
2018-03-15 10:23 ` Jan Beulich
2018-03-15 15:21 ` Doug Goldstein
2018-03-14 14:03 ` [PATCH v9 02/11] x86/mmcfg: add handlers for the PVH Dom0 MMCFG areas Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 03/11] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0 Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 04/11] pci: split code to size BARs from pci_add_device Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 05/11] pci: add support to size ROM BARs to pci_size_mem_bar Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 06/11] xen: introduce rangeset_consume_ranges Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 07/11] vpci/bars: add handlers to map the BARs Roger Pau Monne
2018-03-14 16:13 ` Jan Beulich
2018-03-15 11:33 ` Roger Pau Monné
2018-03-15 12:41 ` Jan Beulich
2018-03-15 13:59 ` Roger Pau Monné
2018-03-15 14:31 ` Jan Beulich
2018-03-14 14:04 ` Roger Pau Monne [this message]
2018-03-14 14:04 ` [PATCH v9 09/11] vpci/msi: add MSI handlers Roger Pau Monne
2018-03-14 16:51 ` Jan Beulich
2018-03-15 11:48 ` Roger Pau Monné
2018-03-15 12:44 ` Jan Beulich
2018-03-15 15:54 ` Roger Pau Monné
2018-03-15 16:19 ` Jan Beulich
2018-03-14 14:04 ` [PATCH v9 10/11] vpci: add a priority parameter to the vPCI register initializer Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 11/11] vpci/msix: add MSI-X handlers Roger Pau Monne
2018-03-14 17:04 ` Jan Beulich
2018-03-15 12:01 ` Roger Pau Monné
2018-03-15 12:45 ` Jan Beulich
2018-03-15 16:33 ` Roger Pau Monné
2018-03-16 7:36 ` Jan Beulich
2018-03-16 11:03 ` Roger Pau Monné
2018-03-16 11:42 ` Jan Beulich
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=20180314140408.40947-9-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jbeulich@suse.com \
--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).