From 00b70689c193b9cccb1fac3c3764bed77e152c4e Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Wed, 23 Jan 2013 09:18:50 +0000 Subject: xen/arch/x86: complete XSM hooks on irq/pirq mappings Manipulation of a domain's pirq namespace was not fully protected by XSM hooks because the XSM hooks for IRQs needed a physical IRQ. Since this may not apply to HVM domains, a complete solution needs to split the XSM hook for this operation, using one hook for the PIRQ manipulation and one for controlling access to the hardware IRQ. This reworking has the advantage of providing the same MSI data to remove_irq that is provided to add_irq, allowing the PCI device to be determined in both functions. It also eliminates the last callers of rcu_lock_target_domain_by_id in x86 and common code in preparation for this function's removal. Signed-off-by: Daniel De Graaf Committed-by: Keir Fraser --- xen/arch/x86/irq.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'xen/arch/x86/irq.c') diff --git a/xen/arch/x86/irq.c b/xen/arch/x86/irq.c index 095c17dbac..068c5a0228 100644 --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1874,7 +1874,7 @@ int map_domain_pirq( return 0; } - ret = xsm_map_domain_pirq(XSM_HOOK, d, irq, data); + ret = xsm_map_domain_irq(XSM_HOOK, d, irq, data); if ( ret ) { dprintk(XENLOG_G_ERR, "dom%d: could not permit access to irq %d mapping to pirq %d\n", @@ -1978,14 +1978,19 @@ int unmap_domain_pirq(struct domain *d, int pirq) goto done; } + desc = irq_to_desc(irq); + msi_desc = desc->msi_desc; + + ret = xsm_unmap_domain_irq(XSM_HOOK, d, irq, msi_desc); + if ( ret ) + goto done; + forced_unbind = pirq_guest_force_unbind(d, info); if ( forced_unbind ) dprintk(XENLOG_G_WARNING, "dom%d: forcing unbind of pirq %d\n", d->domain_id, pirq); - desc = irq_to_desc(irq); - - if ( (msi_desc = desc->msi_desc) != NULL ) + if ( msi_desc != NULL ) pci_disable_msi(msi_desc); spin_lock_irqsave(&desc->lock, flags); -- cgit v1.2.3