Merge branch 'kvm-async-pf-int' into HEAD
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 15 Jun 2020 11:53:05 +0000 (07:53 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 8 Jul 2020 20:20:30 +0000 (16:20 -0400)
1  2 
arch/x86/Kconfig
arch/x86/include/asm/idtentry.h
arch/x86/include/asm/kvm_para.h
arch/x86/kernel/kvm.c

diff --combined arch/x86/Kconfig
@@@ -3,7 -3,7 +3,7 @@@
  config 64BIT
        bool "64-bit kernel" if "$(ARCH)" = "x86"
        default "$(ARCH)" != "i386"
 -      ---help---
 +      help
          Say yes to build a 64-bit kernel - formerly known as x86_64
          Say no to build a 32-bit kernel - formerly known as i386
  
@@@ -59,7 -59,6 +59,7 @@@ config X8
        select ARCH_CLOCKSOURCE_INIT
        select ARCH_HAS_ACPI_TABLE_UPGRADE      if ACPI
        select ARCH_HAS_DEBUG_VIRTUAL
 +      select ARCH_HAS_DEBUG_VM_PGTABLE        if !X86_PAE
        select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_EARLY_DEBUG             if KGDB
        select ARCH_HAS_ELF_RANDOMIZE
        select HAVE_HW_BREAKPOINT
        select HAVE_IDE
        select HAVE_IOREMAP_PROT
 -      select HAVE_IRQ_EXIT_ON_IRQ_STACK       if X86_64
        select HAVE_IRQ_TIME_ACCOUNTING
        select HAVE_KERNEL_BZIP2
        select HAVE_KERNEL_GZIP
        select THREAD_INFO_IN_TASK
        select USER_STACKTRACE_SUPPORT
        select VIRT_TO_BUS
 +      select HAVE_ARCH_KCSAN                  if X86_64
        select X86_FEATURE_NAMES                if PROC_FS
        select PROC_PID_ARCH_STATUS             if PROC_FS
        imply IMA_SECURE_AND_OR_TRUSTED_BOOT    if EFI
@@@ -386,7 -385,7 +386,7 @@@ config ZONE_DM
  
  config SMP
        bool "Symmetric multi-processing support"
 -      ---help---
 +      help
          This enables support for systems with more than one CPU. If you have
          a system with only one CPU, say N. If you have a system with more
          than one CPU, say Y.
  config X86_FEATURE_NAMES
        bool "Processor feature human-readable names" if EMBEDDED
        default y
 -      ---help---
 +      help
          This option compiles in a table of x86 feature bits and corresponding
          names.  This is required to support /proc/cpuinfo and a few kernel
          messages.  You can disable this to save space, at the expense of
  config X86_X2APIC
        bool "Support x2apic"
        depends on X86_LOCAL_APIC && X86_64 && (IRQ_REMAP || HYPERVISOR_GUEST)
 -      ---help---
 +      help
          This enables x2apic support on CPUs that have this feature.
  
          This allows 32-bit apic IDs (so it can support very large systems),
@@@ -438,7 -437,7 +438,7 @@@ config X86_MPPARS
        bool "Enable MPS table" if ACPI || SFI
        default y
        depends on X86_LOCAL_APIC
 -      ---help---
 +      help
          For old smp systems that do not have proper acpi support. Newer systems
          (esp with 64bit cpus) with acpi support, MADT and DSDT will override it
  
@@@ -481,13 -480,13 +481,13 @@@ if X86_3
  config X86_BIGSMP
        bool "Support for big SMP systems with more than 8 CPUs"
        depends on SMP
 -      ---help---
 +      help
          This option is needed for the systems that have more than 8 CPUs.
  
  config X86_EXTENDED_PLATFORM
        bool "Support for extended (non-PC) x86 platforms"
        default y
 -      ---help---
 +      help
          If you disable this option then the kernel will only support
          standard PC platforms. (which covers the vast majority of
          systems out there.)
@@@ -509,7 -508,7 +509,7 @@@ if X86_6
  config X86_EXTENDED_PLATFORM
        bool "Support for extended (non-PC) x86 platforms"
        default y
 -      ---help---
 +      help
          If you disable this option then the kernel will only support
          standard PC platforms. (which covers the vast majority of
          systems out there.)
@@@ -533,7 -532,7 +533,7 @@@ config X86_NUMACHI
        depends on SMP
        depends on X86_X2APIC
        depends on PCI_MMCONFIG
 -      ---help---
 +      help
          Adds support for Numascale NumaChip large-SMP systems. Needed to
          enable more than ~168 cores.
          If you don't have one of these, you should say N here.
@@@ -545,7 -544,7 +545,7 @@@ config X86_VSM
        depends on X86_64 && PCI
        depends on X86_EXTENDED_PLATFORM
        depends on SMP
 -      ---help---
 +      help
          Support for ScaleMP vSMP systems.  Say 'Y' here if this kernel is
          supposed to run on these EM64T-based machines.  Only choose this option
          if you have one of these machines.
@@@ -558,7 -557,7 +558,7 @@@ config X86_U
        depends on EFI
        depends on X86_X2APIC
        depends on PCI
 -      ---help---
 +      help
          This option is needed in order to support SGI Ultraviolet systems.
          If you don't have one of these, you should say N here.
  
  config X86_GOLDFISH
        bool "Goldfish (Virtual Platform)"
        depends on X86_EXTENDED_PLATFORM
 -      ---help---
 +      help
         Enable support for the Goldfish virtual platform used primarily
         for Android development. Unless you are building for the Android
         Goldfish emulator say N here.
@@@ -583,7 -582,7 +583,7 @@@ config X86_INTEL_C
        select X86_REBOOTFIXUPS
        select OF
        select OF_EARLY_FLATTREE
 -      ---help---
 +      help
          Select for the Intel CE media processor (CE4100) SOC.
          This option compiles in support for the CE4100 SOC for settop
          boxes and media devices.
@@@ -601,7 -600,7 +601,7 @@@ config X86_INTEL_MI
        select APB_TIMER
        select INTEL_SCU_PCI
        select MFD_INTEL_MSIC
 -      ---help---
 +      help
          Select to build a kernel capable of supporting Intel MID (Mobile
          Internet Device) platform systems which do not have the PCI legacy
          interfaces. If you are building for a PC class system say N here.
@@@ -621,7 -620,7 +621,7 @@@ config X86_INTEL_QUAR
        select IOSF_MBI
        select INTEL_IMR
        select COMMON_CLK
 -      ---help---
 +      help
          Select to include support for Quark X1000 SoC.
          Say Y here if you have a Quark based system such as the Arduino
          compatible Intel Galileo.
@@@ -632,7 -631,7 +632,7 @@@ config X86_INTEL_LPS
        select COMMON_CLK
        select PINCTRL
        select IOSF_MBI
 -      ---help---
 +      help
          Select to build support for Intel Low Power Subsystem such as
          found on Intel Lynxpoint PCH. Selecting this option enables
          things like clock tree (common clock framework) and pincontrol
@@@ -643,7 -642,7 +643,7 @@@ config X86_AMD_PLATFORM_DEVIC
        depends on ACPI
        select COMMON_CLK
        select PINCTRL
 -      ---help---
 +      help
          Select to interpret AMD specific ACPI device to platform device
          such as I2C, UART, GPIO found on AMD Carrizo and later chipsets.
          I2C and UART depend on COMMON_CLK to set clock. GPIO driver is
  config IOSF_MBI
        tristate "Intel SoC IOSF Sideband support for SoC platforms"
        depends on PCI
 -      ---help---
 +      help
          This option enables sideband register access support for Intel SoC
          platforms. On these platforms the IOSF sideband is used in lieu of
          MSR's for some register accesses, mostly but not limited to thermal
  config IOSF_MBI_DEBUG
        bool "Enable IOSF sideband access through debugfs"
        depends on IOSF_MBI && DEBUG_FS
 -      ---help---
 +      help
          Select this option to expose the IOSF sideband access registers (MCR,
          MDR, MCRX) through debugfs to write and read register information from
          different units on the SoC. This is most useful for obtaining device
@@@ -685,7 -684,7 +685,7 @@@ config X86_RDC321
        depends on X86_EXTENDED_PLATFORM
        select M486
        select X86_REBOOTFIXUPS
 -      ---help---
 +      help
          This option is needed for RDC R-321x system-on-chip, also known
          as R-8610-(G).
          If you don't have one of these chips, you should say N here.
@@@ -694,7 -693,7 +694,7 @@@ config X86_32_NON_STANDAR
        bool "Support non-standard 32-bit SMP architectures"
        depends on X86_32 && SMP
        depends on X86_EXTENDED_PLATFORM
 -      ---help---
 +      help
          This option compiles in the bigsmp and STA2X11 default
          subarchitectures.  It is intended for a generic binary
          kernel. If you select them all, kernel will probe it one by
@@@ -717,7 -716,7 +717,7 @@@ config STA2X1
        select SWIOTLB
        select MFD_STA2X11
        select GPIOLIB
 -      ---help---
 +      help
          This adds support for boards based on the STA2X11 IO-Hub,
          a.k.a. "ConneXt". The chip is used in place of the standard
          PC chipset, so all "standard" peripherals are missing. If this
  config X86_32_IRIS
        tristate "Eurobraille/Iris poweroff module"
        depends on X86_32
 -      ---help---
 +      help
          The Iris machines from EuroBraille do not have APM or ACPI support
          to shut themselves down properly.  A special I/O sequence is
          needed to do so, which is what this module does at
@@@ -741,7 -740,7 +741,7 @@@ config SCHED_OMIT_FRAME_POINTE
        def_bool y
        prompt "Single-depth WCHAN output"
        depends on X86
 -      ---help---
 +      help
          Calculate simpler /proc/<PID>/wchan values. If this option
          is disabled then wchan values will recurse back to the
          caller function. This provides more accurate wchan values,
  
  menuconfig HYPERVISOR_GUEST
        bool "Linux guest support"
 -      ---help---
 +      help
          Say Y here to enable options for running Linux under various hyper-
          visors. This option enables basic hypervisor detection and platform
          setup.
@@@ -763,7 -762,7 +763,7 @@@ if HYPERVISOR_GUES
  
  config PARAVIRT
        bool "Enable paravirtualization code"
 -      ---help---
 +      help
          This changes the kernel so it can modify itself when it is run
          under a hypervisor, potentially improving performance significantly
          over full virtualization.  However, when run without a hypervisor
@@@ -775,14 -774,14 +775,14 @@@ config PARAVIRT_XX
  config PARAVIRT_DEBUG
        bool "paravirt-ops debugging"
        depends on PARAVIRT && DEBUG_KERNEL
 -      ---help---
 +      help
          Enable to debug paravirt_ops internals.  Specifically, BUG if
          a paravirt_op is missing when it is called.
  
  config PARAVIRT_SPINLOCKS
        bool "Paravirtualization layer for spinlocks"
        depends on PARAVIRT && SMP
 -      ---help---
 +      help
          Paravirtualized spinlocks allow a pvops backend to replace the
          spinlock implementation with something virtualization-friendly
          (for example, block the virtual CPU rather than spinning).
@@@ -802,8 -801,9 +802,9 @@@ config KVM_GUES
        depends on PARAVIRT
        select PARAVIRT_CLOCK
        select ARCH_CPUIDLE_HALTPOLL
+       select X86_HV_CALLBACK_VECTOR
        default y
 -      ---help---
 +      help
          This option enables various optimizations for running under the KVM
          hypervisor. It includes a paravirtualized clock, so that instead
          of relying on a PIT (or probably other) emulation by the
@@@ -818,14 -818,14 +819,14 @@@ config ARCH_CPUIDLE_HALTPOL
  
  config PVH
        bool "Support for running PVH guests"
 -      ---help---
 +      help
          This option enables the PVH entry point for guest virtual machines
          as specified in the x86/HVM direct boot ABI.
  
  config PARAVIRT_TIME_ACCOUNTING
        bool "Paravirtual steal time accounting"
        depends on PARAVIRT
 -      ---help---
 +      help
          Select this option to enable fine granularity task steal time
          accounting. Time spent executing other tasks in parallel with
          the current vCPU is discounted from the vCPU power. To account for
@@@ -840,7 -840,7 +841,7 @@@ config JAILHOUSE_GUES
        bool "Jailhouse non-root cell support"
        depends on X86_64 && PCI
        select X86_PM_TIMER
 -      ---help---
 +      help
          This option allows to run Linux as guest in a Jailhouse non-root
          cell. You can leave this option disabled if you only want to start
          Jailhouse and run Linux afterwards in the root cell.
@@@ -863,7 -863,7 +864,7 @@@ source "arch/x86/Kconfig.cpu
  config HPET_TIMER
        def_bool X86_64
        prompt "HPET Timer Support" if X86_32
 -      ---help---
 +      help
          Use the IA-PC HPET (High Precision Event Timer) to manage
          time in preference to the PIT and RTC, if a HPET is
          present.
@@@ -901,7 -901,7 +902,7 @@@ config DM
        default y
        select DMI_SCAN_MACHINE_NON_EFI_FALLBACK
        bool "Enable DMI scanning" if EXPERT
 -      ---help---
 +      help
          Enabled scanning of DMI to identify machine quirks. Say Y
          here unless you have verified that your setup is not
          affected by entries in the DMI blacklist. Required by PNP
@@@ -912,7 -912,7 +913,7 @@@ config GART_IOMM
        select IOMMU_HELPER
        select SWIOTLB
        depends on X86_64 && PCI && AMD_NB
 -      ---help---
 +      help
          Provides a driver for older AMD Athlon64/Opteron/Turion/Sempron
          GART based hardware IOMMUs.
  
@@@ -933,7 -933,7 +934,7 @@@ config MAXSM
        bool "Enable Maximum number of SMP Processors and NUMA Nodes"
        depends on X86_64 && SMP && DEBUG_KERNEL
        select CPUMASK_OFFSTACK
 -      ---help---
 +      help
          Enable maximum number of CPUS and NUMA Nodes for this architecture.
          If unsure, say N.
  
@@@ -989,7 -989,7 +990,7 @@@ config NR_CPU
        int "Maximum number of CPUs" if SMP && !MAXSMP
        range NR_CPUS_RANGE_BEGIN NR_CPUS_RANGE_END
        default NR_CPUS_DEFAULT
 -      ---help---
 +      help
          This allows you to specify the maximum number of CPUs which this
          kernel will support.  If CPUMASK_OFFSTACK is enabled, the maximum
          supported value is 8192, otherwise the maximum value is 512.  The
@@@ -1005,7 -1005,7 +1006,7 @@@ config SCHED_M
        def_bool y
        prompt "Multi-core scheduler support"
        depends on SMP
 -      ---help---
 +      help
          Multi-core scheduler support improves the CPU scheduler's decision
          making when dealing with multi-core CPU chips at a cost of slightly
          increased overhead in some places. If unsure say N here.
@@@ -1016,7 -1016,7 +1017,7 @@@ config SCHED_MC_PRI
        select X86_INTEL_PSTATE
        select CPU_FREQ
        default y
 -      ---help---
 +      help
          Intel Turbo Boost Max Technology 3.0 enabled CPUs have a
          core ordering determined at manufacturing time, which allows
          certain cores to reach higher turbo frequencies (when running
@@@ -1039,7 -1039,7 +1040,7 @@@ config X86_UP_API
        bool "Local APIC support on uniprocessors" if !PCI_MSI
        default PCI_MSI
        depends on X86_32 && !SMP && !X86_32_NON_STANDARD
 -      ---help---
 +      help
          A local APIC (Advanced Programmable Interrupt Controller) is an
          integrated interrupt controller in the CPU. If you have a single-CPU
          system which has a processor with a local APIC, you can say Y here to
  config X86_UP_IOAPIC
        bool "IO-APIC support on uniprocessors"
        depends on X86_UP_APIC
 -      ---help---
 +      help
          An IO-APIC (I/O Advanced Programmable Interrupt Controller) is an
          SMP-capable replacement for PC-style interrupt controllers. Most
          SMP systems and many recent uniprocessor systems have one.
@@@ -1074,7 -1074,7 +1075,7 @@@ config X86_IO_API
  config X86_REROUTE_FOR_BROKEN_BOOT_IRQS
        bool "Reroute for broken boot IRQs"
        depends on X86_IO_APIC
 -      ---help---
 +      help
          This option enables a workaround that fixes a source of
          spurious interrupts. This is recommended when threaded
          interrupt handling is used on systems where the generation of
@@@ -1098,7 -1098,7 +1099,7 @@@ config X86_MC
        bool "Machine Check / overheating reporting"
        select GENERIC_ALLOCATOR
        default y
 -      ---help---
 +      help
          Machine Check support allows the processor to notify the
          kernel if it detects a problem (e.g. overheating, data corruption).
          The action the kernel takes depends on the severity of the problem,
  config X86_MCELOG_LEGACY
        bool "Support for deprecated /dev/mcelog character device"
        depends on X86_MCE
 -      ---help---
 +      help
          Enable support for /dev/mcelog which is needed by the old mcelog
          userspace logging daemon. Consider switching to the new generation
          rasdaemon solution.
@@@ -1116,7 -1116,7 +1117,7 @@@ config X86_MCE_INTE
        def_bool y
        prompt "Intel MCE features"
        depends on X86_MCE && X86_LOCAL_APIC
 -      ---help---
 +      help
           Additional support for intel specific MCE features such as
           the thermal monitor.
  
@@@ -1124,14 -1124,14 +1125,14 @@@ config X86_MCE_AM
        def_bool y
        prompt "AMD MCE features"
        depends on X86_MCE && X86_LOCAL_APIC && AMD_NB
 -      ---help---
 +      help
           Additional support for AMD specific MCE features such as
           the DRAM Error Threshold.
  
  config X86_ANCIENT_MCE
        bool "Support for old Pentium 5 / WinChip machine checks"
        depends on X86_32 && X86_MCE
 -      ---help---
 +      help
          Include support for machine check handling on old Pentium 5 or WinChip
          systems. These typically need to be enabled explicitly on the command
          line.
@@@ -1143,7 -1143,7 +1144,7 @@@ config X86_MCE_THRESHOL
  config X86_MCE_INJECT
        depends on X86_MCE && X86_LOCAL_APIC && DEBUG_FS
        tristate "Machine check injector support"
 -      ---help---
 +      help
          Provide support for injecting machine checks for testing purposes.
          If you don't know what a machine check is and you don't do kernel
          QA it is safe to say n.
@@@ -1157,7 -1157,7 +1158,7 @@@ source "arch/x86/events/Kconfig
  config X86_LEGACY_VM86
        bool "Legacy VM86 support"
        depends on X86_32
 -      ---help---
 +      help
          This option allows user programs to put the CPU into V8086
          mode, which is an 80286-era approximation of 16-bit real mode.
  
@@@ -1189,7 -1189,7 +1190,7 @@@ config X86_16BI
        bool "Enable support for 16-bit segments" if EXPERT
        default y
        depends on MODIFY_LDT_SYSCALL
 -      ---help---
 +      help
          This option is required by programs like Wine to run 16-bit
          protected mode legacy code on x86 processors.  Disabling
          this option saves about 300 bytes on i386, or around 6K text
@@@ -1207,7 -1207,7 +1208,7 @@@ config X86_VSYSCALL_EMULATIO
        bool "Enable vsyscall emulation" if EXPERT
        default y
        depends on X86_64
 -      ---help---
 +      help
         This enables emulation of the legacy vsyscall page.  Disabling
         it is roughly equivalent to booting with vsyscall=none, except
         that it will also disable the helpful warning if a program
  config X86_IOPL_IOPERM
        bool "IOPERM and IOPL Emulation"
        default y
 -      ---help---
 +      help
          This enables the ioperm() and iopl() syscalls which are necessary
          for legacy applications.
  
  config TOSHIBA
        tristate "Toshiba Laptop support"
        depends on X86_32
 -      ---help---
 +      help
          This adds a driver to safely access the System Management Mode of
          the CPU on Toshiba portables with a genuine Toshiba BIOS. It does
          not work on models with a Phoenix BIOS. The System Management Mode
@@@ -1259,7 -1259,7 +1260,7 @@@ config I8
        tristate "Dell i8k legacy laptop support"
        select HWMON
        select SENSORS_DELL_SMM
 -      ---help---
 +      help
          This option enables legacy /proc/i8k userspace interface in hwmon
          dell-smm-hwmon driver. Character file /proc/i8k reports bios version,
          temperature and allows controlling fan speeds of Dell laptops via
  config X86_REBOOTFIXUPS
        bool "Enable X86 board specific fixups for reboot"
        depends on X86_32
 -      ---help---
 +      help
          This enables chipset and/or board specific fixups to be done
          in order to get reboot to work correctly. This is only needed on
          some combinations of hardware and BIOS. The symptom, for which
@@@ -1293,7 -1293,7 +1294,7 @@@ config MICROCOD
        default y
        depends on CPU_SUP_AMD || CPU_SUP_INTEL
        select FW_LOADER
 -      ---help---
 +      help
          If you say Y here, you will be able to update the microcode on
          Intel and AMD processors. The Intel support is for the IA32 family,
          e.g. Pentium Pro, Pentium II, Pentium III, Pentium 4, Xeon etc. The
@@@ -1315,7 -1315,7 +1316,7 @@@ config MICROCODE_INTE
        depends on MICROCODE
        default MICROCODE
        select FW_LOADER
 -      ---help---
 +      help
          This options enables microcode patch loading support for Intel
          processors.
  
@@@ -1327,7 -1327,7 +1328,7 @@@ config MICROCODE_AM
        bool "AMD microcode loading support"
        depends on MICROCODE
        select FW_LOADER
 -      ---help---
 +      help
          If you select this option, microcode patch loading support for AMD
          processors will be enabled.
  
@@@ -1335,7 -1335,7 +1336,7 @@@ config MICROCODE_OLD_INTERFAC
        bool "Ancient loading interface (DEPRECATED)"
        default n
        depends on MICROCODE
 -      ---help---
 +      help
          DO NOT USE THIS! This is the ancient /dev/cpu/microcode interface
          which was used by userspace tools like iucode_tool and microcode.ctl.
          It is inadequate because it runs too late to be able to properly
  
  config X86_MSR
        tristate "/dev/cpu/*/msr - Model-specific register support"
 -      ---help---
 +      help
          This device gives privileged processes access to the x86
          Model-Specific Registers (MSRs).  It is a character device with
          major 202 and minors 0 to 31 for /dev/cpu/0/msr to /dev/cpu/31/msr.
  
  config X86_CPUID
        tristate "/dev/cpu/*/cpuid - CPU information support"
 -      ---help---
 +      help
          This device gives processes access to the x86 CPUID instruction to
          be executed on a specific processor.  It is a character device
          with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
@@@ -1367,7 -1367,7 +1368,7 @@@ choic
  
  config NOHIGHMEM
        bool "off"
 -      ---help---
 +      help
          Linux can use up to 64 Gigabytes of physical memory on x86 systems.
          However, the address space of 32-bit x86 processors is only 4
          Gigabytes large. That means that, if you have a large amount of
  
  config HIGHMEM4G
        bool "4GB"
 -      ---help---
 +      help
          Select this if you have a 32-bit processor and between 1 and 4
          gigabytes of physical RAM.
  
@@@ -1411,7 -1411,7 +1412,7 @@@ config HIGHMEM64
        bool "64GB"
        depends on !M486 && !M586 && !M586TSC && !M586MMX && !MGEODE_LX && !MGEODEGX1 && !MCYRIXIII && !MELAN && !MWINCHIPC6 && !WINCHIP3D && !MK6
        select X86_PAE
 -      ---help---
 +      help
          Select this if you have a 32-bit processor and more than 4
          gigabytes of physical RAM.
  
@@@ -1421,7 -1421,7 +1422,7 @@@ choic
        prompt "Memory split" if EXPERT
        default VMSPLIT_3G
        depends on X86_32
 -      ---help---
 +      help
          Select the desired split between kernel and user memory.
  
          If the address range available to the kernel is less than the
@@@ -1469,7 -1469,7 +1470,7 @@@ config X86_PA
        depends on X86_32 && !HIGHMEM4G
        select PHYS_ADDR_T_64BIT
        select SWIOTLB
 -      ---help---
 +      help
          PAE is required for NX support, and furthermore enables
          larger swapspace support for non-overcommit purposes. It
          has the cost of more pagetable lookup overhead, and also
@@@ -1481,7 -1481,7 +1482,7 @@@ config X86_5LEVE
        select DYNAMIC_MEMORY_LAYOUT
        select SPARSEMEM_VMEMMAP
        depends on X86_64
 -      ---help---
 +      help
          5-level paging enables access to larger address space:
          upto 128 PiB of virtual address space and 4 PiB of
          physical address space.
  config X86_DIRECT_GBPAGES
        def_bool y
        depends on X86_64
 -      ---help---
 +      help
          Certain kernel features effectively disable kernel
          linear 1 GB mappings (even if the CPU otherwise
          supports them), so don't confuse the user by printing
  config X86_CPA_STATISTICS
        bool "Enable statistic for Change Page Attribute"
        depends on DEBUG_FS
 -      ---help---
 +      help
          Expose statistics about the Change Page Attribute mechanism, which
          helps to determine the effectiveness of preserving large and huge
          page mappings when mapping protections are changed.
  config AMD_MEM_ENCRYPT
        bool "AMD Secure Memory Encryption (SME) support"
        depends on X86_64 && CPU_SUP_AMD
 +      select DMA_COHERENT_POOL
        select DYNAMIC_PHYSICAL_MASK
        select ARCH_USE_MEMREMAP_PROT
        select ARCH_HAS_FORCE_DMA_UNENCRYPTED
 -      ---help---
 +      help
          Say yes to enable support for the encryption of system memory.
          This requires an AMD processor that supports Secure Memory
          Encryption (SME).
@@@ -1529,7 -1528,7 +1530,7 @@@ config AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAUL
        bool "Activate AMD Secure Memory Encryption (SME) by default"
        default y
        depends on AMD_MEM_ENCRYPT
 -      ---help---
 +      help
          Say yes to have system memory encrypted by default if running on
          an AMD processor that supports Secure Memory Encryption (SME).
  
@@@ -1545,7 -1544,7 +1546,7 @@@ config NUM
        depends on SMP
        depends on X86_64 || (X86_32 && HIGHMEM64G && X86_BIGSMP)
        default y if X86_BIGSMP
 -      ---help---
 +      help
          Enable NUMA (Non-Uniform Memory Access) support.
  
          The kernel will try to allocate memory used by a CPU on the
@@@ -1564,7 -1563,7 +1565,7 @@@ config AMD_NUM
        def_bool y
        prompt "Old style AMD Opteron NUMA detection"
        depends on X86_64 && NUMA && PCI
 -      ---help---
 +      help
          Enable AMD NUMA node topology detection.  You should say Y here if
          you have a multi processor AMD system. This uses an old method to
          read the NUMA configuration directly from the builtin Northbridge
@@@ -1576,13 -1575,13 +1577,13 @@@ config X86_64_ACPI_NUM
        prompt "ACPI NUMA detection"
        depends on X86_64 && NUMA && ACPI && PCI
        select ACPI_NUMA
 -      ---help---
 +      help
          Enable ACPI SRAT based node topology detection.
  
  config NUMA_EMU
        bool "NUMA emulation"
        depends on NUMA
 -      ---help---
 +      help
          Enable NUMA emulation. A flat machine will be split
          into virtual nodes when booted with "numa=fake=N", where N is the
          number of nodes. This is only useful for debugging.
@@@ -1594,7 -1593,7 +1595,7 @@@ config NODES_SHIF
        default "6" if X86_64
        default "3"
        depends on NEED_MULTIPLE_NODES
 -      ---help---
 +      help
          Specify the maximum number of NUMA Nodes available on the target
          system.  Increases memory reserved to accommodate various tables.
  
@@@ -1653,7 -1652,7 +1654,7 @@@ config X86_PMEM_LEGAC
  config HIGHPTE
        bool "Allocate 3rd-level pagetables from highmem"
        depends on HIGHMEM
 -      ---help---
 +      help
          The VM uses one page table entry for each page of physical memory.
          For systems with a lot of RAM, this can be wasteful of precious
          low memory.  Setting this option will put user-space page table
  
  config X86_CHECK_BIOS_CORRUPTION
        bool "Check for low memory corruption"
 -      ---help---
 +      help
          Periodically check for memory corruption in low memory, which
          is suspected to be caused by BIOS.  Even when enabled in the
          configuration, it is disabled at runtime.  Enable it by
@@@ -1685,7 -1684,7 +1686,7 @@@ config X86_BOOTPARAM_MEMORY_CORRUPTION_
        bool "Set the default setting of memory_corruption_check"
        depends on X86_CHECK_BIOS_CORRUPTION
        default y
 -      ---help---
 +      help
          Set whether the default state of memory_corruption_check is
          on or off.
  
@@@ -1693,7 -1692,7 +1694,7 @@@ config X86_RESERVE_LO
        int "Amount of low memory, in kilobytes, to reserve for the BIOS"
        default 64
        range 4 640
 -      ---help---
 +      help
          Specify the amount of low memory to reserve for the BIOS.
  
          The first page contains BIOS data structures that the kernel
@@@ -1722,7 -1721,7 +1723,7 @@@ config MATH_EMULATIO
        bool
        depends on MODIFY_LDT_SYSCALL
        prompt "Math emulation" if X86_32 && (M486SX || MELAN)
 -      ---help---
 +      help
          Linux can emulate a math coprocessor (used for floating point
          operations) if you don't have one. 486DX and Pentium processors have
          a math coprocessor built in, 486SX and 386 do not, unless you added
  config MTRR
        def_bool y
        prompt "MTRR (Memory Type Range Register) support" if EXPERT
 -      ---help---
 +      help
          On Intel P6 family processors (Pentium Pro, Pentium II and later)
          the Memory Type Range Registers (MTRRs) may be used to control
          processor access to memory ranges. This is most useful if you have
@@@ -1784,7 -1783,7 +1785,7 @@@ config MTRR_SANITIZE
        def_bool y
        prompt "MTRR cleanup support"
        depends on MTRR
 -      ---help---
 +      help
          Convert MTRR layout from continuous to discrete, so X drivers can
          add writeback entries.
  
@@@ -1799,7 -1798,7 +1800,7 @@@ config MTRR_SANITIZER_ENABLE_DEFAUL
        range 0 1
        default "0"
        depends on MTRR_SANITIZER
 -      ---help---
 +      help
          Enable mtrr cleanup default value
  
  config MTRR_SANITIZER_SPARE_REG_NR_DEFAULT
        range 0 7
        default "1"
        depends on MTRR_SANITIZER
 -      ---help---
 +      help
          mtrr cleanup spare entries default, it can be changed via
          mtrr_spare_reg_nr=N on the kernel command line.
  
@@@ -1815,7 -1814,7 +1816,7 @@@ config X86_PA
        def_bool y
        prompt "x86 PAT support" if EXPERT
        depends on MTRR
 -      ---help---
 +      help
          Use PAT attributes to setup page level cache control.
  
          PATs are the modern equivalents of MTRRs and are much more
@@@ -1833,7 -1832,7 +1834,7 @@@ config ARCH_USES_PG_UNCACHE
  config ARCH_RANDOM
        def_bool y
        prompt "x86 architectural random number generator" if EXPERT
 -      ---help---
 +      help
          Enable the x86 architectural RDRAND instruction
          (Intel Bull Mountain technology) to generate random numbers.
          If supported, this is a high bandwidth, cryptographically
  config X86_SMAP
        def_bool y
        prompt "Supervisor Mode Access Prevention" if EXPERT
 -      ---help---
 +      help
          Supervisor Mode Access Prevention (SMAP) is a security
          feature in newer Intel processors.  There is a small
          performance cost if this enabled and turned on; there is
  config X86_UMIP
        def_bool y
        prompt "User Mode Instruction Prevention" if EXPERT
 -      ---help---
 +      help
          User Mode Instruction Prevention (UMIP) is a security feature in
          some x86 processors. If enabled, a general protection fault is
          issued if the SGDT, SLDT, SIDT, SMSW or STR instructions are
@@@ -1872,7 -1871,7 +1873,7 @@@ config X86_INTEL_MEMORY_PROTECTION_KEY
        depends on X86_64 && (CPU_SUP_INTEL || CPU_SUP_AMD)
        select ARCH_USES_HIGH_VMA_FLAGS
        select ARCH_HAS_PKEYS
 -      ---help---
 +      help
          Memory Protection Keys provides a mechanism for enforcing
          page-based protections, but without requiring modification of the
          page tables when an application changes protection domains.
@@@ -1931,7 -1930,7 +1932,7 @@@ config EF
        depends on ACPI
        select UCS2_STRING
        select EFI_RUNTIME_WRAPPERS
 -      ---help---
 +      help
          This enables the kernel to use EFI runtime services that are
          available (such as the EFI variable services).
  
@@@ -1947,7 -1946,7 +1948,7 @@@ config EFI_STU
        depends on EFI && !X86_USE_3DNOW
        depends on $(cc-option,-mabi=ms) || X86_32
        select RELOCATABLE
 -      ---help---
 +      help
          This kernel feature allows a bzImage to be loaded directly
          by EFI firmware without the use of a bootloader.
  
  config EFI_MIXED
        bool "EFI mixed-mode support"
        depends on EFI_STUB && X86_64
 -      ---help---
 +      help
           Enabling this feature allows a 64-bit kernel to be booted
           on a 32-bit firmware, provided that your CPU supports 64-bit
           mode.
  config SECCOMP
        def_bool y
        prompt "Enable seccomp to safely compute untrusted bytecode"
 -      ---help---
 +      help
          This kernel feature is useful for number crunching applications
          that may need to compute untrusted bytecode during their
          execution. By using pipes or other transports made available to
@@@ -1988,7 -1987,7 +1989,7 @@@ source "kernel/Kconfig.hz
  config KEXEC
        bool "kexec system call"
        select KEXEC_CORE
 -      ---help---
 +      help
          kexec is a system call that implements the ability to shutdown your
          current kernel, and to start another kernel.  It is like a reboot
          but it is independent of the system firmware.   And like a reboot
@@@ -2009,7 -2008,7 +2010,7 @@@ config KEXEC_FIL
        depends on X86_64
        depends on CRYPTO=y
        depends on CRYPTO_SHA256=y
 -      ---help---
 +      help
          This is new version of kexec system call. This system call is
          file based and takes file descriptors as system call argument
          for kernel and initramfs as opposed to list of segments as
@@@ -2021,7 -2020,7 +2022,7 @@@ config ARCH_HAS_KEXEC_PURGATOR
  config KEXEC_SIG
        bool "Verify kernel signature during kexec_file_load() syscall"
        depends on KEXEC_FILE
 -      ---help---
 +      help
  
          This option makes the kexec_file_load() syscall check for a valid
          signature of the kernel image.  The image can still be loaded without
  config KEXEC_SIG_FORCE
        bool "Require a valid signature in kexec_file_load() syscall"
        depends on KEXEC_SIG
 -      ---help---
 +      help
          This option makes kernel signature verification mandatory for
          the kexec_file_load() syscall.
  
@@@ -2044,13 -2043,13 +2045,13 @@@ config KEXEC_BZIMAGE_VERIFY_SI
        depends on KEXEC_SIG
        depends on SIGNED_PE_FILE_VERIFICATION
        select SYSTEM_TRUSTED_KEYRING
 -      ---help---
 +      help
          Enable bzImage signature verification support.
  
  config CRASH_DUMP
        bool "kernel crash dumps"
        depends on X86_64 || (X86_32 && HIGHMEM)
 -      ---help---
 +      help
          Generate crash dump after being started by kexec.
          This should be normally only set in special crash dump kernels
          which are loaded in the main kernel with kexec-tools into
  config KEXEC_JUMP
        bool "kexec jump"
        depends on KEXEC && HIBERNATION
 -      ---help---
 +      help
          Jump between original kernel and kexeced kernel and invoke
          code in physical address mode via KEXEC
  
  config PHYSICAL_START
        hex "Physical address where the kernel is loaded" if (EXPERT || CRASH_DUMP)
        default "0x1000000"
 -      ---help---
 +      help
          This gives the physical address where the kernel is loaded.
  
          If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then
  config RELOCATABLE
        bool "Build a relocatable kernel"
        default y
 -      ---help---
 +      help
          This builds a kernel image that retains relocation information
          so it can be loaded someplace besides the default 1MB.
          The relocations tend to make the kernel binary about 10% larger,
@@@ -2130,7 -2129,7 +2131,7 @@@ config RANDOMIZE_BAS
        bool "Randomize the address of the kernel image (KASLR)"
        depends on RELOCATABLE
        default y
 -      ---help---
 +      help
          In support of Kernel Address Space Layout Randomization (KASLR),
          this randomizes the physical address at which the kernel image
          is decompressed and the virtual address where the kernel
@@@ -2171,7 -2170,7 +2172,7 @@@ config PHYSICAL_ALIG
        default "0x200000"
        range 0x2000 0x1000000 if X86_32
        range 0x200000 0x1000000 if X86_64
 -      ---help---
 +      help
          This value puts the alignment restrictions on physical address
          where kernel is loaded and run from. Kernel is compiled for an
          address which meets above alignment restriction.
  
  config DYNAMIC_MEMORY_LAYOUT
        bool
 -      ---help---
 +      help
          This option makes base addresses of vmalloc and vmemmap as well as
          __PAGE_OFFSET movable during boot.
  
@@@ -2205,7 -2204,7 +2206,7 @@@ config RANDOMIZE_MEMOR
        depends on RANDOMIZE_BASE
        select DYNAMIC_MEMORY_LAYOUT
        default RANDOMIZE_BASE
 -      ---help---
 +      help
           Randomizes the base virtual address of kernel memory sections
           (physical memory mapping, vmalloc & vmemmap). This security feature
           makes exploits relying on predictable memory locations less reliable.
@@@ -2224,7 -2223,7 +2225,7 @@@ config RANDOMIZE_MEMORY_PHYSICAL_PADDIN
        default "0x0"
        range 0x1 0x40 if MEMORY_HOTPLUG
        range 0x0 0x40
 -      ---help---
 +      help
           Define the padding in terabytes added to the existing physical
           memory size during kernel memory randomization. It is useful
           for memory hotplug support but reduces the entropy available for
@@@ -2239,7 -2238,7 +2240,7 @@@ config HOTPLUG_CP
  config BOOTPARAM_HOTPLUG_CPU0
        bool "Set default setting of cpu0_hotpluggable"
        depends on HOTPLUG_CPU
 -      ---help---
 +      help
          Set whether default state of cpu0_hotpluggable is on or off.
  
          Say Y here to enable CPU0 hotplug by default. If this switch
@@@ -2268,7 -2267,7 +2269,7 @@@ config DEBUG_HOTPLUG_CPU
        def_bool n
        prompt "Debug CPU0 hotplug"
        depends on HOTPLUG_CPU
 -      ---help---
 +      help
          Enabling this option offlines CPU0 (if CPU0 can be offlined) as
          soon as possible and boots up userspace with CPU0 offlined. User
          can online CPU0 back after boot time.
@@@ -2283,7 -2282,7 +2284,7 @@@ config COMPAT_VDS
        def_bool n
        prompt "Disable the 32-bit vDSO (needed for glibc 2.3.3)"
        depends on COMPAT_32
 -      ---help---
 +      help
          Certain buggy versions of glibc will crash if they are
          presented with a 32-bit vDSO that is not mapped at the address
          indicated in its segment table.
@@@ -2361,7 -2360,7 +2362,7 @@@ endchoic
  
  config CMDLINE_BOOL
        bool "Built-in kernel command line"
 -      ---help---
 +      help
          Allow for specifying boot arguments to the kernel at
          build time.  On some systems (e.g. embedded ones), it is
          necessary or convenient to provide some or all of the
@@@ -2379,7 -2378,7 +2380,7 @@@ config CMDLIN
        string "Built-in kernel command string"
        depends on CMDLINE_BOOL
        default ""
 -      ---help---
 +      help
          Enter arguments here that should be compiled into the kernel
          image and used at boot time.  If the boot loader provides a
          command line at boot time, it is appended to this string to
  config CMDLINE_OVERRIDE
        bool "Built-in command line overrides boot loader arguments"
        depends on CMDLINE_BOOL && CMDLINE != ""
 -      ---help---
 +      help
          Set this option to 'Y' to have the kernel ignore the boot loader
          command line, and use ONLY the built-in command line.
  
  config MODIFY_LDT_SYSCALL
        bool "Enable the LDT (local descriptor table)" if EXPERT
        default y
 -      ---help---
 +      help
          Linux can allow user programs to install a per-process x86
          Local Descriptor Table (LDT) using the modify_ldt(2) system
          call.  This is required to run 16-bit or segmented code such as
@@@ -2469,7 -2468,7 +2470,7 @@@ config X86_APM_BOO
  menuconfig APM
        tristate "APM (Advanced Power Management) BIOS support"
        depends on X86_32 && PM_SLEEP
 -      ---help---
 +      help
          APM is a BIOS specification for saving power using several different
          techniques. This is mostly useful for battery powered laptops with
          APM compliant BIOSes. If you say Y here, the system time will be
@@@ -2529,14 -2528,14 +2530,14 @@@ if AP
  
  config APM_IGNORE_USER_SUSPEND
        bool "Ignore USER SUSPEND"
 -      ---help---
 +      help
          This option will ignore USER SUSPEND requests. On machines with a
          compliant APM BIOS, you want to say N. However, on the NEC Versa M
          series notebooks, it is necessary to say Y because of a BIOS bug.
  
  config APM_DO_ENABLE
        bool "Enable PM at boot time"
 -      ---help---
 +      help
          Enable APM features at boot time. From page 36 of the APM BIOS
          specification: "When disabled, the APM BIOS does not automatically
          power manage devices, enter the Standby State, enter the Suspend
  config APM_CPU_IDLE
        depends on CPU_IDLE
        bool "Make CPU Idle calls when idle"
 -      ---help---
 +      help
          Enable calls to APM CPU Idle/CPU Busy inside the kernel's idle loop.
          On some machines, this can activate improved power savings, such as
          a slowed CPU clock rate, when the machine is idle. These idle calls
  
  config APM_DISPLAY_BLANK
        bool "Enable console blanking using APM"
 -      ---help---
 +      help
          Enable console blanking using the APM. Some laptops can use this to
          turn off the LCD backlight when the screen blanker of the Linux
          virtual console blanks the screen. Note that this is only used by
  
  config APM_ALLOW_INTS
        bool "Allow interrupts during APM BIOS calls"
 -      ---help---
 +      help
          Normally we disable external interrupts while we are making calls to
          the APM BIOS as a measure to lessen the effects of a badly behaving
          BIOS implementation.  The BIOS should reenable interrupts if it
@@@ -2603,7 -2602,7 +2604,7 @@@ choic
        prompt "PCI access mode"
        depends on X86_32 && PCI
        default PCI_GOANY
 -      ---help---
 +      help
          On PCI systems, the BIOS can be used to detect the PCI devices and
          determine their configuration. However, some old PCI motherboards
          have BIOS bugs and may crash if this is done. Also, some embedded
@@@ -2700,7 -2699,7 +2701,7 @@@ if X86_3
  
  config ISA
        bool "ISA support"
 -      ---help---
 +      help
          Find out whether you have ISA slots on your motherboard.  ISA is the
          name of a bus system, i.e. the way the CPU talks to the other stuff
          inside your box.  Other bus systems are PCI, EISA, MicroChannel
  
  config SCx200
        tristate "NatSemi SCx200 support"
 -      ---help---
 +      help
          This provides basic support for National Semiconductor's
          (now AMD's) Geode processors.  The driver probes for the
          PCI-IDs of several on-chip devices, so its a good dependency
@@@ -2721,7 -2720,7 +2722,7 @@@ config SCx200HR_TIME
        tristate "NatSemi SCx200 27MHz High-Resolution Timer Support"
        depends on SCx200
        default y
 -      ---help---
 +      help
          This driver provides a clocksource built upon the on-chip
          27MHz high-resolution timer.  Its also a workaround for
          NSC Geode SC-1100's buggy TSC, which loses time when the
@@@ -2736,20 -2735,20 +2737,20 @@@ config OLP
        select OF_PROMTREE
        select IRQ_DOMAIN
        select OLPC_EC
 -      ---help---
 +      help
          Add support for detecting the unique features of the OLPC
          XO hardware.
  
  config OLPC_XO1_PM
        bool "OLPC XO-1 Power Management"
        depends on OLPC && MFD_CS5535=y && PM_SLEEP
 -      ---help---
 +      help
          Add support for poweroff and suspend of the OLPC XO-1 laptop.
  
  config OLPC_XO1_RTC
        bool "OLPC XO-1 Real Time Clock"
        depends on OLPC_XO1_PM && RTC_DRV_CMOS
 -      ---help---
 +      help
          Add support for the XO-1 real time clock, which can be used as a
          programmable wakeup source.
  
@@@ -2758,7 -2757,7 +2759,7 @@@ config OLPC_XO1_SC
        depends on OLPC && OLPC_XO1_PM && GPIO_CS5535=y
        depends on INPUT=y
        select POWER_SUPPLY
 -      ---help---
 +      help
          Add support for SCI-based features of the OLPC XO-1 laptop:
           - EC-driven system wakeups
           - Power button
@@@ -2771,7 -2770,7 +2772,7 @@@ config OLPC_XO15_SC
        bool "OLPC XO-1.5 SCI extras"
        depends on OLPC && ACPI
        select POWER_SUPPLY
 -      ---help---
 +      help
          Add support for SCI-based features of the OLPC XO-1.5 laptop:
           - EC-driven system wakeups
           - AC adapter status updates
  config ALIX
        bool "PCEngines ALIX System Support (LED setup)"
        select GPIOLIB
 -      ---help---
 +      help
          This option enables system support for the PCEngines ALIX.
          At present this just sets up LEDs for GPIO control on
          ALIX2/3/6 boards.  However, other system specific setup should
  config NET5501
        bool "Soekris Engineering net5501 System Support (LEDS, GPIO, etc)"
        select GPIOLIB
 -      ---help---
 +      help
          This option enables system support for the Soekris Engineering net5501.
  
  config GEOS
        bool "Traverse Technologies GEOS System Support (LEDS, GPIO, etc)"
        select GPIOLIB
        depends on DMI
 -      ---help---
 +      help
          This option enables system support for the Traverse Technologies GEOS.
  
  config TS5500
        select CHECK_SIGNATURE
        select NEW_LEDS
        select LEDS_CLASS
 -      ---help---
 +      help
          This option enables system support for the Technologic Systems TS-5500.
  
  endif # X86_32
@@@ -2857,7 -2856,7 +2858,7 @@@ config IA32_EMULATIO
        select BINFMT_ELF
        select COMPAT_BINFMT_ELF
        select COMPAT_OLD_SIGACTION
 -      ---help---
 +      help
          Include code to run legacy 32-bit programs under a
          64-bit kernel. You should likely turn this on, unless you're
          100% sure that you don't have any 32-bit programs left.
@@@ -2866,13 -2865,13 +2867,13 @@@ config IA32_AOU
        tristate "IA32 a.out support"
        depends on IA32_EMULATION
        depends on BROKEN
 -      ---help---
 +      help
          Support old a.out binaries in the 32bit emulation.
  
  config X86_X32
        bool "x32 ABI for 64-bit mode"
        depends on X86_64
 -      ---help---
 +      help
          Include code to run binaries for the x32 native 32-bit ABI
          for 64-bit processors.  An x32 process gets access to the
          full 64-bit register file and wide data path while leaving
index cf51c50,0000000..cecc603
mode 100644,000000..100644
--- /dev/null
@@@ -1,652 -1,0 +1,656 @@@
 +/* SPDX-License-Identifier: GPL-2.0 */
 +#ifndef _ASM_X86_IDTENTRY_H
 +#define _ASM_X86_IDTENTRY_H
 +
 +/* Interrupts/Exceptions */
 +#include <asm/trapnr.h>
 +
 +#ifndef __ASSEMBLY__
 +#include <linux/hardirq.h>
 +
 +#include <asm/irq_stack.h>
 +
 +void idtentry_enter_user(struct pt_regs *regs);
 +void idtentry_exit_user(struct pt_regs *regs);
 +
 +bool idtentry_enter_cond_rcu(struct pt_regs *regs);
 +void idtentry_exit_cond_rcu(struct pt_regs *regs, bool rcu_exit);
 +
 +/**
 + * DECLARE_IDTENTRY - Declare functions for simple IDT entry points
 + *                  No error code pushed by hardware
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Declares three functions:
 + * - The ASM entry point: asm_##func
 + * - The XEN PV trap entry point: xen_##func (maybe unused)
 + * - The C handler called from the ASM entry point
 + *
 + * Note: This is the C variant of DECLARE_IDTENTRY(). As the name says it
 + * declares the entry points for usage in C code. There is an ASM variant
 + * as well which is used to emit the entry stubs in entry_32/64.S.
 + */
 +#define DECLARE_IDTENTRY(vector, func)                                        \
 +      asmlinkage void asm_##func(void);                               \
 +      asmlinkage void xen_asm_##func(void);                           \
 +      __visible void func(struct pt_regs *regs)
 +
 +/**
 + * DEFINE_IDTENTRY - Emit code for simple IDT entry points
 + * @func:     Function name of the entry point
 + *
 + * @func is called from ASM entry code with interrupts disabled.
 + *
 + * The macro is written so it acts as function definition. Append the
 + * body with a pair of curly brackets.
 + *
 + * idtentry_enter() contains common code which has to be invoked before
 + * arbitrary code in the body. idtentry_exit() contains common code
 + * which has to run before returning to the low level assembly code.
 + */
 +#define DEFINE_IDTENTRY(func)                                         \
 +static __always_inline void __##func(struct pt_regs *regs);           \
 +                                                                      \
 +__visible noinstr void func(struct pt_regs *regs)                     \
 +{                                                                     \
 +      bool rcu_exit = idtentry_enter_cond_rcu(regs);                  \
 +                                                                      \
 +      instrumentation_begin();                                        \
 +      __##func (regs);                                                \
 +      instrumentation_end();                                          \
 +      idtentry_exit_cond_rcu(regs, rcu_exit);                         \
 +}                                                                     \
 +                                                                      \
 +static __always_inline void __##func(struct pt_regs *regs)
 +
 +/* Special case for 32bit IRET 'trap' */
 +#define DECLARE_IDTENTRY_SW   DECLARE_IDTENTRY
 +#define DEFINE_IDTENTRY_SW    DEFINE_IDTENTRY
 +
 +/**
 + * DECLARE_IDTENTRY_ERRORCODE - Declare functions for simple IDT entry points
 + *                            Error code pushed by hardware
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Declares three functions:
 + * - The ASM entry point: asm_##func
 + * - The XEN PV trap entry point: xen_##func (maybe unused)
 + * - The C handler called from the ASM entry point
 + *
 + * Same as DECLARE_IDTENTRY, but has an extra error_code argument for the
 + * C-handler.
 + */
 +#define DECLARE_IDTENTRY_ERRORCODE(vector, func)                      \
 +      asmlinkage void asm_##func(void);                               \
 +      asmlinkage void xen_asm_##func(void);                           \
 +      __visible void func(struct pt_regs *regs, unsigned long error_code)
 +
 +/**
 + * DEFINE_IDTENTRY_ERRORCODE - Emit code for simple IDT entry points
 + *                           Error code pushed by hardware
 + * @func:     Function name of the entry point
 + *
 + * Same as DEFINE_IDTENTRY, but has an extra error_code argument
 + */
 +#define DEFINE_IDTENTRY_ERRORCODE(func)                                       \
 +static __always_inline void __##func(struct pt_regs *regs,            \
 +                                   unsigned long error_code);         \
 +                                                                      \
 +__visible noinstr void func(struct pt_regs *regs,                     \
 +                          unsigned long error_code)                   \
 +{                                                                     \
 +      bool rcu_exit = idtentry_enter_cond_rcu(regs);                  \
 +                                                                      \
 +      instrumentation_begin();                                        \
 +      __##func (regs, error_code);                                    \
 +      instrumentation_end();                                          \
 +      idtentry_exit_cond_rcu(regs, rcu_exit);                         \
 +}                                                                     \
 +                                                                      \
 +static __always_inline void __##func(struct pt_regs *regs,            \
 +                                   unsigned long error_code)
 +
 +/**
 + * DECLARE_IDTENTRY_RAW - Declare functions for raw IDT entry points
 + *                  No error code pushed by hardware
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Maps to DECLARE_IDTENTRY().
 + */
 +#define DECLARE_IDTENTRY_RAW(vector, func)                            \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +/**
 + * DEFINE_IDTENTRY_RAW - Emit code for raw IDT entry points
 + * @func:     Function name of the entry point
 + *
 + * @func is called from ASM entry code with interrupts disabled.
 + *
 + * The macro is written so it acts as function definition. Append the
 + * body with a pair of curly brackets.
 + *
 + * Contrary to DEFINE_IDTENTRY() this does not invoke the
 + * idtentry_enter/exit() helpers before and after the body invocation. This
 + * needs to be done in the body itself if applicable. Use if extra work
 + * is required before the enter/exit() helpers are invoked.
 + */
 +#define DEFINE_IDTENTRY_RAW(func)                                     \
 +__visible noinstr void func(struct pt_regs *regs)
 +
 +/**
 + * DECLARE_IDTENTRY_RAW_ERRORCODE - Declare functions for raw IDT entry points
 + *                                Error code pushed by hardware
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Maps to DECLARE_IDTENTRY_ERRORCODE()
 + */
 +#define DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func)                  \
 +      DECLARE_IDTENTRY_ERRORCODE(vector, func)
 +
 +/**
 + * DEFINE_IDTENTRY_RAW_ERRORCODE - Emit code for raw IDT entry points
 + * @func:     Function name of the entry point
 + *
 + * @func is called from ASM entry code with interrupts disabled.
 + *
 + * The macro is written so it acts as function definition. Append the
 + * body with a pair of curly brackets.
 + *
 + * Contrary to DEFINE_IDTENTRY_ERRORCODE() this does not invoke the
 + * idtentry_enter/exit() helpers before and after the body invocation. This
 + * needs to be done in the body itself if applicable. Use if extra work
 + * is required before the enter/exit() helpers are invoked.
 + */
 +#define DEFINE_IDTENTRY_RAW_ERRORCODE(func)                           \
 +__visible noinstr void func(struct pt_regs *regs, unsigned long error_code)
 +
 +/**
 + * DECLARE_IDTENTRY_IRQ - Declare functions for device interrupt IDT entry
 + *                      points (common/spurious)
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Maps to DECLARE_IDTENTRY_ERRORCODE()
 + */
 +#define DECLARE_IDTENTRY_IRQ(vector, func)                            \
 +      DECLARE_IDTENTRY_ERRORCODE(vector, func)
 +
 +/**
 + * DEFINE_IDTENTRY_IRQ - Emit code for device interrupt IDT entry points
 + * @func:     Function name of the entry point
 + *
 + * The vector number is pushed by the low level entry stub and handed
 + * to the function as error_code argument which needs to be truncated
 + * to an u8 because the push is sign extending.
 + *
 + * On 64-bit idtentry_enter/exit() are invoked in the ASM entry code before
 + * and after switching to the interrupt stack. On 32-bit this happens in C.
 + *
 + * irq_enter/exit_rcu() are invoked before the function body and the
 + * KVM L1D flush request is set.
 + */
 +#define DEFINE_IDTENTRY_IRQ(func)                                     \
 +static __always_inline void __##func(struct pt_regs *regs, u8 vector);        \
 +                                                                      \
 +__visible noinstr void func(struct pt_regs *regs,                     \
 +                          unsigned long error_code)                   \
 +{                                                                     \
 +      bool rcu_exit = idtentry_enter_cond_rcu(regs);                  \
 +                                                                      \
 +      instrumentation_begin();                                        \
 +      irq_enter_rcu();                                                \
 +      kvm_set_cpu_l1tf_flush_l1d();                                   \
 +      __##func (regs, (u8)error_code);                                \
 +      irq_exit_rcu();                                                 \
 +      instrumentation_end();                                          \
 +      idtentry_exit_cond_rcu(regs, rcu_exit);                         \
 +}                                                                     \
 +                                                                      \
 +static __always_inline void __##func(struct pt_regs *regs, u8 vector)
 +
 +/**
 + * DECLARE_IDTENTRY_SYSVEC - Declare functions for system vector entry points
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Declares three functions:
 + * - The ASM entry point: asm_##func
 + * - The XEN PV trap entry point: xen_##func (maybe unused)
 + * - The C handler called from the ASM entry point
 + *
 + * Maps to DECLARE_IDTENTRY().
 + */
 +#define DECLARE_IDTENTRY_SYSVEC(vector, func)                         \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +/**
 + * DEFINE_IDTENTRY_SYSVEC - Emit code for system vector IDT entry points
 + * @func:     Function name of the entry point
 + *
 + * idtentry_enter/exit() and irq_enter/exit_rcu() are invoked before the
 + * function body. KVM L1D flush request is set.
 + *
 + * Runs the function on the interrupt stack if the entry hit kernel mode
 + */
 +#define DEFINE_IDTENTRY_SYSVEC(func)                                  \
 +static void __##func(struct pt_regs *regs);                           \
 +                                                                      \
 +__visible noinstr void func(struct pt_regs *regs)                     \
 +{                                                                     \
 +      bool rcu_exit = idtentry_enter_cond_rcu(regs);                  \
 +                                                                      \
 +      instrumentation_begin();                                        \
 +      irq_enter_rcu();                                                \
 +      kvm_set_cpu_l1tf_flush_l1d();                                   \
 +      run_on_irqstack_cond(__##func, regs, regs);                     \
 +      irq_exit_rcu();                                                 \
 +      instrumentation_end();                                          \
 +      idtentry_exit_cond_rcu(regs, rcu_exit);                         \
 +}                                                                     \
 +                                                                      \
 +static noinline void __##func(struct pt_regs *regs)
 +
 +/**
 + * DEFINE_IDTENTRY_SYSVEC_SIMPLE - Emit code for simple system vector IDT
 + *                               entry points
 + * @func:     Function name of the entry point
 + *
 + * Runs the function on the interrupted stack. No switch to IRQ stack and
 + * only the minimal __irq_enter/exit() handling.
 + *
 + * Only use for 'empty' vectors like reschedule IPI and KVM posted
 + * interrupt vectors.
 + */
 +#define DEFINE_IDTENTRY_SYSVEC_SIMPLE(func)                           \
 +static __always_inline void __##func(struct pt_regs *regs);           \
 +                                                                      \
 +__visible noinstr void func(struct pt_regs *regs)                     \
 +{                                                                     \
 +      bool rcu_exit = idtentry_enter_cond_rcu(regs);                  \
 +                                                                      \
 +      instrumentation_begin();                                        \
 +      __irq_enter_raw();                                              \
 +      kvm_set_cpu_l1tf_flush_l1d();                                   \
 +      __##func (regs);                                                \
 +      __irq_exit_raw();                                               \
 +      instrumentation_end();                                          \
 +      idtentry_exit_cond_rcu(regs, rcu_exit);                         \
 +}                                                                     \
 +                                                                      \
 +static __always_inline void __##func(struct pt_regs *regs)
 +
 +/**
 + * DECLARE_IDTENTRY_XENCB - Declare functions for XEN HV callback entry point
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Declares three functions:
 + * - The ASM entry point: asm_##func
 + * - The XEN PV trap entry point: xen_##func (maybe unused)
 + * - The C handler called from the ASM entry point
 + *
 + * Maps to DECLARE_IDTENTRY(). Distinct entry point to handle the 32/64-bit
 + * difference
 + */
 +#define DECLARE_IDTENTRY_XENCB(vector, func)                          \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +#ifdef CONFIG_X86_64
 +/**
 + * DECLARE_IDTENTRY_IST - Declare functions for IST handling IDT entry points
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Maps to DECLARE_IDTENTRY_RAW, but declares also the NOIST C handler
 + * which is called from the ASM entry point on user mode entry
 + */
 +#define DECLARE_IDTENTRY_IST(vector, func)                            \
 +      DECLARE_IDTENTRY_RAW(vector, func);                             \
 +      __visible void noist_##func(struct pt_regs *regs)
 +
 +/**
 + * DEFINE_IDTENTRY_IST - Emit code for IST entry points
 + * @func:     Function name of the entry point
 + *
 + * Maps to DEFINE_IDTENTRY_RAW
 + */
 +#define DEFINE_IDTENTRY_IST(func)                                     \
 +      DEFINE_IDTENTRY_RAW(func)
 +
 +/**
 + * DEFINE_IDTENTRY_NOIST - Emit code for NOIST entry points which
 + *                       belong to a IST entry point (MCE, DB)
 + * @func:     Function name of the entry point. Must be the same as
 + *            the function name of the corresponding IST variant
 + *
 + * Maps to DEFINE_IDTENTRY_RAW().
 + */
 +#define DEFINE_IDTENTRY_NOIST(func)                                   \
 +      DEFINE_IDTENTRY_RAW(noist_##func)
 +
 +/**
 + * DECLARE_IDTENTRY_DF - Declare functions for double fault
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Maps to DECLARE_IDTENTRY_RAW_ERRORCODE
 + */
 +#define DECLARE_IDTENTRY_DF(vector, func)                             \
 +      DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func)
 +
 +/**
 + * DEFINE_IDTENTRY_DF - Emit code for double fault
 + * @func:     Function name of the entry point
 + *
 + * Maps to DEFINE_IDTENTRY_RAW_ERRORCODE
 + */
 +#define DEFINE_IDTENTRY_DF(func)                                      \
 +      DEFINE_IDTENTRY_RAW_ERRORCODE(func)
 +
 +#else /* CONFIG_X86_64 */
 +
 +/* Maps to a regular IDTENTRY on 32bit for now */
 +# define DECLARE_IDTENTRY_IST         DECLARE_IDTENTRY
 +# define DEFINE_IDTENTRY_IST          DEFINE_IDTENTRY
 +
 +/**
 + * DECLARE_IDTENTRY_DF - Declare functions for double fault 32bit variant
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Declares two functions:
 + * - The ASM entry point: asm_##func
 + * - The C handler called from the C shim
 + */
 +#define DECLARE_IDTENTRY_DF(vector, func)                             \
 +      asmlinkage void asm_##func(void);                               \
 +      __visible void func(struct pt_regs *regs,                       \
 +                          unsigned long error_code,                   \
 +                          unsigned long address)
 +
 +/**
 + * DEFINE_IDTENTRY_DF - Emit code for double fault on 32bit
 + * @func:     Function name of the entry point
 + *
 + * This is called through the doublefault shim which already provides
 + * cr2 in the address argument.
 + */
 +#define DEFINE_IDTENTRY_DF(func)                                      \
 +__visible noinstr void func(struct pt_regs *regs,                     \
 +                          unsigned long error_code,                   \
 +                          unsigned long address)
 +
 +#endif        /* !CONFIG_X86_64 */
 +
 +/* C-Code mapping */
 +#define DECLARE_IDTENTRY_MCE          DECLARE_IDTENTRY_IST
 +#define DEFINE_IDTENTRY_MCE           DEFINE_IDTENTRY_IST
 +#define DEFINE_IDTENTRY_MCE_USER      DEFINE_IDTENTRY_NOIST
 +
 +#define DECLARE_IDTENTRY_NMI          DECLARE_IDTENTRY_RAW
 +#define DEFINE_IDTENTRY_NMI           DEFINE_IDTENTRY_RAW
 +
 +#define DECLARE_IDTENTRY_DEBUG                DECLARE_IDTENTRY_IST
 +#define DEFINE_IDTENTRY_DEBUG         DEFINE_IDTENTRY_IST
 +#define DEFINE_IDTENTRY_DEBUG_USER    DEFINE_IDTENTRY_NOIST
 +
 +/**
 + * DECLARE_IDTENTRY_XEN - Declare functions for XEN redirect IDT entry points
 + * @vector:   Vector number (ignored for C)
 + * @func:     Function name of the entry point
 + *
 + * Used for xennmi and xendebug redirections. No DEFINE as this is all ASM
 + * indirection magic.
 + */
 +#define DECLARE_IDTENTRY_XEN(vector, func)                            \
 +      asmlinkage void xen_asm_exc_xen##func(void);                    \
 +      asmlinkage void asm_exc_xen##func(void)
 +
 +#else /* !__ASSEMBLY__ */
 +
 +/*
 + * The ASM variants for DECLARE_IDTENTRY*() which emit the ASM entry stubs.
 + */
 +#define DECLARE_IDTENTRY(vector, func)                                        \
 +      idtentry vector asm_##func func has_error_code=0
 +
 +#define DECLARE_IDTENTRY_ERRORCODE(vector, func)                      \
 +      idtentry vector asm_##func func has_error_code=1
 +
 +/* Special case for 32bit IRET 'trap'. Do not emit ASM code */
 +#define DECLARE_IDTENTRY_SW(vector, func)
 +
 +#define DECLARE_IDTENTRY_RAW(vector, func)                            \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +#define DECLARE_IDTENTRY_RAW_ERRORCODE(vector, func)                  \
 +      DECLARE_IDTENTRY_ERRORCODE(vector, func)
 +
 +/* Entries for common/spurious (device) interrupts */
 +#define DECLARE_IDTENTRY_IRQ(vector, func)                            \
 +      idtentry_irq vector func
 +
 +/* System vector entries */
 +#define DECLARE_IDTENTRY_SYSVEC(vector, func)                         \
 +      idtentry_sysvec vector func
 +
 +#ifdef CONFIG_X86_64
 +# define DECLARE_IDTENTRY_MCE(vector, func)                           \
 +      idtentry_mce_db vector asm_##func func
 +
 +# define DECLARE_IDTENTRY_DEBUG(vector, func)                         \
 +      idtentry_mce_db vector asm_##func func
 +
 +# define DECLARE_IDTENTRY_DF(vector, func)                            \
 +      idtentry_df vector asm_##func func
 +
 +# define DECLARE_IDTENTRY_XENCB(vector, func)                         \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +#else
 +# define DECLARE_IDTENTRY_MCE(vector, func)                           \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +# define DECLARE_IDTENTRY_DEBUG(vector, func)                         \
 +      DECLARE_IDTENTRY(vector, func)
 +
 +/* No ASM emitted for DF as this goes through a C shim */
 +# define DECLARE_IDTENTRY_DF(vector, func)
 +
 +/* No ASM emitted for XEN hypervisor callback */
 +# define DECLARE_IDTENTRY_XENCB(vector, func)
 +
 +#endif
 +
 +/* No ASM code emitted for NMI */
 +#define DECLARE_IDTENTRY_NMI(vector, func)
 +
 +/* XEN NMI and DB wrapper */
 +#define DECLARE_IDTENTRY_XEN(vector, func)                            \
 +      idtentry vector asm_exc_xen##func exc_##func has_error_code=0
 +
 +/*
 + * ASM code to emit the common vector entry stubs where each stub is
 + * packed into 8 bytes.
 + *
 + * Note, that the 'pushq imm8' is emitted via '.byte 0x6a, vector' because
 + * GCC treats the local vector variable as unsigned int and would expand
 + * all vectors above 0x7F to a 5 byte push. The original code did an
 + * adjustment of the vector number to be in the signed byte range to avoid
 + * this. While clever it's mindboggling counterintuitive and requires the
 + * odd conversion back to a real vector number in the C entry points. Using
 + * .byte achieves the same thing and the only fixup needed in the C entry
 + * point is to mask off the bits above bit 7 because the push is sign
 + * extending.
 + */
 +      .align 8
 +SYM_CODE_START(irq_entries_start)
 +    vector=FIRST_EXTERNAL_VECTOR
 +    pos = .
 +    .rept (FIRST_SYSTEM_VECTOR - FIRST_EXTERNAL_VECTOR)
 +      UNWIND_HINT_IRET_REGS
 +      .byte   0x6a, vector
 +      jmp     asm_common_interrupt
 +      nop
 +      /* Ensure that the above is 8 bytes max */
 +      . = pos + 8
 +    pos=pos+8
 +    vector=vector+1
 +    .endr
 +SYM_CODE_END(irq_entries_start)
 +
 +#ifdef CONFIG_X86_LOCAL_APIC
 +      .align 8
 +SYM_CODE_START(spurious_entries_start)
 +    vector=FIRST_SYSTEM_VECTOR
 +    pos = .
 +    .rept (NR_VECTORS - FIRST_SYSTEM_VECTOR)
 +      UNWIND_HINT_IRET_REGS
 +      .byte   0x6a, vector
 +      jmp     asm_spurious_interrupt
 +      nop
 +      /* Ensure that the above is 8 bytes max */
 +      . = pos + 8
 +    pos=pos+8
 +    vector=vector+1
 +    .endr
 +SYM_CODE_END(spurious_entries_start)
 +#endif
 +
 +#endif /* __ASSEMBLY__ */
 +
 +/*
 + * The actual entry points. Note that DECLARE_IDTENTRY*() serves two
 + * purposes:
 + *  - provide the function declarations when included from C-Code
 + *  - emit the ASM stubs when included from entry_32/64.S
 + *
 + * This avoids duplicate defines and ensures that everything is consistent.
 + */
 +
 +/*
 + * Dummy trap number so the low level ASM macro vector number checks do not
 + * match which results in emitting plain IDTENTRY stubs without bells and
 + * whistels.
 + */
 +#define X86_TRAP_OTHER                0xFFFF
 +
 +/* Simple exception entry points. No hardware error code */
 +DECLARE_IDTENTRY(X86_TRAP_DE,         exc_divide_error);
 +DECLARE_IDTENTRY(X86_TRAP_OF,         exc_overflow);
 +DECLARE_IDTENTRY(X86_TRAP_BR,         exc_bounds);
 +DECLARE_IDTENTRY(X86_TRAP_NM,         exc_device_not_available);
 +DECLARE_IDTENTRY(X86_TRAP_OLD_MF,     exc_coproc_segment_overrun);
 +DECLARE_IDTENTRY(X86_TRAP_SPURIOUS,   exc_spurious_interrupt_bug);
 +DECLARE_IDTENTRY(X86_TRAP_MF,         exc_coprocessor_error);
 +DECLARE_IDTENTRY(X86_TRAP_XF,         exc_simd_coprocessor_error);
 +
 +/* 32bit software IRET trap. Do not emit ASM code */
 +DECLARE_IDTENTRY_SW(X86_TRAP_IRET,    iret_error);
 +
 +/* Simple exception entries with error code pushed by hardware */
 +DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_TS,       exc_invalid_tss);
 +DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_NP,       exc_segment_not_present);
 +DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_SS,       exc_stack_segment);
 +DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_GP,       exc_general_protection);
 +DECLARE_IDTENTRY_ERRORCODE(X86_TRAP_AC,       exc_alignment_check);
 +
 +/* Raw exception entries which need extra work */
 +DECLARE_IDTENTRY_RAW(X86_TRAP_UD,             exc_invalid_op);
 +DECLARE_IDTENTRY_RAW(X86_TRAP_BP,             exc_int3);
 +DECLARE_IDTENTRY_RAW_ERRORCODE(X86_TRAP_PF,   exc_page_fault);
 +
 +#ifdef CONFIG_X86_MCE
 +DECLARE_IDTENTRY_MCE(X86_TRAP_MC,     exc_machine_check);
 +#endif
 +
 +/* NMI */
 +DECLARE_IDTENTRY_NMI(X86_TRAP_NMI,    exc_nmi);
 +DECLARE_IDTENTRY_XEN(X86_TRAP_NMI,    nmi);
 +
 +/* #DB */
 +DECLARE_IDTENTRY_DEBUG(X86_TRAP_DB,   exc_debug);
 +DECLARE_IDTENTRY_XEN(X86_TRAP_DB,     debug);
 +
 +/* #DF */
 +DECLARE_IDTENTRY_DF(X86_TRAP_DF,      exc_double_fault);
 +
 +#ifdef CONFIG_XEN_PV
 +DECLARE_IDTENTRY_XENCB(X86_TRAP_OTHER,        exc_xen_hypervisor_callback);
 +#endif
 +
 +/* Device interrupts common/spurious */
 +DECLARE_IDTENTRY_IRQ(X86_TRAP_OTHER,  common_interrupt);
 +#ifdef CONFIG_X86_LOCAL_APIC
 +DECLARE_IDTENTRY_IRQ(X86_TRAP_OTHER,  spurious_interrupt);
 +#endif
 +
 +/* System vector entry points */
 +#ifdef CONFIG_X86_LOCAL_APIC
 +DECLARE_IDTENTRY_SYSVEC(ERROR_APIC_VECTOR,            sysvec_error_interrupt);
 +DECLARE_IDTENTRY_SYSVEC(SPURIOUS_APIC_VECTOR,         sysvec_spurious_apic_interrupt);
 +DECLARE_IDTENTRY_SYSVEC(LOCAL_TIMER_VECTOR,           sysvec_apic_timer_interrupt);
 +DECLARE_IDTENTRY_SYSVEC(X86_PLATFORM_IPI_VECTOR,      sysvec_x86_platform_ipi);
 +#endif
 +
 +#ifdef CONFIG_SMP
 +DECLARE_IDTENTRY(RESCHEDULE_VECTOR,                   sysvec_reschedule_ipi);
 +DECLARE_IDTENTRY_SYSVEC(IRQ_MOVE_CLEANUP_VECTOR,      sysvec_irq_move_cleanup);
 +DECLARE_IDTENTRY_SYSVEC(REBOOT_VECTOR,                        sysvec_reboot);
 +DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_SINGLE_VECTOR,  sysvec_call_function_single);
 +DECLARE_IDTENTRY_SYSVEC(CALL_FUNCTION_VECTOR,         sysvec_call_function);
 +#endif
 +
 +#ifdef CONFIG_X86_LOCAL_APIC
 +# ifdef CONFIG_X86_UV
 +DECLARE_IDTENTRY_SYSVEC(UV_BAU_MESSAGE,                       sysvec_uv_bau_message);
 +# endif
 +
 +# ifdef CONFIG_X86_MCE_THRESHOLD
 +DECLARE_IDTENTRY_SYSVEC(THRESHOLD_APIC_VECTOR,                sysvec_threshold);
 +# endif
 +
 +# ifdef CONFIG_X86_MCE_AMD
 +DECLARE_IDTENTRY_SYSVEC(DEFERRED_ERROR_VECTOR,                sysvec_deferred_error);
 +# endif
 +
 +# ifdef CONFIG_X86_THERMAL_VECTOR
 +DECLARE_IDTENTRY_SYSVEC(THERMAL_APIC_VECTOR,          sysvec_thermal);
 +# endif
 +
 +# ifdef CONFIG_IRQ_WORK
 +DECLARE_IDTENTRY_SYSVEC(IRQ_WORK_VECTOR,              sysvec_irq_work);
 +# endif
 +#endif
 +
 +#ifdef CONFIG_HAVE_KVM
 +DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_VECTOR,           sysvec_kvm_posted_intr_ipi);
 +DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_WAKEUP_VECTOR,    sysvec_kvm_posted_intr_wakeup_ipi);
 +DECLARE_IDTENTRY_SYSVEC(POSTED_INTR_NESTED_VECTOR,    sysvec_kvm_posted_intr_nested_ipi);
 +#endif
 +
 +#if IS_ENABLED(CONFIG_HYPERV)
 +DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR,   sysvec_hyperv_callback);
 +DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_REENLIGHTENMENT_VECTOR,    sysvec_hyperv_reenlightenment);
 +DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_STIMER0_VECTOR,    sysvec_hyperv_stimer0);
 +#endif
 +
 +#if IS_ENABLED(CONFIG_ACRN_GUEST)
 +DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR,   sysvec_acrn_hv_callback);
 +#endif
 +
 +#ifdef CONFIG_XEN_PVHVM
 +DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR,   sysvec_xen_hvm_callback);
 +#endif
 +
++#ifdef CONFIG_KVM_GUEST
++DECLARE_IDTENTRY_SYSVEC(HYPERVISOR_CALLBACK_VECTOR,   sysvec_kvm_asyncpf_interrupt);
++#endif
++
 +#undef X86_TRAP_OTHER
 +
 +#endif
@@@ -4,6 -4,7 +4,7 @@@
  
  #include <asm/processor.h>
  #include <asm/alternative.h>
+ #include <linux/interrupt.h>
  #include <uapi/asm/kvm_para.h>
  
  extern void kvmclock_init(void);
@@@ -104,6 -105,12 +105,6 @@@ static __always_inline bool kvm_handle_
                return false;
  }
  
 -extern __visible void kvm_async_pf_vector(void);
 -#ifdef CONFIG_TRACING
 -#define trace_kvm_async_pf_vector kvm_async_pf_vector
 -#endif
 -__visible void __irq_entry kvm_async_pf_intr(struct pt_regs *regs);
 -
  #ifdef CONFIG_PARAVIRT_SPINLOCKS
  void __init kvm_spinlock_init(void);
  #else /* !CONFIG_PARAVIRT_SPINLOCKS */
@@@ -141,7 -148,7 +142,7 @@@ static inline void kvm_disable_steal_ti
        return;
  }
  
 -static inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)
 +static __always_inline bool kvm_handle_async_pf(struct pt_regs *regs, u32 token)
  {
        return false;
  }
diff --combined arch/x86/kernel/kvm.c
@@@ -9,6 -9,6 +9,7 @@@
  
  #include <linux/context_tracking.h>
  #include <linux/init.h>
++#include <linux/irq.h>
  #include <linux/kernel.h>
  #include <linux/kvm_para.h>
  #include <linux/cpu.h>
@@@ -217,7 -217,7 +218,7 @@@ again
  }
  EXPORT_SYMBOL_GPL(kvm_async_pf_task_wake);
  
 -u32 kvm_read_and_reset_apf_flags(void)
 +noinstr u32 kvm_read_and_reset_apf_flags(void)
  {
        u32 flags = 0;
  
        return flags;
  }
  EXPORT_SYMBOL_GPL(kvm_read_and_reset_apf_flags);
 -NOKPROBE_SYMBOL(kvm_read_and_reset_apf_flags);
  
 -bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token)
 +noinstr bool __kvm_handle_async_pf(struct pt_regs *regs, u32 token)
  {
-       u32 reason = kvm_read_and_reset_apf_flags();
+       u32 flags = kvm_read_and_reset_apf_flags();
 +      bool rcu_exit;
  
-       switch (reason) {
-       case KVM_PV_REASON_PAGE_NOT_PRESENT:
-       case KVM_PV_REASON_PAGE_READY:
-               break;
-       default:
+       if (!flags)
                return false;
-       }
  
 +      rcu_exit = idtentry_enter_cond_rcu(regs);
 +      instrumentation_begin();
 +
        /*
         * If the host managed to inject an async #PF into an interrupt
         * disabled region, then die hard as this is not going to end well
        if (unlikely(!(regs->flags & X86_EFLAGS_IF)))
                panic("Host injected async #PF in interrupt disabled region\n");
  
-       if (reason == KVM_PV_REASON_PAGE_NOT_PRESENT) {
+       if (flags & KVM_PV_REASON_PAGE_NOT_PRESENT) {
                if (unlikely(!(user_mode(regs))))
                        panic("Host injected async #PF in kernel mode\n");
                /* Page is swapped out by the host. */
                kvm_async_pf_task_wait_schedule(token);
 -              return true;
 +      } else {
-               kvm_async_pf_task_wake(token);
++              WARN_ONCE(1, "Unexpected async PF flags: %x\n", flags);
        }
  
 -      WARN_ONCE(1, "Unexpected async PF flags: %x\n", flags);
 +      instrumentation_end();
 +      idtentry_exit_cond_rcu(regs, rcu_exit);
        return true;
  }
 -NOKPROBE_SYMBOL(__kvm_handle_async_pf);
  
 -__visible void __irq_entry kvm_async_pf_intr(struct pt_regs *regs)
++DEFINE_IDTENTRY_SYSVEC(sysvec_kvm_asyncpf_interrupt)
+ {
++      struct pt_regs *old_regs = set_irq_regs(regs);
+       u32 token;
++      bool rcu_exit;
 -      entering_ack_irq();
++      rcu_exit = idtentry_enter_cond_rcu(regs);
+       inc_irq_stat(irq_hv_callback_count);
+       if (__this_cpu_read(apf_reason.enabled)) {
+               token = __this_cpu_read(apf_reason.token);
 -              rcu_irq_enter();
+               kvm_async_pf_task_wake(token);
 -              rcu_irq_exit();
+               __this_cpu_write(apf_reason.token, 0);
+               wrmsrl(MSR_KVM_ASYNC_PF_ACK, 1);
+       }
 -      exiting_irq();
++      idtentry_exit_cond_rcu(regs, rcu_exit);
++      set_irq_regs(old_regs);
+ }
  static void __init paravirt_ops_setup(void)
  {
        pv_info.name = "KVM";
@@@ -311,17 -322,19 +328,19 @@@ static notrace void kvm_guest_apic_eoi_
  
  static void kvm_guest_cpu_init(void)
  {
-       if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF) && kvmapf) {
-               u64 pa;
+       if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) {
+               u64 pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
  
                WARN_ON_ONCE(!static_branch_likely(&kvm_async_pf_enabled));
  
                pa = slow_virt_to_phys(this_cpu_ptr(&apf_reason));
-               pa |= KVM_ASYNC_PF_ENABLED;
+               pa |= KVM_ASYNC_PF_ENABLED | KVM_ASYNC_PF_DELIVERY_AS_INT;
  
                if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_VMEXIT))
                        pa |= KVM_ASYNC_PF_DELIVERY_AS_PF_VMEXIT;
  
+               wrmsrl(MSR_KVM_ASYNC_PF_INT, HYPERVISOR_CALLBACK_VECTOR);
                wrmsrl(MSR_KVM_ASYNC_PF_EN, pa);
                __this_cpu_write(apf_reason.enabled, 1);
                pr_info("KVM setup async PF for cpu %d\n", smp_processor_id());
@@@ -646,8 -659,10 +665,10 @@@ static void __init kvm_guest_init(void
        if (kvm_para_has_feature(KVM_FEATURE_PV_EOI))
                apic_set_eoi_write(kvm_guest_apic_eoi_write);
  
-       if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF) && kvmapf)
+       if (kvm_para_has_feature(KVM_FEATURE_ASYNC_PF_INT) && kvmapf) {
                static_branch_enable(&kvm_async_pf_enabled);
 -              alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, kvm_async_pf_vector);
++              alloc_intr_gate(HYPERVISOR_CALLBACK_VECTOR, asm_sysvec_kvm_asyncpf_interrupt);
+       }
  
  #ifdef CONFIG_SMP
        smp_ops.smp_prepare_cpus = kvm_smp_prepare_cpus;