diff options
author | Alex Nixon <alex.nixon@citrix.com> | 2010-03-18 16:31:34 -0400 |
---|---|---|
committer | Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | 2010-10-18 10:49:35 -0400 |
commit | b5401a96b59475c1c878439caecb8c521bdfd4ad (patch) | |
tree | 1d120803720cc047445181af514357fec65e6125 /drivers | |
parent | 294ee6f89cfd629e276f632a6003a0fad7785dce (diff) |
xen/x86/PCI: Add support for the Xen PCI subsystem
The frontend stub lives in arch/x86/pci/xen.c, alongside other
sub-arch PCI init code (e.g. olpc.c).
It provides a mechanism for Xen PCI frontend to setup/destroy
legacy interrupts, MSI/MSI-X, and PCI configuration operations.
[ Impact: add core of Xen PCI support ]
[ v2: Removed the IOMMU code and only focusing on PCI.]
[ v3: removed usage of pci_scan_all_fns as that does not exist]
[ v4: introduced pci_xen value to fix compile warnings]
[ v5: squished fixes+features in one patch, changed Reviewed-by to Ccs]
[ v7: added Acked-by]
Signed-off-by: Alex Nixon <alex.nixon@citrix.com>
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Qing He <qing.he@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86@kernel.org
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/xen/events.c | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index cd504092299b..7016a734257c 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -582,7 +582,9 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name) | |||
582 | goto out; /* XXX need refcount? */ | 582 | goto out; /* XXX need refcount? */ |
583 | } | 583 | } |
584 | 584 | ||
585 | if (identity_mapped_irq(gsi)) { | 585 | /* If we are a PV guest, we don't have GSIs (no ACPI passed). Therefore |
586 | * we are using the !xen_initial_domain() to drop in the function.*/ | ||
587 | if (identity_mapped_irq(gsi) || !xen_initial_domain()) { | ||
586 | irq = gsi; | 588 | irq = gsi; |
587 | irq_to_desc_alloc_node(irq, 0); | 589 | irq_to_desc_alloc_node(irq, 0); |
588 | dynamic_irq_init(irq); | 590 | dynamic_irq_init(irq); |
@@ -593,7 +595,13 @@ int xen_allocate_pirq(unsigned gsi, int shareable, char *name) | |||
593 | handle_level_irq, name); | 595 | handle_level_irq, name); |
594 | 596 | ||
595 | irq_op.irq = irq; | 597 | irq_op.irq = irq; |
596 | if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) { | 598 | irq_op.vector = 0; |
599 | |||
600 | /* Only the privileged domain can do this. For non-priv, the pcifront | ||
601 | * driver provides a PCI bus that does the call to do exactly | ||
602 | * this in the priv domain. */ | ||
603 | if (xen_initial_domain() && | ||
604 | HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op)) { | ||
597 | dynamic_irq_cleanup(irq); | 605 | dynamic_irq_cleanup(irq); |
598 | irq = -ENOSPC; | 606 | irq = -ENOSPC; |
599 | goto out; | 607 | goto out; |
@@ -608,6 +616,26 @@ out: | |||
608 | return irq; | 616 | return irq; |
609 | } | 617 | } |
610 | 618 | ||
619 | int xen_destroy_irq(int irq) | ||
620 | { | ||
621 | struct irq_desc *desc; | ||
622 | int rc = -ENOENT; | ||
623 | |||
624 | spin_lock(&irq_mapping_update_lock); | ||
625 | |||
626 | desc = irq_to_desc(irq); | ||
627 | if (!desc) | ||
628 | goto out; | ||
629 | |||
630 | irq_info[irq] = mk_unbound_info(); | ||
631 | |||
632 | dynamic_irq_cleanup(irq); | ||
633 | |||
634 | out: | ||
635 | spin_unlock(&irq_mapping_update_lock); | ||
636 | return rc; | ||
637 | } | ||
638 | |||
611 | int xen_vector_from_irq(unsigned irq) | 639 | int xen_vector_from_irq(unsigned irq) |
612 | { | 640 | { |
613 | return vector_from_irq(irq); | 641 | return vector_from_irq(irq); |