linux_dsm_epyc7002/arch/mips/include/asm
James Hogan 539cb89fbd MIPS: KVM: Add base guest MSA support
Add base code for supporting the MIPS SIMD Architecture (MSA) in MIPS
KVM guests. MSA cannot yet be enabled in the guest, we're just laying
the groundwork.

As with the FPU, whether the guest's MSA context is loaded is stored in
another bit in the fpu_inuse vcpu member. This allows MSA to be disabled
when the guest disables it, but keeping the MSA context loaded so it
doesn't have to be reloaded if the guest re-enables it.

New assembly code is added for saving and restoring the MSA context,
restoring only the upper half of the MSA context (for if the FPU context
is already loaded) and for saving/clearing and restoring MSACSR (which
can itself cause an MSA FP exception depending on the value). The MSACSR
is restored before returning to the guest if MSA is already enabled, and
the existing FP exception die notifier is extended to catch the possible
MSA FP exception and step over the ctcmsa instruction.

The helper function kvm_own_msa() is added to enable MSA and restore
the MSA context if it isn't already loaded, which will be used in a
later patch when the guest attempts to use MSA for the first time and
triggers an MSA disabled exception.

The existing FPU helpers are extended to handle MSA. kvm_lose_fpu()
saves the full MSA context if it is loaded (which includes the FPU
context) and both kvm_lose_fpu() and kvm_drop_fpu() disable MSA.

kvm_own_fpu() also needs to lose any MSA context if FR=0, since there
would be a risk of getting reserved instruction exceptions if CU1 is
enabled and we later try and save the MSA context. We shouldn't usually
hit this case since it will be handled when emulating CU1 changes,
however there's nothing to stop the guest modifying the Status register
directly via the comm page, which will cause this case to get hit.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Gleb Natapov <gleb@kernel.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
2015-03-27 21:25:19 +00:00
..
dec
emma
fw MIPS: ARC: Fix build error. 2015-01-19 13:09:52 +01:00
ip32
lasat
mach-ar7
mach-ath25 MIPS: ath25: add AR2315 PCI host controller driver 2014-11-24 07:45:28 +01:00
mach-ath79
mach-au1x00 MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mach-bcm47xx MIPS: BCM47XX: Clean up nvram header 2014-11-24 07:45:08 +01:00
mach-bcm63xx MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mach-bcm3384 MIPS: bcm3384: Initial commit of bcm3384 platform support 2014-11-24 07:45:13 +01:00
mach-cavium-octeon MIPS: OCTEON: More OCTEONIII support 2015-02-20 15:32:46 +01:00
mach-cobalt
mach-db1x00
mach-dec
mach-emma2rh
mach-generic MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mach-ip22
mach-ip27
mach-ip28 MIPS: IP28: Fix/clean spaces.h 2014-08-26 02:18:58 +02:00
mach-ip32
mach-jazz
mach-jz4740 mtd: nand: jz4740: Convert to GPIO descriptor API 2015-02-02 01:04:36 -08:00
mach-lantiq MIPS: lantiq: export soc type 2014-11-24 07:45:18 +01:00
mach-lasat
mach-loongson MIPS: Loongson: Improve LEFI firmware interface 2014-11-24 07:45:01 +01:00
mach-loongson1 MIPS: Loongson1B: Some fixes/updates for LS1B 2014-11-24 07:45:09 +01:00
mach-malta irqchip: mips-gic: Probe for number of external interrupts 2014-11-24 07:44:56 +01:00
mach-netlogic MIPS: NL: Fix nlm_xlp_defconfig build error 2014-08-26 02:18:55 +02:00
mach-paravirt
mach-pmcs-msp71xx MIPS: asm: Rename GCC_OFF12_ASM to GCC_OFF_SMALL_ASM 2015-02-17 15:37:21 +00:00
mach-pnx833x
mach-ralink MIPS: ralink: add mt7628an support 2014-11-24 07:45:24 +01:00
mach-rc32434
mach-rm
mach-sead3 irqchip: mips-gic: Probe for number of external interrupts 2014-11-24 07:44:56 +01:00
mach-sibyte
mach-tx39xx MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mach-tx49xx MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mach-vr41xx
mips-boards MIPS: Move gic.h to include/linux/irqchip/mips-gic.h 2014-11-24 07:44:59 +01:00
netlogic
octeon Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
pci
sgi
sibyte
sn
txx9
vr41xx
xtalk
abi.h mips: Use get_signal() signal_setup_done() 2014-08-06 13:03:08 +02:00
addrspace.h
amon.h
arch_hweight.h
asm-eva.h
asm-offsets.h
asm.h
asmmacro-32.h Revert "MIPS: Don't assume 64-bit FP registers for context switch" 2015-03-27 19:42:48 +01:00
asmmacro-64.h
asmmacro.h Revert "MIPS: Don't assume 64-bit FP registers for context switch" 2015-03-27 19:42:48 +01:00
atomic.h MIPS: asm: atomic: Update ISA constraints for MIPS R6 support 2015-02-17 15:37:22 +00:00
barrier.h arch: Add lightweight memory barriers dma_rmb() and dma_wmb() 2014-12-11 21:15:06 -05:00
bcache.h
bitops.h MIPS: asm: bitops: Update ISA constraints for MIPS R6 support 2015-02-17 15:37:22 +00:00
bmips.h MIPS: BMIPS: Let each platform customize the CPU1 IRQ mask 2014-11-24 07:45:11 +01:00
bootinfo.h MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
branch.h MIPS: kernel: mips-r2-to-r6-emul: Add R2 emulator for MIPS R6 2015-02-17 15:37:37 +00:00
break.h
bug.h
bugs.h
cache.h
cacheflush.h
cacheops.h
cevt-r4k.h
checksum.h MIPS: Use generic checksum functions for MIPS R6 2015-02-17 15:37:19 +00:00
clkdev.h
clock.h MIPS: Remove declaration of obsolete arch_init_clk_ops() 2014-11-24 07:45:37 +01:00
cmp.h
cmpxchg.h MIPS: asm: cmpxchg: Update ISA constraints for MIPS R6 support 2015-02-17 15:37:22 +00:00
compat-signal.h
compat.h
compiler.h MIPS: Use the new "ZC" constraint for MIPS R6 2015-02-17 15:37:21 +00:00
cop2.h MIPS: Prevent compiler warning from cop2_{save,restore} 2014-10-23 19:58:13 +02:00
cpu-features.h MIPS: Handle MIPS IV, V and R2 FPU instructions on MIPS R6 as well 2015-02-17 15:37:37 +00:00
cpu-info.h MIPS: HTW: Prevent accidental HTW start due to nested htw_{start, stop} 2015-02-16 10:55:26 +01:00
cpu-type.h MIPS: Add cases for CPU_QEMU_GENERIC 2015-02-16 10:01:24 +00:00
cpu.h MIPS: Add LLB bit and related feature for the Config 5 CP0 register 2015-02-17 15:37:36 +00:00
debug.h
delay.h
device.h
div64.h
dma-coherence.h
dma-mapping.h
dma.h
ds1287.h
dsp.h
edac.h MIPS: asm: Rename GCC_OFF12_ASM to GCC_OFF_SMALL_ASM 2015-02-17 15:37:21 +00:00
elf.h MIPS: kernel: elf: Improve the overall ABI and FPU mode checks 2015-02-17 15:37:39 +00:00
errno.h
eva.h MIPS: EVA: Add new EVA header 2014-08-26 02:18:56 +02:00
exec.h
fb.h
fixmap.h
floppy.h
fpregdef.h MIPS: Fix build with binutils 2.24.51+ 2014-11-07 15:07:36 +01:00
fpu_emulator.h MIPS: Replace __get_cpu_var uses in FPU emulator. 2014-08-26 13:45:51 -04:00
fpu.h MIPS: disable FPU if the mode is unsupported 2015-03-27 19:42:47 +01:00
ftrace.h MIPS: ftrace: Fix a microMIPS build problem 2014-10-24 02:38:33 +02:00
futex.h MIPS: asm: futex: Set the appropriate ISA level for MIPS R6 2015-02-17 15:37:23 +00:00
gio_device.h MIPS: ip22-gio: Remove legacy suspend/resume support 2015-02-20 13:30:55 +01:00
gpio.h
gt64120.h
hardirq.h
hazards.h MIPS: asm: hazards: Add MIPSR6 definitions 2015-02-17 15:37:19 +00:00
highmem.h
hpet.h MIPS: Loongson-3: Add RS780/SBX00 HPET support 2014-11-24 07:45:02 +01:00
hugetlb.h
hw_irq.h
i8259.h
ide.h
idle.h cpuidle: Invert CPUIDLE_FLAG_TIME_VALID logic 2014-11-12 21:17:27 +01:00
inst.h
io.h MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
irq_cpu.h MIPS: Rename mips_cpu_intc_init() -> mips_cpu_irq_of_init() 2014-11-24 07:44:52 +01:00
irq_gt641xx.h
irq_regs.h
irq.h MIPS: Add arch_trigger_all_cpu_backtrace() function 2014-11-24 07:44:49 +01:00
irqflags.h MIPS: asm: irqflags: Add MIPS R6 related definitions 2015-02-17 15:37:20 +00:00
isadep.h
jazz.h
jazzdma.h
jump_label.h MIPS: jump_label.c: Handle the microMIPS J instruction encoding 2014-11-19 18:22:09 +01:00
Kbuild MIPS: Use generic checksum functions for MIPS R6 2015-02-17 15:37:19 +00:00
kdebug.h MIPS: Clear [MSA]FPE CSR.Cause after notify_die() 2015-03-27 21:25:06 +00:00
kexec.h
kgdb.h
kmap_types.h
kprobes.h
kvm_host.h MIPS: KVM: Add base guest MSA support 2015-03-27 21:25:19 +00:00
kvm_para.h
linkage.h
local.h MIPS: asm: local: Set the appropriate ISA level for MIPS R6 2015-02-17 15:37:24 +00:00
m48t37.h
maar.h
mc146818-time.h
mc146818rtc.h
mips_machine.h
mips_mt.h
mips-cm.h MIPS: mips-cm: Fix sparse warnings 2015-01-13 15:53:09 +01:00
mips-cpc.h MIPS: Replace use of phys_t with phys_addr_t. 2014-11-24 22:47:31 +01:00
mips-r2-to-r6-emul.h MIPS: kernel: mips-r2-to-r6-emul: Add R2 emulator for MIPS R6 2015-02-17 15:37:37 +00:00
mipsmtregs.h
mipsprom.h
mipsregs.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
mmu_context.h MIPS: HTW: Prevent accidental HTW start due to nested htw_{start, stop} 2015-02-16 10:55:26 +01:00
mmu.h MIPS,prctl: add PR_[GS]ET_FP_MODE prctl options for MIPS 2015-02-12 12:30:29 +01:00
mmzone.h
module.h MIPS: asm: module: define MODULE_PROC_FAMILY for MIPS R6 2015-02-17 15:37:17 +00:00
msa.h
msc01_ic.h
nile4.h
paccess.h MIPS: Apply `.insn' to fixup labels throughout 2014-11-24 07:45:36 +01:00
page.h MIPS: Replace MIPS-specific 64BIT_PHYS_ADDR with generic PHYS_ADDR_T_64BIT 2014-11-24 22:46:44 +01:00
pci.h mips: pci: Add ifdef around pci_proc_domain 2015-02-20 13:16:14 +01:00
perf_event.h
pgalloc.h
pgtable-32.h mm: make FIRST_USER_ADDRESS unsigned long on all archs 2015-02-11 17:06:03 -08:00
pgtable-64.h mips: drop _PAGE_FILE and pte_file()-related helpers 2015-02-10 14:30:32 -08:00
pgtable-bits.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
pgtable.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
pm-cps.h
pm.h
pmon.h
prefetch.h
processor.h MIPS: MSA: Fix big-endian FPR_IDX implementation 2015-03-27 19:42:48 +01:00
prom.h MIPS: Remove unused dt_setup_arch() 2015-01-16 13:10:42 +01:00
ptrace.h MIPS: OCTEON: Save/Restore wider multiply registers in OCTEON III CPUs 2015-02-20 15:28:29 +01:00
r4k-timer.h
r4kcache.h MIPS: asm: r4kcache: Add MIPS R6 cache unroll functions 2015-02-17 15:37:20 +00:00
reboot.h
reg.h
regdef.h
rtlx.h
seccomp.h
setup.h
sgialib.h MIPS: ARC: Add declarations for a few missing ARC firmware functions. 2015-01-13 16:04:28 +01:00
sgiarcs.h
shmparam.h
sigcontext.h
signal.h
sim.h
smp-cps.h
smp-ops.h
smp.h MIPS: Move CPU topology macros to topology.h 2014-08-27 13:44:44 +02:00
sni.h
socket.h
sparsemem.h
spinlock_types.h
spinlock.h MIPS: asm: spinlock: Replace "sub" instruction with "addiu" 2015-02-17 15:37:23 +00:00
spram.h MIPS: asm: spram: Add new symbol for MIPS scratch pad storage 2015-02-17 15:37:20 +00:00
stackframe.h MIPS: asm: stackframe: Do not preserve the HI/LO registers on MIPS R6 2015-02-17 15:37:17 +00:00
stackprotector.h
stacktrace.h
string.h
switch_to.h MIPS: Make use of the ERETNC instruction on MIPS R6 2015-02-17 15:37:37 +00:00
syscall.h MIPS: Fix syscall_get_nr for the syscall exit tracing. 2015-02-04 16:40:09 +01:00
termios.h
thread_info.h Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus 2015-02-21 19:41:38 -08:00
time.h clocksource: mips-gic: Use CPU notifiers to setup the timer 2014-11-24 07:45:16 +01:00
timex.h
tlb.h
tlbdebug.h
tlbflush.h
tlbmisc.h
topology.h MIPS: Move CPU topology macros to topology.h 2014-08-27 13:44:44 +02:00
traps.h
txx9irq.h
txx9pio.h
txx9tmr.h
types.h MIPS: Remove now unused definition of phys_t. 2014-11-24 22:47:31 +01:00
uaccess.h MIPS: uaccess.h: Fix strnlen_user comment. 2014-11-24 07:45:33 +01:00
uasm.h MIPS: Add MFHC0 and MTHC0 instructions to uasm. 2014-11-24 22:47:31 +01:00
unaligned.h
unistd.h
vdso.h
vga.h
vpe.h
war.h
watch.h
wbflush.h