License cleanup: add SPDX GPL-2.0 license identifier to files with no license
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.
By default all files without license information are under the default
license of the kernel, which is GPL version 2.
Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.
This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.
How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,
Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.
The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.
The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.
Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if <5
lines).
All documentation files were explicitly excluded.
The following heuristics were used to determine which SPDX license
identifiers to apply.
- when both scanners couldn't find any license traces, file was
considered to have no license information in it, and the top level
COPYING file license applied.
For non */uapi/* files that summary was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 11139
and resulted in the first patch in this series.
If that file was a */uapi/* path one, it was "GPL-2.0 WITH
Linux-syscall-note" otherwise it was "GPL-2.0". Results of that was:
SPDX license identifier # files
---------------------------------------------------|-------
GPL-2.0 WITH Linux-syscall-note 930
and resulted in the second patch in this series.
- if a file had some form of licensing information in it, and was one
of the */uapi/* ones, it was denoted with the Linux-syscall-note if
any GPL family license was found in the file or had no licensing in
it (per prior point). Results summary:
SPDX license identifier # files
---------------------------------------------------|------
GPL-2.0 WITH Linux-syscall-note 270
GPL-2.0+ WITH Linux-syscall-note 169
((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) 21
((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) 17
LGPL-2.1+ WITH Linux-syscall-note 15
GPL-1.0+ WITH Linux-syscall-note 14
((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause) 5
LGPL-2.0+ WITH Linux-syscall-note 4
LGPL-2.1 WITH Linux-syscall-note 3
((GPL-2.0 WITH Linux-syscall-note) OR MIT) 3
((GPL-2.0 WITH Linux-syscall-note) AND MIT) 1
and that resulted in the third patch in this series.
- when the two scanners agreed on the detected license(s), that became
the concluded license(s).
- when there was disagreement between the two scanners (one detected a
license but the other didn't, or they both detected different
licenses) a manual inspection of the file occurred.
- In most cases a manual inspection of the information in the file
resulted in a clear resolution of the license that should apply (and
which scanner probably needed to revisit its heuristics).
- When it was not immediately clear, the license identifier was
confirmed with lawyers working with the Linux Foundation.
- If there was any question as to the appropriate license identifier,
the file was flagged for further research and to be revisited later
in time.
In total, over 70 hours of logged manual review was done on the
spreadsheet to determine the SPDX license identifiers to apply to the
source files by Kate, Philippe, Thomas and, in some cases, confirmation
by lawyers working with the Linux Foundation.
Kate also obtained a third independent scan of the 4.13 code base from
FOSSology, and compared selected files where the other two scanners
disagreed against that SPDX file, to see if there was new insights. The
Windriver scanner is based on an older version of FOSSology in part, so
they are related.
Thomas did random spot checks in about 500 files from the spreadsheets
for the uapi headers and agreed with SPDX license identifier in the
files he inspected. For the non-uapi files Thomas did random spot checks
in about 15000 files.
In initial set of patches against 4.14-rc6, 3 files were found to have
copy/paste license identifier errors, and have been fixed to reflect the
correct identifier.
Additionally Philippe spent 10 hours this week doing a detailed manual
inspection and review of the 12,461 patched files from the initial patch
version early this week with:
- a full scancode scan run, collecting the matched texts, detected
license ids and scores
- reviewing anything where there was a license detected (about 500+
files) to ensure that the applied SPDX license was correct
- reviewing anything where there was no detection but the patch license
was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
SPDX license was correct
This produced a worksheet with 20 files needing minor correction. This
worksheet was then exported into 3 different .csv files for the
different types of files to be modified.
These .csv files were then reviewed by Greg. Thomas wrote a script to
parse the csv files and add the proper SPDX tag to the file, in the
format that the file expected. This script was further refined by Greg
based on the output to detect more types of files automatically and to
distinguish between header and source .c files (which need different
comment types.) Finally Greg ran the script using the .csv files to
generate the patches.
Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org>
Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-01 22:07:57 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-03-13 23:29:25 +08:00
|
|
|
/*
|
|
|
|
* Xen event channels (2-level ABI)
|
|
|
|
*
|
|
|
|
* Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define pr_fmt(fmt) "xen:" KBUILD_MODNAME ": " fmt
|
|
|
|
|
|
|
|
#include <linux/linkage.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
|
|
|
|
#include <asm/sync_bitops.h>
|
|
|
|
#include <asm/xen/hypercall.h>
|
|
|
|
#include <asm/xen/hypervisor.h>
|
|
|
|
|
|
|
|
#include <xen/xen.h>
|
|
|
|
#include <xen/xen-ops.h>
|
|
|
|
#include <xen/events.h>
|
|
|
|
#include <xen/interface/xen.h>
|
|
|
|
#include <xen/interface/event_channel.h>
|
|
|
|
|
|
|
|
#include "events_internal.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Note sizeof(xen_ulong_t) can be more than sizeof(unsigned long). Be
|
|
|
|
* careful to only use bitops which allow for this (e.g
|
|
|
|
* test_bit/find_first_bit and friends but not __ffs) and to pass
|
|
|
|
* BITS_PER_EVTCHN_WORD as the bitmask length.
|
|
|
|
*/
|
|
|
|
#define BITS_PER_EVTCHN_WORD (sizeof(xen_ulong_t)*8)
|
|
|
|
/*
|
|
|
|
* Make a bitmask (i.e. unsigned long *) of a xen_ulong_t
|
|
|
|
* array. Primarily to avoid long lines (hence the terse name).
|
|
|
|
*/
|
|
|
|
#define BM(x) (unsigned long *)(x)
|
|
|
|
/* Find the first set bit in a evtchn mask */
|
|
|
|
#define EVTCHN_FIRST_BIT(w) find_first_bit(BM(&(w)), BITS_PER_EVTCHN_WORD)
|
|
|
|
|
2016-03-16 05:52:49 +08:00
|
|
|
#define EVTCHN_MASK_SIZE (EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD)
|
|
|
|
|
|
|
|
static DEFINE_PER_CPU(xen_ulong_t [EVTCHN_MASK_SIZE], cpu_evtchn_mask);
|
2013-03-13 23:29:25 +08:00
|
|
|
|
2013-10-17 22:23:15 +08:00
|
|
|
static unsigned evtchn_2l_max_channels(void)
|
|
|
|
{
|
2013-03-15 18:55:41 +08:00
|
|
|
return EVTCHN_2L_NR_CHANNELS;
|
2013-10-17 22:23:15 +08:00
|
|
|
}
|
|
|
|
|
2013-03-14 20:49:19 +08:00
|
|
|
static void evtchn_2l_bind_to_cpu(struct irq_info *info, unsigned cpu)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
clear_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, info->cpu)));
|
|
|
|
set_bit(info->evtchn, BM(per_cpu(cpu_evtchn_mask, cpu)));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static void evtchn_2l_clear_pending(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
sync_clear_bit(port, BM(&s->evtchn_pending[0]));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static void evtchn_2l_set_pending(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
sync_set_bit(port, BM(&s->evtchn_pending[0]));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static bool evtchn_2l_is_pending(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
return sync_test_bit(port, BM(&s->evtchn_pending[0]));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static bool evtchn_2l_test_and_set_mask(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
return sync_test_and_set_bit(port, BM(&s->evtchn_mask[0]));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static void evtchn_2l_mask(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
sync_set_bit(port, BM(&s->evtchn_mask[0]));
|
|
|
|
}
|
|
|
|
|
2020-03-24 00:15:11 +08:00
|
|
|
static void evtchn_2l_unmask(evtchn_port_t port)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
unsigned int cpu = get_cpu();
|
|
|
|
int do_hypercall = 0, evtchn_pending = 0;
|
|
|
|
|
|
|
|
BUG_ON(!irqs_disabled());
|
|
|
|
|
|
|
|
if (unlikely((cpu != cpu_from_evtchn(port))))
|
|
|
|
do_hypercall = 1;
|
|
|
|
else {
|
|
|
|
/*
|
|
|
|
* Need to clear the mask before checking pending to
|
|
|
|
* avoid a race with an event becoming pending.
|
|
|
|
*
|
|
|
|
* EVTCHNOP_unmask will only trigger an upcall if the
|
|
|
|
* mask bit was set, so if a hypercall is needed
|
|
|
|
* remask the event.
|
|
|
|
*/
|
|
|
|
sync_clear_bit(port, BM(&s->evtchn_mask[0]));
|
|
|
|
evtchn_pending = sync_test_bit(port, BM(&s->evtchn_pending[0]));
|
|
|
|
|
|
|
|
if (unlikely(evtchn_pending && xen_hvm_domain())) {
|
|
|
|
sync_set_bit(port, BM(&s->evtchn_mask[0]));
|
|
|
|
do_hypercall = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Slow path (hypercall) if this is a non-local port or if this is
|
|
|
|
* an hvm domain and an event is pending (hvm domains don't have
|
|
|
|
* their own implementation of irq_enable). */
|
|
|
|
if (do_hypercall) {
|
|
|
|
struct evtchn_unmask unmask = { .port = port };
|
|
|
|
(void)HYPERVISOR_event_channel_op(EVTCHNOP_unmask, &unmask);
|
|
|
|
} else {
|
|
|
|
struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following is basically the equivalent of
|
|
|
|
* 'hw_resend_irq'. Just like a real IO-APIC we 'lose
|
|
|
|
* the interrupt edge' if the channel is masked.
|
|
|
|
*/
|
|
|
|
if (evtchn_pending &&
|
|
|
|
!sync_test_and_set_bit(port / BITS_PER_EVTCHN_WORD,
|
|
|
|
BM(&vcpu_info->evtchn_pending_sel)))
|
|
|
|
vcpu_info->evtchn_upcall_pending = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
put_cpu();
|
|
|
|
}
|
|
|
|
|
|
|
|
static DEFINE_PER_CPU(unsigned int, current_word_idx);
|
|
|
|
static DEFINE_PER_CPU(unsigned int, current_bit_idx);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Mask out the i least significant bits of w
|
|
|
|
*/
|
|
|
|
#define MASK_LSBS(w, i) (w & ((~((xen_ulong_t)0UL)) << i))
|
|
|
|
|
|
|
|
static inline xen_ulong_t active_evtchns(unsigned int cpu,
|
|
|
|
struct shared_info *sh,
|
|
|
|
unsigned int idx)
|
|
|
|
{
|
|
|
|
return sh->evtchn_pending[idx] &
|
|
|
|
per_cpu(cpu_evtchn_mask, cpu)[idx] &
|
|
|
|
~sh->evtchn_mask[idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Search the CPU's pending events bitmasks. For each one found, map
|
|
|
|
* the event number to an irq, and feed it into do_IRQ() for handling.
|
|
|
|
*
|
|
|
|
* Xen uses a two-level bitmap to speed searching. The first level is
|
|
|
|
* a bitset of words which contain pending event bits. The second
|
|
|
|
* level is a bitset of pending events themselves.
|
|
|
|
*/
|
2013-03-14 20:49:19 +08:00
|
|
|
static void evtchn_2l_handle_events(unsigned cpu)
|
2013-03-13 23:29:25 +08:00
|
|
|
{
|
|
|
|
int irq;
|
|
|
|
xen_ulong_t pending_words;
|
|
|
|
xen_ulong_t pending_bits;
|
|
|
|
int start_word_idx, start_bit_idx;
|
|
|
|
int word_idx, bit_idx;
|
|
|
|
int i;
|
|
|
|
struct shared_info *s = HYPERVISOR_shared_info;
|
|
|
|
struct vcpu_info *vcpu_info = __this_cpu_read(xen_vcpu);
|
|
|
|
|
|
|
|
/* Timer interrupt has highest priority. */
|
|
|
|
irq = irq_from_virq(cpu, VIRQ_TIMER);
|
|
|
|
if (irq != -1) {
|
2020-03-24 00:15:11 +08:00
|
|
|
evtchn_port_t evtchn = evtchn_from_irq(irq);
|
2013-03-13 23:29:25 +08:00
|
|
|
word_idx = evtchn / BITS_PER_LONG;
|
|
|
|
bit_idx = evtchn % BITS_PER_LONG;
|
2014-02-24 05:40:18 +08:00
|
|
|
if (active_evtchns(cpu, s, word_idx) & (1ULL << bit_idx))
|
|
|
|
generic_handle_irq(irq);
|
2013-03-13 23:29:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Master flag must be cleared /before/ clearing
|
|
|
|
* selector flag. xchg_xen_ulong must contain an
|
|
|
|
* appropriate barrier.
|
|
|
|
*/
|
|
|
|
pending_words = xchg_xen_ulong(&vcpu_info->evtchn_pending_sel, 0);
|
|
|
|
|
|
|
|
start_word_idx = __this_cpu_read(current_word_idx);
|
|
|
|
start_bit_idx = __this_cpu_read(current_bit_idx);
|
|
|
|
|
|
|
|
word_idx = start_word_idx;
|
|
|
|
|
|
|
|
for (i = 0; pending_words != 0; i++) {
|
|
|
|
xen_ulong_t words;
|
|
|
|
|
|
|
|
words = MASK_LSBS(pending_words, word_idx);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If we masked out all events, wrap to beginning.
|
|
|
|
*/
|
|
|
|
if (words == 0) {
|
|
|
|
word_idx = 0;
|
|
|
|
bit_idx = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
word_idx = EVTCHN_FIRST_BIT(words);
|
|
|
|
|
|
|
|
pending_bits = active_evtchns(cpu, s, word_idx);
|
|
|
|
bit_idx = 0; /* usually scan entire word from start */
|
|
|
|
/*
|
|
|
|
* We scan the starting word in two parts.
|
|
|
|
*
|
|
|
|
* 1st time: start in the middle, scanning the
|
|
|
|
* upper bits.
|
|
|
|
*
|
|
|
|
* 2nd time: scan the whole word (not just the
|
|
|
|
* parts skipped in the first pass) -- if an
|
|
|
|
* event in the previously scanned bits is
|
|
|
|
* pending again it would just be scanned on
|
|
|
|
* the next loop anyway.
|
|
|
|
*/
|
|
|
|
if (word_idx == start_word_idx) {
|
|
|
|
if (i == 0)
|
|
|
|
bit_idx = start_bit_idx;
|
|
|
|
}
|
|
|
|
|
|
|
|
do {
|
|
|
|
xen_ulong_t bits;
|
2020-03-24 00:15:11 +08:00
|
|
|
evtchn_port_t port;
|
2013-03-13 23:29:25 +08:00
|
|
|
|
|
|
|
bits = MASK_LSBS(pending_bits, bit_idx);
|
|
|
|
|
|
|
|
/* If we masked out all events, move on. */
|
|
|
|
if (bits == 0)
|
|
|
|
break;
|
|
|
|
|
|
|
|
bit_idx = EVTCHN_FIRST_BIT(bits);
|
|
|
|
|
|
|
|
/* Process port. */
|
|
|
|
port = (word_idx * BITS_PER_EVTCHN_WORD) + bit_idx;
|
2013-10-17 22:23:15 +08:00
|
|
|
irq = get_evtchn_to_irq(port);
|
2013-03-13 23:29:25 +08:00
|
|
|
|
2014-02-24 05:40:18 +08:00
|
|
|
if (irq != -1)
|
|
|
|
generic_handle_irq(irq);
|
2013-03-13 23:29:25 +08:00
|
|
|
|
|
|
|
bit_idx = (bit_idx + 1) % BITS_PER_EVTCHN_WORD;
|
|
|
|
|
|
|
|
/* Next caller starts at last processed + 1 */
|
|
|
|
__this_cpu_write(current_word_idx,
|
|
|
|
bit_idx ? word_idx :
|
|
|
|
(word_idx+1) % BITS_PER_EVTCHN_WORD);
|
|
|
|
__this_cpu_write(current_bit_idx, bit_idx);
|
|
|
|
} while (bit_idx != 0);
|
|
|
|
|
|
|
|
/* Scan start_l1i twice; all others once. */
|
|
|
|
if ((word_idx != start_word_idx) || (i != 0))
|
|
|
|
pending_words &= ~(1UL << word_idx);
|
|
|
|
|
|
|
|
word_idx = (word_idx + 1) % BITS_PER_EVTCHN_WORD;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
irqreturn_t xen_debug_interrupt(int irq, void *dev_id)
|
|
|
|
{
|
|
|
|
struct shared_info *sh = HYPERVISOR_shared_info;
|
|
|
|
int cpu = smp_processor_id();
|
|
|
|
xen_ulong_t *cpu_evtchn = per_cpu(cpu_evtchn_mask, cpu);
|
|
|
|
int i;
|
|
|
|
unsigned long flags;
|
|
|
|
static DEFINE_SPINLOCK(debug_lock);
|
|
|
|
struct vcpu_info *v;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&debug_lock, flags);
|
|
|
|
|
|
|
|
printk("\nvcpu %d\n ", cpu);
|
|
|
|
|
|
|
|
for_each_online_cpu(i) {
|
|
|
|
int pending;
|
|
|
|
v = per_cpu(xen_vcpu, i);
|
|
|
|
pending = (get_irq_regs() && i == cpu)
|
|
|
|
? xen_irqs_disabled(get_irq_regs())
|
|
|
|
: v->evtchn_upcall_mask;
|
|
|
|
printk("%d: masked=%d pending=%d event_sel %0*"PRI_xen_ulong"\n ", i,
|
|
|
|
pending, v->evtchn_upcall_pending,
|
|
|
|
(int)(sizeof(v->evtchn_pending_sel)*2),
|
|
|
|
v->evtchn_pending_sel);
|
|
|
|
}
|
|
|
|
v = per_cpu(xen_vcpu, cpu);
|
|
|
|
|
|
|
|
printk("\npending:\n ");
|
|
|
|
for (i = ARRAY_SIZE(sh->evtchn_pending)-1; i >= 0; i--)
|
|
|
|
printk("%0*"PRI_xen_ulong"%s",
|
|
|
|
(int)sizeof(sh->evtchn_pending[0])*2,
|
|
|
|
sh->evtchn_pending[i],
|
|
|
|
i % 8 == 0 ? "\n " : " ");
|
|
|
|
printk("\nglobal mask:\n ");
|
|
|
|
for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
|
|
|
|
printk("%0*"PRI_xen_ulong"%s",
|
|
|
|
(int)(sizeof(sh->evtchn_mask[0])*2),
|
|
|
|
sh->evtchn_mask[i],
|
|
|
|
i % 8 == 0 ? "\n " : " ");
|
|
|
|
|
|
|
|
printk("\nglobally unmasked:\n ");
|
|
|
|
for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--)
|
|
|
|
printk("%0*"PRI_xen_ulong"%s",
|
|
|
|
(int)(sizeof(sh->evtchn_mask[0])*2),
|
|
|
|
sh->evtchn_pending[i] & ~sh->evtchn_mask[i],
|
|
|
|
i % 8 == 0 ? "\n " : " ");
|
|
|
|
|
|
|
|
printk("\nlocal cpu%d mask:\n ", cpu);
|
2013-03-15 18:55:41 +08:00
|
|
|
for (i = (EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD)-1; i >= 0; i--)
|
2013-03-13 23:29:25 +08:00
|
|
|
printk("%0*"PRI_xen_ulong"%s", (int)(sizeof(cpu_evtchn[0])*2),
|
|
|
|
cpu_evtchn[i],
|
|
|
|
i % 8 == 0 ? "\n " : " ");
|
|
|
|
|
|
|
|
printk("\nlocally unmasked:\n ");
|
|
|
|
for (i = ARRAY_SIZE(sh->evtchn_mask)-1; i >= 0; i--) {
|
|
|
|
xen_ulong_t pending = sh->evtchn_pending[i]
|
|
|
|
& ~sh->evtchn_mask[i]
|
|
|
|
& cpu_evtchn[i];
|
|
|
|
printk("%0*"PRI_xen_ulong"%s",
|
|
|
|
(int)(sizeof(sh->evtchn_mask[0])*2),
|
|
|
|
pending, i % 8 == 0 ? "\n " : " ");
|
|
|
|
}
|
|
|
|
|
|
|
|
printk("\npending list:\n");
|
2013-03-15 18:55:41 +08:00
|
|
|
for (i = 0; i < EVTCHN_2L_NR_CHANNELS; i++) {
|
2013-03-13 23:29:25 +08:00
|
|
|
if (sync_test_bit(i, BM(sh->evtchn_pending))) {
|
|
|
|
int word_idx = i / BITS_PER_EVTCHN_WORD;
|
|
|
|
printk(" %d: event %d -> irq %d%s%s%s\n",
|
|
|
|
cpu_from_evtchn(i), i,
|
2013-10-17 22:23:15 +08:00
|
|
|
get_evtchn_to_irq(i),
|
2013-03-13 23:29:25 +08:00
|
|
|
sync_test_bit(word_idx, BM(&v->evtchn_pending_sel))
|
|
|
|
? "" : " l2-clear",
|
|
|
|
!sync_test_bit(i, BM(sh->evtchn_mask))
|
|
|
|
? "" : " globally-masked",
|
|
|
|
sync_test_bit(i, BM(cpu_evtchn))
|
|
|
|
? "" : " locally-masked");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&debug_lock, flags);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
2013-03-14 20:49:19 +08:00
|
|
|
|
2015-04-30 05:10:12 +08:00
|
|
|
static void evtchn_2l_resume(void)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for_each_online_cpu(i)
|
|
|
|
memset(per_cpu(cpu_evtchn_mask, i), 0, sizeof(xen_ulong_t) *
|
|
|
|
EVTCHN_2L_NR_CHANNELS/BITS_PER_EVTCHN_WORD);
|
|
|
|
}
|
|
|
|
|
2013-03-14 20:49:19 +08:00
|
|
|
static const struct evtchn_ops evtchn_ops_2l = {
|
2013-10-17 22:23:15 +08:00
|
|
|
.max_channels = evtchn_2l_max_channels,
|
|
|
|
.nr_channels = evtchn_2l_max_channels,
|
2013-03-14 20:49:19 +08:00
|
|
|
.bind_to_cpu = evtchn_2l_bind_to_cpu,
|
|
|
|
.clear_pending = evtchn_2l_clear_pending,
|
|
|
|
.set_pending = evtchn_2l_set_pending,
|
|
|
|
.is_pending = evtchn_2l_is_pending,
|
|
|
|
.test_and_set_mask = evtchn_2l_test_and_set_mask,
|
|
|
|
.mask = evtchn_2l_mask,
|
|
|
|
.unmask = evtchn_2l_unmask,
|
|
|
|
.handle_events = evtchn_2l_handle_events,
|
2015-04-30 05:10:12 +08:00
|
|
|
.resume = evtchn_2l_resume,
|
2013-03-14 20:49:19 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void __init xen_evtchn_2l_init(void)
|
|
|
|
{
|
|
|
|
pr_info("Using 2-level ABI\n");
|
|
|
|
evtchn_ops = &evtchn_ops_2l;
|
|
|
|
}
|