linux_dsm_epyc7002/arch/x86/include/asm
Tom Lendacky 147277540b kvm: svm: Add support for additional SVM NPF error codes
AMD hardware adds two additional bits to aid in nested page fault handling.

Bit 32 - NPF occurred while translating the guest's final physical address
Bit 33 - NPF occurred while translating the guest page tables

The guest page tables fault indicator can be used as an aid for nested
virtualization. Using V0 for the host, V1 for the first level guest and
V2 for the second level guest, when both V1 and V2 are using nested paging
there are currently a number of unnecessary instruction emulations. When
V2 is launched shadow paging is used in V1 for the nested tables of V2. As
a result, KVM marks these pages as RO in the host nested page tables. When
V2 exits and we resume V1, these pages are still marked RO.

Every nested walk for a guest page table is treated as a user-level write
access and this causes a lot of NPFs because the V1 page tables are marked
RO in the V0 nested tables. While executing V1, when these NPFs occur KVM
sees a write to a read-only page, emulates the V1 instruction and unprotects
the page (marking it RW). This patch looks for cases where we get a NPF due
to a guest page table walk where the page was marked RO. It immediately
unprotects the page and resumes the guest, leading to far fewer instruction
emulations when nested virtualization is used.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
2016-11-24 18:32:26 +01:00
..
crypto
fpu x86/pkeys: Make protection keys an "eager" feature 2016-10-08 12:26:44 +02:00
numachip
trace x86/fpu: Add tracepoints to dump FPU state at key points 2016-06-08 13:33:33 +02:00
uv x86/platform/uv/BAU: Add UV4-specific functions 2016-09-22 11:16:15 +02:00
xen xen: Remove event channel notification through Xen PCI platform device 2016-09-30 11:44:34 +01:00
a.out-core.h
acenv.h
acpi.h Merge branch 'acpi-tables' 2016-07-25 13:41:01 +02:00
agp.h
alternative-asm.h
alternative.h x86/alternatives: Add stack frame dependency to alternative_call_2() 2016-09-24 09:30:03 +02:00
amd_nb.h x86/mce/AMD: Document some functionality 2016-03-08 11:48:15 +01:00
apb_timer.h
apic_flat_64.h
apic.h x86/apic: Order irq_enter/exit() calls correctly vs. ack_APIC_irq() 2016-09-20 00:31:19 +02:00
apicdef.h
apm.h x86, asm: use bool for bitops and other assembly outputs 2016-06-08 12:41:20 -07:00
arch_hweight.h x86/hweight: Get rid of the special calling convention 2016-06-08 15:01:02 +02:00
archrandom.h x86, asm: Use CC_SET()/CC_OUT() and static_cpu_has() in archrandom.h 2016-06-08 12:41:20 -07:00
asm-offsets.h
asm.h x86, asm: define CC_SET() and CC_OUT() macros 2016-06-08 12:41:20 -07:00
atomic64_32.h locking/atomic, arch/x86: Implement atomic{,64}_fetch_{add,sub,and,or,xor}() 2016-06-16 10:48:31 +02:00
atomic64_64.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 15:34:18 -07:00
atomic.h Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 15:34:18 -07:00
barrier.h locking/x86: Tweak the comment about use of wmb() for IO 2016-01-29 09:40:10 +01:00
bios_ebda.h x86/boot: Reorganize and clean up the BIOS area reservation code 2016-07-21 10:11:57 +02:00
bitops.h x86, asm: Use CC_SET()/CC_OUT() in <asm/bitops.h> 2016-06-08 12:41:20 -07:00
boot.h x86/KASLR: Build identity mappings on demand 2016-05-07 07:38:39 +02:00
bootparam_utils.h
bug.h
bugs.h x86/mm/mpx: Work around MPX erratum SKD046 2016-05-20 09:07:40 +02:00
cache.h
cacheflush.h remove stray include of asm/uaccess.h from cacheflush.h 2016-09-27 21:15:22 -04:00
calgary.h
ce4100.h
checksum_32.h x86/uaccess: Move thread_info::addr_limit to thread_struct 2016-07-15 10:26:30 +02:00
checksum_64.h ipv6: Pass proto to csum_ipv6_magic as __u8 instead of unsigned short 2016-03-13 23:55:13 -04:00
checksum.h
clocksource.h x86/vdso: Remove direct HPET access through the vDSO 2016-04-13 10:28:34 +02:00
cmdline.h
cmpxchg_32.h
cmpxchg_64.h
cmpxchg.h x86/cmpxchg, locking/atomics: Remove superfluous definitions 2016-09-30 10:56:01 +02:00
compat.h x86/coredump: Use pr_reg size, rather that TIF_IA32 flag 2016-09-14 21:28:10 +02:00
cpu_device_id.h
cpu.h xen: features and fixes for 4.8-rc0 2016-07-27 11:35:37 -07:00
cpufeature.h x86/cpufeature: Add helper macro for mask check macros 2016-06-30 09:11:32 +02:00
cpufeatures.h x86/cpufeature: Add AVX512_4VNNIW and AVX512_4FMAPS features 2016-10-19 17:37:13 +02:00
cpumask.h
crash.h
current.h
debugreg.h
delay.h
desc_defs.h x86/signal/64: Fix SS if needed when delivering a 64-bit signal 2016-02-17 08:32:11 +01:00
desc.h x86: Apply more __ro_after_init and const 2016-08-10 14:55:05 +02:00
device.h
disabled-features.h x86/cpufeature: Make sure DISABLED/REQUIRED macros are updated 2016-06-30 09:11:32 +02:00
div64.h
dma-mapping.h dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
dma.h
dmi.h x86/dmi: Switch dmi_remap() from ioremap() [uncached] to ioremap_cache() 2016-02-09 14:36:43 +01:00
dwarf2.h
e820.h x86/e820: Prepare e280 code for switch to dynamic storage 2016-09-21 15:02:12 +02:00
edac.h
efi.h x86/efi: Allow invocation of arbitrary boot services 2016-09-09 16:08:57 +01:00
elf.h tree-wide: replace config_enabled() with IS_ENABLED() 2016-08-04 08:50:07 -04:00
emergency-restart.h
entry_arch.h
espfix.h
exec.h
export.h x86: move exports to actual definitions 2016-08-07 23:47:15 -04:00
extable.h x86: separate extable.h, switch sections.h to it 2016-09-27 21:15:23 -04:00
fb.h
fixmap.h x86/mm: Make kmap_prot into a #define 2016-01-20 11:39:14 +01:00
floppy.h
frame.h x86/asm: Add C versions of frame pointer macros 2016-01-19 12:59:07 +01:00
ftrace.h ftrace/x86: Implement HAVE_FUNCTION_GRAPH_RET_ADDR_PTR 2016-08-24 12:15:15 +02:00
futex.h
gart.h
genapic.h
geode.h
hardirq.h x86/irq: Do not substract irq_tlb_count from irq_call_count 2016-08-11 11:14:59 +02:00
highmem.h
hpet.h
hugetlb.h Merge branch 'x86/urgent' into x86/asm, to fix semantic conflict 2016-04-22 10:13:53 +02:00
hw_breakpoint.h
hw_irq.h x86/irq: Cure live lock in fixup_irqs() 2016-03-18 14:51:06 +01:00
hypertransport.h
hypervisor.h virt, sched: Add generic vCPU pinning support 2016-09-05 13:52:38 +02:00
i8259.h
ia32_unistd.h
ia32.h
idle.h
imr.h x86/platform/intel/quark: Drop IMR lock bit support 2016-02-23 07:37:23 +01:00
inat_types.h
inat.h x86/insn: Add AVX-512 support to the instruction decoder 2016-07-21 09:37:11 -03:00
init.h x86/power/64: Always create temporary identity mapping correctly 2016-08-08 22:04:30 +02:00
insn.h x86/insn: Add AVX-512 support to the instruction decoder 2016-07-21 09:37:11 -03:00
inst.h
intel_mid_vrtc.h
intel_pmc_ipc.h
intel_pt.h
intel_punit_ipc.h platform:x86: add Intel P-Unit mailbox IPC driver 2016-01-19 15:49:36 -08:00
intel_scu_ipc.h x86/platform/intel-mid: Implement power off sequence 2016-09-08 08:03:58 +02:00
intel_telemetry.h intel_telemetry: Constify telemetry_core_ops structures 2016-05-05 13:58:55 -07:00
intel-family.h x86/cpu/intel: Add Knights Mill to Intel family 2016-10-17 10:45:08 +02:00
intel-mid.h x86/platform/intel-mid: Implement power off sequence 2016-09-08 08:03:58 +02:00
io_apic.h
io.h x86/io: add interface to reserve io memtype for a resource range. (v1.1) 2016-10-26 15:45:38 +10:00
iomap.h
iommu_table.h
iommu.h
iosf_mbi.h
ipi.h x86/apic: Deinline __default_send_IPI_*, save ~200 bytes 2016-03-08 12:26:41 +01:00
irq_regs.h
irq_remapping.h
irq_vectors.h
irq_work.h x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage 2016-04-13 11:37:41 +02:00
irq.h nmi_backtrace: add more trigger_*_cpu_backtrace() methods 2016-10-07 18:46:30 -07:00
irqdomain.h
irqflags.h nmi_backtrace: generate one-line reports for idle cpus 2016-10-07 18:46:30 -07:00
ist.h
jump_label.h
kasan.h
kaslr.h x86/mm/64: Enable KASLR for vmemmap memory region 2016-08-10 16:10:06 +02:00
kbdleds.h
Kbuild kbuild, x86: Track generated headers with generated-y 2016-07-07 15:58:44 +02:00
kdebug.h x86/dumpstack: Remove show_trace() 2016-08-18 18:41:27 +02:00
kexec-bzimage64.h
kexec.h x86/panic: replace smp_send_stop() with kdump friendly version in panic path 2016-10-11 15:06:32 -07:00
kgdb.h x86/asm: Stop depending on ptrace.h in alternative.h 2016-04-29 11:56:40 +02:00
kmap_types.h
kmemcheck.h
kprobes.h x86: fix up a few misc stack pointer vs thread_info confusions 2016-06-24 16:55:53 -07:00
kvm_emulate.h
kvm_guest.h
kvm_host.h kvm: svm: Add support for additional SVM NPF error codes 2016-11-24 18:32:26 +01:00
kvm_page_track.h kvm/page_track: call notifiers with kvm_page_track_notifier_node 2016-11-04 12:13:20 +01:00
kvm_para.h x86/mm: Always enable CONFIG_DEBUG_RODATA and remove the Kconfig option 2016-02-22 08:51:38 +01:00
lguest_hcall.h
lguest.h
linkage.h x86/entry/32: Remove asmlinkage_protect() 2016-05-05 08:37:31 +02:00
livepatch.h x86: Audit and remove any remaining unnecessary uses of module.h 2016-07-14 15:07:00 +02:00
local64.h
local.h x86, asm: change the GEN_*_RMWcc() macros to not quote the condition 2016-06-08 12:41:20 -07:00
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h rtc: cmos: move mc146818rtc code out of asm-generic/rtc.h 2016-06-04 00:20:00 +02:00
mce.h x86/mce/AMD, EDAC/mce_amd: Define and use tables for known SMCA IP types 2016-09-13 15:23:10 +02:00
microcode_amd.h x86/microcode/AMD: Make amd_ucode_patch[] static 2016-06-08 11:04:20 +02:00
microcode_intel.h x86/microcode/intel: Unexport save_mc_for_early() 2016-06-08 11:04:20 +02:00
microcode.h x86/microcode: Fix suspend to RAM with builtin microcode 2016-06-08 11:04:19 +02:00
misc.h
mmconfig.h
mmu_context.h x86/pkeys: Allocation/free syscalls 2016-09-09 13:02:27 +02:00
mmu.h x86/pkeys: Allocation/free syscalls 2016-09-09 13:02:27 +02:00
mmx.h
mmzone_32.h
mmzone_64.h
mmzone.h
module.h
mpspec_def.h
mpspec.h x86/acpi: Introduce persistent storage for cpuid <-> apicid mapping 2016-09-21 21:18:38 +02:00
mpx.h
mshyperv.h
msi.h
msidef.h
msr-index.h x86: Remove duplicate rtit status MSR macro 2016-10-14 14:14:20 +02:00
msr-trace.h
msr.h x86/msr: Use the proper trace point conditional for writes 2016-06-06 15:33:39 +02:00
mtrr.h x86/mtrr: Fix Xorg crashes in Qemu sessions 2016-03-29 12:23:26 +02:00
mutex_32.h locking/mutex: Optimize mutex_trylock() fast-path 2016-06-08 15:17:01 +02:00
mutex_64.h locking/mutex: Optimize mutex_trylock() fast-path 2016-06-08 15:17:01 +02:00
mutex.h
mwait.h x86/cpu: Add workaround for MONITOR instruction erratum on Goldmont based CPUs 2016-07-20 09:48:40 +02:00
nmi.h
nops.h
numa_32.h
numa.h
olpc_ofw.h
olpc.h
page_32_types.h x86/asm, x86/microcode: Add __PAGE_OFFSET_BASE define on 32-bit 2016-07-27 14:59:59 +02:00
page_32.h
page_64_types.h x86/mm: Enable KASLR for physical mapping memory regions 2016-07-08 17:35:15 +02:00
page_64.h
page_types.h
page.h x86/boot: Split out kernel_ident_mapping_init() 2016-05-07 07:38:39 +02:00
paravirt_types.h Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-10-03 16:13:28 -07:00
paravirt.h Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-10-03 16:13:28 -07:00
parport.h
pat.h x86/xen, pat: Remove PAT table init code from Xen 2016-03-29 12:23:27 +02:00
pci_64.h
pci_x86.h Revert "PCI, x86: Implement pcibios_alloc_irq() and pcibios_free_irq()" 2016-02-27 08:52:20 -06:00
pci-direct.h
pci-functions.h
pci.h x86/PCI: VMD: Request userspace control of PCIe hotplug indicators 2016-09-23 08:41:08 -05:00
percpu.h percpu: eliminate two sparse warnings 2016-09-22 12:14:29 -04:00
perf_event_p4.h
perf_event.h perf/x86/intel/pt: Don't die on VMXON 2016-04-28 10:32:42 +02:00
pgalloc.h arch: x86: charge page tables to kmemcg 2016-07-26 16:19:19 -07:00
pgtable_32_types.h
pgtable_32.h
pgtable_64_types.h x86/mm/64: Enable KASLR for vmemmap memory region 2016-08-10 16:10:06 +02:00
pgtable_64.h x86/mm: Fix swap entry comment and macro 2016-08-11 11:04:10 +02:00
pgtable_types.h mm: move phys_mem_access_prot_allowed() declaration to pgtable.h 2016-10-07 18:46:29 -07:00
pgtable-2level_types.h
pgtable-2level.h
pgtable-3level_types.h
pgtable-3level.h
pgtable.h Merge branch 'x86-boot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 17:32:28 -07:00
pkeys.h x86/pkeys: Default to a restrictive init PKRU 2016-09-09 13:02:28 +02:00
platform_sst_audio.h
pm-trace.h
pmc_atom.h
pmc_core.h platform/x86: Add PMC Driver for Intel Core SoC 2016-05-27 11:47:56 -07:00
pmem.h x86/mce: Improve memcpy_mcsafe() 2016-09-05 11:47:31 +02:00
posix_types.h
preempt.h x86, asm: change the GEN_*_RMWcc() macros to not quote the condition 2016-06-08 12:41:20 -07:00
probe_roms.h
processor-cyrix.h
processor-flags.h
processor.h x86/cpuid: Provide get_scattered_cpuid_leaf() 2016-11-16 11:13:09 +01:00
prom.h
proto.h x86/entry: Vastly simplify SYSENTER TF (single-step) handling 2016-03-10 09:48:13 +01:00
ptrace.h x86/entry: Get rid of two-phase syscall entry work 2016-06-14 10:54:39 -07:00
pvclock-abi.h
pvclock.h KVM: x86: introduce get_kvmclock_ns 2016-09-20 09:26:15 +02:00
qrwlock.h
qspinlock_paravirt.h x86/locking: Create stack frame in PV unlock 2016-02-24 08:35:44 +01:00
qspinlock.h
realmode.h x86/asm/head: Rename 'stack_start' -> 'initial_stack' 2016-08-18 18:41:29 +02:00
reboot_fixups.h
reboot.h
required-features.h x86/cpufeature: Make sure DISABLED/REQUIRED macros are updated 2016-06-30 09:11:32 +02:00
rio.h
rmwcc.h x86, asm: change GEN_*_RMWcc() to use CC_SET()/CC_OUT() 2016-06-08 12:41:20 -07:00
rwsem.h locking/rwsem/x86: Add stack frame dependency for ____down_write() 2016-10-18 12:21:16 +02:00
seccomp.h
sections.h x86: separate extable.h, switch sections.h to it 2016-09-27 21:15:23 -04:00
segment.h x86/arch_prctl/64: Remove FSBASE/GSBASE < 4G optimization 2016-04-29 11:56:41 +02:00
serial.h
setup_arch.h
setup.h x86/asm: Stop depending on ptrace.h in alternative.h 2016-04-29 11:56:40 +02:00
shmparam.h
sigcontext.h
sigframe.h
sighandling.h x86/signal/64: Re-add support for SS in the 64-bit signal context 2016-02-17 08:32:11 +01:00
signal.h x86/signal: Add SA_{X32,IA32}_ABI sa_flags 2016-09-14 21:28:11 +02:00
simd.h
smap.h x86/cpufeature: Carve out X86_FEATURE_* 2016-01-30 11:22:17 +01:00
smp.h x86/panic: replace smp_send_stop() with kdump friendly version in panic path 2016-10-11 15:06:32 -07:00
sparsemem.h
special_insns.h x86/asm: Get rid of __read_cr4_safe() 2016-09-30 12:40:12 +02:00
spinlock_types.h x86, locking/spinlocks: Remove ticket (spin)lock implementation 2016-09-30 10:56:00 +02:00
spinlock.h x86, locking/spinlocks: Remove ticket (spin)lock implementation 2016-09-30 10:56:00 +02:00
sta2x11.h
stackprotector.h
stacktrace.h x86/dumpstack: Remove dump_trace() and related callbacks 2016-09-20 08:29:34 +02:00
string_32.h
string_64.h x86/mce: Improve memcpy_mcsafe() 2016-09-05 11:47:31 +02:00
string.h
suspend_32.h
suspend_64.h
suspend.h
svm.h x86/kvm/svm: Simplify cpu_has_svm() 2016-06-16 00:04:31 +02:00
swiotlb.h dma-mapping: use unsigned long for dma_attrs 2016-08-04 08:50:07 -04:00
switch_to.h sched/x86: Pass kernel thread parameters in 'struct fork_frame' 2016-08-24 12:31:50 +02:00
sync_bitops.h x86, bitops: remove use of "sbb" to return CF 2016-06-08 12:41:20 -07:00
sys_ia32.h
syscall.h x86/asm: Move the thread_info::status field to thread_struct 2016-09-15 08:25:12 +02:00
syscalls.h
sysfb.h
tce.h
text-patching.h x86/asm: Stop depending on ptrace.h in alternative.h 2016-04-29 11:56:40 +02:00
thread_info.h sched/core, x86: Make struct thread_info arch specific again 2016-10-20 13:27:47 +02:00
time.h
timer.h
timex.h
tlb.h
tlbflush.h x86/asm: Get rid of __read_cr4_safe() 2016-09-30 12:40:12 +02:00
topology.h Merge branch 'x86-headers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-08-01 14:23:42 -04:00
trace_clock.h
traps.h x86/mm: Improve stack-overflow #PF handling 2016-09-08 08:47:20 +02:00
tsc.h x86/tsc: Remove the unused check_tsc_disabled() 2016-07-15 10:35:08 +02:00
uaccess_32.h x86/uaccess: Enable hardened usercopy 2016-07-26 14:41:48 -07:00
uaccess_64.h x86/uaccess: Enable hardened usercopy 2016-07-26 14:41:48 -07:00
uaccess.h x86: separate extable.h, switch sections.h to it 2016-09-27 21:15:23 -04:00
unaligned.h
unistd.h x86/syscalls: Add compat_sys_preadv64v2/compat_sys_pwritev64v2 2016-07-15 10:30:26 +02:00
unwind.h x86/unwind: Fix oprofile module link error 2016-10-06 09:52:20 +02:00
uprobes.h
user32.h
user_32.h
user_64.h
user.h
vdso.h x86/arch_prctl/vdso: Add ARCH_MAP_VDSO_* 2016-09-14 21:28:09 +02:00
vga.h
vgtod.h
virtext.h x86/kvm/svm: Simplify cpu_has_svm() 2016-06-16 00:04:31 +02:00
vm86.h
vmx.h KVM: VMX: clean up declaration of VPID/EPT invalidation types 2016-11-22 17:26:15 +01:00
vsyscall.h
vvar.h
word-at-a-time.h
x2apic.h
x86_init.h Merge branch 'x86-timers-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2016-07-25 19:41:35 -07:00
xor_32.h x86/cpufeature: Replace cpu_has_xmm with boot_cpu_has() usage 2016-04-13 11:37:40 +02:00
xor_64.h
xor_avx.h x86/cpufeature: Replace cpu_has_avx with boot_cpu_has() usage 2016-04-13 11:37:40 +02:00
xor.h