linux/arch/arm/include/asm
Dave Martin 17eed27b02 arm64/sve: KVM: Prevent guests from using SVE
Until KVM has full SVE support, guests must not be allowed to
execute SVE instructions.

This patch enables the necessary traps, and also ensures that the
traps are disabled again on exit from the guest so that the host
can still use SVE if it wants to.

On guest exit, high bits of the SVE Zn registers may have been
clobbered as a side-effect the execution of FPSIMD instructions in
the guest.  The existing KVM host FPSIMD restore code is not
sufficient to restore these bits, so this patch explicitly marks
the CPU as not containing cached vector state for any task, thus
forcing a reload on the next return to userspace.  This is an
interim measure, in advance of adding full SVE awareness to KVM.

This marking of cached vector state in the CPU as invalid is done
using __this_cpu_write(fpsimd_last_state, NULL) in fpsimd.c.  Due
to the repeated use of this rather obscure operation, it makes
sense to factor it out as a separate helper with a clearer name.
This patch factors it out as fpsimd_flush_cpu_state(), and ports
all callers to use it.

As a side effect of this refactoring, a this_cpu_write() in
fpsimd_cpu_pm_notifier() is changed to __this_cpu_write().  This
should be fine, since cpu_pm_enter() is supposed to be called only
with interrupts disabled.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
2017-11-03 15:24:19 +00:00
..
hardware ARM/clk: move the ICST library to drivers/clk 2017-04-07 11:58:12 +02:00
mach ARM/PCI: Convert PCI scan API to pci_scan_root_bus_bridge() 2017-06-28 15:13:55 -05:00
xen xen: avoid type warning in xchg_xen_ulong 2017-06-08 15:07:38 -07:00
arch_gicv3.h irqchip/gic-v3-its: Add VPE interrupt masking 2017-08-31 15:31:38 +01:00
arch_timer.h arm_arch_timer: Expose event stream status 2017-10-13 18:55:05 +01:00
arm-cci.h arm-cci: Get rid of secure transactions for PMU driver 2015-03-27 13:44:35 +00:00
asm-offsets.h
assembler.h ARM: Prepare for randomized task_struct 2017-06-30 12:00:50 -07:00
atomic.h locking/atomic: Remove linux/atomic.h:atomic_fetch_or() 2016-06-16 10:48:32 +02:00
auxvec.h ARM: 8329/1: miscellaneous vdso infrastructure, preparation 2015-03-27 22:20:45 +00:00
barrier.h ARM: 8582/1: remove unused CONFIG_ARCH_HAS_BARRIERS 2016-07-02 11:01:08 +01:00
bitops.h ARM: 8679/1: bitops: Align prototypes to generic API 2017-06-18 22:36:33 +01:00
bitrev.h ARM: 8287/1: add bitrev.h file to support rbit instruction 2015-01-16 14:06:18 +00:00
bL_switcher.h ARM: bL_switcher: Add query interface to discover CPU affinities 2013-09-23 18:47:31 -04:00
bug.h debug: Fix WARN_ON_ONCE() for modules 2017-07-20 12:31:04 +02:00
bugs.h
cache.h
cacheflush.h randstruct: opt-out externally exposed function pointer structs 2017-06-30 12:00:52 -07:00
cachetype.h ARM: 8604/1: V7M: Add support for reading the CTR with read_cpuid_cachetype() 2016-09-06 15:51:07 +01:00
checksum.h ipv6: Pass proto to csum_ipv6_magic as __u8 instead of unsigned short 2016-03-13 23:55:13 -04:00
clocksource.h arm/arm64: arch_timer: Use archdata to indicate vdso suitability 2016-09-23 17:19:25 +01:00
cmpxchg.h ARM: 8443/1: Adding support for atomic half word exchange 2015-10-09 16:22:54 +01:00
compiler.h ARM: 8300/1: teach __asmeq that r11 == fp and r12 == ip 2015-02-10 10:23:11 +00:00
cp15.h ARM: Move system register accessors to asm/cp15.h 2016-09-22 13:22:10 +02:00
cpu.h
cpufeature.h ARM: 8663/1: wire up HWCAP/HWCAP2 feature bits to the CPU modalias 2017-03-30 19:45:52 +01:00
cpuidle.h ARM: cpuidle: add const qualifier to cpuidle_ops member in structures 2016-04-20 06:59:10 +02:00
cputype.h ARM: 8634/1: hw_breakpoint: blacklist Scorpion CPUs 2017-01-10 23:32:26 +00:00
cti.h
dcc.h ARM: tty: Move HVC DCC assembly to arch/arm 2014-05-28 13:33:18 -07:00
delay.h ARM: 8619/1: udelay: document the various constants 2016-10-19 10:52:36 +01:00
device.h ARM: dma-mapping: Don't tear down third-party mappings 2017-05-30 11:31:33 +02:00
div64.h ARM: 8504/1: __arch_xprod_64(): small optimization 2016-02-11 15:33:37 +00:00
dma-contiguous.h drivers: dma-contiguous: clean source code and prepare for device tree 2013-08-27 09:18:29 +02:00
dma-iommu.h arm: remove arch specific dma_supported implementation 2017-06-28 06:54:45 -07:00
dma-mapping.h ARM: NOMMU: Introduce dma operations for noMMU 2017-06-30 10:03:09 -07:00
dma.h remove <asm/scatterlist.h> 2015-05-05 13:35:39 -06:00
dmi.h efi/arm: Enable DMI/SMBIOS 2017-06-05 17:50:44 +02:00
domain.h ARM: 8573/1: domain: move {set,get}_domain under config guard 2016-05-05 19:03:02 +01:00
ecard.h
edac.h EDAC: Cleanup atomic_scrub mess 2015-05-28 15:31:53 +02:00
efi.h efi/arm-stub: Correct FDT and initrd allocation rules for arm64 2017-04-05 12:27:23 +02:00
elf.h arm: move ELF_ET_DYN_BASE to 4MB 2017-07-10 16:32:36 -07:00
entry-macro-multi.S ARM: replace BSYM() with badr assembly macro 2015-05-08 17:33:50 +01:00
exception.h arch, ftrace: for KASAN put hard/soft IRQ entries into separate sections 2016-03-25 16:37:42 -07:00
fb.h
fiq.h
firmware.h ARM: EXYNOS: add exynos_get_boot_addr() helper 2015-06-06 02:17:56 +09:00
fixmap.h ARM: 8667/3: Fix memory attribute inconsistencies when using fixmap 2017-04-20 11:19:42 +01:00
flat.h binfmt_flat: flat_{get,put}_addr_from_rp() should be able to fail 2017-07-03 18:44:02 -04:00
floppy.h ARM: 8584/1: floppy: avoid gcc-6 warning 2016-07-02 11:02:13 +01:00
fncpy.h
fpstate.h
ftrace.h ARM: 8678/1: ftrace: Adds support for CONFIG_DYNAMIC_FTRACE_WITH_REGS 2017-06-18 22:25:16 +01:00
futex.h futex: Remove duplicated code and fix undefined behaviour 2017-08-25 22:49:59 +02:00
glue-cache.h ARM: 8607/1: V7M: Wire up caches for V7M processors with cache support. 2016-09-06 15:51:08 +01:00
glue-df.h ARM: 8065/1: remove last use of CONFIG_CPU_ARM710 2014-05-30 01:12:30 +01:00
glue-pf.h
glue-proc.h ARM: 8103/1: save/restore Cortex-A9 CP15 registers on suspend/resume 2014-07-18 12:29:37 +01:00
glue.h
gpio.h ARM: delete old reference to ARM_GPIOLIB_COMPLEX 2014-06-30 21:37:39 +02:00
hardirq.h ARM: 8487/1: Remove IPI_CALL_FUNC_SINGLE 2015-12-22 12:09:43 +00:00
highmem.h kmap_atomic_to_page() has no users, remove it 2015-11-09 15:11:24 -08:00
hugetlb-3level.h
hugetlb.h mm/hugetlb: remove arch_prepare/release_hugepage from arch headers 2015-06-25 17:00:35 -07:00
hw_breakpoint.h ARM: 8598/1: remove traces of perf_ops_bp 2016-08-23 10:09:23 +01:00
hw_irq.h ARM: Remove ununsed set_irq_flags 2015-09-16 16:53:39 +02:00
hwcap.h ARM: 7981/1: add support for AT_HWCAP2 ELF auxv entry 2014-02-25 11:40:48 +00:00
hypervisor.h
ide.h
idmap.h
insn.h ARM: kprobes: enable OPTPROBES for ARM 32 2015-01-13 16:10:17 +00:00
io.h ARM: Implement pci_remap_cfgspace() interface 2017-04-24 13:53:13 -05:00
irq_work.h arm: Tell irq work about self IPI support 2014-09-13 18:38:39 +02:00
irq.h nmi_backtrace: add more trigger_*_cpu_backtrace() methods 2016-10-07 18:46:30 -07:00
irqflags.h ARM: 8422/1: enable imprecise aborts during early kernel startup 2015-09-22 08:13:56 +01:00
jump_label.h locking/static_keys: Add a new static_key interface 2015-08-03 11:34:15 +02:00
Kbuild ARM: move generic-y of exported headers to uapi/asm/Kbuild 2017-07-10 03:43:20 +09:00
kexec.h ARM: kexec: fix failure to boot crash kernel 2017-07-20 11:37:42 +01:00
kgdb.h ARM: kdgb: use <asm/opcodes.h> for data to be assembled as intruction 2013-10-19 20:46:35 +01:00
kmap_types.h
kprobes.h kprobes: move kprobe declarations to asm-generic/kprobes.h 2017-02-27 18:43:45 -08:00
kvm_arm.h KVM: arm/arm64: Fix guest external abort matching 2017-09-05 17:33:37 +02:00
kvm_asm.h ARM: KVM: Gracefully handle hyp-stubs being restored from under our feet 2017-04-09 07:49:31 -07:00
kvm_coproc.h KVM: arm: plug potential guest hardware debug leakage 2017-05-15 14:29:19 +02:00
kvm_emulate.h KVM: arm/arm64: Fix guest external abort matching 2017-09-05 17:33:37 +02:00
kvm_host.h arm64/sve: KVM: Prevent guests from using SVE 2017-11-03 15:24:19 +00:00
kvm_hyp.h ARM: KVM: move asmlinkage before type 2017-07-12 16:26:04 -07:00
kvm_mmio.h KVM: arm/arm64: Export mmio_read/write_bus 2016-05-20 15:39:42 +02:00
kvm_mmu.h arm/arm64: KVM: Remove kvm_get_idmap_start 2017-04-09 07:49:32 -07:00
kvm_psci.h ARM/ARM64: KVM: Make kvm_psci_call() return convention more flexible 2014-04-30 04:18:57 -07:00
limits.h
linkage.h
mc146818rtc.h
mcpm.h ARM: MCPM: remove residency argument from mcpm_cpu_suspend() 2015-05-06 11:47:10 -04:00
mcs_spinlock.h ARM: 8098/1: mcs lock: implement wfe-based polling for MCS locking 2014-07-18 12:29:35 +01:00
memblock.h ARM: 8025/1: Get rid of meminfo 2014-06-01 01:17:12 +01:00
memory.h ARM: 8648/2: nommu: display vectors base 2017-02-28 11:06:14 +00:00
mmu_context.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
mmu.h ARM: 8329/1: miscellaneous vdso infrastructure, preparation 2015-03-27 22:20:45 +00:00
module.h ARM: 8662/1: module: split core and init PLT sections 2017-03-17 10:01:28 +00:00
mpu.h
mtd-xip.h
neon.h
nwflash.h
opcodes-sec.h
opcodes-virt.h
opcodes.h
outercache.h ARM: move heavy barrier support out of line 2015-07-25 15:28:05 +01:00
page-nommu.h ARM: 8684/1: NOMMU: Remove unused KTHREAD_SIZE definition 2017-06-27 14:58:10 +01:00
page.h ARM: make vectors page inaccessible from userspace 2013-08-01 14:31:58 +01:00
paravirt.h arm: introduce CONFIG_PARAVIRT, PARAVIRT_TIME_ACCOUNTING and pv_time_ops 2015-12-21 14:40:54 +00:00
patch.h ARM: probes: move all probe code to dedicate directory 2015-01-09 09:36:50 +00:00
pci.h ARM/PCI: Use generic pci_mmap_resource_range() 2017-04-20 08:47:47 -05:00
percpu.h ARM: 8174/1: Use global stack register variable for percpu 2014-11-13 23:58:06 +00:00
perf_event.h arm: perf: Fix callchain parse error with kernel tracepoint events 2015-05-27 16:12:05 +01:00
pgalloc.h arm: get rid of superfluous __GFP_REPEAT 2016-07-26 16:19:19 -07:00
pgtable-2level-hwdef.h ARM: 8612/1: LPAE: initialize cache policy correctly 2016-09-12 12:12:30 +01:00
pgtable-2level-types.h
pgtable-2level.h ARM: 8578/1: mm: ensure pmd_present only checks the valid bit 2016-06-09 17:51:47 +01:00
pgtable-3level-hwdef.h ARM: 8612/1: LPAE: initialize cache policy correctly 2016-09-12 12:12:30 +01:00
pgtable-3level-types.h
pgtable-3level.h ARM: 8579/1: mm: Fix definition of pmd_mknotpresent 2016-06-09 17:51:47 +01:00
pgtable-hwdef.h
pgtable-nommu.h ARM: 8676/1: NOMMU: provide pgprot_device() macro 2017-06-05 10:29:40 +01:00
pgtable.h arch, mm: convert all architectures to use 5level-fixup.h 2017-03-09 11:48:47 -08:00
probes.h ARM: optprobes: execute instruction during restoring if possible. 2015-01-14 12:24:52 +00:00
proc-fns.h ARM: soft-reboot into same mode that we entered the kernel 2017-04-09 07:49:24 -07:00
processor.h locking/core: Provide common cpu_relax_yield() definition 2016-11-17 08:17:36 +01:00
procinfo.h
prom.h of/fdt: move memreserve and dtb memory reservations into core 2014-04-30 00:59:17 -05:00
psci.h ARM: SoC cleanups for v4.5 2016-01-20 17:55:20 -08:00
ptrace.h ARM: save and reset the address limit when entering an exception 2016-07-07 16:01:01 +01:00
sections.h ARM: 8518/1: Use correct symbols for XIP_KERNEL 2016-02-11 15:43:14 +00:00
set_memory.h treewide: move set_memory_* functions away from cacheflush.h 2017-05-08 17:15:13 -07:00
setup.h ARM: 8495/1: ATAGS: move save_atags() to arch/arm/include/asm/setup.h 2016-01-04 11:26:00 +00:00
shmparam.h
signal.h
smp_plat.h ARM: 8392/3: smp: Only expose /sys/.../cpuX/online if hotpluggable 2015-07-31 18:58:30 +01:00
smp_scu.h ARM: 8689/1: scu: add missing errno include 2017-08-02 14:14:54 +01:00
smp_twd.h
smp.h ARM: 8423/1: add const qualifier to smp_operations member in structures 2015-09-22 08:13:57 +01:00
sparsemem.h ARM: 8411/1: Add default SPARSEMEM settings 2016-02-16 16:35:21 +00:00
spinlock_types.h ARM: locks: prefetch the destination word for write prior to strex 2013-09-30 16:42:55 +01:00
spinlock.h arch: Remove spin_unlock_wait() arch-specific definitions 2017-08-17 08:08:59 -07:00
stackprotector.h
stacktrace.h ARM: 8070/1: Introduce arm_get_current_stack_frame() 2014-07-18 12:29:11 +01:00
stage2_pgtable.h kvm-arm: arm32: Introduce stage2 page table helpers 2016-04-21 14:57:26 +02:00
string.h ARM: implement memset32 & memset64 2017-09-08 18:26:48 -07:00
suspend.h ARM: 8688/1: pm: add missing types include 2017-08-02 14:14:28 +01:00
swab.h
switch_to.h sched, arm: Remove finish_arch_switch() 2015-08-04 09:37:52 +02:00
sync_bitops.h ARM: 7989/1: Delete asm/system.h 2014-02-25 11:33:37 +00:00
syscall.h ARM: 8152/1: Convert pr_warning to pr_warn 2014-09-26 14:39:53 +01:00
system_info.h ARM: 8355/1: arch: Show the serial number from devicetree in cpuinfo 2015-05-08 10:42:35 +01:00
system_misc.h arm/arm64: KVM: add guest SEA support 2017-06-22 18:22:05 +01:00
tcm.h
therm.h
thread_info.h Revert "arm/syscalls: Check address limit on user-mode return" 2017-09-17 19:45:33 +02:00
thread_notify.h
timex.h ARM: drop <mach/timex.h> for !ARCH_MULTIPLATFORM, too 2013-12-20 17:17:16 +01:00
tlb.h mm: fix MADV_[FREE|DONTNEED] TLB flush miss problem 2017-08-10 15:54:07 -07:00
tlbflush.h sched/headers: Prepare to remove the <linux/mm_types.h> dependency from <linux/sched.h> 2017-03-02 08:42:37 +01:00
tls.h ARM: 8178/1: fix set_tls for !CONFIG_KUSER_HELPERS 2014-09-30 16:55:23 +01:00
topology.h sched/topology: Rename topology_thread_cpumask() to topology_sibling_cpumask() 2015-05-27 15:22:15 +02:00
traps.h irq: Make the irqentry text section unconditional 2017-08-10 16:28:53 +02:00
trusted_foundations.h treewide: remove redundant #include <linux/kconfig.h> 2016-10-11 15:06:33 -07:00
uaccess.h Revert "arm/syscalls: Check address limit on user-mode return" 2017-09-17 19:45:33 +02:00
ucontext.h ARM: 8687/1: signal: Fix unparseable iwmmxt_sigframe in uc_regspace[] 2017-07-24 14:26:55 +01:00
unified.h ARM: replace BSYM() with badr assembly macro 2015-05-08 17:33:50 +01:00
unistd.h ARM: wire up new pkey syscalls 2016-10-19 10:18:47 +01:00
unwind.h
uprobes.h ARM: add uprobes support 2014-03-18 16:39:40 -04:00
user.h
v7m.h ARM: 8603/1: V7M: Add addresses for mem-mapped V7M cache operations 2016-09-06 15:51:06 +01:00
vdso_datapage.h ARM: 8329/1: miscellaneous vdso infrastructure, preparation 2015-03-27 22:20:45 +00:00
vdso.h ARM: 8329/1: miscellaneous vdso infrastructure, preparation 2015-03-27 22:20:45 +00:00
vfp.h ARM: vfp: Add vfp_disable for problematic platforms 2015-05-20 15:07:00 -07:00
vfpmacros.h
vga.h
virt.h ARM: hyp-stub/KVM: Kill __hyp_get_vectors 2017-04-09 07:49:34 -07:00
word-at-a-time.h ARM: 8322/1: keep .text and .fixup regions closer together 2015-03-29 23:11:56 +01:00
xor.h ARM: crypto: add NEON accelerated XOR implementation 2013-07-08 22:09:06 +01:00