summaryrefslogtreecommitdiffstats
path: root/drivers/xen/events.c
Commit message (Collapse)AuthorAgeFilesLines
...
| | * | xen: events: push setup of irq<->{evtchn,ipi,virq,pirq} maps into irq_info ↵Ian Campbell2011-03-101-21/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | init functions Encapsulate setup of XXX_to_irq array in the relevant xen_irq_info_*_init function. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: turn irq_info constructors into initialiser functionsIan Campbell2011-03-101-38/+66
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: use per-cpu variable for cpu_evtchn_maskIan Campbell2011-03-101-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I can't see any reason why it isn't already. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: refactor GSI pirq bindings functionsIan Campbell2011-03-101-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following the example set by xen_allocate_pirq_msi and xen_bind_pirq_msi_to_irq: xen_allocate_pirq becomes xen_allocate_pirq_gsi and now only allocates a pirq number and does not bind it. xen_map_pirq_gsi becomes xen_bind_pirq_gsi_to_irq and binds an existing pirq. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: rename restore_cpu_pirqs -> restore_pirqsIan Campbell2011-03-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | There is nothing per-cpu about this function. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: remove unused public functionsIan Campbell2011-03-101-20/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I was unable to find any user of these functions in either the functionality pending for 2.6.39 or the xen/next-2.6.32 branch of xen.git An exception to this was xen_gsi_from_irq which did appear to be used in xen/next-2.6.32's pciback. However in the 2.6.39 version of pciback xen_pirq_from_irq is, correctly AFAICT, used instead. Only a minority of functions in events.h use "extern" so drop it from those places for consistency. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: fix xen_map_pirq_gsi error returnIan Campbell2011-03-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix initial value of irq so that first goto out (if pirq or gsi arguments are too large) actually returns an error. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: simplify commentIan Campbell2011-03-101-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It is never valid assume any particular relationship between a Xen PIRQ number and and Linux IRQ number so there is no need to hedge when saying so. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| | * | xen: events: separate two unrelated halves of if conditionIan Campbell2011-03-101-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Clarifies which bit the comment applies to. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| * | | xen: events: Remove redundant clear of l2i at end of round-robin loopKeir Fraser2011-03-101-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Keir Fraser <keir.fraser@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [ijc: forward ported from linux-2.6.18-xen.hg 991:9ba6d9f3fbc0] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| * | | xen: events: Make round-robin scan fairer by snapshotting each l2 word once onlyKeir Fraser2011-03-101-9/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (except for starting l2 word, which we scan in two parts). Signed-off-by: Keir Fraser <keir.fraser@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [ijc: forward ported from linux-2.6.18-xen.hg 990:427276ac595d] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| * | | xen: events: Clean up round-robin evtchn scan.Keir Fraser2011-03-101-24/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also fixes a couple of boundary cases. Signed-off-by: Keir Fraser <keir.fraser@citrix.com> Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [ijc: forward ported from linux-2.6.18-xen.hg 988:c88a02a22a05] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| * | | xen: events: Make last processed event channel a per-cpu variable.Ian Campbell2011-03-101-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [ijc: forward ported from linux-2.6.18-xen.hg 325:b2768401db94] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
| * | | xen: events: Process event channels notifications in round-robin order.Scott Rixner2011-03-101-7/+65
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Avoids fairness issue resulting from domain 0 processing lowest numbered event channel first. Fixes bug #1115 "Event channel port scanning unfair". Bugzilla: http://bugzilla.xensource.com/bugzilla/show_bug.cgi?id=1115 Signed-off-by: Ian Campbell <ian.campbell@citrix.com> [ijc: forward ported from linux-2.6.18-xen.hg 324:7fe1c6d02a2b various variables have different names in this tree: l1 -> pending_words l2 -> pending_bits l1i -> word_idx l2i -> bit_idx] Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | | Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6Linus Torvalds2011-03-161-0/+38
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1480 commits) bonding: enable netpoll without checking link status xfrm: Refcount destination entry on xfrm_lookup net: introduce rx_handler results and logic around that bonding: get rid of IFF_SLAVE_INACTIVE netdev->priv_flag bonding: wrap slave state work net: get rid of multiple bond-related netdevice->priv_flags bonding: register slave pointer for rx_handler be2net: Bump up the version number be2net: Copyright notice change. Update to Emulex instead of ServerEngines e1000e: fix kconfig for crc32 dependency netfilter ebtables: fix xt_AUDIT to work with ebtables xen network backend driver bonding: Improve syslog message at device creation time bonding: Call netif_carrier_off after register_netdevice bonding: Incorrect TX queue offset net_sched: fix ip_tos2prio xfrm: fix __xfrm_route_forward() be2net: Fix UDP packet detected status in RX compl Phonet: fix aligned-mode pipe socket buffer header reserve netxen: support for GbE port settings ... Fix up conflicts in drivers/staging/brcm80211/brcmsmac/wl_mac80211.c with the staging updates.
| * | | xen/irq: implement bind_interdomain_evtchn_to_irqhandler for backend driversIan Campbell2011-02-281-0/+38
| | |/ | |/| | | | | | | | | | | | | | | | | | | Impact: new Xen-internal API Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | | Merge branch 'irq-core-for-linus' of ↵Linus Torvalds2011-03-151-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip * 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (116 commits) x86: Enable forced interrupt threading support x86: Mark low level interrupts IRQF_NO_THREAD x86: Use generic show_interrupts x86: ioapic: Avoid redundant lookup of irq_cfg x86: ioapic: Use new move_irq functions x86: Use the proper accessors in fixup_irqs() x86: ioapic: Use irq_data->state x86: ioapic: Simplify irq chip and handler setup x86: Cleanup the genirq name space genirq: Add chip flag to force mask on suspend genirq: Add desc->irq_data accessor genirq: Add comments to Kconfig switches genirq: Fixup fasteoi handler for oneshot mode genirq: Provide forced interrupt threading sched: Switch wait_task_inactive to schedule_hrtimeout() genirq: Add IRQF_NO_THREAD genirq: Allow shared oneshot interrupts genirq: Prepare the handling of shared oneshot interrupts genirq: Make warning in handle_percpu_event useful x86: ioapic: Move trigger defines to io_apic.h ... Fix up trivial(?) conflicts in arch/x86/pci/xen.c due to genirq name space changes clashing with the Xen cleanups. The set_irq_msi() had moved to xen_bind_pirq_msi_to_irq().
| | |
| \ \
*-. \ \ Merge branches 'stable/ia64', 'stable/blkfront-cleanup' and 'stable/cleanup' ↵Linus Torvalds2011-03-151-1/+1
|\ \ \ \ | | |/ / | |/| / | |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen * 'stable/ia64' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen: ia64 build broken due to "xen: switch to new schedop hypercall by default." * 'stable/blkfront-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen: Union the blkif_request request specific fields * 'stable/cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen: annotate functions which only call into __init at start of day xen p2m: annotate variable which appears unused xen: events: mark cpu_evtchn_mask_p as __refdata
| | * xen: events: mark cpu_evtchn_mask_p as __refdataIan Campbell2011-02-111-1/+1
| |/ | | | | | | | | | | | | | | | | | | This variable starts out pointing at init_evtchn_mask which is marked __initdata but is set to point to a non-init data region in xen_init_IRQ which is itself an __init function so this is safe. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Tested-and-acked-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: remove dom0 specific xen_create_msi_irqIan Campbell2011-03-101-41/+0
| | | | | | | | | | | | | | | | | | | | | | The function name does not distinguish it from xen_allocate_pirq_msi (which operates on domU and pvhvm domains rather than dom0). Hoist domain 0 specific functionality up into the only caller leaving functionality common to all guest types in xen_bind_pirq_msi_to_irq. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: use xen_bind_pirq_msi_to_irq from xen_create_msi_irqIan Campbell2011-03-101-29/+7
| | | | | | | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: push set_irq_msi down into xen_create_msi_irqIan Campbell2011-03-101-1/+9
| | | | | | | | | | | | | | | | Makes the tail end of this function look even more like xen_bind_pirq_msi_to_irq. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: update pirq_to_irq in xen_create_msi_irqIan Campbell2011-03-101-0/+1
| | | | | | | | | | | | | | | | | | | | I don't think this was a deliberate ommision. Makes the tail end of this function look even more like xen_bind_pirq_msi_to_irq. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: refactor xen_create_msi_irq slightlyIan Campbell2011-03-101-9/+6
| | | | | | | | | | | | | | | | | | Calling PHYSDEVOP_map_pirq earlier simplifies error handling and starts to make the tail end of this function look like xen_bind_pirq_msi_to_irq. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: separate MSI PIRQ allocation from PIRQ binding to IRQIan Campbell2011-03-101-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Split the binding aspect of xen_allocate_pirq_msi out into a new xen_bind_pirq_to_irq function. In xen_hvm_setup_msi_irq when allocating a pirq write the MSI message to signal the PIRQ as soon as the pirq is obtained. There is no way to free the pirq back so if the subsequent binding to an IRQ fails we want to ensure that we will reuse the PIRQ next time rather than leak it. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: assume PHYSDEVOP_get_free_pirq existsIan Campbell2011-03-101-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The find_unbound_pirq is called only from xen_allocate_pirq_msi and only if alloc_pirq is true. The only caller which does this is xen_hvm_setup_msi_irqs. The use of this function is gated, in pci_xen_hvm_init, on XENFEAT_hvm_pirqs. The PHYSDEVOP_get_free_pirq interfaces was added to the hypervisor in 22410:be96f6058c05 while XENFEAT_hvm_pirqs was added a couple of minutes prior in 22409:6663214f06ac. Therefore we do not need to concern ourselves with hypervisors which support XENFEAT_hvm_pirqs but not PHYSDEVOP_get_free_pirq. This eliminates the fallback path in find_unbound_pirq which walks to pirq_to_irq array looking for a free pirq. Unlike the PHYSDEVOP_get_free_pirq interface this fallback only looks up a free pirq but does not reserve it. Removing this fallback will simplify locking in the future. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: return irq from xen_allocate_pirq_msiIan Campbell2011-03-101-8/+11
| | | | | | | | | | | | | | consistent with other similar functions. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: drop XEN_ALLOC_IRQ flag to xen_allocate_pirq_msiIan Campbell2011-03-101-7/+5
| | | | | | | | | | | | | | All callers pass this flag so it is pointless. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: do not leak IRQ from xen_allocate_pirq_msi when no pirq available.Ian Campbell2011-03-101-1/+4
| | | | | | | | | | | | | | Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: xen-devel@lists.xensource.com Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen/irq: Cleanup up the pirq_to_irq for DomU PV PCI passthrough guests as well.Konrad Rzeszutek Wilk2011-03-031-1/+2
| | | | | | | | | | | | | | | | | | | | We only did this for PV guests that are xen_initial_domain() but there is not reason not to do this for other cases. The other case is only exercised when you pass in a PCI device to a PV guest _and_ the device in question. Reviewed-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: Use IRQF_FORCE_RESUMEThomas Gleixner2011-03-031-19/+1
| | | | | | | | | | | | | | | | Mark the IRQF_NO_SUSPEND interrupts IRQF_FORCE_RESUME and remove the extra walk through the interrupt descriptors. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: Fix compile error introduced by "switch to new irq_chip functions"Ian Campbell2011-03-031-1/+1
| | | | | | | | | | | | | | | | drivers/xen/events.c: In function 'ack_pirq': drivers/xen/events.c:568: error: implicit declaration of function 'irq_move_irq' Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: Switch to new irq_chip functionsThomas Gleixner2011-03-031-44/+51
| | | | | | | | | | | | | | | | | | Convert Xen to the new irq_chip functions. Brings us closer to enable CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: Remove stale irq_chip.endThomas Gleixner2011-03-031-18/+0
| | | | | | | | | | | | | | | | irq_chip.end got obsolete with the removal of __do_IRQ() Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: do not free legacy IRQsIan Campbell2011-03-031-0/+4
| | | | | | | | | | | | | | | | | | | | c514d00c8057 "xen: events: add xen_allocate_irq_{dynamic, gsi} and xen_free_irq" correctly avoids reallocating legacy IRQs (which are managed by the arch core) but erroneously did not prevent them being freed. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: events: allocate GSIs and dynamic IRQs from separate IRQ ranges.Ian Campbell2011-03-031-50/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are three cases which we need to care about, PV guest, PV domain 0 and HVM guest. The PV guest case is simple since it has no access to ACPI or real APICs and therefore has no GSIs therefore we simply dynamically allocate all IRQs. The potentially interesting case here is PIRQ type event channels associated with passed through PCI devices. However even in this case the guest has no direct interaction with the physical GSI since that happens in the PCI backend. The PV domain 0 and HVM guest cases are actually the same. In domain 0 case the kernel sees the host ACPI and GSIs (although it only sees the APIC indirectly via the hypervisor) and in the HVM guest case it sees the virtualised ACPI and emulated APICs. In these cases we start allocating dynamic IRQs at nr_irqs_gsi so that they cannot clash with any GSI. Currently xen_allocate_irq_dynamic starts at nr_irqs and works backwards looking for a free IRQ in order to (try and) avoid clashing with GSIs used in domain 0 and in HVM guests. This change avoids that although we retain the behaviour of allowing dynamic IRQs to encroach on the GSI range if no suitable IRQs are available since a future IRQ clash is deemed preferable to failure right now. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
* | xen: events: add xen_allocate_irq_{dynamic, gsi} and xen_free_irqIan Campbell2011-03-031-18/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is neater than open-coded calls to irq_alloc_desc_at and irq_free_desc. No intended behavioural change. Note that we previously were not checking the return value of irq_alloc_desc_at which would be failing for GSI<NR_IRQS_LEGACY because the core architecture code has already allocated those for us. Hence the additional check against NR_IRQS_LEGACY in xen_allocate_irq_gsi. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
* | xen:events: move find_unbound_irq inside CONFIG_PCI_MSIIan Campbell2011-03-031-17/+17
|/ | | | | | | | | | | | The only caller is xen_allocate_pirq_msi which is also under this ifdef so this fixes: drivers/xen/events.c:377: warning: 'find_unbound_pirq' defined but not used when CONFIG_PCI_MSI=n Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org>
* Merge branch 'stable/bug-fixes' of ↵Linus Torvalds2011-01-101-6/+15
|\ | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen * 'stable/bug-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen: xen/event: validate irq before get evtchn by irq xen/fb: fix potential memory leak xen/fb: fix xenfb suspend/resume race. xen: disable ACPI NUMA for PV guests xen/irq: Cleanup the find_unbound_irq
| * xen/event: validate irq before get evtchn by irqJoe Jin2011-01-101-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When retrieving the event channel number from irq, the irq number may not be valid under some conditions. So far that can be when we suspend/resume and irq ends with -1. Validate and return sanitized irq and provide diagnostics information. [v3: added unlikely on the WARN path] [v2: reworded the commit message] Signed-off-by: Joe Jin <joe.jin@oracle.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Tested-by: Gurudas Pai <gurudas.pai@oracle.com> Cc: Ian Campbell <ian.campbell@citrix.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Cc: Andrew Morton <akpm@linux-foundation.org>
| * xen/irq: Cleanup the find_unbound_irqKonrad Rzeszutek Wilk2010-12-091-6/+12
| | | | | | | | | | | | | | | | | | | | The "find_unbound_irq" is a bit unusual - it allocates virtual IRQ (event channels) in reverse order. This means starting at the "top" of the available IRQs (nr_irqs) down to the GSI/MSI IRQs (nr_irqs_gsi). Lets document this and also make the variables easier to understand. Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* | xen: Use this_cpu_inc_returnChristoph Lameter2010-12-171-1/+1
| | | | | | | | | | | | | | | | __this_cpu_inc_return reduces code and simplifies code. Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Christoph Lameter <cl@linux.com>
* | xen: Use this_cpu_opsChristoph Lameter2010-12-171-4/+4
|/ | | | | | | | | | | | | Use this_cpu_ops to reduce code size and simplify things in various places. V3->V4: Move instance of this_cpu_inc_return to a later patchset so that this patch can be applied without infrastructure changes. Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com> Acked-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Christoph Lameter <cl@linux.com> Signed-off-by: Tejun Heo <tj@kernel.org>
* Merge branch '2.6.37-rc4-pvhvm-fixes' of ↵Linus Torvalds2010-12-031-31/+74
|\ | | | | | | | | | | | | | | | | | | | | git://xenbits.xen.org/people/sstabellini/linux-pvhvm * '2.6.37-rc4-pvhvm-fixes' of git://xenbits.xen.org/people/sstabellini/linux-pvhvm: xen: unplug the emulated devices at resume time xen: fix save/restore for PV on HVM guests with pirq remapping xen: resume the pv console for hvm guests too xen: fix MSI setup and teardown for PV on HVM guests xen: use PHYSDEVOP_get_free_pirq to implement find_unbound_pirq
| * xen: fix save/restore for PV on HVM guests with pirq remappingStefano Stabellini2010-12-021-0/+38
| | | | | | | | | | | | Re-map and re-bind all the pirqs at resume time. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
| * xen: fix MSI setup and teardown for PV on HVM guestsStefano Stabellini2010-12-021-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When remapping MSIs into pirqs for PV on HVM guests, qemu is responsible for doing the actual mapping and unmapping. We only give qemu the desired pirq number when we ask to do the mapping the first time, after that we should be reading back the pirq number from qemu every time we want to re-enable the MSI. This fixes a bug in xen_hvm_setup_msi_irqs that manifests itself when trying to enable the same MSI for the second time: the old MSI to pirq mapping is still valid at this point but xen_hvm_setup_msi_irqs would try to assign a new pirq anyway. A simple way to reproduce this bug is to assign an MSI capable network card to a PV on HVM guest, if the user brings down the corresponding ethernet interface and up again, Linux would fail to enable MSIs on the device. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
| * xen: use PHYSDEVOP_get_free_pirq to implement find_unbound_pirqStefano Stabellini2010-12-021-25/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the new hypercall PHYSDEVOP_get_free_pirq to ask Xen to allocate a pirq. Remove the unsupported PHYSDEVOP_get_nr_pirqs hypercall to get the amount of pirq available. This fixes find_unbound_pirq that otherwise would return a number starting from nr_irqs that might very well be out of range in Xen. The symptom of this bug is that when you passthrough an MSI capable pci device to a PV on HVM guest, Linux would fail to enable MSIs on the device. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
* | xen: allocate irq descs on any NUMA nodeJeremy Fitzhardinge2010-12-021-2/+2
|/ | | | | | | | | | Allocate irq descs on any NUMA node (we don't care) rather than specifically node 0, which may not exist. (At the moment NUMA is meaningless within a domain, so any info the kernel has is just from an SRAT table we haven't suppressed/disabled.) Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
* xen/events: Use PIRQ instead of GSI value when unmapping MSI/MSI-X irqs.Konrad Rzeszutek Wilk2010-11-221-1/+1
| | | | | | | | | | | | | | | | | When we allocate a vector for MSI/MSI-X we save away the PIRQ, and the vector value. When we unmap (de-allocate) the MSI/MSI-X vector(s) we need to provide the PIRQ and the vector value. What we did instead was to provide the GSI (which was zero) and the vector value, and we got these unhappy error messages: (XEN) irq.c:1575: dom0: pirq 0 not mapped [ 7.733415] unmap irq failed -22 This patches fixes this and we use the PIRQ value instead of the GSI value. CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
* xen/events: use locked set|clear_bit() for cpu_evtchn_maskJeremy Fitzhardinge2010-11-161-2/+2
| | | | | | | The per-cpu event channel masks can be updated unlocked from multiple CPUs, so use the locked variant. Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
OpenPOWER on IntegriCloud