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 */
|
2008-05-20 07:52:27 +08:00
|
|
|
/*
|
2005-04-17 06:20:36 +08:00
|
|
|
* trampoline.S: Jump start slave processors on sparc64.
|
|
|
|
*
|
|
|
|
* Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
|
|
|
|
*/
|
|
|
|
|
2008-02-21 14:22:16 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
#include <asm/head.h>
|
|
|
|
#include <asm/asi.h>
|
|
|
|
#include <asm/lsu.h>
|
|
|
|
#include <asm/dcr.h>
|
|
|
|
#include <asm/dcu.h>
|
|
|
|
#include <asm/pstate.h>
|
|
|
|
#include <asm/page.h>
|
|
|
|
#include <asm/pgtable.h>
|
|
|
|
#include <asm/spitfire.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/thread_info.h>
|
|
|
|
#include <asm/mmu.h>
|
2006-02-09 18:52:44 +08:00
|
|
|
#include <asm/hypervisor.h>
|
2006-02-14 16:55:49 +08:00
|
|
|
#include <asm/cpudata.h>
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
.data
|
|
|
|
.align 8
|
|
|
|
call_method:
|
|
|
|
.asciz "call-method"
|
|
|
|
.align 8
|
|
|
|
itlb_load:
|
|
|
|
.asciz "SUNW,itlb-load"
|
|
|
|
.align 8
|
|
|
|
dtlb_load:
|
|
|
|
.asciz "SUNW,dtlb-load"
|
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
#define TRAMP_STACK_SIZE 1024
|
|
|
|
.align 16
|
|
|
|
tramp_stack:
|
|
|
|
.skip TRAMP_STACK_SIZE
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
.align 8
|
|
|
|
.globl sparc64_cpu_startup, sparc64_cpu_startup_end
|
|
|
|
sparc64_cpu_startup:
|
2006-02-09 18:52:44 +08:00
|
|
|
BRANCH_IF_SUN4V(g1, niagara_startup)
|
|
|
|
BRANCH_IF_CHEETAH_BASE(g1, g5, cheetah_startup)
|
|
|
|
BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1, g5, cheetah_plus_startup)
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
ba,pt %xcc, spitfire_startup
|
|
|
|
nop
|
|
|
|
|
|
|
|
cheetah_plus_startup:
|
|
|
|
/* Preserve OBP chosen DCU and DCR register settings. */
|
|
|
|
ba,pt %xcc, cheetah_generic_startup
|
|
|
|
nop
|
|
|
|
|
|
|
|
cheetah_startup:
|
|
|
|
mov DCR_BPE | DCR_RPE | DCR_SI | DCR_IFPOE | DCR_MS, %g1
|
|
|
|
wr %g1, %asr18
|
|
|
|
|
|
|
|
sethi %uhi(DCU_ME|DCU_RE|DCU_HPE|DCU_SPE|DCU_SL|DCU_WE), %g5
|
|
|
|
or %g5, %ulo(DCU_ME|DCU_RE|DCU_HPE|DCU_SPE|DCU_SL|DCU_WE), %g5
|
|
|
|
sllx %g5, 32, %g5
|
|
|
|
or %g5, DCU_DM | DCU_IM | DCU_DC | DCU_IC, %g5
|
|
|
|
stxa %g5, [%g0] ASI_DCU_CONTROL_REG
|
|
|
|
membar #Sync
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
/* fallthru */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
cheetah_generic_startup:
|
|
|
|
mov TSB_EXTENSION_P, %g3
|
|
|
|
stxa %g0, [%g3] ASI_DMMU
|
|
|
|
stxa %g0, [%g3] ASI_IMMU
|
|
|
|
membar #Sync
|
|
|
|
|
|
|
|
mov TSB_EXTENSION_S, %g3
|
|
|
|
stxa %g0, [%g3] ASI_DMMU
|
|
|
|
membar #Sync
|
|
|
|
|
|
|
|
mov TSB_EXTENSION_N, %g3
|
|
|
|
stxa %g0, [%g3] ASI_DMMU
|
|
|
|
stxa %g0, [%g3] ASI_IMMU
|
|
|
|
membar #Sync
|
2006-02-09 18:52:44 +08:00
|
|
|
/* fallthru */
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-02-09 18:52:44 +08:00
|
|
|
niagara_startup:
|
2005-04-17 06:20:36 +08:00
|
|
|
/* Disable STICK_INT interrupts. */
|
|
|
|
sethi %hi(0x80000000), %g5
|
|
|
|
sllx %g5, 32, %g5
|
|
|
|
wr %g5, %asr25
|
|
|
|
|
|
|
|
ba,pt %xcc, startup_continue
|
|
|
|
nop
|
|
|
|
|
|
|
|
spitfire_startup:
|
|
|
|
mov (LSU_CONTROL_IC | LSU_CONTROL_DC | LSU_CONTROL_IM | LSU_CONTROL_DM), %g1
|
|
|
|
stxa %g1, [%g0] ASI_LSU_CONTROL
|
|
|
|
membar #Sync
|
|
|
|
|
|
|
|
startup_continue:
|
2007-08-16 16:56:00 +08:00
|
|
|
mov %o0, %l0
|
|
|
|
BRANCH_IF_SUN4V(g1, niagara_lock_tlb)
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
sethi %hi(0x80000000), %g2
|
|
|
|
sllx %g2, 32, %g2
|
|
|
|
wr %g2, 0, %tick_cmpr
|
|
|
|
|
|
|
|
/* Call OBP by hand to lock KERNBASE into i/d tlbs.
|
2008-03-22 08:01:38 +08:00
|
|
|
* We lock 'num_kernel_image_mappings' consequetive entries.
|
2005-04-17 06:20:36 +08:00
|
|
|
*/
|
|
|
|
sethi %hi(prom_entry_lock), %g2
|
|
|
|
1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
|
|
|
|
brnz,pn %g1, 1b
|
[SPARC64]: Avoid membar instructions in delay slots.
In particular, avoid membar instructions in the delay
slot of a jmpl instruction.
UltraSPARC-I, II, IIi, and IIe have a bug, documented in
the UltraSPARC-IIi User's Manual, Appendix K, Erratum 51
The long and short of it is that if the IMU unit misses
on a branch or jmpl, and there is a store buffer synchronizing
membar in the delay slot, the chip can stop fetching instructions.
If interrupts are enabled or some other trap is enabled, the
chip will unwedge itself, but performance will suffer.
We already had a workaround for this bug in a few spots, but
it's better to have the entire tree sanitized for this rule.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-06-28 06:42:04 +08:00
|
|
|
nop
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2014-10-24 03:58:13 +08:00
|
|
|
/* Get onto temporary stack which will be in the locked
|
|
|
|
* kernel image.
|
|
|
|
*/
|
|
|
|
sethi %hi(tramp_stack), %g1
|
|
|
|
or %g1, %lo(tramp_stack), %g1
|
|
|
|
add %g1, TRAMP_STACK_SIZE, %g1
|
|
|
|
sub %g1, STACKFRAME_SZ + STACK_BIAS + 256, %sp
|
2005-04-17 06:20:36 +08:00
|
|
|
flushw
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* Setup the loop variables:
|
|
|
|
* %l3: VADDR base
|
|
|
|
* %l4: TTE base
|
|
|
|
* %l5: Loop iterator, iterates from 0 to 'num_kernel_image_mappings'
|
|
|
|
* %l6: Number of TTE entries to map
|
|
|
|
* %l7: Highest TTE entry number, we count down
|
|
|
|
*/
|
|
|
|
sethi %hi(KERNBASE), %l3
|
|
|
|
sethi %hi(kern_locked_tte_data), %l4
|
|
|
|
ldx [%l4 + %lo(kern_locked_tte_data)], %l4
|
|
|
|
clr %l5
|
|
|
|
sethi %hi(num_kernel_image_mappings), %l6
|
|
|
|
lduw [%l6 + %lo(num_kernel_image_mappings)], %l6
|
|
|
|
|
|
|
|
mov 15, %l7
|
|
|
|
BRANCH_IF_ANY_CHEETAH(g1,g5,2f)
|
|
|
|
|
|
|
|
mov 63, %l7
|
|
|
|
2:
|
|
|
|
|
|
|
|
3:
|
|
|
|
/* Lock into I-MMU */
|
2005-04-17 06:20:36 +08:00
|
|
|
sethi %hi(call_method), %g2
|
|
|
|
or %g2, %lo(call_method), %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x00]
|
|
|
|
mov 5, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x08]
|
|
|
|
mov 1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x10]
|
|
|
|
sethi %hi(itlb_load), %g2
|
|
|
|
or %g2, %lo(itlb_load), %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x18]
|
[SPARC64]: Rewrite bootup sequence.
Instead of all of this cpu-specific code to remap the kernel
to the correct location, use portable firmware calls to do
this instead.
What we do now is the following in position independant
assembler:
chosen_node = prom_finddevice("/chosen");
prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu");
vaddr = 4MB_ALIGN(current_text_addr());
prom_translate(vaddr, &paddr_high, &paddr_low, &mode);
prom_boot_mapping_mode = mode;
prom_boot_mapping_phys_high = paddr_high;
prom_boot_mapping_phys_low = paddr_low;
prom_map(-1, 8 * 1024 * 1024, KERNBASE, paddr_low);
and that replaces the massive amount of by-hand TLB probing and
programming we used to do here.
The new code should also handle properly the case where the kernel
is mapped at the correct address already (think: future kexec
support).
Consequently, the bulk of remap_kernel() dies as does the entirety
of arch/sparc64/prom/map.S
We try to share some strings in the PROM library with the ones used
at bootup, and while we're here mark input strings to oplib.h routines
with "const" when appropriate.
There are many more simplifications now possible. For one thing, we
can consolidate the two copies we now have of a lot of cpu setup code
sitting in head.S and trampoline.S.
This is a significant step towards CONFIG_DEBUG_PAGEALLOC support.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-23 11:11:33 +08:00
|
|
|
sethi %hi(prom_mmu_ihandle_cache), %g2
|
|
|
|
lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2
|
2005-04-17 06:20:36 +08:00
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x20]
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* Each TTE maps 4MB, convert index to offset. */
|
|
|
|
sllx %l5, 22, %g1
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l3, %g1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x28] ! VADDR
|
|
|
|
add %l4, %g1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x30] ! TTE
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* TTE index is highest minus loop index. */
|
|
|
|
sub %l7, %l5, %g2
|
2005-04-17 06:20:36 +08:00
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x38]
|
2008-03-22 08:01:38 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
sethi %hi(p1275buf), %g2
|
|
|
|
or %g2, %lo(p1275buf), %g2
|
|
|
|
ldx [%g2 + 0x08], %o1
|
|
|
|
call %o1
|
|
|
|
add %sp, (2047 + 128), %o0
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* Lock into D-MMU */
|
2005-04-17 06:20:36 +08:00
|
|
|
sethi %hi(call_method), %g2
|
|
|
|
or %g2, %lo(call_method), %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x00]
|
|
|
|
mov 5, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x08]
|
|
|
|
mov 1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x10]
|
|
|
|
sethi %hi(dtlb_load), %g2
|
|
|
|
or %g2, %lo(dtlb_load), %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x18]
|
[SPARC64]: Rewrite bootup sequence.
Instead of all of this cpu-specific code to remap the kernel
to the correct location, use portable firmware calls to do
this instead.
What we do now is the following in position independant
assembler:
chosen_node = prom_finddevice("/chosen");
prom_mmu_ihandle_cache = prom_getint(chosen_node, "mmu");
vaddr = 4MB_ALIGN(current_text_addr());
prom_translate(vaddr, &paddr_high, &paddr_low, &mode);
prom_boot_mapping_mode = mode;
prom_boot_mapping_phys_high = paddr_high;
prom_boot_mapping_phys_low = paddr_low;
prom_map(-1, 8 * 1024 * 1024, KERNBASE, paddr_low);
and that replaces the massive amount of by-hand TLB probing and
programming we used to do here.
The new code should also handle properly the case where the kernel
is mapped at the correct address already (think: future kexec
support).
Consequently, the bulk of remap_kernel() dies as does the entirety
of arch/sparc64/prom/map.S
We try to share some strings in the PROM library with the ones used
at bootup, and while we're here mark input strings to oplib.h routines
with "const" when appropriate.
There are many more simplifications now possible. For one thing, we
can consolidate the two copies we now have of a lot of cpu setup code
sitting in head.S and trampoline.S.
This is a significant step towards CONFIG_DEBUG_PAGEALLOC support.
Signed-off-by: David S. Miller <davem@davemloft.net>
2005-09-23 11:11:33 +08:00
|
|
|
sethi %hi(prom_mmu_ihandle_cache), %g2
|
|
|
|
lduw [%g2 + %lo(prom_mmu_ihandle_cache)], %g2
|
2005-04-17 06:20:36 +08:00
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x20]
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* Each TTE maps 4MB, convert index to offset. */
|
|
|
|
sllx %l5, 22, %g1
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l3, %g1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x28] ! VADDR
|
|
|
|
add %l4, %g1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x30] ! TTE
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
/* TTE index is highest minus loop index. */
|
|
|
|
sub %l7, %l5, %g2
|
2005-04-17 06:20:36 +08:00
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x38]
|
2008-03-22 08:01:38 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
sethi %hi(p1275buf), %g2
|
|
|
|
or %g2, %lo(p1275buf), %g2
|
|
|
|
ldx [%g2 + 0x08], %o1
|
|
|
|
call %o1
|
|
|
|
add %sp, (2047 + 128), %o0
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l5, 1, %l5
|
|
|
|
cmp %l5, %l6
|
|
|
|
bne,pt %xcc, 3b
|
2005-04-17 06:20:36 +08:00
|
|
|
nop
|
|
|
|
|
|
|
|
sethi %hi(prom_entry_lock), %g2
|
|
|
|
stb %g0, [%g2 + %lo(prom_entry_lock)]
|
|
|
|
|
2006-02-09 18:52:44 +08:00
|
|
|
ba,pt %xcc, after_lock_tlb
|
|
|
|
nop
|
|
|
|
|
|
|
|
niagara_lock_tlb:
|
2008-03-22 08:01:38 +08:00
|
|
|
sethi %hi(KERNBASE), %l3
|
|
|
|
sethi %hi(kern_locked_tte_data), %l4
|
|
|
|
ldx [%l4 + %lo(kern_locked_tte_data)], %l4
|
|
|
|
clr %l5
|
|
|
|
sethi %hi(num_kernel_image_mappings), %l6
|
|
|
|
lduw [%l6 + %lo(num_kernel_image_mappings)], %l6
|
|
|
|
|
|
|
|
1:
|
2006-02-10 14:57:21 +08:00
|
|
|
mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
|
2008-03-22 08:01:38 +08:00
|
|
|
sllx %l5, 22, %g2
|
|
|
|
add %l3, %g2, %o0
|
2006-02-10 14:57:21 +08:00
|
|
|
clr %o1
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l4, %g2, %o2
|
2006-02-10 14:57:21 +08:00
|
|
|
mov HV_MMU_IMMU, %o3
|
2006-02-09 18:52:44 +08:00
|
|
|
ta HV_FAST_TRAP
|
|
|
|
|
2006-02-10 14:57:21 +08:00
|
|
|
mov HV_FAST_MMU_MAP_PERM_ADDR, %o5
|
2008-03-22 08:01:38 +08:00
|
|
|
sllx %l5, 22, %g2
|
|
|
|
add %l3, %g2, %o0
|
2006-02-10 14:57:21 +08:00
|
|
|
clr %o1
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l4, %g2, %o2
|
2006-02-10 14:57:21 +08:00
|
|
|
mov HV_MMU_DMMU, %o3
|
2006-02-09 18:52:44 +08:00
|
|
|
ta HV_FAST_TRAP
|
|
|
|
|
2008-03-22 08:01:38 +08:00
|
|
|
add %l5, 1, %l5
|
|
|
|
cmp %l5, %l6
|
|
|
|
bne,pt %xcc, 1b
|
2006-02-09 18:52:44 +08:00
|
|
|
nop
|
|
|
|
|
|
|
|
after_lock_tlb:
|
2005-04-17 06:20:36 +08:00
|
|
|
wrpr %g0, (PSTATE_PRIV | PSTATE_PEF), %pstate
|
|
|
|
wr %g0, 0, %fprs
|
|
|
|
|
|
|
|
wr %g0, ASI_P, %asi
|
|
|
|
|
|
|
|
mov PRIMARY_CONTEXT, %g7
|
2006-02-08 14:13:05 +08:00
|
|
|
|
|
|
|
661: stxa %g0, [%g7] ASI_DMMU
|
|
|
|
.section .sun4v_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
stxa %g0, [%g7] ASI_MMU
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
membar #Sync
|
|
|
|
mov SECONDARY_CONTEXT, %g7
|
2006-02-08 14:13:05 +08:00
|
|
|
|
|
|
|
661: stxa %g0, [%g7] ASI_DMMU
|
|
|
|
.section .sun4v_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
stxa %g0, [%g7] ASI_MMU
|
|
|
|
.previous
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
membar #Sync
|
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
/* Everything we do here, until we properly take over the
|
|
|
|
* trap table, must be done with extreme care. We cannot
|
|
|
|
* make any references to %g6 (current thread pointer),
|
|
|
|
* %g4 (current task pointer), or %g5 (base of current cpu's
|
|
|
|
* per-cpu area) until we properly take over the trap table
|
|
|
|
* from the firmware and hypervisor.
|
|
|
|
*
|
|
|
|
* Get onto temporary stack which is in the locked kernel image.
|
|
|
|
*/
|
|
|
|
sethi %hi(tramp_stack), %g1
|
|
|
|
or %g1, %lo(tramp_stack), %g1
|
|
|
|
add %g1, TRAMP_STACK_SIZE, %g1
|
2007-09-17 02:51:15 +08:00
|
|
|
sub %g1, STACKFRAME_SZ + STACK_BIAS + 256, %sp
|
2005-04-17 06:20:36 +08:00
|
|
|
mov 0, %fp
|
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
/* Put garbage in these registers to trap any access to them. */
|
|
|
|
set 0xdeadbeef, %g4
|
|
|
|
set 0xdeadbeef, %g5
|
|
|
|
set 0xdeadbeef, %g6
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
call init_irqwork_curcpu
|
|
|
|
nop
|
2006-02-08 16:08:23 +08:00
|
|
|
|
|
|
|
sethi %hi(tlb_type), %g3
|
|
|
|
lduw [%g3 + %lo(tlb_type)], %g2
|
|
|
|
cmp %g2, 3
|
|
|
|
bne,pt %icc, 1f
|
|
|
|
nop
|
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
call hard_smp_processor_id
|
|
|
|
nop
|
|
|
|
|
2007-08-09 08:32:33 +08:00
|
|
|
call sun4v_register_mondo_queues
|
|
|
|
nop
|
2006-02-08 16:08:23 +08:00
|
|
|
|
|
|
|
1: call init_cur_cpu_trap
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
ldx [%l0], %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2005-10-05 06:23:20 +08:00
|
|
|
/* Start using proper page size encodings in ctx register. */
|
2006-02-08 14:13:05 +08:00
|
|
|
sethi %hi(sparc64_kern_pri_context), %g3
|
|
|
|
ldx [%g3 + %lo(sparc64_kern_pri_context)], %g2
|
|
|
|
mov PRIMARY_CONTEXT, %g1
|
|
|
|
|
|
|
|
661: stxa %g2, [%g1] ASI_DMMU
|
|
|
|
.section .sun4v_1insn_patch, "ax"
|
|
|
|
.word 661b
|
|
|
|
stxa %g2, [%g1] ASI_MMU
|
|
|
|
.previous
|
|
|
|
|
|
|
|
membar #Sync
|
2005-04-17 06:20:36 +08:00
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
wrpr %g0, 0, %wstate
|
|
|
|
|
2008-10-20 14:33:03 +08:00
|
|
|
sethi %hi(prom_entry_lock), %g2
|
|
|
|
1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
|
|
|
|
brnz,pn %g1, 1b
|
|
|
|
nop
|
|
|
|
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
/* As a hack, put &init_thread_union into %g6.
|
|
|
|
* prom_world() loads from here to restore the %asi
|
|
|
|
* register.
|
|
|
|
*/
|
|
|
|
sethi %hi(init_thread_union), %g6
|
|
|
|
or %g6, %lo(init_thread_union), %g6
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2006-02-11 07:39:51 +08:00
|
|
|
sethi %hi(is_sun4v), %o0
|
|
|
|
lduw [%o0 + %lo(is_sun4v)], %o0
|
2008-10-20 14:33:03 +08:00
|
|
|
brz,pt %o0, 2f
|
2006-02-11 07:39:51 +08:00
|
|
|
nop
|
|
|
|
|
|
|
|
TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
|
|
|
|
add %g2, TRAP_PER_CPU_FAULT_INFO, %g2
|
|
|
|
stxa %g2, [%g0] ASI_SCRATCHPAD
|
|
|
|
|
|
|
|
/* Compute physical address:
|
|
|
|
*
|
|
|
|
* paddr = kern_base + (mmfsa_vaddr - KERNBASE)
|
|
|
|
*/
|
|
|
|
sethi %hi(KERNBASE), %g3
|
|
|
|
sub %g2, %g3, %g2
|
|
|
|
sethi %hi(kern_base), %g3
|
|
|
|
ldx [%g3 + %lo(kern_base)], %g3
|
|
|
|
add %g2, %g3, %o1
|
2007-09-17 02:51:15 +08:00
|
|
|
sethi %hi(sparc64_ttable_tl0), %o0
|
2006-02-11 07:39:51 +08:00
|
|
|
|
2007-09-17 02:51:15 +08:00
|
|
|
set prom_set_trap_table_name, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x00]
|
|
|
|
mov 2, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x08]
|
|
|
|
mov 0, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x10]
|
|
|
|
stx %o0, [%sp + 2047 + 128 + 0x18]
|
|
|
|
stx %o1, [%sp + 2047 + 128 + 0x20]
|
|
|
|
sethi %hi(p1275buf), %g2
|
|
|
|
or %g2, %lo(p1275buf), %g2
|
|
|
|
ldx [%g2 + 0x08], %o1
|
|
|
|
call %o1
|
|
|
|
add %sp, (2047 + 128), %o0
|
2006-02-11 07:39:51 +08:00
|
|
|
|
2008-10-20 14:33:03 +08:00
|
|
|
ba,pt %xcc, 3f
|
2006-02-11 07:39:51 +08:00
|
|
|
nop
|
|
|
|
|
2008-10-20 14:33:03 +08:00
|
|
|
2: sethi %hi(sparc64_ttable_tl0), %o0
|
2007-09-17 02:51:15 +08:00
|
|
|
set prom_set_trap_table_name, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x00]
|
|
|
|
mov 1, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x08]
|
|
|
|
mov 0, %g2
|
|
|
|
stx %g2, [%sp + 2047 + 128 + 0x10]
|
|
|
|
stx %o0, [%sp + 2047 + 128 + 0x18]
|
|
|
|
sethi %hi(p1275buf), %g2
|
|
|
|
or %g2, %lo(p1275buf), %g2
|
|
|
|
ldx [%g2 + 0x08], %o1
|
|
|
|
call %o1
|
|
|
|
add %sp, (2047 + 128), %o0
|
2005-04-17 06:20:36 +08:00
|
|
|
|
2008-10-20 14:33:03 +08:00
|
|
|
3: sethi %hi(prom_entry_lock), %g2
|
|
|
|
stb %g0, [%g2 + %lo(prom_entry_lock)]
|
|
|
|
|
|
|
|
ldx [%l0], %g6
|
[SPARC64]: Get SUN4V SMP working.
The sibling cpu bringup is extremely fragile. We can only
perform the most basic calls until we take over the trap
table from the firmware/hypervisor on the new cpu.
This means no accesses to %g4, %g5, %g6 since those can't be
TLB translated without our trap handlers.
In order to achieve this:
1) Change sun4v_init_mondo_queues() so that it can operate in
several modes.
It can allocate the queues, or install them in the current
processor, or both.
The boot cpu does both in it's call early on.
Later, the boot cpu allocates the sibling cpu queue, starts
the sibling cpu, then the sibling cpu loads them in.
2) init_cur_cpu_trap() is changed to take the current_thread_info()
as an argument instead of reading %g6 directly on the current
cpu.
3) Create a trampoline stack for the sibling cpus. We do our basic
kernel calls using this stack, which is locked into the kernel
image, then go to our proper thread stack after taking over the
trap table.
4) While we are in this delicate startup state, we put 0xdeadbeef
into %g4/%g5/%g6 in order to catch accidental accesses.
5) On the final prom_set_trap_table*() call, we put &init_thread_union
into %g6. This is a hack to make prom_world(0) work. All that
wants to do is restore the %asi register using
get_thread_current_ds().
Longer term we should just do the OBP calls to set the trap table by
hand just like we do for everything else. This would avoid that silly
prom_world(0) issue, then we can remove the init_thread_union hack.
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-02-17 17:29:17 +08:00
|
|
|
ldx [%g6 + TI_TASK], %g4
|
|
|
|
|
|
|
|
mov 1, %g5
|
|
|
|
sllx %g5, THREAD_SHIFT, %g5
|
|
|
|
sub %g5, (STACKFRAME_SZ + STACK_BIAS), %g5
|
|
|
|
add %g6, %g5, %sp
|
|
|
|
|
|
|
|
rdpr %pstate, %o1
|
|
|
|
or %o1, PSTATE_IE, %o1
|
|
|
|
wrpr %o1, 0, %pstate
|
|
|
|
|
|
|
|
call smp_callin
|
2005-04-17 06:20:36 +08:00
|
|
|
nop
|
2013-04-12 03:38:50 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
call cpu_panic
|
|
|
|
nop
|
|
|
|
1: b,a,pt %xcc, 1b
|
|
|
|
|
|
|
|
.align 8
|
|
|
|
sparc64_cpu_startup_end:
|