Add a series of TLB function that allow TLB flushing in a variety of
ways depending on the mode encoded in enum tlb_state:
TLB_BROADCOAST -> Use single TLBI propagated to all units via the mesh
TLB_LOCAL -> Use TLBI that only perform local flushes
TLB_IPI -> Use TLBIs that perform local flushes on multiple cpus
TLB_NONE -> Suppress TLBI because there are no users of the address space
The tlb mode is determined based on the cpus included in the cpumask
of an address space. A TLB entry can only be present in a cpus
TLB cache if code from the address space has been running on a
particular cpu.
The TLB operation modes can be controlled via
1. A tlb_mode kernel config option at boot time
Pass tlb_mode=XXX on the kernel command line.
2. /sys/kernel/debug/arm64/tlb_mode at run time
The lower 10 bits encode the weight of the cpumask. If the cpumask has more than
this weight then TLB_BROADCAST mode is selected. For lower weigths TLB_IPI is used.
A zero disables this functionality. The system will calculate a weight that depends
on the number of cpus in the system if not specified on the kernel command line.
Bit 10 enables TLB_LOCAL mode. TLB_LOCAL causes only local invalidates when the
address space has only been used by the local cpu.
Bit 11 enables TLBI range instructions
Bit 12 enables TLBI suppression if an address space does not record any use by a cpu.
Signed-off-by: Christoph Lameter (Ampere) <cl@linux.com>