]> Git Repo - linux.git/commitdiff
Merge tag 'kvmarm-6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm...
authorPaolo Bonzini <[email protected]>
Mon, 3 Oct 2022 19:33:32 +0000 (15:33 -0400)
committerPaolo Bonzini <[email protected]>
Mon, 3 Oct 2022 19:33:32 +0000 (15:33 -0400)
KVM/arm64 updates for v6.1

- Fixes for single-stepping in the presence of an async
  exception as well as the preservation of PSTATE.SS

- Better handling of AArch32 ID registers on AArch64-only
  systems

- Fixes for the dirty-ring API, allowing it to work on
  architectures with relaxed memory ordering

- Advertise the new kvmarm mailing list

- Various minor cleanups and spelling fixes

1  2 
Documentation/virt/kvm/api.rst
MAINTAINERS
arch/arm64/kernel/head.S
arch/arm64/kvm/arm.c
tools/testing/selftests/kvm/.gitignore
tools/testing/selftests/kvm/Makefile
tools/testing/selftests/kvm/lib/kvm_util.c
virt/kvm/kvm_main.c

index 236a797be71c430defb8a47b138ef34f26549125,32427ea160dfa94a219b86754d6cdef5dedef92b..eee9f857a986f52c802882f6378eccdd94c4fcb6
@@@ -4074,7 -4074,7 +4074,7 @@@ Queues an SMI on the thread's vcpu
  4.97 KVM_X86_SET_MSR_FILTER
  ----------------------------
  
 -:Capability: KVM_X86_SET_MSR_FILTER
 +:Capability: KVM_CAP_X86_MSR_FILTER
  :Architectures: x86
  :Type: vm ioctl
  :Parameters: struct kvm_msr_filter
@@@ -4173,10 -4173,8 +4173,10 @@@ If an MSR access is not permitted throu
  allows user space to deflect and potentially handle various MSR accesses
  into user space.
  
 -If a vCPU is in running state while this ioctl is invoked, the vCPU may
 -experience inconsistent filtering behavior on MSR accesses.
 +Note, invoking this ioctl while a vCPU is running is inherently racy.  However,
 +KVM does guarantee that vCPUs will see either the previous filter or the new
 +filter, e.g. MSRs with identical settings in both the old and new filter will
 +have deterministic behavior.
  
  4.98 KVM_CREATE_SPAPR_TCE_64
  ----------------------------
@@@ -5289,7 -5287,110 +5289,7 @@@ KVM_PV_DUM
      authentication tag all of which are needed to decrypt the dump at a
      later time.
  
 -
 -4.126 KVM_X86_SET_MSR_FILTER
 -----------------------------
 -
 -:Capability: KVM_CAP_X86_MSR_FILTER
 -:Architectures: x86
 -:Type: vm ioctl
 -:Parameters: struct kvm_msr_filter
 -:Returns: 0 on success, < 0 on error
 -
 -::
 -
 -  struct kvm_msr_filter_range {
 -  #define KVM_MSR_FILTER_READ  (1 << 0)
 -  #define KVM_MSR_FILTER_WRITE (1 << 1)
 -      __u32 flags;
 -      __u32 nmsrs; /* number of msrs in bitmap */
 -      __u32 base;  /* MSR index the bitmap starts at */
 -      __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
 -  };
 -
 -  #define KVM_MSR_FILTER_MAX_RANGES 16
 -  struct kvm_msr_filter {
 -  #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
 -  #define KVM_MSR_FILTER_DEFAULT_DENY  (1 << 0)
 -      __u32 flags;
 -      struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
 -  };
 -
 -flags values for ``struct kvm_msr_filter_range``:
 -
 -``KVM_MSR_FILTER_READ``
 -
 -  Filter read accesses to MSRs using the given bitmap. A 0 in the bitmap
 -  indicates that a read should immediately fail, while a 1 indicates that
 -  a read for a particular MSR should be handled regardless of the default
 -  filter action.
 -
 -``KVM_MSR_FILTER_WRITE``
 -
 -  Filter write accesses to MSRs using the given bitmap. A 0 in the bitmap
 -  indicates that a write should immediately fail, while a 1 indicates that
 -  a write for a particular MSR should be handled regardless of the default
 -  filter action.
 -
 -``KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE``
 -
 -  Filter both read and write accesses to MSRs using the given bitmap. A 0
 -  in the bitmap indicates that both reads and writes should immediately fail,
 -  while a 1 indicates that reads and writes for a particular MSR are not
 -  filtered by this range.
 -
 -flags values for ``struct kvm_msr_filter``:
 -
 -``KVM_MSR_FILTER_DEFAULT_ALLOW``
 -
 -  If no filter range matches an MSR index that is getting accessed, KVM will
 -  fall back to allowing access to the MSR.
 -
 -``KVM_MSR_FILTER_DEFAULT_DENY``
 -
 -  If no filter range matches an MSR index that is getting accessed, KVM will
 -  fall back to rejecting access to the MSR. In this mode, all MSRs that should
 -  be processed by KVM need to explicitly be marked as allowed in the bitmaps.
 -
 -This ioctl allows user space to define up to 16 bitmaps of MSR ranges to
 -specify whether a certain MSR access should be explicitly filtered for or not.
 -
 -If this ioctl has never been invoked, MSR accesses are not guarded and the
 -default KVM in-kernel emulation behavior is fully preserved.
 -
 -Calling this ioctl with an empty set of ranges (all nmsrs == 0) disables MSR
 -filtering. In that mode, ``KVM_MSR_FILTER_DEFAULT_DENY`` is invalid and causes
 -an error.
 -
 -As soon as the filtering is in place, every MSR access is processed through
 -the filtering except for accesses to the x2APIC MSRs (from 0x800 to 0x8ff);
 -x2APIC MSRs are always allowed, independent of the ``default_allow`` setting,
 -and their behavior depends on the ``X2APIC_ENABLE`` bit of the APIC base
 -register.
 -
 -If a bit is within one of the defined ranges, read and write accesses are
 -guarded by the bitmap's value for the MSR index if the kind of access
 -is included in the ``struct kvm_msr_filter_range`` flags.  If no range
 -cover this particular access, the behavior is determined by the flags
 -field in the kvm_msr_filter struct: ``KVM_MSR_FILTER_DEFAULT_ALLOW``
 -and ``KVM_MSR_FILTER_DEFAULT_DENY``.
 -
 -Each bitmap range specifies a range of MSRs to potentially allow access on.
 -The range goes from MSR index [base .. base+nmsrs]. The flags field
 -indicates whether reads, writes or both reads and writes are filtered
 -by setting a 1 bit in the bitmap for the corresponding MSR index.
 -
 -If an MSR access is not permitted through the filtering, it generates a
 -#GP inside the guest. When combined with KVM_CAP_X86_USER_SPACE_MSR, that
 -allows user space to deflect and potentially handle various MSR accesses
 -into user space.
 -
 -Note, invoking this ioctl with a vCPU is running is inherently racy.  However,
 -KVM does guarantee that vCPUs will see either the previous filter or the new
 -filter, e.g. MSRs with identical settings in both the old and new filter will
 -have deterministic behavior.
 -
 -4.127 KVM_XEN_HVM_SET_ATTR
 +4.126 KVM_XEN_HVM_SET_ATTR
  --------------------------
  
  :Capability: KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO
@@@ -7918,8 -8019,8 +7918,8 @@@ guest according to the bits in the KVM_
  (0x40000001). Otherwise, a guest may use the paravirtual features
  regardless of what has actually been exposed through the CPUID leaf.
  
- 8.29 KVM_CAP_DIRTY_LOG_RING
- ---------------------------
+ 8.29 KVM_CAP_DIRTY_LOG_RING/KVM_CAP_DIRTY_LOG_RING_ACQ_REL
+ ----------------------------------------------------------
  
  :Architectures: x86
  :Parameters: args[0] - size of the dirty log ring
@@@ -7977,6 -8078,11 +7977,11 @@@ on to the next GFN.  The userspace shou
  flags of a GFN have the DIRTY bit cleared, meaning that it has harvested
  all the dirty GFNs that were available.
  
+ Note that on weakly ordered architectures, userspace accesses to the
+ ring buffer (and more specifically the 'flags' field) must be ordered,
+ using load-acquire/store-release accessors when available, or any
+ other memory barrier that will ensure this ordering.
  It's not necessary for userspace to harvest the all dirty GFNs at once.
  However it must collect the dirty GFNs in sequence, i.e., the userspace
  program cannot skip one dirty GFN to collect the one next to it.
@@@ -8005,6 -8111,14 +8010,14 @@@ KVM_CAP_DIRTY_LOG_RING with an acceptab
  machine will switch to ring-buffer dirty page tracking and further
  KVM_GET_DIRTY_LOG or KVM_CLEAR_DIRTY_LOG ioctls will fail.
  
+ NOTE: KVM_CAP_DIRTY_LOG_RING_ACQ_REL is the only capability that
+ should be exposed by weakly ordered architecture, in order to indicate
+ the additional memory ordering requirements imposed on userspace when
+ reading the state of an entry and mutating it from DIRTY to HARVESTED.
+ Architecture with TSO-like ordering (such as x86) are allowed to
+ expose both KVM_CAP_DIRTY_LOG_RING and KVM_CAP_DIRTY_LOG_RING_ACQ_REL
+ to userspace.
  8.30 KVM_CAP_XEN_HVM
  --------------------
  
diff --combined MAINTAINERS
index 9ae989b32ebb7272acb1de5746cc5f6dd675c28a,f29f27717de4d972d70c4792521f9b7b483a5735..7f3720e443ccd7ef445c056161e4380da72260b4
@@@ -1803,7 -1803,7 +1803,7 @@@ N:      sun[x456789]
  N:    sun50i
  
  ARM/Amlogic Meson SoC CLOCK FRAMEWORK
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  M:    Jerome Brunet <[email protected]>
  L:    [email protected]
  S:    Maintained
@@@ -1828,7 -1828,7 +1828,7 @@@ F:      Documentation/devicetree/bindings/so
  F:    sound/soc/meson/
  
  ARM/Amlogic Meson SoC support
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  M:    Kevin Hilman <[email protected]>
  R:    Jerome Brunet <[email protected]>
  R:    Martin Blumenstingl <[email protected]>
@@@ -2531,7 -2531,7 +2531,7 @@@ W:      http://www.digriz.org.uk/ts78xx/kern
  F:    arch/arm/mach-orion5x/ts78xx-*
  
  ARM/OXNAS platform support
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected] (moderated for non-subscribers)
  L:    [email protected] (moderated for non-subscribers)
  S:    Maintained
@@@ -6792,7 -6792,7 +6792,7 @@@ F:      Documentation/devicetree/bindings/di
  F:    drivers/gpu/drm/sun4i/
  
  DRM DRIVERS FOR AMLOGIC SOCS
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -6814,7 -6814,7 +6814,7 @@@ F:      drivers/gpu/drm/atmel-hlcdc
  
  DRM DRIVERS FOR BRIDGE CHIPS
  M:    Andrzej Hajda <[email protected]>
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  M:    Robert Foss <[email protected]>
  R:    Laurent Pinchart <[email protected]>
  R:    Jonas Karlman <[email protected]>
@@@ -9122,7 -9122,7 +9122,7 @@@ S:      Maintaine
  F:    drivers/dma/hisi_dma.c
  
  HISILICON GPIO DRIVER
 -M:    Luo Jiaxing <luojiaxing@huawei.com>
 +M:    Jay Fang <f.fangjian@huawei.com>
  L:    [email protected]
  S:    Maintained
  F:    drivers/gpio/gpio-hisi.c
@@@ -9208,8 -9208,8 +9208,8 @@@ F:      Documentation/ABI/testing/debugfs-hi
  F:    drivers/crypto/hisilicon/zip/
  
  HISILICON ROCE DRIVER
 +M:    Haoyue Xu <[email protected]>
  M:    Wenpeng Liang <[email protected]>
 -M:    Weihang Li <[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/infiniband/hisilicon-hns-roce.txt
@@@ -10032,7 -10032,6 +10032,7 @@@ F:   Documentation/devicetree/bindings/in
  F:    Documentation/devicetree/bindings/serio/
  F:    Documentation/input/
  F:    drivers/input/
 +F:    include/dt-bindings/input/
  F:    include/linux/input.h
  F:    include/linux/input/
  F:    include/uapi/linux/input-event-codes.h
@@@ -10828,7 -10827,7 +10828,7 @@@ F:   drivers/media/tuners/it913x
  
  ITE IT66121 HDMI BRIDGE DRIVER
  M:    Phong LE <[email protected]>
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  S:    Maintained
  T:    git git://anongit.freedesktop.org/drm/drm-misc
  F:    Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
@@@ -11125,7 -11124,8 +11125,8 @@@ R:   Alexandru Elisei <alexandru.elisei@a
  R:    Suzuki K Poulose <[email protected]>
  R:    Oliver Upton <[email protected]>
  L:    [email protected] (moderated for non-subscribers)
- L:    [email protected] (moderated for non-subscribers)
+ L:    [email protected]
+ L:    [email protected] (deprecated, moderated for non-subscribers)
  S:    Maintained
  T:    git git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm.git
  F:    arch/arm64/include/asm/kvm*
@@@ -11347,7 -11347,7 +11348,7 @@@ F:   kernel/debug
  F:    kernel/module/kdb.c
  
  KHADAS MCU MFD DRIVER
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected]
  S:    Maintained
  F:    Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
@@@ -13218,7 -13218,7 +13219,7 @@@ S:   Maintaine
  F:    drivers/watchdog/menz69_wdt.c
  
  MESON AO CEC DRIVER FOR AMLOGIC SOCS
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -13229,7 -13229,7 +13230,7 @@@ F:   drivers/media/cec/platform/meson/ao-
  F:    drivers/media/cec/platform/meson/ao-cec.c
  
  MESON GE2D DRIVER FOR AMLOGIC SOCS
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -13245,7 -13245,7 +13246,7 @@@ F:   Documentation/devicetree/bindings/mt
  F:    drivers/mtd/nand/raw/meson_*
  
  MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS
 -M:    Neil Armstrong <n[email protected]>
 +M:    Neil Armstrong <n[email protected]>
  L:    [email protected]
  L:    [email protected]
  S:    Supported
@@@ -17532,19 -17532,9 +17533,19 @@@ M: Conor Dooley <conor.dooley@microchip
  M:    Daire McNamara <[email protected]>
  L:    [email protected]
  S:    Supported
 +F:    Documentation/devicetree/bindings/clock/microchip,mpfs.yaml
 +F:    Documentation/devicetree/bindings/gpio/microchip,mpfs-gpio.yaml
 +F:    Documentation/devicetree/bindings/i2c/microchip,corei2c.yaml
 +F:    Documentation/devicetree/bindings/mailbox/microchip,mpfs-mailbox.yaml
 +F:    Documentation/devicetree/bindings/net/can/microchip,mpfs-can.yaml
 +F:    Documentation/devicetree/bindings/pwm/microchip,corepwm.yaml
 +F:    Documentation/devicetree/bindings/soc/microchip/microchip,mpfs-sys-controller.yaml
 +F:    Documentation/devicetree/bindings/spi/microchip,mpfs-spi.yaml
 +F:    Documentation/devicetree/bindings/usb/microchip,mpfs-musb.yaml
  F:    arch/riscv/boot/dts/microchip/
  F:    drivers/char/hw_random/mpfs-rng.c
  F:    drivers/clk/microchip/clk-mpfs.c
 +F:    drivers/i2c/busses/i2c-microchip-core.c
  F:    drivers/mailbox/mailbox-mpfs.c
  F:    drivers/pci/controller/pcie-microchip-host.c
  F:    drivers/rtc/rtc-mpfs.c
  S:    Maintained
  F:    drivers/infiniband/ulp/rtrs/
  
 +RUNTIME VERIFICATION (RV)
 +M:    Daniel Bristot de Oliveira <[email protected]>
 +M:    Steven Rostedt <[email protected]>
 +L:    [email protected]
 +S:    Maintained
 +F:    Documentation/trace/rv/
 +F:    include/linux/rv.h
 +F:    include/rv/
 +F:    kernel/trace/rv/
 +F:    tools/verification/
 +
  RXRPC SOCKETS (AF_RXRPC)
  M:    David Howells <[email protected]>
  M:    Marc Dionne <[email protected]>
@@@ -20622,7 -20601,6 +20623,7 @@@ F:   include/*/ftrace.
  F:    include/linux/trace*.h
  F:    include/trace/
  F:    kernel/trace/
 +F:    scripts/tracing/
  F:    tools/testing/selftests/ftrace/
  
  TRACING MMIO ACCESSES (MMIOTRACE)
@@@ -20787,7 -20765,6 +20788,7 @@@ UBLK USERSPACE BLOCK DRIVE
  M:    Ming Lei <[email protected]>
  L:    [email protected]
  S:    Maintained
 +F:    Documentation/block/ublk.rst
  F:    drivers/block/ublk_drv.c
  F:    include/uapi/linux/ublk_cmd.h
  
@@@ -22329,7 -22306,7 +22330,7 @@@ M:   Shubhrajyoti Datta <shubhrajyoti.dat
  R:    Srinivas Neeli <[email protected]>
  R:    Michal Simek <[email protected]>
  S:    Maintained
 -F:    Documentation/devicetree/bindings/gpio/gpio-xilinx.txt
 +F:    Documentation/devicetree/bindings/gpio/xlnx,gpio-xilinx.yaml
  F:    Documentation/devicetree/bindings/gpio/gpio-zynq.yaml
  F:    drivers/gpio/gpio-xilinx.c
  F:    drivers/gpio/gpio-zynq.c
diff --combined arch/arm64/kernel/head.S
index 814b6587ccb78fc2fcc4dc0d1e6d4d8098236bca,b5accf53a15368e0fb95da464f9b5d8bb7ca3b5e..2196aad7b55bcef05b2554b5fae086e3cdc84159
@@@ -99,7 -99,7 +99,7 @@@ SYM_CODE_START(primary_entry
         */
  #if VA_BITS > 48
        mrs_s   x0, SYS_ID_AA64MMFR2_EL1
-       tst     x0, #0xf << ID_AA64MMFR2_LVA_SHIFT
+       tst     x0, #0xf << ID_AA64MMFR2_EL1_VARange_SHIFT
        mov     x0, #VA_BITS
        mov     x25, #VA_BITS_MIN
        csel    x25, x25, x0, eq
@@@ -371,9 -371,7 +371,9 @@@ SYM_FUNC_END(create_idmap
  SYM_FUNC_START_LOCAL(create_kernel_mapping)
        adrp    x0, init_pg_dir
        mov_q   x5, KIMAGE_VADDR                // compile time __va(_text)
 +#ifdef CONFIG_RELOCATABLE
        add     x5, x5, x23                     // add KASLR displacement
 +#endif
        adrp    x6, _end                        // runtime __pa(_end)
        adrp    x3, _text                       // runtime __pa(_text)
        sub     x6, x6, x3                      // _end - _text
@@@ -658,10 -656,10 +658,10 @@@ SYM_FUNC_END(__secondary_too_slow
   */
  SYM_FUNC_START(__enable_mmu)
        mrs     x3, ID_AA64MMFR0_EL1
-       ubfx    x3, x3, #ID_AA64MMFR0_TGRAN_SHIFT, 4
-       cmp     x3, #ID_AA64MMFR0_TGRAN_SUPPORTED_MIN
+       ubfx    x3, x3, #ID_AA64MMFR0_EL1_TGRAN_SHIFT, 4
+       cmp     x3, #ID_AA64MMFR0_EL1_TGRAN_SUPPORTED_MIN
        b.lt    __no_granule_support
-       cmp     x3, #ID_AA64MMFR0_TGRAN_SUPPORTED_MAX
+       cmp     x3, #ID_AA64MMFR0_EL1_TGRAN_SUPPORTED_MAX
        b.gt    __no_granule_support
        phys_to_ttbr x2, x2
        msr     ttbr0_el1, x2                   // load TTBR0
@@@ -679,7 -677,7 +679,7 @@@ SYM_FUNC_START(__cpu_secondary_check52b
        b.ne    2f
  
        mrs_s   x0, SYS_ID_AA64MMFR2_EL1
-       and     x0, x0, #(0xf << ID_AA64MMFR2_LVA_SHIFT)
+       and     x0, x0, #(0xf << ID_AA64MMFR2_EL1_VARange_SHIFT)
        cbnz    x0, 2f
  
        update_early_cpu_boot_status \
diff --combined arch/arm64/kvm/arm.c
index 446f628a9de1837023f4cb354bda9d2e649fdad3,c7fb2ad8be9f5dae8cfd1daff7498a6fa870575e..94d33e296e10c57c34008af96d7a9adcb72d99ef
@@@ -666,6 -666,7 +666,6 @@@ void kvm_vcpu_wfi(struct kvm_vcpu *vcpu
  
        kvm_vcpu_halt(vcpu);
        vcpu_clear_flag(vcpu, IN_WFIT);
 -      kvm_clear_request(KVM_REQ_UNHALT, vcpu);
  
        preempt_disable();
        vgic_v4_load(vcpu);
@@@ -2113,7 -2114,7 +2113,7 @@@ static int finalize_hyp_mode(void
         * at, which would end badly once inaccessible.
         */
        kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
 -      kmemleak_free_part(__va(hyp_mem_base), hyp_mem_size);
 +      kmemleak_free_part_phys(hyp_mem_base, hyp_mem_size);
        return pkvm_drop_host_privileges();
  }
  
@@@ -2269,6 -2270,16 +2269,16 @@@ static int __init early_kvm_mode_cfg(ch
        if (!arg)
                return -EINVAL;
  
+       if (strcmp(arg, "none") == 0) {
+               kvm_mode = KVM_MODE_NONE;
+               return 0;
+       }
+       if (!is_hyp_mode_available()) {
+               pr_warn_once("KVM is not available. Ignoring kvm-arm.mode\n");
+               return 0;
+       }
        if (strcmp(arg, "protected") == 0) {
                if (!is_kernel_in_hyp_mode())
                        kvm_mode = KVM_MODE_PROTECTED;
                return 0;
        }
  
-       if (strcmp(arg, "none") == 0) {
-               kvm_mode = KVM_MODE_NONE;
-               return 0;
-       }
        return -EINVAL;
  }
  early_param("kvm-arm.mode", early_kvm_mode_cfg);
index 45d9aee1c0d84dd1d0d06e51298707f8586edf79,87d1a0b1bae0470048656fd2a69d179b9e0c3ba0..2f0d705db9dba5ad0d9923658908d934f4024a93
@@@ -1,4 -1,5 +1,5 @@@
  # SPDX-License-Identifier: GPL-2.0-only
+ /aarch64/aarch32_id_regs
  /aarch64/arch_timer
  /aarch64/debug-exceptions
  /aarch64/get-reg-list
@@@ -28,7 -29,6 +29,7 @@@
  /x86_64/max_vcpuid_cap_test
  /x86_64/mmio_warning_test
  /x86_64/monitor_mwait_test
 +/x86_64/nested_exceptions_test
  /x86_64/nx_huge_pages_test
  /x86_64/platform_info_test
  /x86_64/pmu_event_filter_test
index fde3ae8cfa4c7cc1b909d9caa17a152365ffb8b1,784abe7f096252b298ce4ba1096eb53dd694d07d..0172eb6cb6eee228cd2b3bea864abdb561f4346c
@@@ -48,8 -48,6 +48,8 @@@ LIBKVM += lib/rbtree.
  LIBKVM += lib/sparsebit.c
  LIBKVM += lib/test_util.c
  
 +LIBKVM_STRING += lib/string_override.c
 +
  LIBKVM_x86_64 += lib/x86_64/apic.c
  LIBKVM_x86_64 += lib/x86_64/handlers.S
  LIBKVM_x86_64 += lib/x86_64/perf_test_util.c
@@@ -91,7 -89,6 +91,7 @@@ TEST_GEN_PROGS_x86_64 += x86_64/kvm_clo
  TEST_GEN_PROGS_x86_64 += x86_64/kvm_pv_test
  TEST_GEN_PROGS_x86_64 += x86_64/mmio_warning_test
  TEST_GEN_PROGS_x86_64 += x86_64/monitor_mwait_test
 +TEST_GEN_PROGS_x86_64 += x86_64/nested_exceptions_test
  TEST_GEN_PROGS_x86_64 += x86_64/platform_info_test
  TEST_GEN_PROGS_x86_64 += x86_64/pmu_event_filter_test
  TEST_GEN_PROGS_x86_64 += x86_64/set_boot_cpu_id
@@@ -147,6 -144,7 +147,7 @@@ TEST_GEN_PROGS_x86_64 += system_counter
  # Compiled outputs used by test targets
  TEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test
  
+ TEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs
  TEST_GEN_PROGS_aarch64 += aarch64/arch_timer
  TEST_GEN_PROGS_aarch64 += aarch64/debug-exceptions
  TEST_GEN_PROGS_aarch64 += aarch64/get-reg-list
@@@ -223,8 -221,7 +224,8 @@@ LIBKVM_C := $(filter %.c,$(LIBKVM)
  LIBKVM_S := $(filter %.S,$(LIBKVM))
  LIBKVM_C_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_C))
  LIBKVM_S_OBJ := $(patsubst %.S, $(OUTPUT)/%.o, $(LIBKVM_S))
 -LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ)
 +LIBKVM_STRING_OBJ := $(patsubst %.c, $(OUTPUT)/%.o, $(LIBKVM_STRING))
 +LIBKVM_OBJS = $(LIBKVM_C_OBJ) $(LIBKVM_S_OBJ) $(LIBKVM_STRING_OBJ)
  
  EXTRA_CLEAN += $(LIBKVM_OBJS) cscope.*
  
@@@ -235,12 -232,6 +236,12 @@@ $(LIBKVM_C_OBJ): $(OUTPUT)/%.o: %.
  $(LIBKVM_S_OBJ): $(OUTPUT)/%.o: %.S
        $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
  
 +# Compile the string overrides as freestanding to prevent the compiler from
 +# generating self-referential code, e.g. without "freestanding" the compiler may
 +# "optimize" memcmp() by invoking memcmp(), thus causing infinite recursion.
 +$(LIBKVM_STRING_OBJ): $(OUTPUT)/%.o: %.c
 +      $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -ffreestanding $< -o $@
 +
  x := $(shell mkdir -p $(sort $(dir $(TEST_GEN_PROGS))))
  $(TEST_GEN_PROGS): $(LIBKVM_OBJS)
  $(TEST_GEN_PROGS_EXTENDED): $(LIBKVM_OBJS)
index 504c1e1355c3a962a65b2aad3a48670479cfd0c7,411a4c0bc81c8f045af5b874296a56a0e6a9be83..f1cb1627161fde1ba5c3501b353fb765459347df
@@@ -50,45 -50,6 +50,45 @@@ int open_kvm_dev_path_or_exit(void
        return _open_kvm_dev_path_or_exit(O_RDONLY);
  }
  
 +static bool get_module_param_bool(const char *module_name, const char *param)
 +{
 +      const int path_size = 128;
 +      char path[path_size];
 +      char value;
 +      ssize_t r;
 +      int fd;
 +
 +      r = snprintf(path, path_size, "/sys/module/%s/parameters/%s",
 +                   module_name, param);
 +      TEST_ASSERT(r < path_size,
 +                  "Failed to construct sysfs path in %d bytes.", path_size);
 +
 +      fd = open_path_or_exit(path, O_RDONLY);
 +
 +      r = read(fd, &value, 1);
 +      TEST_ASSERT(r == 1, "read(%s) failed", path);
 +
 +      r = close(fd);
 +      TEST_ASSERT(!r, "close(%s) failed", path);
 +
 +      if (value == 'Y')
 +              return true;
 +      else if (value == 'N')
 +              return false;
 +
 +      TEST_FAIL("Unrecognized value '%c' for boolean module param", value);
 +}
 +
 +bool get_kvm_intel_param_bool(const char *param)
 +{
 +      return get_module_param_bool("kvm_intel", param);
 +}
 +
 +bool get_kvm_amd_param_bool(const char *param)
 +{
 +      return get_module_param_bool("kvm_amd", param);
 +}
 +
  /*
   * Capability
   *
@@@ -121,7 -82,10 +121,10 @@@ unsigned int kvm_check_cap(long cap
  
  void vm_enable_dirty_ring(struct kvm_vm *vm, uint32_t ring_size)
  {
-       vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING, ring_size);
+       if (vm_check_cap(vm, KVM_CAP_DIRTY_LOG_RING_ACQ_REL))
+               vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING_ACQ_REL, ring_size);
+       else
+               vm_enable_cap(vm, KVM_CAP_DIRTY_LOG_RING, ring_size);
        vm->dirty_ring_size = ring_size;
  }
  
diff --combined virt/kvm/kvm_main.c
index 26383e63d9dd352aa2fadd320f96844a8459498e,5b064dbadaf420d6e568ac1da006e35b2326452c..e30f1b4ecfa5d1c3110bdbd36108aa417de008a9
@@@ -3409,8 -3409,10 +3409,8 @@@ static int kvm_vcpu_check_block(struct 
        int ret = -EINTR;
        int idx = srcu_read_lock(&vcpu->kvm->srcu);
  
 -      if (kvm_arch_vcpu_runnable(vcpu)) {
 -              kvm_make_request(KVM_REQ_UNHALT, vcpu);
 +      if (kvm_arch_vcpu_runnable(vcpu))
                goto out;
 -      }
        if (kvm_cpu_has_pending_timer(vcpu))
                goto out;
        if (signal_pending(current))
@@@ -4473,7 -4475,13 +4473,13 @@@ static long kvm_vm_ioctl_check_extensio
        case KVM_CAP_NR_MEMSLOTS:
                return KVM_USER_MEM_SLOTS;
        case KVM_CAP_DIRTY_LOG_RING:
- #ifdef CONFIG_HAVE_KVM_DIRTY_RING
+ #ifdef CONFIG_HAVE_KVM_DIRTY_RING_TSO
+               return KVM_DIRTY_RING_MAX_ENTRIES * sizeof(struct kvm_dirty_gfn);
+ #else
+               return 0;
+ #endif
+       case KVM_CAP_DIRTY_LOG_RING_ACQ_REL:
+ #ifdef CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL
                return KVM_DIRTY_RING_MAX_ENTRIES * sizeof(struct kvm_dirty_gfn);
  #else
                return 0;
@@@ -4578,6 -4586,7 +4584,7 @@@ static int kvm_vm_ioctl_enable_cap_gene
                return 0;
        }
        case KVM_CAP_DIRTY_LOG_RING:
+       case KVM_CAP_DIRTY_LOG_RING_ACQ_REL:
                return kvm_vm_ioctl_enable_dirty_log_ring(kvm, cap->args[0]);
        default:
                return kvm_vm_ioctl_enable_cap(kvm, cap);
@@@ -5879,7 -5888,7 +5886,7 @@@ int kvm_init(void *opaque, unsigned vcp
  
        r = kvm_async_pf_init();
        if (r)
 -              goto out_free_5;
 +              goto out_free_4;
  
        kvm_chardev_ops.owner = module;
  
  
  out_unreg:
        kvm_async_pf_deinit();
 -out_free_5:
 +out_free_4:
        for_each_possible_cpu(cpu)
                free_cpumask_var(per_cpu(cpu_kick_mask, cpu));
 -out_free_4:
        kmem_cache_destroy(kvm_vcpu_cache);
  out_free_3:
        unregister_reboot_notifier(&kvm_reboot_notifier);
This page took 0.125637 seconds and 4 git commands to generate.