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 */
|
2006-02-07 15:44:37 +08:00
|
|
|
/* sun4v_tlb_miss.S: Sun4v TLB miss handlers.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 <davem@davemloft.net>
|
|
|
|
*/
|
|
|
|
|
|
|
|
.text
|
|
|
|
.align 32
|
|
|
|
|
2006-02-11 16:29:34 +08:00
|
|
|
/* Load ITLB fault information into VADDR and CTX, using BASE. */
|
|
|
|
#define LOAD_ITLB_INFO(BASE, VADDR, CTX) \
|
|
|
|
ldx [BASE + HV_FAULT_I_ADDR_OFFSET], VADDR; \
|
|
|
|
ldx [BASE + HV_FAULT_I_CTX_OFFSET], CTX;
|
|
|
|
|
|
|
|
/* Load DTLB fault information into VADDR and CTX, using BASE. */
|
|
|
|
#define LOAD_DTLB_INFO(BASE, VADDR, CTX) \
|
|
|
|
ldx [BASE + HV_FAULT_D_ADDR_OFFSET], VADDR; \
|
|
|
|
ldx [BASE + HV_FAULT_D_CTX_OFFSET], CTX;
|
2006-02-07 15:44:37 +08:00
|
|
|
|
2006-02-18 10:01:02 +08:00
|
|
|
/* DEST = (VADDR >> 22)
|
2006-02-11 16:29:34 +08:00
|
|
|
*
|
2006-03-03 12:42:53 +08:00
|
|
|
* Branch to ZERO_CTX_LABEL if context is zero.
|
2006-02-07 15:44:37 +08:00
|
|
|
*/
|
2006-02-18 10:01:02 +08:00
|
|
|
#define COMPUTE_TAG_TARGET(DEST, VADDR, CTX, ZERO_CTX_LABEL) \
|
|
|
|
srlx VADDR, 22, DEST; \
|
2006-02-11 16:29:34 +08:00
|
|
|
brz,pn CTX, ZERO_CTX_LABEL; \
|
2006-02-18 10:01:02 +08:00
|
|
|
nop;
|
2006-02-07 15:44:37 +08:00
|
|
|
|
|
|
|
/* Create TSB pointer. This is something like:
|
|
|
|
*
|
|
|
|
* index_mask = (512 << (tsb_reg & 0x7UL)) - 1UL;
|
|
|
|
* tsb_base = tsb_reg & ~0x7UL;
|
2006-03-22 16:49:59 +08:00
|
|
|
* tsb_index = ((vaddr >> HASH_SHIFT) & tsb_mask);
|
2006-02-07 15:44:37 +08:00
|
|
|
* tsb_ptr = tsb_base + (tsb_index * 16);
|
|
|
|
*/
|
2006-03-22 16:49:59 +08:00
|
|
|
#define COMPUTE_TSB_PTR(TSB_PTR, VADDR, HASH_SHIFT, TMP1, TMP2) \
|
2006-02-11 16:29:34 +08:00
|
|
|
and TSB_PTR, 0x7, TMP1; \
|
|
|
|
mov 512, TMP2; \
|
|
|
|
andn TSB_PTR, 0x7, TSB_PTR; \
|
|
|
|
sllx TMP2, TMP1, TMP2; \
|
2006-03-22 16:49:59 +08:00
|
|
|
srlx VADDR, HASH_SHIFT, TMP1; \
|
2006-02-11 16:29:34 +08:00
|
|
|
sub TMP2, 1, TMP2; \
|
|
|
|
and TMP1, TMP2, TMP1; \
|
|
|
|
sllx TMP1, 4, TMP1; \
|
|
|
|
add TSB_PTR, TMP1, TSB_PTR;
|
|
|
|
|
|
|
|
sun4v_itlb_miss:
|
|
|
|
/* Load MMU Miss base into %g2. */
|
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
|
|
|
|
/* Load UTSB reg into %g1. */
|
|
|
|
mov SCRATCHPAD_UTSBREG1, %g1
|
|
|
|
ldxa [%g1] ASI_SCRATCHPAD, %g1
|
|
|
|
|
|
|
|
LOAD_ITLB_INFO(%g2, %g4, %g5)
|
2006-02-18 10:01:02 +08:00
|
|
|
COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_itlb_4v)
|
2006-03-22 16:49:59 +08:00
|
|
|
COMPUTE_TSB_PTR(%g1, %g4, PAGE_SHIFT, %g3, %g7)
|
2006-02-07 15:44:37 +08:00
|
|
|
|
|
|
|
/* Load TSB tag/pte into %g2/%g3 and compare the tag. */
|
2006-02-16 13:21:17 +08:00
|
|
|
ldda [%g1] ASI_QUAD_LDD_PHYS_4V, %g2
|
2006-02-07 15:44:37 +08:00
|
|
|
cmp %g2, %g6
|
|
|
|
bne,a,pn %xcc, tsb_miss_page_table_walk
|
|
|
|
mov FAULT_CODE_ITLB, %g3
|
2006-03-02 14:42:18 +08:00
|
|
|
andcc %g3, _PAGE_EXEC_4V, %g0
|
2006-02-07 15:44:37 +08:00
|
|
|
be,a,pn %xcc, tsb_do_fault
|
|
|
|
mov FAULT_CODE_ITLB, %g3
|
|
|
|
|
|
|
|
/* We have a valid entry, make hypervisor call to load
|
|
|
|
* I-TLB and return from trap.
|
|
|
|
*
|
|
|
|
* %g3: PTE
|
|
|
|
* %g4: vaddr
|
|
|
|
*/
|
|
|
|
sun4v_itlb_load:
|
2006-02-18 10:01:02 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g6
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %o0, %g1 ! save %o0
|
|
|
|
mov %o1, %g2 ! save %o1
|
|
|
|
mov %o2, %g5 ! save %o2
|
|
|
|
mov %o3, %g7 ! save %o3
|
|
|
|
mov %g4, %o0 ! vaddr
|
2006-02-18 10:01:02 +08:00
|
|
|
ldx [%g6 + HV_FAULT_I_CTX_OFFSET], %o1 ! ctx
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %g3, %o2 ! PTE
|
|
|
|
mov HV_MMU_IMMU, %o3 ! flags
|
|
|
|
ta HV_MMU_MAP_ADDR_TRAP
|
2006-02-18 06:58:02 +08:00
|
|
|
brnz,pn %o0, sun4v_itlb_error
|
|
|
|
mov %g2, %o1 ! restore %o1
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %g1, %o0 ! restore %o0
|
|
|
|
mov %g5, %o2 ! restore %o2
|
|
|
|
mov %g7, %o3 ! restore %o3
|
|
|
|
|
|
|
|
retry
|
|
|
|
|
|
|
|
sun4v_dtlb_miss:
|
2006-02-11 07:39:51 +08:00
|
|
|
/* Load MMU Miss base into %g2. */
|
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
2006-02-07 15:44:37 +08:00
|
|
|
|
|
|
|
/* Load UTSB reg into %g1. */
|
2006-02-11 07:39:51 +08:00
|
|
|
mov SCRATCHPAD_UTSBREG1, %g1
|
2006-02-12 04:21:20 +08:00
|
|
|
ldxa [%g1] ASI_SCRATCHPAD, %g1
|
2006-02-07 15:44:37 +08:00
|
|
|
|
2006-02-11 16:29:34 +08:00
|
|
|
LOAD_DTLB_INFO(%g2, %g4, %g5)
|
2006-02-18 10:01:02 +08:00
|
|
|
COMPUTE_TAG_TARGET(%g6, %g4, %g5, kvmap_dtlb_4v)
|
2006-03-22 16:49:59 +08:00
|
|
|
COMPUTE_TSB_PTR(%g1, %g4, PAGE_SHIFT, %g3, %g7)
|
2006-02-07 15:44:37 +08:00
|
|
|
|
|
|
|
/* Load TSB tag/pte into %g2/%g3 and compare the tag. */
|
2006-02-16 13:21:17 +08:00
|
|
|
ldda [%g1] ASI_QUAD_LDD_PHYS_4V, %g2
|
2006-02-07 15:44:37 +08:00
|
|
|
cmp %g2, %g6
|
|
|
|
bne,a,pn %xcc, tsb_miss_page_table_walk
|
2006-03-02 14:27:09 +08:00
|
|
|
mov FAULT_CODE_DTLB, %g3
|
2006-02-07 15:44:37 +08:00
|
|
|
|
|
|
|
/* We have a valid entry, make hypervisor call to load
|
|
|
|
* D-TLB and return from trap.
|
|
|
|
*
|
|
|
|
* %g3: PTE
|
|
|
|
* %g4: vaddr
|
|
|
|
*/
|
|
|
|
sun4v_dtlb_load:
|
2006-02-18 10:01:02 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g6
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %o0, %g1 ! save %o0
|
|
|
|
mov %o1, %g2 ! save %o1
|
|
|
|
mov %o2, %g5 ! save %o2
|
|
|
|
mov %o3, %g7 ! save %o3
|
|
|
|
mov %g4, %o0 ! vaddr
|
2006-02-18 10:01:02 +08:00
|
|
|
ldx [%g6 + HV_FAULT_D_CTX_OFFSET], %o1 ! ctx
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %g3, %o2 ! PTE
|
|
|
|
mov HV_MMU_DMMU, %o3 ! flags
|
|
|
|
ta HV_MMU_MAP_ADDR_TRAP
|
2006-02-18 06:58:02 +08:00
|
|
|
brnz,pn %o0, sun4v_dtlb_error
|
|
|
|
mov %g2, %o1 ! restore %o1
|
2006-02-07 15:44:37 +08:00
|
|
|
mov %g1, %o0 ! restore %o0
|
|
|
|
mov %g5, %o2 ! restore %o2
|
|
|
|
mov %g7, %o3 ! restore %o3
|
|
|
|
|
|
|
|
retry
|
|
|
|
|
|
|
|
sun4v_dtlb_prot:
|
2006-02-18 10:01:02 +08:00
|
|
|
SET_GL(1)
|
|
|
|
|
2006-02-19 08:39:39 +08:00
|
|
|
/* Load MMU Miss base into %g5. */
|
2006-02-18 10:01:02 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g5
|
2006-02-07 15:44:37 +08:00
|
|
|
|
2006-02-18 10:01:02 +08:00
|
|
|
ldx [%g5 + HV_FAULT_D_ADDR_OFFSET], %g5
|
2006-02-07 15:44:37 +08:00
|
|
|
rdpr %tl, %g1
|
|
|
|
cmp %g1, 1
|
2006-02-18 10:01:02 +08:00
|
|
|
bgu,pn %xcc, winfix_trampoline
|
|
|
|
mov FAULT_CODE_DTLB | FAULT_CODE_WRITE, %g4
|
2007-01-27 10:48:16 +08:00
|
|
|
ba,pt %xcc, sparc64_realfault_common
|
|
|
|
nop
|
2006-02-07 15:44:37 +08:00
|
|
|
|
2006-02-19 08:39:39 +08:00
|
|
|
/* Called from trap table:
|
|
|
|
* %g4: vaddr
|
|
|
|
* %g5: context
|
|
|
|
* %g6: TAG TARGET
|
2006-02-10 08:12:22 +08:00
|
|
|
*/
|
|
|
|
sun4v_itsb_miss:
|
2006-02-12 04:21:20 +08:00
|
|
|
mov SCRATCHPAD_UTSBREG1, %g1
|
|
|
|
ldxa [%g1] ASI_SCRATCHPAD, %g1
|
|
|
|
brz,pn %g5, kvmap_itlb_4v
|
2006-02-10 08:12:22 +08:00
|
|
|
mov FAULT_CODE_ITLB, %g3
|
2006-02-18 06:58:02 +08:00
|
|
|
ba,a,pt %xcc, sun4v_tsb_miss_common
|
2006-02-10 08:12:22 +08:00
|
|
|
|
2006-02-19 08:39:39 +08:00
|
|
|
/* Called from trap table:
|
|
|
|
* %g4: vaddr
|
|
|
|
* %g5: context
|
|
|
|
* %g6: TAG TARGET
|
2006-02-10 08:12:22 +08:00
|
|
|
*/
|
|
|
|
sun4v_dtsb_miss:
|
2006-02-12 04:21:20 +08:00
|
|
|
mov SCRATCHPAD_UTSBREG1, %g1
|
|
|
|
ldxa [%g1] ASI_SCRATCHPAD, %g1
|
|
|
|
brz,pn %g5, kvmap_dtlb_4v
|
|
|
|
mov FAULT_CODE_DTLB, %g3
|
2006-02-10 08:12:22 +08:00
|
|
|
|
2006-02-19 08:39:39 +08:00
|
|
|
/* fallthrough */
|
|
|
|
|
2006-02-10 08:12:22 +08:00
|
|
|
sun4v_tsb_miss_common:
|
2006-03-22 16:49:59 +08:00
|
|
|
COMPUTE_TSB_PTR(%g1, %g4, PAGE_SHIFT, %g5, %g7)
|
2006-02-11 16:29:34 +08:00
|
|
|
|
|
|
|
sub %g2, TRAP_PER_CPU_FAULT_INFO, %g2
|
2006-03-22 16:49:59 +08:00
|
|
|
|
2012-10-09 07:34:29 +08:00
|
|
|
#if defined(CONFIG_HUGETLB_PAGE) || defined(CONFIG_TRANSPARENT_HUGEPAGE)
|
2006-03-22 16:49:59 +08:00
|
|
|
mov SCRATCHPAD_UTSBREG2, %g5
|
|
|
|
ldxa [%g5] ASI_SCRATCHPAD, %g5
|
|
|
|
cmp %g5, -1
|
|
|
|
be,pt %xcc, 80f
|
|
|
|
nop
|
sparc64: Move from 4MB to 8MB huge pages.
The impetus for this is that we would like to move to 64-bit PMDs and
PGDs, but that would result in only supporting a 42-bit address space
with the current page table layout. It'd be nice to support at least
43-bits.
The reason we'd end up with only 42-bits after making PMDs and PGDs
64-bit is that we only use half-page sized PTE tables in order to make
PMDs line up to 4MB, the hardware huge page size we use.
So what we do here is we make huge pages 8MB, and fabricate them using
4MB hw TLB entries.
Facilitate this by providing a "REAL_HPAGE_SHIFT" which is used in
places that really need to operate on hardware 4MB pages.
Use full pages (512 entries) for PTE tables, and adjust PMD_SHIFT,
PGD_SHIFT, and the build time CPP test as needed. Use a CPP test to
make sure REAL_HPAGE_SHIFT and the _PAGE_SZHUGE_* we use match up.
This makes the pgtable cache completely unused, so remove the code
managing it and the state used in mm_context_t. Now we have less
spinlocks taken in the page table allocation path.
The technique we use to fabricate the 8MB pages is to transfer bit 22
from the missing virtual address into the PTEs physical address field.
That takes care of the transparent huge pages case.
For hugetlb, we fill things in at the PTE level and that code already
puts the sub huge page physical bits into the PTEs, based upon the
offset, so there is nothing special we need to do. It all just works
out.
So, a small amount of complexity in the THP case, but this code is
about to get much simpler when we move the 64-bit PMDs as we can move
away from the fancy 32-bit huge PMD encoding and just put a real PTE
value in there.
With bug fixes and help from Bob Picco.
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-09-26 04:48:49 +08:00
|
|
|
COMPUTE_TSB_PTR(%g5, %g4, REAL_HPAGE_SHIFT, %g2, %g7)
|
2006-03-22 16:49:59 +08:00
|
|
|
|
|
|
|
/* That clobbered %g2, reload it. */
|
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
sub %g2, TRAP_PER_CPU_FAULT_INFO, %g2
|
|
|
|
|
|
|
|
80: stx %g5, [%g2 + TRAP_PER_CPU_TSB_HUGE_TEMP]
|
|
|
|
#endif
|
|
|
|
|
2006-02-11 16:29:34 +08:00
|
|
|
ba,pt %xcc, tsb_miss_page_table_walk_sun4v_fastpath
|
|
|
|
ldx [%g2 + TRAP_PER_CPU_PGD_PADDR], %g7
|
2006-02-10 08:12:22 +08:00
|
|
|
|
2006-02-18 06:58:02 +08:00
|
|
|
sun4v_itlb_error:
|
2014-09-16 21:26:47 +08:00
|
|
|
rdpr %tl, %g1
|
|
|
|
cmp %g1, 1
|
|
|
|
ble,pt %icc, sun4v_bad_ra
|
|
|
|
or %g0, FAULT_CODE_BAD_RA | FAULT_CODE_ITLB, %g1
|
|
|
|
|
2006-02-18 06:58:02 +08:00
|
|
|
sethi %hi(sun4v_err_itlb_vaddr), %g1
|
|
|
|
stx %g4, [%g1 + %lo(sun4v_err_itlb_vaddr)]
|
|
|
|
sethi %hi(sun4v_err_itlb_ctx), %g1
|
2006-02-18 10:01:02 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g6
|
|
|
|
ldx [%g6 + HV_FAULT_I_CTX_OFFSET], %o1
|
2006-02-18 06:58:02 +08:00
|
|
|
stx %o1, [%g1 + %lo(sun4v_err_itlb_ctx)]
|
|
|
|
sethi %hi(sun4v_err_itlb_pte), %g1
|
|
|
|
stx %g3, [%g1 + %lo(sun4v_err_itlb_pte)]
|
|
|
|
sethi %hi(sun4v_err_itlb_error), %g1
|
|
|
|
stx %o0, [%g1 + %lo(sun4v_err_itlb_error)]
|
|
|
|
|
2014-09-16 21:26:47 +08:00
|
|
|
sethi %hi(1f), %g7
|
2006-02-18 06:58:02 +08:00
|
|
|
rdpr %tl, %g4
|
|
|
|
ba,pt %xcc, etraptl1
|
2014-09-16 21:26:47 +08:00
|
|
|
1: or %g7, %lo(1f), %g7
|
2008-01-17 17:32:09 +08:00
|
|
|
mov %l4, %o1
|
2006-02-18 06:58:02 +08:00
|
|
|
call sun4v_itlb_error_report
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
|
|
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
|
|
|
sun4v_dtlb_error:
|
2014-09-16 21:26:47 +08:00
|
|
|
rdpr %tl, %g1
|
|
|
|
cmp %g1, 1
|
|
|
|
ble,pt %icc, sun4v_bad_ra
|
|
|
|
or %g0, FAULT_CODE_BAD_RA | FAULT_CODE_DTLB, %g1
|
|
|
|
|
2006-02-18 06:58:02 +08:00
|
|
|
sethi %hi(sun4v_err_dtlb_vaddr), %g1
|
|
|
|
stx %g4, [%g1 + %lo(sun4v_err_dtlb_vaddr)]
|
|
|
|
sethi %hi(sun4v_err_dtlb_ctx), %g1
|
2006-02-18 10:01:02 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g6
|
|
|
|
ldx [%g6 + HV_FAULT_D_CTX_OFFSET], %o1
|
2006-02-18 06:58:02 +08:00
|
|
|
stx %o1, [%g1 + %lo(sun4v_err_dtlb_ctx)]
|
|
|
|
sethi %hi(sun4v_err_dtlb_pte), %g1
|
|
|
|
stx %g3, [%g1 + %lo(sun4v_err_dtlb_pte)]
|
|
|
|
sethi %hi(sun4v_err_dtlb_error), %g1
|
|
|
|
stx %o0, [%g1 + %lo(sun4v_err_dtlb_error)]
|
|
|
|
|
2014-09-16 21:26:47 +08:00
|
|
|
sethi %hi(1f), %g7
|
2006-02-18 06:58:02 +08:00
|
|
|
rdpr %tl, %g4
|
|
|
|
ba,pt %xcc, etraptl1
|
2014-09-16 21:26:47 +08:00
|
|
|
1: or %g7, %lo(1f), %g7
|
2008-01-17 17:32:09 +08:00
|
|
|
mov %l4, %o1
|
2006-02-18 06:58:02 +08:00
|
|
|
call sun4v_dtlb_error_report
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
|
|
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
2014-09-16 21:26:47 +08:00
|
|
|
sun4v_bad_ra:
|
|
|
|
or %g0, %g4, %g5
|
|
|
|
ba,pt %xcc, sparc64_realfault_common
|
|
|
|
or %g1, %g0, %g4
|
|
|
|
|
|
|
|
/* NOTREACHED */
|
|
|
|
|
2006-02-10 12:20:34 +08:00
|
|
|
/* Instruction Access Exception, tl0. */
|
|
|
|
sun4v_iacc:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_I_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call sun4v_insn_access_exception
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Instruction Access Exception, tl1. */
|
|
|
|
sun4v_iacc_tl1:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_I_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_I_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_I_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etraptl1
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call sun4v_insn_access_exception_tl1
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Data Access Exception, tl0. */
|
|
|
|
sun4v_dacc:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_D_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call sun4v_data_access_exception
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Data Access Exception, tl1. */
|
|
|
|
sun4v_dacc_tl1:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_D_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etraptl1
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call sun4v_data_access_exception_tl1
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Memory Address Unaligned. */
|
|
|
|
sun4v_mna:
|
2006-02-19 08:39:39 +08:00
|
|
|
/* Window fixup? */
|
|
|
|
rdpr %tl, %g2
|
|
|
|
cmp %g2, 1
|
|
|
|
ble,pt %icc, 1f
|
|
|
|
nop
|
|
|
|
|
|
|
|
SET_GL(1)
|
2006-03-03 12:42:53 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g5
|
2006-02-19 08:39:39 +08:00
|
|
|
mov HV_FAULT_TYPE_UNALIGNED, %g3
|
2006-03-03 12:42:53 +08:00
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g4
|
2006-02-19 08:39:39 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g4, %g3, %g4
|
|
|
|
ba,pt %xcc, winfix_mna
|
|
|
|
rdpr %tpc, %g3
|
|
|
|
/* not reached */
|
|
|
|
|
|
|
|
1: ldxa [%g0] ASI_SCRATCHPAD, %g2
|
2006-02-10 12:20:34 +08:00
|
|
|
mov HV_FAULT_TYPE_UNALIGNED, %g3
|
2006-02-11 07:39:51 +08:00
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
2006-02-15 08:39:22 +08:00
|
|
|
call sun4v_do_mna
|
2006-02-10 12:20:34 +08:00
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
arch/sparc: Avoid DCTI Couples
Avoid un-intended DCTI Couples. Use of DCTI couples is deprecated.
Also address the "Programming Note" for optimal performance.
Here is the complete text from Oracle SPARC Architecture Specs.
6.3.4.7 DCTI Couples
"A delayed control transfer instruction (DCTI) in the delay slot of
another DCTI is referred to as a “DCTI couple”. The use of DCTI couples
is deprecated in the Oracle SPARC Architecture; no new software should
place a DCTI in the delay slot of another DCTI, because on future Oracle
SPARC Architecture implementations DCTI couples may execute either
slowly or differently than the programmer assumes it will.
SPARC V8 and SPARC V9 Compatibility Note
The SPARC V8 architecture left behavior undefined for a DCTI couple. The
SPARC V9 architecture defined behavior in that case, but as of
UltraSPARC Architecture 2005, use of DCTI couples was deprecated.
Software should not expect high performance from DCTI couples, and
performance of DCTI couples should be expected to decline further in
future processors.
Programming Note
As noted in TABLE 6-5 on page 115, an annulled branch-always
(branch-always with a = 1) instruction is not architecturally a DCTI.
However, since not all implementations make that distinction, for
optimal performance, a DCTI should not be placed in the instruction word
immediately following an annulled branch-always instruction (BA,A or
BPA,A)."
Signed-off-by: Babu Moger <babu.moger@oracle.com>
Reviewed-by: Rob Gardner <rob.gardner@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-03-18 04:52:21 +08:00
|
|
|
nop
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Privileged Action. */
|
|
|
|
sun4v_privact:
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
call do_privact
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Unaligned ldd float, tl0. */
|
|
|
|
sun4v_lddfmna:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_D_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call handle_lddfmna
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 12:20:34 +08:00
|
|
|
|
|
|
|
/* Unaligned std float, tl0. */
|
|
|
|
sun4v_stdfmna:
|
2006-02-11 07:39:51 +08:00
|
|
|
ldxa [%g0] ASI_SCRATCHPAD, %g2
|
|
|
|
ldx [%g2 + HV_FAULT_D_TYPE_OFFSET], %g3
|
|
|
|
ldx [%g2 + HV_FAULT_D_ADDR_OFFSET], %g4
|
|
|
|
ldx [%g2 + HV_FAULT_D_CTX_OFFSET], %g5
|
2006-02-10 12:20:34 +08:00
|
|
|
sllx %g3, 16, %g3
|
|
|
|
or %g5, %g3, %g5
|
|
|
|
ba,pt %xcc, etrap
|
|
|
|
rd %pc, %g7
|
|
|
|
mov %l4, %o1
|
|
|
|
mov %l5, %o2
|
|
|
|
call handle_stdfmna
|
|
|
|
add %sp, PTREGS_OFF, %o0
|
2008-04-24 18:15:22 +08:00
|
|
|
ba,a,pt %xcc, rtrap
|
2006-02-10 08:12:22 +08:00
|
|
|
|
2006-02-07 15:44:37 +08:00
|
|
|
#define BRANCH_ALWAYS 0x10680000
|
|
|
|
#define NOP 0x01000000
|
|
|
|
#define SUN4V_DO_PATCH(OLD, NEW) \
|
|
|
|
sethi %hi(NEW), %g1; \
|
|
|
|
or %g1, %lo(NEW), %g1; \
|
|
|
|
sethi %hi(OLD), %g2; \
|
|
|
|
or %g2, %lo(OLD), %g2; \
|
|
|
|
sub %g1, %g2, %g1; \
|
|
|
|
sethi %hi(BRANCH_ALWAYS), %g3; \
|
2006-02-12 04:21:20 +08:00
|
|
|
sll %g1, 11, %g1; \
|
|
|
|
srl %g1, 11 + 2, %g1; \
|
2006-02-07 15:44:37 +08:00
|
|
|
or %g3, %lo(BRANCH_ALWAYS), %g3; \
|
|
|
|
or %g3, %g1, %g3; \
|
|
|
|
stw %g3, [%g2]; \
|
|
|
|
sethi %hi(NOP), %g3; \
|
|
|
|
or %g3, %lo(NOP), %g3; \
|
|
|
|
stw %g3, [%g2 + 0x4]; \
|
|
|
|
flush %g2;
|
|
|
|
|
|
|
|
.globl sun4v_patch_tlb_handlers
|
|
|
|
.type sun4v_patch_tlb_handlers,#function
|
|
|
|
sun4v_patch_tlb_handlers:
|
|
|
|
SUN4V_DO_PATCH(tl0_iamiss, sun4v_itlb_miss)
|
|
|
|
SUN4V_DO_PATCH(tl1_iamiss, sun4v_itlb_miss)
|
|
|
|
SUN4V_DO_PATCH(tl0_damiss, sun4v_dtlb_miss)
|
|
|
|
SUN4V_DO_PATCH(tl1_damiss, sun4v_dtlb_miss)
|
|
|
|
SUN4V_DO_PATCH(tl0_daprot, sun4v_dtlb_prot)
|
|
|
|
SUN4V_DO_PATCH(tl1_daprot, sun4v_dtlb_prot)
|
2006-02-10 12:20:34 +08:00
|
|
|
SUN4V_DO_PATCH(tl0_iax, sun4v_iacc)
|
|
|
|
SUN4V_DO_PATCH(tl1_iax, sun4v_iacc_tl1)
|
|
|
|
SUN4V_DO_PATCH(tl0_dax, sun4v_dacc)
|
|
|
|
SUN4V_DO_PATCH(tl1_dax, sun4v_dacc_tl1)
|
|
|
|
SUN4V_DO_PATCH(tl0_mna, sun4v_mna)
|
|
|
|
SUN4V_DO_PATCH(tl1_mna, sun4v_mna)
|
|
|
|
SUN4V_DO_PATCH(tl0_lddfmna, sun4v_lddfmna)
|
|
|
|
SUN4V_DO_PATCH(tl0_stdfmna, sun4v_stdfmna)
|
|
|
|
SUN4V_DO_PATCH(tl0_privact, sun4v_privact)
|
2006-02-07 15:44:37 +08:00
|
|
|
retl
|
|
|
|
nop
|
|
|
|
.size sun4v_patch_tlb_handlers,.-sun4v_patch_tlb_handlers
|