Skip to content
Permalink
Reiji-Watanabe…
Switch branches/tags

Commits on Nov 17, 2021

  1. KVM: arm64: selftests: Introduce id_reg_test

    Introduce a test for aarch64 to validate basic behavior of
    KVM_GET_ONE_REG and KVM_SET_ONE_REG for ID registers.
    
    This test runs only when KVM_CAP_ARM_ID_REG_CONFIGURABLE is supported.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  2. KVM: arm64: Add kunit test for trap initialization

    Add KUnit tests for functions that initialize traps.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  3. KVM: arm64: Initialize trapping of disabled CPU features for the guest

    Call kvm_vcpu_init_traps() at the first KVM_RUN to initialize trapping
    of disabled CPU features for the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  4. KVM: arm64: Trap disabled features of ID_AA64ISAR1_EL1

    Add feature_config_ctrl for PTRAUTH, which is indicated in
    ID_AA64ISAR1_EL1, to program configuration register to trap
    guest's using the feature when it is not exposed to the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  5. KVM: arm64: Trap disabled features of ID_AA64MMFR1_EL1

    Add feature_config_ctrl for LORegions, which is indicated in
    ID_AA64MMFR1_EL1, to program configuration register to trap
    guest's using the feature when it is not exposed to the guest.
    
    Change trap_loregion() to use vcpu_feature_is_available()
    to simplify checking of the feature's availability.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  6. KVM: arm64: Trap disabled features of ID_AA64DFR0_EL1

    Add feature_config_ctrl for PMUv3, PMS and TraceFilt, which are
    indicated in ID_AA64DFR0_EL1, to program configuration registers
    to trap guest's using those features when they are not exposed to
    the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  7. KVM: arm64: Trap disabled features of ID_AA64PFR1_EL1

    Add feature_config_ctrl for MTE, which is indicated in
    ID_AA64PFR1_EL1, to program configuration register to trap the
    guest's using the feature when it is not exposed to the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  8. KVM: arm64: Trap disabled features of ID_AA64PFR0_EL1

    Add feature_config_ctrl for RAS and AMU, which are indicated in
    ID_AA64PFR0_EL1, to program configuration registers to trap
    guest's using those features when they are not exposed to the guest.
    
    Introduce trap_ras_regs() to change a behavior of guest's access to
    the registers, which is currently raz/wi, depending on the feature's
    availability for the guest (and inject undefined instruction
    exception when guest's RAS register access are trapped and RAS is
    not exposed to the guest).  In order to keep the current visibility
    of the RAS registers from userspace (always visible), a visibility
    function for RAS registers is not added.
    
    No code is added for AMU's access/visibility handler because the
    current code already injects the exception for Guest's AMU register
    access unconditionally because AMU is never exposed to the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  9. KVM: arm64: Introduce framework to trap disabled features

    When a CPU feature that is supported on the host is not exposed to
    its guest, emulating a real CPU's behavior (by trapping or disabling
    guest's using the feature) is generally a desirable behavior (when
    it's possible without any or little side effect).
    
    Introduce feature_config_ctrl structure, which manages feature
    information to program configuration register to trap or disable
    the feature when the feature is not exposed to the guest, and
    functions that uses the structure to activate trapping the feature.
    
    At present, no feature has feature_config_ctrl yet and the following
    patches will add the feature_config_ctrl for several features.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  10. KVM: arm64: Use vcpu->arch.mdcr_el2 to track value of mdcr_el2

    Track the baseline guest value for mdcr_el2 in struct kvm_vcpu_arch.
    Use this value when setting mdcr_el2 for the guest.
    
    Currently this value is unchanged, but the following patches will set
    trapping bits based on features supported for the guest.
    
    No functional change intended.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  11. KVM: arm64: Use vcpu->arch cptr_el2 to track value of cptr_el2 for VHE

    Track the baseline guest value for cptr_el2 in struct kvm_vcpu_arch
    for VHE.  Use this value when setting cptr_el2 for the guest.
    
    Currently this value is unchanged, but the following patches will set
    trapping bits based on features supported for the guest.
    
    No functional change intended.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  12. KVM: arm64: Add kunit test for ID register validation

    Add kunit tests for functions that are used for validation of ID
    registers and CONFIG_KVM_KUNIT_TEST option to enable the tests.
    
    Since those tests only cover ID register validation so far, only
    a few lines of change are needed in the default arm64.py to run
    all of those tests as follows.
    -----------------------------------------------------------------------
    $ diff tools/testing/kunit/qemu_configs/arm64.py arm64_kvm_min.py
    4a5,7
    > CONFIG_VIRTUALIZATION=y
    > CONFIG_KVM=y
    > CONFIG_KVM_KUNIT_TEST=y
    12c15
    < 			   extra_qemu_params=['-machine virt', '-cpu cortex-a57'])
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  13. KVM: arm64: Introduce KVM_CAP_ARM_ID_REG_CONFIGURABLE capability

    Introduce a new capability KVM_CAP_ARM_ID_REG_CONFIGURABLE to indicate
    that ID registers are writable by userspace.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  14. KVM: arm64: Add consistency checking for frac fields of ID registers

    Feature fractional field of an ID register cannot be simply validated
    at KVM_SET_ONE_REG because its validity depends on its (main) feature
    field value, which could be in a different ID register (and might be
    set later).
    Validate fractional fields at the first KVM_RUN instead.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  15. KVM: arm64: Make ID registers without id_reg_info writable

    Make ID registers that don't have id_reg_info writable.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  16. KVM: arm64: Make MVFR1_EL1 writable

    This patch adds id_reg_info for MVFR1_EL1 to make it writable
    by userspace.
    
    There are only a few valid combinations of values that can be set
    for FPHP and SIMDHP fields according to Arm ARM.  Return an error
    when userspace tries to set those fields to values that don't match
    any of the valid combinations.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  17. KVM: arm64: Make ID_MMFR0_EL1 writable

    This patch adds id_reg_info for ID_MMFR0_EL1 to make it writable
    by userspace.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  18. KVM: arm64: Make ID_DFR1_EL1 writable

    This patch adds id_reg_info for ID_DFR1_EL1 to make it writable
    by userspace.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  19. KVM: arm64: Make ID_DFR0_EL1 writable

    This patch adds id_reg_info for ID_DFR0_EL1 to make it writable
    by userspace.
    
    Return an error if userspace tries to set PerfMon field of the
    register to a value that conflicts with the PMU configuration.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  20. KVM: arm64: Make ID_AA64DFR0_EL1 writable

    This patch adds id_reg_info for ID_AA64DFR0_EL1 to make it writable
    by userspace.
    
    Return an error if userspace tries to set PMUVER field of the
    register to a value that conflicts with the PMU configuration.
    
    Since number of context-aware breakpoints must be no more than number
    of supported breakpoints according to Arm ARM, return an error
    if userspace tries to set CTX_CMPS field to such value.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  21. KVM: arm64: Hide IMPLEMENTATION DEFINED PMU support for the guest

    When ID_AA64DFR0_EL1.PMUVER or ID_DFR0_EL1.PERFMON is 0xf, which
    means IMPLEMENTATION DEFINED PMU supported, KVM unconditionally
    expose the value for the guest as it is.  Since KVM doesn't support
    IMPLEMENTATION DEFINED PMU for the guest, in that case KVM should
    exopse 0x0 (PMU is not implemented) instead.
    
    Change cpuid_feature_cap_perfmon_field() to update the field value
    to 0x0 when it is 0xf.
    
    Fixes: 8e35aa6 ("arm64: cpufeature: Extract capped perfmon fields")
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  22. KVM: arm64: Make ID_AA64MMFR0_EL1 writable

    This patch adds id_reg_info for ID_AA64MMFR0_EL1 to make it
    writable by userspace.
    
    Since ID_AA64MMFR0_EL1 stage 2 granule size fields don't follow the
    standard ID scheme, we need a special handling to validate those fields.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  23. KVM: arm64: Make ID_AA64ISAR1_EL1 writable

    This patch adds id_reg_info for ID_AA64ISAR1_EL1 to make it
    writable by userspace.
    
    Return an error if userspace tries to set PTRAUTH related fields
    of the register to values that conflict with PTRAUTH configuration,
    which was configured by KVM_ARM_VCPU_INIT, for the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  24. KVM: arm64: Make ID_AA64ISAR0_EL1 writable

    This patch adds id_reg_info for ID_AA64ISAR0_EL1 to make it writable
    by userspace.
    
    Updating sm3, sm4, sha1, sha2 and sha3 fields are allowed only
    if values of those fields follow Arm ARM.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  25. KVM: arm64: Make ID_AA64PFR1_EL1 writable

    This patch adds id_reg_info for ID_AA64PFR1_EL1 to make it writable
    by userspace.
    
    Return an error if userspace tries to set MTE field of the register
    to a value that conflicts with KVM_CAP_ARM_MTE configuration for
    the guest.
    Skip fractional feature fields validation at present and they will
    be handled by the following patches.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  26. KVM: arm64: Make ID_AA64PFR0_EL1 writable

    This patch adds id_reg_info for ID_AA64PFR0_EL1 to make it writable by
    userspace.
    
    The CSV2/CSV3 fields of the register were already writable and values
    that were written for them affected all vCPUs before. Now they only
    affect the vCPU.
    Return an error if userspace tries to set SVE/GIC field of the register
    to a value that conflicts with SVE/GIC configuration for the guest.
    SIMD/FP/SVE fields of the requested value are validated according to
    Arm ARM.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  27. KVM: arm64: Introduce struct id_reg_info

    This patch lays the groundwork to make ID registers writable.
    
    Introduce struct id_reg_info for an ID register to manage the
    register specific control of its value for the guest, and provide set
    of functions commonly used for ID registers to make them writable.
    
    The id_reg_info is used to do register specific initialization,
    validation of the ID register and etc.  Not all ID registers must
    have the id_reg_info. ID registers that don't have the id_reg_info
    are handled in a common way that is applied to all ID registers.
    
    At present, changing an ID register from userspace is allowed only
    if the ID register has the id_reg_info, but that will be changed
    by the following patches.
    
    No ID register has the structure yet and the following patches
    will add the id_reg_info for some ID registers.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  28. KVM: arm64: Save ID registers' sanitized value per vCPU

    Extend sys_regs[] of kvm_cpu_context for ID registers and save ID
    registers' sanitized value in the array for the vCPU at the first
    vCPU reset. Use the saved ones when ID registers are read by
    userspace (via KVM_GET_ONE_REG) or the guest.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021
  29. KVM: arm64: Add has_reset_once flag for vcpu

    Introduce 'has_reset_once' flag in kvm_vcpu_arch, which indicates
    if the vCPU reset has been done once, for later use.
    
    Signed-off-by: Reiji Watanabe <reijiw@google.com>
    Reviewed-by: Oliver Upton <oupton@google.com>
    reijiw-kvm authored and intel-lab-lkp committed Nov 17, 2021

Commits on Nov 14, 2021

  1. Linux 5.16-rc1

    torvalds committed Nov 14, 2021
  2. kconfig: Add support for -Wimplicit-fallthrough

    Add Kconfig support for -Wimplicit-fallthrough for both GCC and Clang.
    
    The compiler option is under configuration CC_IMPLICIT_FALLTHROUGH,
    which is enabled by default.
    
    Special thanks to Nathan Chancellor who fixed the Clang bug[1][2]. This
    bugfix only appears in Clang 14.0.0, so older versions still contain
    the bug and -Wimplicit-fallthrough won't be enabled for them, for now.
    
    This concludes a long journey and now we are finally getting rid
    of the unintentional fallthrough bug-class in the kernel, entirely. :)
    
    Link: llvm/llvm-project@9ed4a94 [1]
    Link: https://bugs.llvm.org/show_bug.cgi?id=51094 [2]
    Link: KSPP#115
    Link: ClangBuiltLinux#236
    Co-developed-by: Kees Cook <keescook@chromium.org>
    Signed-off-by: Kees Cook <keescook@chromium.org>
    Co-developed-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
    Reviewed-by: Nathan Chancellor <nathan@kernel.org>
    Tested-by: Nathan Chancellor <nathan@kernel.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    GustavoARSilva authored and torvalds committed Nov 14, 2021
  3. Merge tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/x…

    …fs-linux
    
    Pull xfs cleanups from Darrick Wong:
     "The most 'exciting' aspect of this branch is that the xfsprogs
      maintainer and I have worked through the last of the code
      discrepancies between kernel and userspace libxfs such that there are
      no code differences between the two except for #includes.
    
      IOWs, diff suffices to demonstrate that the userspace tools behave the
      same as the kernel, and kernel-only bits are clearly marked in the
      /kernel/ source code instead of just the userspace source.
    
      Summary:
    
       - Clean up open-coded swap() calls.
    
       - A little bit of #ifdef golf to complete the reunification of the
         kernel and userspace libxfs source code"
    
    * tag 'xfs-5.16-merge-5' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
      xfs: sync xfs_btree_split macros with userspace libxfs
      xfs: #ifdef out perag code for userspace
      xfs: use swap() to make dabtree code cleaner
    torvalds committed Nov 14, 2021
  4. Merge tag 'for-5.16/parisc-3' of git://git.kernel.org/pub/scm/linux/k…

    …ernel/git/deller/parisc-linux
    
    Pull more parisc fixes from Helge Deller:
     "Fix a build error in stracktrace.c, fix resolving of addresses to
      function names in backtraces, fix single-stepping in assembly code and
      flush userspace pte's when using set_pte_at()"
    
    * tag 'for-5.16/parisc-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
      parisc/entry: fix trace test in syscall exit path
      parisc: Flush kernel data mapping in set_pte_at() when installing pte for user page
      parisc: Fix implicit declaration of function '__kernel_text_address'
      parisc: Fix backtrace to always include init funtion names
    torvalds committed Nov 14, 2021
  5. Merge tag 'sh-for-5.16' of git://git.libc.org/linux-sh

    Pull arch/sh updates from Rich Felker.
    
    * tag 'sh-for-5.16' of git://git.libc.org/linux-sh:
      sh: pgtable-3level: Fix cast to pointer from integer of different size
      sh: fix READ/WRITE redefinition warnings
      sh: define __BIG_ENDIAN for math-emu
      sh: math-emu: drop unused functions
      sh: fix kconfig unmet dependency warning for FRAME_POINTER
      sh: Cleanup about SPARSE_IRQ
      sh: kdump: add some attribute to function
      maple: fix wrong return value of maple_bus_init().
      sh: boot: avoid unneeded rebuilds under arch/sh/boot/compressed/
      sh: boot: add intermediate vmlinux.bin* to targets instead of extra-y
      sh: boards: Fix the cacography in irq.c
      sh: check return code of request_irq
      sh: fix trivial misannotations
    torvalds committed Nov 14, 2021
  6. Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

    Pull ARM fixes from Russell King:
    
     - Fix early_iounmap
    
     - Drop cc-option fallbacks for architecture selection
    
    * tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
      ARM: 9156/1: drop cc-option fallbacks for architecture selection
      ARM: 9155/1: fix early early_iounmap()
    torvalds committed Nov 14, 2021
Older