diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-04-15 10:33:48 +0200 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-04-15 10:33:48 +0200 |
commit | 6a727d6be892ea5ff818446d96974bebdf8ac3a2 (patch) | |
tree | 7b167dd6266b4c5b4824a496c8e7405fba05f489 /xen/arch/x86/msi.c | |
parent | 887885c17ada9c571a7a2cd71410876448d0610a (diff) | |
download | xen-6a727d6be892ea5ff818446d96974bebdf8ac3a2.tar.gz xen-6a727d6be892ea5ff818446d96974bebdf8ac3a2.tar.bz2 xen-6a727d6be892ea5ff818446d96974bebdf8ac3a2.zip |
IOMMU: allow MSI message to IRTE propagation to fail
With the need to allocate multiple contiguous IRTEs for multi-vector
MSI, the chance of failure here increases. While on the AMD side
there's no allocation of IRTEs at present at all (and hence no way for
this allocation to fail, which is going to change with a later patch in
this series), VT-d already ignores an eventual error here, which this
patch fixes.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Zhang, Xiantao" <xiantao.zhang@intel.com>
Diffstat (limited to 'xen/arch/x86/msi.c')
-rw-r--r-- | xen/arch/x86/msi.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/xen/arch/x86/msi.c b/xen/arch/x86/msi.c index 6cc8f7acab..36bed2953e 100644 --- a/xen/arch/x86/msi.c +++ b/xen/arch/x86/msi.c @@ -214,14 +214,18 @@ static void read_msi_msg(struct msi_desc *entry, struct msi_msg *msg) iommu_read_msi_from_ire(entry, msg); } -static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) +static int write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) { entry->msg = *msg; if ( iommu_intremap ) { + int rc; + ASSERT(msg != &entry->msg); - iommu_update_ire_from_msi(entry, msg); + rc = iommu_update_ire_from_msi(entry, msg); + if ( rc ) + return rc; } switch ( entry->msi_attrib.type ) @@ -264,6 +268,8 @@ static void write_msi_msg(struct msi_desc *entry, struct msi_msg *msg) default: BUG(); } + + return 0; } void set_msi_affinity(struct irq_desc *desc, const cpumask_t *mask) @@ -464,19 +470,15 @@ static struct msi_desc* alloc_msi_entry(void) return entry; } -void setup_msi_handler(struct irq_desc *desc, struct msi_desc *msidesc) +int setup_msi_irq(struct irq_desc *desc, struct msi_desc *msidesc) { + struct msi_msg msg; + desc->msi_desc = msidesc; desc->handler = msi_maskable_irq(msidesc) ? &pci_msi_maskable : &pci_msi_nonmaskable; -} - -void setup_msi_irq(struct irq_desc *desc) -{ - struct msi_msg msg; - msi_compose_msg(desc, &msg); - write_msi_msg(desc->msi_desc, &msg); + return write_msi_msg(msidesc, &msg); } int msi_free_irq(struct msi_desc *entry) |