1. 13 Apr, 2021 2 commits
  2. 11 Apr, 2021 2 commits
  3. 08 Apr, 2021 1 commit
  4. 07 Apr, 2021 2 commits
    • Alexandru Elisei's avatar
      KVM: arm64: Initialize VCPU mdcr_el2 before loading it · 263d6287
      Alexandru Elisei authored
      When a VCPU is created, the kvm_vcpu struct is initialized to zero in
      kvm_vm_ioctl_create_vcpu(). On VHE systems, the first time
      vcpu.arch.mdcr_el2 is loaded on hardware is in vcpu_load(), before it is
      set to a sensible value in kvm_arm_setup_debug() later in the run loop. The
      result is that KVM executes for a short time with MDCR_EL2 set to zero.
      
      This has several unintended consequences:
      
      * Setting MDCR_EL2.HPMN to 0 is constrained unpredictable according to ARM
        DDI 0487G.a, page D13-3820. The behavior specified by the architecture
        in this case is for the PE to behave as if MDCR_EL2.HPMN is set to a
        value less than or equal to PMCR_EL0.N, which means that an unknown
        number of counters are now disabled by MDCR_EL2.HPME, which is zero.
      
      * The host configuration for the other debug features controlled by
        MDCR_EL2 is temporarily lost. This has been harmless so far, as Linux
        doesn't use the other fields, but that might change in the future.
      
      Let's avoid both issues by initializing the VCPU's mdcr_el2 field in
      kvm_vcpu_vcpu_first_run_init(), thus making sure that the MDCR_EL2 register
      has a consistent value after each vcpu_load().
      
      Fixes: d5a21bcc ("KVM: arm64: Move common VHE/non-VHE trap config in separate functions")
      Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210407144857.199746-3-alexandru.elisei@arm.com
      263d6287
    • Alexandru Elisei's avatar
      Documentation: KVM: Document KVM_GUESTDBG_USE_HW control flag for arm64 · feb5dc3d
      Alexandru Elisei authored
      Commit 21b6f32f ("KVM: arm64: guest debug, define API headers") added
      the arm64 KVM_GUESTDBG_USE_HW flag for the KVM_SET_GUEST_DEBUG ioctl and
      commit 834bf887 ("KVM: arm64: enable KVM_CAP_SET_GUEST_DEBUG")
      documented and implemented the flag functionality. Since its introduction,
      at no point was the flag known by any name other than KVM_GUESTDBG_USE_HW
      for the arm64 architecture, so refer to it as such in the documentation.
      
      CC: Paolo Bonzini <pbonzini@redhat.com>
      Signed-off-by: default avatarAlexandru Elisei <alexandru.elisei@arm.com>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/20210407144857.199746-2-alexandru.elisei@arm.com
      feb5dc3d
  5. 06 Apr, 2021 16 commits
  6. 05 Apr, 2021 4 commits
    • Anshuman Khandual's avatar
      arm64: Add TRBE definitions · 3f9b72f6
      Anshuman Khandual authored
      This adds TRBE related registers and corresponding feature macros.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Reviewed-by: default avatarMike Leach <mike.leach@linaro.org>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-5-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      3f9b72f6
    • Suzuki K Poulose's avatar
      arm64: Add support for trace synchronization barrier · be968269
      Suzuki K Poulose authored
      tsb csync synchronizes the trace operation of instructions.
      The instruction is a nop when FEAT_TRF is not implemented.
      
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Acked-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-4-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      be968269
    • Suzuki K Poulose's avatar
      perf: aux: Add CoreSight PMU buffer formats · 7dde5176
      Suzuki K Poulose authored
      CoreSight PMU supports aux-buffer for the ETM tracing. The trace
      generated by the ETM (associated with individual CPUs, like Intel PT)
      is captured by a separate IP (CoreSight TMC-ETR/ETF until now).
      
      The TMC-ETR applies formatting of the raw ETM trace data, as it
      can collect traces from multiple ETMs, with the TraceID to indicate
      the source of a given trace packet.
      
      Arm Trace Buffer Extension is new "sink" IP, attached to individual
      CPUs and thus do not provide additional formatting, like TMC-ETR.
      
      Additionally, a system could have both TRBE *and* TMC-ETR for
      the trace collection. e.g, TMC-ETR could be used as a single
      trace buffer to collect data from multiple ETMs to correlate
      the traces from different CPUs. It is possible to have a
      perf session where some events end up collecting the trace
      in TMC-ETR while the others in TRBE. Thus we need a way
      to identify the type of the trace for each AUX record.
      
      Define the trace formats exported by the CoreSight PMU.
      We don't define the flags following the "ETM" as this
      information is available to the user when issuing
      the session. What is missing is the additional
      formatting applied by the "sink" which is decided
      at the runtime and the user may not have a control on.
      
      So we define :
       - CORESIGHT format (indicates the Frame format)
       - RAW format (indicates the format of the source)
      
      The default value is CORESIGHT format for all the records
      (i,e == 0). Add the RAW format for others that use
      raw format.
      
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Leo Yan <leo.yan@linaro.org>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: default avatarMike Leach <mike.leach@linaro.org>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-3-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      7dde5176
    • Suzuki K Poulose's avatar
      perf: aux: Add flags for the buffer format · 547b6098
      Suzuki K Poulose authored
      Allocate a byte for advertising the PMU specific format type
      of the given AUX record. A PMU could end up providing hardware
      trace data in multiple format in a single session.
      
      e.g, The format of hardware buffer produced by CoreSight ETM
      PMU depends on the type of the "sink" device used for collection
      for an event (Traditional TMC-ETR/Bs with formatting or
      TRBEs without any formatting).
      
       # Boring story of why this is needed. Goto The_End_of_Story for skipping.
      
      CoreSight ETM trace allows instruction level tracing of Arm CPUs.
      The ETM generates the CPU excecution trace and pumps it into CoreSight
      AMBA Trace Bus and is collected by a different CoreSight component
      (traditionally CoreSight TMC-ETR /ETB/ETF), called "sink".
      Important to note that there is no guarantee that every CPU has
      a dedicated sink.  Thus multiple ETMs could pump the trace data
      into the same "sink" and thus they apply additional formatting
      of the trace data for the user to decode it properly and attribute
      the trace data to the corresponding ETM.
      
      However, with the introduction of Arm Trace buffer Extensions (TRBE),
      we now have a dedicated per-CPU architected sink for collecting the
      trace. Since the TRBE is always per-CPU, it doesn't apply any formatting
      of the trace. The support for this driver is under review [1].
      
      Now a system could have a per-cpu TRBE and one or more shared
      TMC-ETRs on the system. A user could choose a "specific" sink
      for a perf session (e.g, a TMC-ETR) or the driver could automatically
      select the nearest sink for a given ETM. It is possible that
      some ETMs could end up using TMC-ETR (e.g, if the TRBE is not
      usable on the CPU) while the others using TRBE in a single
      perf session. Thus we now have "formatted" trace collected
      from TMC-ETR and "unformatted" trace collected from TRBE.
      However, we don't get into a situation where a single event
      could end up using TMC-ETR & TRBE. i.e, any AUX buffer is
      guaranteed to be either RAW or FORMATTED, but not a mix
      of both.
      
      As for perf decoding, we need to know the type of the data
      in the individual AUX buffers, so that it can set up the
      "OpenCSD" (library for decoding CoreSight trace) decoder
      instance appropriately. Thus the perf.data file must conatin
      the hints for the tool to decode the data correctly.
      
      Since this is a runtime variable, and perf tool doesn't have
      a control on what sink gets used (in case of automatic sink
      selection), we need this information made available from
      the PMU driver for each AUX record.
      
       # The_End_of_Story
      
      Cc: Peter Ziljstra <peterz@infradead.org>
      Cc: alexander.shishkin@linux.intel.com
      Cc: mingo@redhat.com
      Cc: will@kernel.org
      Cc: mark.rutland@arm.com
      Cc: mike.leach@linaro.org
      Cc: acme@kernel.org
      Cc: jolsa@redhat.com
      Cc: Mathieu Poirier <mathieu.poirer@linaro.org>
      Reviewed by: Mike Leach <mike.leach@linaro.org>
      Acked-by: default avatarPeter Ziljstra <peterz@infradead.org>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/20210405164307.1720226-2-suzuki.poulose@arm.comSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
      547b6098
  7. 31 Mar, 2021 1 commit
  8. 25 Mar, 2021 2 commits
  9. 24 Mar, 2021 2 commits
  10. 19 Mar, 2021 8 commits