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
|
2012-10-09 17:54:47 +08:00
|
|
|
/*
|
|
|
|
* Meta internal (HWSTATMETA) interrupt code.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011-2012 Imagination Technologies Ltd.
|
|
|
|
*
|
|
|
|
* This code is based on the code in SoC/common/irq.c and SoC/comet/irq.c
|
|
|
|
* The code base could be generalised/merged as a lot of the functionality is
|
|
|
|
* similar. Until this is done, we try to keep the code simple here.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/irqdomain.h>
|
|
|
|
|
|
|
|
#include <asm/irq.h>
|
|
|
|
#include <asm/hwthread.h>
|
|
|
|
|
|
|
|
#define PERF0VECINT 0x04820580
|
|
|
|
#define PERF1VECINT 0x04820588
|
|
|
|
#define PERF0TRIG_OFFSET 16
|
|
|
|
#define PERF1TRIG_OFFSET 17
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct metag_internal_irq_priv - private meta internal interrupt data
|
|
|
|
* @domain: IRQ domain for all internal Meta IRQs (HWSTATMETA)
|
|
|
|
* @unmasked: Record of unmasked IRQs
|
|
|
|
*/
|
|
|
|
struct metag_internal_irq_priv {
|
|
|
|
struct irq_domain *domain;
|
|
|
|
|
|
|
|
unsigned long unmasked;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Private data for the one and only internal interrupt controller */
|
|
|
|
static struct metag_internal_irq_priv metag_internal_irq_priv;
|
|
|
|
|
|
|
|
static unsigned int metag_internal_irq_startup(struct irq_data *data);
|
|
|
|
static void metag_internal_irq_shutdown(struct irq_data *data);
|
|
|
|
static void metag_internal_irq_ack(struct irq_data *data);
|
|
|
|
static void metag_internal_irq_mask(struct irq_data *data);
|
|
|
|
static void metag_internal_irq_unmask(struct irq_data *data);
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
static int metag_internal_irq_set_affinity(struct irq_data *data,
|
|
|
|
const struct cpumask *cpumask, bool force);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
static struct irq_chip internal_irq_edge_chip = {
|
|
|
|
.name = "HWSTATMETA-IRQ",
|
|
|
|
.irq_startup = metag_internal_irq_startup,
|
|
|
|
.irq_shutdown = metag_internal_irq_shutdown,
|
|
|
|
.irq_ack = metag_internal_irq_ack,
|
|
|
|
.irq_mask = metag_internal_irq_mask,
|
|
|
|
.irq_unmask = metag_internal_irq_unmask,
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
.irq_set_affinity = metag_internal_irq_set_affinity,
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* metag_hwvec_addr - get the address of *VECINT regs of irq
|
|
|
|
*
|
|
|
|
* This function is a table of supported triggers on HWSTATMETA
|
|
|
|
* Could do with a structure, but better keep it simple. Changes
|
|
|
|
* in this code should be rare.
|
|
|
|
*/
|
|
|
|
static inline void __iomem *metag_hwvec_addr(irq_hw_number_t hw)
|
|
|
|
{
|
|
|
|
void __iomem *addr;
|
|
|
|
|
|
|
|
switch (hw) {
|
|
|
|
case PERF0TRIG_OFFSET:
|
|
|
|
addr = (void __iomem *)PERF0VECINT;
|
|
|
|
break;
|
|
|
|
case PERF1TRIG_OFFSET:
|
|
|
|
addr = (void __iomem *)PERF1VECINT;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
addr = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return addr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* metag_internal_startup - setup an internal irq
|
|
|
|
* @irq: the irq to startup
|
|
|
|
*
|
|
|
|
* Multiplex interrupts for @irq onto TR1. Clear any pending
|
|
|
|
* interrupts.
|
|
|
|
*/
|
|
|
|
static unsigned int metag_internal_irq_startup(struct irq_data *data)
|
|
|
|
{
|
|
|
|
/* Clear (toggle) the bit in HWSTATMETA for our interrupt. */
|
|
|
|
metag_internal_irq_ack(data);
|
|
|
|
|
|
|
|
/* Enable the interrupt by unmasking it */
|
|
|
|
metag_internal_irq_unmask(data);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* metag_internal_irq_shutdown - turn off the irq
|
|
|
|
* @irq: the irq number to turn off
|
|
|
|
*
|
|
|
|
* Mask @irq and clear any pending interrupts.
|
|
|
|
* Stop muxing @irq onto TR1.
|
|
|
|
*/
|
|
|
|
static void metag_internal_irq_shutdown(struct irq_data *data)
|
|
|
|
{
|
|
|
|
/* Disable the IRQ at the core by masking it. */
|
|
|
|
metag_internal_irq_mask(data);
|
|
|
|
|
|
|
|
/* Clear (toggle) the bit in HWSTATMETA for our interrupt. */
|
|
|
|
metag_internal_irq_ack(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* metag_internal_irq_ack - acknowledge irq
|
|
|
|
* @irq: the irq to ack
|
|
|
|
*/
|
|
|
|
static void metag_internal_irq_ack(struct irq_data *data)
|
|
|
|
{
|
|
|
|
irq_hw_number_t hw = data->hwirq;
|
|
|
|
unsigned int bit = 1 << hw;
|
|
|
|
|
|
|
|
if (metag_in32(HWSTATMETA) & bit)
|
|
|
|
metag_out32(bit, HWSTATMETA);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* metag_internal_irq_mask() - mask an internal irq by unvectoring
|
|
|
|
* @data: data for the internal irq to mask
|
|
|
|
*
|
|
|
|
* HWSTATMETA has no mask register. Instead the IRQ is unvectored from the core
|
|
|
|
* and retriggered if necessary later.
|
|
|
|
*/
|
|
|
|
static void metag_internal_irq_mask(struct irq_data *data)
|
|
|
|
{
|
|
|
|
struct metag_internal_irq_priv *priv = &metag_internal_irq_priv;
|
|
|
|
irq_hw_number_t hw = data->hwirq;
|
|
|
|
void __iomem *vec_addr = metag_hwvec_addr(hw);
|
|
|
|
|
|
|
|
clear_bit(hw, &priv->unmasked);
|
|
|
|
|
|
|
|
/* there is no interrupt mask, so unvector the interrupt */
|
|
|
|
metag_out32(0, vec_addr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* meta_intc_unmask_edge_irq_nomask() - unmask an edge irq by revectoring
|
|
|
|
* @data: data for the internal irq to unmask
|
|
|
|
*
|
|
|
|
* HWSTATMETA has no mask register. Instead the IRQ is revectored back to the
|
|
|
|
* core and retriggered if necessary.
|
|
|
|
*/
|
|
|
|
static void metag_internal_irq_unmask(struct irq_data *data)
|
|
|
|
{
|
|
|
|
struct metag_internal_irq_priv *priv = &metag_internal_irq_priv;
|
|
|
|
irq_hw_number_t hw = data->hwirq;
|
|
|
|
unsigned int bit = 1 << hw;
|
|
|
|
void __iomem *vec_addr = metag_hwvec_addr(hw);
|
|
|
|
unsigned int thread = hard_processor_id();
|
|
|
|
|
|
|
|
set_bit(hw, &priv->unmasked);
|
|
|
|
|
|
|
|
/* there is no interrupt mask, so revector the interrupt */
|
|
|
|
metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)), vec_addr);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Re-trigger interrupt
|
|
|
|
*
|
|
|
|
* Writing a 1 toggles, and a 0->1 transition triggers. We only
|
|
|
|
* retrigger if the status bit is already set, which means we
|
|
|
|
* need to clear it first. Retriggering is fundamentally racy
|
|
|
|
* because if the interrupt fires again after we clear it we
|
|
|
|
* could end up clearing it again and the interrupt handler
|
|
|
|
* thinking it hasn't fired. Therefore we need to keep trying to
|
|
|
|
* retrigger until the bit is set.
|
|
|
|
*/
|
|
|
|
if (metag_in32(HWSTATMETA) & bit) {
|
|
|
|
metag_out32(bit, HWSTATMETA);
|
|
|
|
while (!(metag_in32(HWSTATMETA) & bit))
|
|
|
|
metag_out32(bit, HWSTATMETA);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
/*
|
|
|
|
* metag_internal_irq_set_affinity - set the affinity for an interrupt
|
|
|
|
*/
|
|
|
|
static int metag_internal_irq_set_affinity(struct irq_data *data,
|
|
|
|
const struct cpumask *cpumask, bool force)
|
|
|
|
{
|
|
|
|
unsigned int cpu, thread;
|
|
|
|
irq_hw_number_t hw = data->hwirq;
|
|
|
|
/*
|
|
|
|
* Wire up this interrupt from *VECINT to the Meta core.
|
|
|
|
*
|
|
|
|
* Note that we can't wire up *VECINT to interrupt more than
|
|
|
|
* one cpu (the interrupt code doesn't support it), so we just
|
|
|
|
* pick the first cpu we find in 'cpumask'.
|
|
|
|
*/
|
2014-02-26 06:05:35 +08:00
|
|
|
cpu = cpumask_any_and(cpumask, cpu_online_mask);
|
2012-10-09 17:54:47 +08:00
|
|
|
thread = cpu_2_hwthread_id[cpu];
|
|
|
|
|
|
|
|
metag_out32(TBI_TRIG_VEC(TBID_SIGNUM_TR1(thread)),
|
|
|
|
metag_hwvec_addr(hw));
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* metag_internal_irq_demux - irq de-multiplexer
|
|
|
|
* @irq: the interrupt number
|
|
|
|
* @desc: the interrupt description structure for this irq
|
|
|
|
*
|
|
|
|
* The cpu receives an interrupt on TR1 when an interrupt has
|
|
|
|
* occurred. It is this function's job to demux this irq and
|
|
|
|
* figure out exactly which trigger needs servicing.
|
|
|
|
*/
|
2015-09-14 16:42:37 +08:00
|
|
|
static void metag_internal_irq_demux(struct irq_desc *desc)
|
2012-10-09 17:54:47 +08:00
|
|
|
{
|
|
|
|
struct metag_internal_irq_priv *priv = irq_desc_get_handler_data(desc);
|
|
|
|
irq_hw_number_t hw;
|
|
|
|
unsigned int irq_no;
|
|
|
|
u32 status;
|
|
|
|
|
|
|
|
recalculate:
|
|
|
|
status = metag_in32(HWSTATMETA) & priv->unmasked;
|
|
|
|
|
|
|
|
for (hw = 0; status != 0; status >>= 1, ++hw) {
|
|
|
|
if (status & 0x1) {
|
|
|
|
/*
|
|
|
|
* Map the hardware IRQ number to a virtual Linux IRQ
|
|
|
|
* number.
|
|
|
|
*/
|
|
|
|
irq_no = irq_linear_revmap(priv->domain, hw);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Only fire off interrupts that are
|
|
|
|
* registered to be handled by the kernel.
|
|
|
|
* Other interrupts are probably being
|
|
|
|
* handled by other Meta hardware threads.
|
|
|
|
*/
|
|
|
|
generic_handle_irq(irq_no);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The handler may have re-enabled interrupts
|
|
|
|
* which could have caused a nested invocation
|
|
|
|
* of this code and make the copy of the
|
|
|
|
* status register we are using invalid.
|
|
|
|
*/
|
|
|
|
goto recalculate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* internal_irq_map() - Map an internal meta IRQ to a virtual IRQ number.
|
|
|
|
* @hw: Number of the internal IRQ. Must be in range.
|
|
|
|
*
|
|
|
|
* Returns: The virtual IRQ number of the Meta internal IRQ specified by
|
|
|
|
* @hw.
|
|
|
|
*/
|
|
|
|
int internal_irq_map(unsigned int hw)
|
|
|
|
{
|
|
|
|
struct metag_internal_irq_priv *priv = &metag_internal_irq_priv;
|
|
|
|
if (!priv->domain)
|
|
|
|
return -ENODEV;
|
|
|
|
return irq_create_mapping(priv->domain, hw);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* metag_internal_irq_init_cpu - regsister with the Meta cpu
|
|
|
|
* @cpu: the CPU to register on
|
|
|
|
*
|
|
|
|
* Configure @cpu's TR1 irq so that we can demux irqs.
|
|
|
|
*/
|
|
|
|
static void metag_internal_irq_init_cpu(struct metag_internal_irq_priv *priv,
|
|
|
|
int cpu)
|
|
|
|
{
|
|
|
|
unsigned int thread = cpu_2_hwthread_id[cpu];
|
|
|
|
unsigned int signum = TBID_SIGNUM_TR1(thread);
|
|
|
|
int irq = tbisig_map(signum);
|
|
|
|
|
|
|
|
/* Register the multiplexed IRQ handler */
|
irqchip/metag: Consolidate chained IRQ handler install/remove
Chained irq handlers usually set up handler data as well. We now have
a function to set both under irq_desc->lock. Replace the two calls
with one.
Search and conversion was done with coccinelle:
@@
expression E1, E2, E3;
@@
(
-if (irq_set_handler_data(E1, E2) != 0)
- BUG();
|
-irq_set_handler_data(E1, E2);
)
-irq_set_chained_handler(E1, E3);
+irq_set_chained_handler_and_data(E1, E3, E2);
@@
expression E1, E2, E3;
@@
(
-if (irq_set_handler_data(E1, E2) != 0)
- BUG();
...
|
-irq_set_handler_data(E1, E2);
...
)
-irq_set_chained_handler(E1, E3);
+irq_set_chained_handler_and_data(E1, E3, E2);
Reported-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: linux-metag@vger.kernel.org
2015-06-22 03:10:55 +08:00
|
|
|
irq_set_chained_handler_and_data(irq, metag_internal_irq_demux, priv);
|
2012-10-09 17:54:47 +08:00
|
|
|
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* metag_internal_intc_map() - map an internal irq
|
|
|
|
* @d: irq domain of internal trigger block
|
|
|
|
* @irq: virtual irq number
|
|
|
|
* @hw: hardware irq number within internal trigger block
|
|
|
|
*
|
|
|
|
* This sets up a virtual irq for a specified hardware interrupt. The irq chip
|
|
|
|
* and handler is configured.
|
|
|
|
*/
|
|
|
|
static int metag_internal_intc_map(struct irq_domain *d, unsigned int irq,
|
|
|
|
irq_hw_number_t hw)
|
|
|
|
{
|
|
|
|
/* only register interrupt if it is mapped */
|
|
|
|
if (!metag_hwvec_addr(hw))
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
irq_set_chip_and_handler(irq, &internal_irq_edge_chip,
|
|
|
|
handle_edge_irq);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const struct irq_domain_ops metag_internal_intc_domain_ops = {
|
|
|
|
.map = metag_internal_intc_map,
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* metag_internal_irq_register - register internal IRQs
|
|
|
|
*
|
|
|
|
* Register the irq chip and handler function for all internal IRQs
|
|
|
|
*/
|
|
|
|
int __init init_internal_IRQ(void)
|
|
|
|
{
|
|
|
|
struct metag_internal_irq_priv *priv = &metag_internal_irq_priv;
|
|
|
|
unsigned int cpu;
|
|
|
|
|
|
|
|
/* Set up an IRQ domain */
|
|
|
|
priv->domain = irq_domain_add_linear(NULL, 32,
|
|
|
|
&metag_internal_intc_domain_ops,
|
|
|
|
priv);
|
|
|
|
if (unlikely(!priv->domain)) {
|
|
|
|
pr_err("meta-internal-intc: cannot add IRQ domain\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup TR1 for all cpus. */
|
|
|
|
for_each_possible_cpu(cpu)
|
|
|
|
metag_internal_irq_init_cpu(priv, cpu);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
};
|