linux_dsm_epyc7002/arch/arm
Mark Rutland 384b40caa8 KVM: arm/arm64: Context-switch ptrauth registers
When pointer authentication is supported, a guest may wish to use it.
This patch adds the necessary KVM infrastructure for this to work, with
a semi-lazy context switch of the pointer auth state.

Pointer authentication feature is only enabled when VHE is built
in the kernel and present in the CPU implementation so only VHE code
paths are modified.

When we schedule a vcpu, we disable guest usage of pointer
authentication instructions and accesses to the keys. While these are
disabled, we avoid context-switching the keys. When we trap the guest
trying to use pointer authentication functionality, we change to eagerly
context-switching the keys, and enable the feature. The next time the
vcpu is scheduled out/in, we start again. However the host key save is
optimized and implemented inside ptrauth instruction/register access
trap.

Pointer authentication consists of address authentication and generic
authentication, and CPUs in a system might have varied support for
either. Where support for either feature is not uniform, it is hidden
from guests via ID register emulation, as a result of the cpufeature
framework in the host.

Unfortunately, address authentication and generic authentication cannot
be trapped separately, as the architecture provides a single EL2 trap
covering both. If we wish to expose one without the other, we cannot
prevent a (badly-written) guest from intermittently using a feature
which is not uniformly supported (when scheduled on a physical CPU which
supports the relevant feature). Hence, this patch expects both type of
authentication to be present in a cpu.

This switch of key is done from guest enter/exit assembly as preparation
for the upcoming in-kernel pointer authentication support. Hence, these
key switching routines are not implemented in C code as they may cause
pointer authentication key signing error in some situations.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
[Only VHE, key switch in full assembly, vcpu_has_ptrauth checks
, save host key in ptrauth exception trap]
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@arm.com>
Reviewed-by: Julien Thierry <julien.thierry@arm.com>
Cc: Christoffer Dall <christoffer.dall@arm.com>
Cc: kvmarm@lists.cs.columbia.edu
[maz: various fixups]
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2019-04-24 15:30:40 +01:00
..
boot ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
common ARM: 8847/1: pm: fix HYP/SVC mode mismatch when MCPM is used 2019-02-26 11:32:54 +00:00
configs configs: get rid of obsolete CONFIG_ENABLE_WARN_DEPRECATED 2019-03-07 18:32:02 -08:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-03-05 09:09:55 -08:00
firmware
include KVM: arm/arm64: Context-switch ptrauth registers 2019-04-24 15:30:40 +01:00
kernel ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
kvm ARM: some cleanups, direct physical timer assignment, cache sanitization 2019-03-15 15:00:28 -07:00
lib ARM: 8844/1: use unified assembler in assembly files 2019-02-26 11:26:07 +00:00
mach-actions ARM: actions: remove boot_lock and pen_release 2019-02-01 21:59:15 +00:00
mach-alpine PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
mach-artpec
mach-asm9260
mach-aspeed
mach-at91 treewide: add intermediate .s files to targets 2018-12-23 10:12:08 +09:00
mach-axxia
mach-bcm bcm2835-pm: Move bcm2835-watchdog's DT probe to an MFD. 2019-01-09 16:55:06 +01:00
mach-berlin
mach-clps711x
mach-cns3xxx irqchip updates for 5.1, take #2 2019-03-21 12:30:54 +01:00
mach-davinci Power management updates for 5.1-rc1 2019-03-06 12:59:46 -08:00
mach-digicolor
mach-dove
mach-ebsa110
mach-efm32
mach-ep93xx arch/arm/mach-ep93xx: Remove duplicate header 2019-01-30 22:59:53 +01:00
mach-exynos ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
mach-footbridge PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
mach-gemini
mach-highbank
mach-hisi
mach-imx DMA mapping updates for 5.1 2019-03-10 11:54:48 -07:00
mach-integrator ARM: integrator: impd1: use struct_size() in devm_kzalloc() 2019-01-11 13:33:00 +01:00
mach-iop13xx
mach-iop32x ARM: iop32x/n2100: fix PCI IRQ mapping 2019-01-30 11:34:42 +01:00
mach-iop33x
mach-ixp4xx PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
mach-keystone
mach-ks8695 ARM: 8844/1: use unified assembler in assembly files 2019-02-26 11:26:07 +00:00
mach-lpc18xx
mach-lpc32xx ARM: lpc32xx: remove platform data of ARM PL111 LCD controller 2019-02-03 21:40:41 +02:00
mach-mediatek arm: mediatek: add MT7629 smp bring up code 2019-02-07 17:59:16 +01:00
mach-meson ARM: meson: remove COMMON_CLK_AMLOGIC selection 2019-02-06 19:53:02 -08:00
mach-milbeaut ARM: milbeaut: Add basic support for Milbeaut m10v SoC 2019-03-01 15:18:26 +01:00
mach-mmp regulator: fixed/gpio: Pull inversion/OD into gpiolib 2019-02-06 15:58:29 +00:00
mach-moxart
mach-mv78xx0 PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
mach-mvebu PCI: consolidate PCI config entry in drivers/pci 2018-11-23 11:45:34 +09:00
mach-mxs
mach-netx
mach-nomadik
mach-npcm
mach-nspire
mach-omap1 Merge branch 'i2c/for-5.1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2019-03-08 09:27:33 -08:00
mach-omap2 ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
mach-orion5x ARM: orion5x: Include platform_data/dsa.h 2019-01-17 11:31:24 -08:00
mach-oxnas ARM: oxnas: remove CPU hotplug implementation 2019-02-01 21:59:15 +00:00
mach-picoxcell
mach-prima2 ARM: smp: remove arch-provided "pen_release" 2019-02-01 22:05:23 +00:00
mach-pxa ARM: SoC platform updates for 5.1 2019-03-06 09:33:05 -08:00
mach-qcom ARM: qcom: remove unnecessary boot_lock 2019-02-01 21:59:15 +00:00
mach-rda ARM: Prepare RDA8810PL SoC 2018-12-31 13:09:39 -08:00
mach-realview ARM: vexpress/realview: consolidate immitation CPU hotplug 2018-12-14 14:44:59 +00:00
mach-rockchip
mach-rpc
mach-s3c24xx ARM: s3c24xx: Fix boolean expressions in osiris_dvs_notify 2019-01-07 20:41:01 +01:00
mach-s3c64xx regulator: wm8994: Pass descriptor instead of GPIO number 2018-11-15 11:42:08 -08:00
mach-s5pv210 ARM: s5pv210: Remove legacy setting of external wakeup interrupts 2018-11-12 21:19:48 +01:00
mach-sa1100 This is the bulk of GPIO changes for the v5.1 cycle: 2019-03-08 10:09:53 -08:00
mach-shmobile ARM: shmobile: Fix R-Car Gen2 regulator quirk 2019-01-07 13:24:07 +01:00
mach-socfpga reset: socfpga: declare socfpga_reset_init in a header file 2019-01-28 11:16:04 +01:00
mach-spear ARM: smp: remove arch-provided "pen_release" 2019-02-01 22:05:23 +00:00
mach-sti ARM: sti: remove pen_release and boot_lock 2018-12-20 14:32:15 +01:00
mach-stm32
mach-sunxi reset: sunxi: declare sun6i_reset_init in a header file 2019-01-28 11:16:04 +01:00
mach-tango ARM: tango: Improve ARCH_MULTIPLATFORM compatibility 2019-01-30 11:45:10 +01:00
mach-tegra ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
mach-u300
mach-uniphier
mach-ux500
mach-versatile
mach-vexpress ARM: vexpress/realview: consolidate immitation CPU hotplug 2018-12-14 14:44:59 +00:00
mach-vt8500
mach-w90x900
mach-zx
mach-zynq
mm ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
net arm: bpf: implement jitting of JMP32 2019-01-26 13:33:02 -08:00
nwfpe
oprofile Remove 'type' argument from access_ok() function 2019-01-03 18:57:57 -08:00
plat-iop
plat-omap ARM: Kconfig: remove useless "default n" 2018-11-08 10:53:09 +00:00
plat-orion ARM: orion5x: Include platform_data/dsa.h 2019-01-17 11:31:24 -08:00
plat-pxa ARM: pxa: ssp: unneeded to free devm_ allocated data 2019-01-23 21:32:01 +01:00
plat-samsung ARM: samsung: Limit SAMSUNG_PM_DEBUG config option to non-Exynos platforms 2018-11-18 15:11:27 +01:00
plat-versatile ARM: versatile: rename and comment SMP implementation 2018-12-14 14:44:59 +00:00
probes ARM: 8834/1: Fix: kprobes: optimized kprobes illegal instruction 2019-02-12 15:20:58 +00:00
tools y2038: add 64-bit time_t syscalls to all 32-bit architectures 2019-02-07 00:13:28 +01:00
vdso
vfp Merge branches 'misc', 'sa1100-for-next' and 'spectre' into for-linus 2019-01-02 10:37:05 +00:00
xen get rid of legacy 'get_ds()' function 2019-03-04 10:50:14 -08:00
Kconfig ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00
Kconfig-nommu ARM: 8832/1: NOMMU: Limit visibility for CONFIG_FLASH_{MEM_BASE,SIZE} 2019-02-01 21:44:46 +00:00
Kconfig.debug i.MX SoC changes for 4.21: 2018-12-12 13:52:48 -08:00
Makefile ARM updates for 5.1-rc1 2019-03-15 14:37:46 -07:00