1. 01 Oct, 2022 1 commit
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/dirty-log-ordered into kvmarm-master/next · 250012dd
      Marc Zyngier authored
      * kvm-arm64/dirty-log-ordered:
        : .
        : Retrofit some ordering into the existing API dirty-ring by:
        :
        : - relying on acquire/release semantics which are the default on x86,
        :   but need to be explicit on arm64
        :
        : - adding a new capability that indicate which flavor is supported, either
        :   with explicit ordering (arm64) or both implicit and explicit (x86),
        :   as suggested by Paolo at KVM Forum
        :
        : - documenting the requirements for this new capability on weakly ordered
        :   architectures
        :
        : - updating the selftests to do the right thing
        : .
        KVM: selftests: dirty-log: Use KVM_CAP_DIRTY_LOG_RING_ACQ_REL if available
        KVM: selftests: dirty-log: Upgrade flag accesses to acquire/release semantics
        KVM: Document weakly ordered architecture requirements for dirty ring
        KVM: x86: Select CONFIG_HAVE_KVM_DIRTY_RING_ACQ_REL
        KVM: Add KVM_CAP_DIRTY_LOG_RING_ACQ_REL capability and config option
        KVM: Use acquire/release semantics when accessing dirty ring GFN state
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      250012dd
  2. 29 Sep, 2022 6 commits
  3. 19 Sep, 2022 6 commits
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/single-step-async-exception into kvmarm-master/next · bb0cca24
      Marc Zyngier authored
      * kvm-arm64/single-step-async-exception:
        : .
        : Single-step fixes from Reiji Watanabe:
        :
        : "This series fixes two bugs of single-step execution enabled by
        : userspace, and add a test case for KVM_GUESTDBG_SINGLESTEP to
        : the debug-exception test to verify the single-step behavior."
        : .
        KVM: arm64: selftests: Add a test case for KVM_GUESTDBG_SINGLESTEP
        KVM: arm64: selftests: Refactor debug-exceptions to make it amenable to new test cases
        KVM: arm64: Clear PSTATE.SS when the Software Step state was Active-pending
        KVM: arm64: Preserve PSTATE.SS for the guest while single-step is enabled
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      bb0cca24
    • Reiji Watanabe's avatar
      KVM: arm64: selftests: Add a test case for KVM_GUESTDBG_SINGLESTEP · b18e4d4a
      Reiji Watanabe authored
      Add a test case for KVM_GUESTDBG_SINGLESTEP to the debug-exceptions test.
      The test enables single-step execution from userspace, and check if the
      exit to userspace occurs for each instruction that is stepped.
      Set the default number of the test iterations to a number of iterations
      sufficient to always reproduce the problem that the previous patch fixes
      on an Ampere Altra machine.
      Signed-off-by: default avatarReiji Watanabe <reijiw@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220917010600.532642-5-reijiw@google.com
      b18e4d4a
    • Reiji Watanabe's avatar
      KVM: arm64: selftests: Refactor debug-exceptions to make it amenable to new test cases · ff00e737
      Reiji Watanabe authored
      Split up the current test into a helper, but leave the debug version
      checking in main(), to make it convenient to add a new debug exception
      test case in a subsequent patch.
      Signed-off-by: default avatarReiji Watanabe <reijiw@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220917010600.532642-4-reijiw@google.com
      ff00e737
    • Reiji Watanabe's avatar
      KVM: arm64: Clear PSTATE.SS when the Software Step state was Active-pending · 370531d1
      Reiji Watanabe authored
      While userspace enables single-step, if the Software Step state at the
      last guest exit was "Active-pending", clear PSTATE.SS on guest entry
      to restore the state.
      
      Currently, KVM sets PSTATE.SS to 1 on every guest entry while userspace
      enables single-step for the vCPU (with KVM_GUESTDBG_SINGLESTEP).
      It means KVM always makes the vCPU's Software Step state
      "Active-not-pending" on the guest entry, which lets the VCPU perform
      single-step (then Software Step exception is taken). This could cause
      extra single-step (without returning to userspace) if the Software Step
      state at the last guest exit was "Active-pending" (i.e. the last
      exit was triggered by an asynchronous exception after the single-step
      is performed, but before the Software Step exception is taken.
      See "Figure D2-3 Software step state machine" and "D2.12.7 Behavior
      in the active-pending state" in ARM DDI 0487I.a for more info about
      this behavior).
      
      Fix this by clearing PSTATE.SS on guest entry if the Software Step state
      at the last exit was "Active-pending" so that KVM restore the state (and
      the exception is taken before further single-step is performed).
      
      Fixes: 337b99bf ("KVM: arm64: guest debug, add support for single-step")
      Signed-off-by: default avatarReiji Watanabe <reijiw@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220917010600.532642-3-reijiw@google.com
      370531d1
    • Reiji Watanabe's avatar
      KVM: arm64: Preserve PSTATE.SS for the guest while single-step is enabled · 34fbdee0
      Reiji Watanabe authored
      Preserve the PSTATE.SS value for the guest while userspace enables
      single-step (i.e. while KVM manipulates the PSTATE.SS) for the vCPU.
      
      Currently, while userspace enables single-step for the vCPU
      (with KVM_GUESTDBG_SINGLESTEP), KVM sets PSTATE.SS to 1 on every
      guest entry, not saving its original value.
      When userspace disables single-step, KVM doesn't restore the original
      value for the subsequent guest entry (use the current value instead).
      Exception return instructions copy PSTATE.SS from SPSR_ELx.SS
      only in certain cases when single-step is enabled (and set it to 0
      in other cases). So, the value matters only when the guest enables
      single-step (and when the guest's Software step state isn't affected
      by single-step enabled by userspace, practically), though.
      
      Fix this by preserving the original PSTATE.SS value while userspace
      enables single-step, and restoring the value once it is disabled.
      
      This fix modifies the behavior of GET_ONE_REG/SET_ONE_REG for the
      PSTATE.SS while single-step is enabled by userspace.
      Presently, GET_ONE_REG/SET_ONE_REG gets/sets the current PSTATE.SS
      value, which KVM will override on the next guest entry (i.e. the
      value userspace gets/sets is not used for the next guest entry).
      With this patch, GET_ONE_REG/SET_ONE_REG will get/set the guest's
      preserved value, which KVM will preserve and try to restore after
      single-step is disabled.
      
      Fixes: 337b99bf ("KVM: arm64: guest debug, add support for single-step")
      Signed-off-by: default avatarReiji Watanabe <reijiw@google.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20220917010600.532642-2-reijiw@google.com
      34fbdee0
    • Marc Zyngier's avatar
      Merge remote-tracking branch 'arm64/for-next/sysreg' into kvmarm-master/next · b04b3315
      Marc Zyngier authored
      Merge arm64/for-next/sysreg in order to avoid upstream conflicts
      due to the never ending sysreg repainting...
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      b04b3315
  4. 16 Sep, 2022 7 commits
  5. 14 Sep, 2022 7 commits
  6. 09 Sep, 2022 13 commits