diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2009-05-27 10:38:51 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2009-05-27 10:38:51 +0100 |
commit | cf5e6f2d34413cac233939ab701191655a587ca7 (patch) | |
tree | 5fde2db2a07a672e7b4ca8d5d3c2d38d0d93fe3e /xen/include/xen/hvm | |
parent | e3e8ff02c5f467b72078bf9246b2484844c4cadc (diff) | |
download | xen-cf5e6f2d34413cac233939ab701191655a587ca7.tar.gz xen-cf5e6f2d34413cac233939ab701191655a587ca7.tar.bz2 xen-cf5e6f2d34413cac233939ab701191655a587ca7.zip |
x86: eliminate hard-coded NR_IRQS
... splitting it into global nr_irqs (determined at boot time) and
per- domain nr_pirqs (derived from nr_irqs and a possibly command line
specified value, which probably should later become a per-domain
config setting).
This has the (desirable imo) side effect of reducing the size of
struct hvm_irq_dpci from requiring an order-3 page to order-2 (on
x86-64), which nevertheless still is too large.
However, there is now a variable size bit array on the stack in
pt_irq_time_out() - while for the moment this probably is okay, it
certainly doesn't look nice. However, replacing this with a static
(pre-)allocation also seems less than ideal, because that would
require at least min(d->nr_pirqs, NR_VECTORS) bit arrays of
d->nr_pirqs bits, since this bit array is used outside of the
serialized code region in that function, and keeping the domain's
event lock acquired across pirq_guest_eoi() doesn't look like a good
idea either.
The IRQ- and vector-indexed arrays hanging off struct hvm_irq_dpci
could in fact be changed further to dynamically use the smaller of the
two ranges for indexing, since there are other assumptions about a
one-to-one relationship between IRQs and vectors here and elsewhere.
Additionally, it seems to me that struct hvm_mirq_dpci_mapping's
digl_list and gmsi fields could really be overlayed, which would yield
significant savings since this structure gets always instanciated in
form of d->nr_pirqs (as per the above could also be the smaller of
this and NR_VECTORS) dimensioned arrays.
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/include/xen/hvm')
-rw-r--r-- | xen/include/xen/hvm/irq.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/xen/include/xen/hvm/irq.h b/xen/include/xen/hvm/irq.h index 1a879d630b..4fe118c31b 100644 --- a/xen/include/xen/hvm/irq.h +++ b/xen/include/xen/hvm/irq.h @@ -68,21 +68,26 @@ struct hvm_girq_dpci_mapping { #define NR_ISAIRQS 16 #define NR_LINK 4 +#if defined(__i386__) || defined(__x86_64__) +# define NR_HVM_IRQS VIOAPIC_NUM_PINS +#elif defined(__ia64__) +# define NR_HVM_IRQS VIOSAPIC_NUM_PINS +#endif /* Protected by domain's event_lock */ struct hvm_irq_dpci { /* Machine IRQ to guest device/intx mapping. */ - DECLARE_BITMAP(mapping, NR_IRQS); - struct hvm_mirq_dpci_mapping mirq[NR_IRQS]; + unsigned long *mapping; + struct hvm_mirq_dpci_mapping *mirq; + unsigned long *dirq_mask; /* Guest IRQ to guest device/intx mapping. */ - struct list_head girq[NR_IRQS]; - uint8_t msi_gvec_pirq[NR_VECTORS]; - DECLARE_BITMAP(dirq_mask, NR_IRQS); + struct list_head girq[NR_HVM_IRQS]; + uint8_t msi_gvec_pirq[0x100]; /* Record of mapped ISA IRQs */ DECLARE_BITMAP(isairq_map, NR_ISAIRQS); /* Record of mapped Links */ uint8_t link_cnt[NR_LINK]; - struct timer hvm_timer[NR_IRQS]; + struct timer hvm_timer[NR_VECTORS]; }; /* Modify state of a PCI INTx wire. */ |