android_kernel_xiaomi_sm8350/arch/sparc64/kernel
David S. Miller 56fb4df6da [SPARC64]: Elminate all usage of hard-coded trap globals.
UltraSPARC has special sets of global registers which are switched to
for certain trap types.  There is one set for MMU related traps, one
set of Interrupt Vector processing, and another set (called the
Alternate globals) for all other trap types.

For what seems like forever we've hard coded the values in some of
these trap registers.  Some examples include:

1) Interrupt Vector global %g6 holds current processors interrupt
   work struct where received interrupts are managed for IRQ handler
   dispatch.

2) MMU global %g7 holds the base of the page tables of the currently
   active address space.

3) Alternate global %g6 held the current_thread_info() value.

Such hardcoding has resulted in some serious issues in many areas.
There are some code sequences where having another register available
would help clean up the implementation.  Taking traps such as
cross-calls from the OBP firmware requires some trick code sequences
wherein we have to save away and restore all of the special sets of
global registers when we enter/exit OBP.

We were also using the IMMU TSB register on SMP to hold the per-cpu
area base address, which doesn't work any longer now that we actually
use the TSB facility of the cpu.

The implementation is pretty straight forward.  One tricky bit is
getting the current processor ID as that is different on different cpu
variants.  We use a stub with a fancy calling convention which we
patch at boot time.  The calling convention is that the stub is
branched to and the (PC - 4) to return to is in register %g1.  The cpu
number is left in %g6.  This stub can be invoked by using the
__GET_CPUID macro.

We use an array of per-cpu trap state to store the current thread and
physical address of the current address space's page tables.  The
TRAP_LOAD_THREAD_REG loads %g6 with the current thread from this
table, it uses __GET_CPUID and also clobbers %g1.

TRAP_LOAD_IRQ_WORK is used by the interrupt vector processing to load
the current processor's IRQ software state into %g6.  It also uses
__GET_CPUID and clobbers %g1.

Finally, TRAP_LOAD_PGD_PHYS loads the physical address base of the
current address space's page tables into %g7, it clobbers %g1 and uses
__GET_CPUID.

Many refinements are possible, as well as some tuning, with this stuff
in place.

Signed-off-by: David S. Miller <davem@davemloft.net>
2006-03-20 01:11:16 -08:00
..
asm-offsets.c kbuild: frv,m32r,sparc64 introduce fake asm-offsets.h file 2005-09-09 22:47:53 +02:00
auxio.c [SPARC64]: Get rid of fast IRQ feature. 2005-06-27 17:04:45 -07:00
binfmt_aout32.c [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
binfmt_elf32.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
central.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
chmc.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
cpu.c [SPARC64]: Use ARRAY_SIZE macro 2005-11-09 12:03:42 -08:00
devices.c [SPARC64]: Probe D/I/E-cache config and use. 2005-09-26 00:32:17 -07:00
dtlb_miss.S [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
dtlb_prot.S [SPARC64]: Fix boot failures on SunBlade-150 2005-10-12 12:22:46 -07:00
ebus.c [PATCH] PCI: pci_find_device remove (sparc64/kernel/ebus.c) 2006-01-09 12:13:15 -08:00
entry.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
etrap.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
head.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
idprom.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
init_task.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iommu_common.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
iommu_common.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
irq.c [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
isa.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
itlb_miss.S [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
kprobes.c [PATCH] kprobes: fix race in recovery of reentrant probe 2006-01-11 18:42:12 -08:00
ktlb.S [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
Makefile [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
module.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci_common.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci_impl.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
pci_iommu.c [SPARC64]: Eliminate PCI IOMMU dma mapping size limit. 2005-10-13 22:15:24 -07:00
pci_psycho.c [SPARC64]: Consolidate common PCI IOMMU init code. 2005-10-13 21:10:08 -07:00
pci_sabre.c [SPARC64]: Consolidate common PCI IOMMU init code. 2005-10-13 21:10:08 -07:00
pci_schizo.c [SPARC64]: Consolidate common PCI IOMMU init code. 2005-10-13 21:10:08 -07:00
pci.c [PATCH] Make sparc64 use setup-res.c 2005-09-08 14:57:25 -07:00
power.c [SPARC64]: Add needed pm_power_off symbol. 2006-01-09 14:12:50 -08:00
process.c [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
ptrace.c [PATCH] sparc64: task_pt_regs() 2006-01-12 09:08:52 -08:00
rtrap.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
sbus.c [PATCH] unpaged: fix sound Bad page states 2005-11-22 09:13:43 -08:00
semaphore.c [SPARC64]: Avoid membar instructions in delay slots. 2005-06-27 15:42:04 -07:00
setup.c [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
signal32.c [SPARC]: Add support for *at(), ppoll, and pselect syscalls. 2006-01-19 02:42:49 -08:00
signal.c [SPARC]: Add support for *at(), ppoll, and pselect syscalls. 2006-01-19 02:42:49 -08:00
smp.c [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
sparc64_ksyms.c [SPARC64]: Kill pgtable quicklists and use SLAB. 2006-03-20 01:11:14 -08:00
starfire.c Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sunos_ioctl32.c [SPARC]: Kill remaining kbio.h references. 2005-11-07 14:12:21 -08:00
sys32.S [SPARC64]: Mark __ex_table section correctly. 2006-03-04 23:23:56 -08:00
sys_sparc32.c [SPARC]: sys_newfstatat --> sys_fstatat64 2006-02-12 23:30:11 -08:00
sys_sparc.c [PATCH] Avoiding mmap fragmentation 2005-06-21 18:46:16 -07:00
sys_sunos32.c [PATCH] capable/capability.h (arch/) 2006-01-11 18:42:14 -08:00
systbls.S [SPARC]: sys_newfstatat --> sys_fstatat64 2006-02-12 23:30:11 -08:00
time.c [SPARC64]: Eliminate race condition reading Hummingbird STICK register 2006-01-17 15:21:01 -08:00
trampoline.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
traps.c [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
tsb.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
ttable.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00
una_asm.S [SPARC64]: Mark __ex_table section correctly. 2006-03-04 23:23:56 -08:00
unaligned.c [SPARC64]: Fix fault handling in unaligned trap handler. 2005-09-28 20:41:45 -07:00
us2e_cpufreq.c [PATCH] kfree cleanup: arch 2005-11-07 07:54:06 -08:00
us3_cpufreq.c [PATCH] kfree cleanup: arch 2005-11-07 07:54:06 -08:00
vmlinux.lds.S [SPARC64]: Move away from virtual page tables, part 1. 2006-03-20 01:11:13 -08:00
winfixup.S [SPARC64]: Elminate all usage of hard-coded trap globals. 2006-03-20 01:11:16 -08:00