aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/hvm/vmsi.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2011-05-01 13:17:44 +0100
committerJan Beulich <jbeulich@novell.com>2011-05-01 13:17:44 +0100
commit76ce27755b87aa5a91ce0f5a02e560ab5c0515e4 (patch)
treef2a7fcbd31e863d8a0238782c12a716bbc0f21e9 /xen/arch/x86/hvm/vmsi.c
parentf22f2fe48d144141fffd42a380383f45efbea8e3 (diff)
downloadxen-76ce27755b87aa5a91ce0f5a02e560ab5c0515e4.tar.gz
xen-76ce27755b87aa5a91ce0f5a02e560ab5c0515e4.tar.bz2
xen-76ce27755b87aa5a91ce0f5a02e560ab5c0515e4.zip
replace d->nr_pirqs sized arrays with radix tree
With this it is questionable whether retaining struct domain's nr_pirqs is actually necessary - the value now only serves for bounds checking, and this boundary could easily be nr_irqs. Another thing to consider is whether it's worth storing the pirq number in struct pirq, to avoid passing the number and a pointer to quite a number of functions. Note that ia64, the build of which is broken currently anyway, is only partially fixed up. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/arch/x86/hvm/vmsi.c')
-rw-r--r--xen/arch/x86/hvm/vmsi.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c
index 8ed26f6106..f037af88fa 100644
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -65,11 +65,10 @@ static void vmsi_inj_irq(
}
}
-int vmsi_deliver(struct domain *d, int pirq)
+int vmsi_deliver(struct domain *d, const struct hvm_pirq_dpci *pirq_dpci)
{
- struct hvm_irq_dpci *hvm_irq_dpci = d->arch.hvm_domain.irq.dpci;
- uint32_t flags = hvm_irq_dpci->mirq[pirq].gmsi.gflags;
- int vector = hvm_irq_dpci->mirq[pirq].gmsi.gvec;
+ uint32_t flags = pirq_dpci->gmsi.gflags;
+ int vector = pirq_dpci->gmsi.gvec;
uint8_t dest = (uint8_t)flags;
uint8_t dest_mode = !!(flags & VMSI_DM_MASK);
uint8_t delivery_mode = (flags & VMSI_DELIV_MASK) >> GLFAGS_SHIFT_DELIV_MODE;
@@ -82,11 +81,7 @@ int vmsi_deliver(struct domain *d, int pirq)
"vector=%x trig_mode=%x\n",
dest, dest_mode, delivery_mode, vector, trig_mode);
- if ( !( hvm_irq_dpci->mirq[pirq].flags & HVM_IRQ_DPCI_GUEST_MSI ) )
- {
- gdprintk(XENLOG_WARNING, "pirq %x not msi \n", pirq);
- return 0;
- }
+ ASSERT(pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI);
switch ( delivery_mode )
{
@@ -349,7 +344,7 @@ static void del_msixtbl_entry(struct msixtbl_entry *entry)
call_rcu(&entry->rcu, free_msixtbl_entry);
}
-int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
+int msixtbl_pt_register(struct domain *d, struct pirq *pirq, uint64_t gtable)
{
struct irq_desc *irq_desc;
struct msi_desc *msi_desc;
@@ -358,6 +353,7 @@ int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
int r = -EINVAL;
ASSERT(spin_is_locked(&pcidevs_lock));
+ ASSERT(spin_is_locked(&d->event_lock));
/*
* xmalloc() with irq_disabled causes the failure of check_lock()
@@ -367,7 +363,7 @@ int msixtbl_pt_register(struct domain *d, int pirq, uint64_t gtable)
if ( !new_entry )
return -ENOMEM;
- irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
+ irq_desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
if ( !irq_desc )
{
xfree(new_entry);
@@ -404,7 +400,7 @@ out:
return r;
}
-void msixtbl_pt_unregister(struct domain *d, int pirq)
+void msixtbl_pt_unregister(struct domain *d, struct pirq *pirq)
{
struct irq_desc *irq_desc;
struct msi_desc *msi_desc;
@@ -412,8 +408,9 @@ void msixtbl_pt_unregister(struct domain *d, int pirq)
struct msixtbl_entry *entry;
ASSERT(spin_is_locked(&pcidevs_lock));
+ ASSERT(spin_is_locked(&d->event_lock));
- irq_desc = domain_spin_lock_irq_desc(d, pirq, NULL);
+ irq_desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
if ( !irq_desc )
return;
@@ -447,7 +444,7 @@ found:
spin_unlock_irq(&irq_desc->lock);
}
-void msixtbl_pt_cleanup(struct domain *d, int pirq)
+void msixtbl_pt_cleanup(struct domain *d)
{
struct msixtbl_entry *entry, *temp;
unsigned long flags;