Skip to content
Snippets Groups Projects
  1. Jan 21, 2025
  2. Jan 17, 2025
    • Marc Zyngier's avatar
      arm64/sysreg: Get rid of TRFCR_ELx SysregFields · 01009b06
      Marc Zyngier authored
      
      There is no such thing as TRFCR_ELx in the architecture.
      What we have is TRFCR_EL1, for which TRFCR_EL12 is an accessor.
      
      Rename TRFCR_ELx_* to TRFCR_EL1_*, and fix the bit of code using
      these names.
      
      Similarly, TRFCR_EL12 is redefined as a mapping to TRFCR_EL1.
      
      Reviewed-by: default avatarJames Clark <james.clark@linaro.org>
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      Link: https://lore.kernel.org/r/87cygsqgkh.wl-maz@kernel.org
      Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      01009b06
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/misc-6.14 into kvmarm-master/next · fa5e4043
      Marc Zyngier authored
      
      * kvm-arm64/misc-6.14:
        : .
        : Misc KVM/arm64 changes for 6.14
        :
        : - Don't expose AArch32 EL0 capability when NV is enabled
        :
        : - Update documentation to reflect the full gamut of kvm-arm.mode
        :   behaviours
        :
        : - Use the hypervisor VA bit width when dumping stacktraces
        :
        : - Decouple the hypervisor stack size from PAGE_SIZE, at least
        :   on the surface...
        :
        : - Make use of str_enabled_disabled() when advertising GICv4.1 support
        :
        : - Explicitly handle BRBE traps as UNDEFINED
        : .
        KVM: arm64: Explicitly handle BRBE traps as UNDEFINED
        KVM: arm64: vgic: Use str_enabled_disabled() in vgic_v3_probe()
        arm64: kvm: Introduce nvhe stack size constants
        KVM: arm64: Fix nVHE stacktrace VA bits mask
        Documentation: Update the behaviour of "kvm-arm.mode"
        KVM: arm64: nv: Advertise the lack of AArch32 EL0 support
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      fa5e4043
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/nv-resx-fixes-6.14 into kvmarm-master/next · 3643b334
      Marc Zyngier authored
      
      * kvm-arm64/nv-resx-fixes-6.14:
        : .
        : Fixes for NV sysreg accessors. From the cover letter:
        :
        : "Joey recently reported that some rather basic tests were failing on
        : NV, and managed to track it down to critical register fields (such as
        : HCR_EL2.E2H) not having their expect value.
        :
        : Further investigation has outlined a couple of critical issues:
        :
        : - Evaluating HCR_EL2.E2H must always be done with a sanitising
        :   accessor, no ifs, no buts. Given that KVM assumes a fixed value for
        :   this bit, we cannot leave it to the guest to mess with.
        :
        : - Resetting the sysreg file must result in the RESx bits taking
        :   effect. Otherwise, we may end-up making the wrong decision (see
        :   above), and we definitely expose invalid values to the guest. Note
        :   that because we compute the RESx masks very late in the VM setup, we
        :   need to apply these masks at that particular point as well.
        : [...]"
        : .
        KVM: arm64: nv: Apply RESx settings to sysreg reset values
        KVM: arm64: nv: Always evaluate HCR_EL2 using sanitising accessors
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      
      # Conflicts:
      #	arch/arm64/kvm/nested.c
      3643b334
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/coresight-6.14 into kvmarm-master/next · 946904e7
      Marc Zyngier authored
      
      * kvm-arm64/coresight-6.14:
        : .
        : Trace filtering update from James Clark. From the cover letter:
        :
        : "The guest filtering rules from the Perf session are now honored for both
        : nVHE and VHE modes. This is done by either writing to TRFCR_EL12 at the
        : start of the Perf session and doing nothing else further, or caching the
        : guest value and writing it at guest switch for nVHE. In pKVM, trace is
        : now be disabled for both protected and unprotected guests."
        : .
        KVM: arm64: Fix selftests after sysreg field name update
        coresight: Pass guest TRFCR value to KVM
        KVM: arm64: Support trace filtering for guests
        KVM: arm64: coresight: Give TRBE enabled state to KVM
        coresight: trbe: Remove redundant disable call
        arm64/sysreg/tools: Move TRFCR definitions to sysreg
        tools: arm64: Update sysreg.h header files
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      946904e7
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/pkvm-memshare-declutter into kvmarm-master/next · 5e68d2ee
      Marc Zyngier authored
      
      * kvm-arm64/pkvm-memshare-declutter:
        : .
        : pKVM memory transition simplifications, courtesy of Quentin Perret.
        :
        : From the cover letter:
        : "Since its early days, pKVM has formalized memory 'transitions' (shares
        : and donations) using 'struct pkvm_mem_transition' and bunch of helpers
        : to manipulate it. The intention was for all transitions to use this
        : machinery to ensure we're checking things consistently. However, as
        : development progressed, it became clear that the rigidity of this model
        : made it really difficult to use in some use-cases which ended-up
        : side-stepping it entirely. That is the case for the
        : hyp_{un}pin_shared_mem() and host_{un}share_guest() paths upstream which
        : use lower level helpers directly, as well as for several other pKVM
        : features that should land upstream in the future (ex: when a guest
        : relinquishes a page during ballooning, when annotating a page that is
        : being DMA'd to, ...). On top of this, the pkvm_mem_transition machinery
        : requires a lot of boilerplate which makes the code hard to read, but
        : also adds layers of indirection that no compilers seems to see through,
        : hence leading to suboptimal generated code.
        :
        : Given all the above, this series removes the pkvm_mem_transition
        : machinery from mem_protect.c, and converts all its users to use
        : __*_{check,set}_page_state_range() low-level helpers directly."
        : .
        KVM: arm64: Drop pkvm_mem_transition for host/hyp donations
        KVM: arm64: Drop pkvm_mem_transition for host/hyp sharing
        KVM: arm64: Drop pkvm_mem_transition for FF-A
        KVM: arm64: Only apply PMCR_EL0.P to the guest range of counters
        KVM: arm64: nv: Reload PMU events upon MDCR_EL2.HPME change
        KVM: arm64: Use KVM_REQ_RELOAD_PMU to handle PMCR_EL0.E change
        KVM: arm64: Add unified helper for reprogramming counters by mask
        KVM: arm64: Always check the state from hyp_ack_unshare()
        KVM: arm64: Fix set_id_regs selftest for ASIDBITS becoming unwritable
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      5e68d2ee
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/nv-timers into kvmarm-master/next · 080612b2
      Marc Zyngier authored
      
      * kvm-arm64/nv-timers:
        : .
        : Nested Virt support for the EL2 timers. From the initial cover letter:
        :
        : "Here's another batch of NV-related patches, this time bringing in most
        : of the timer support for EL2 as well as nested guests.
        :
        : The code is pretty convoluted for a bunch of reasons:
        :
        : - FEAT_NV2 breaks the timer semantics by redirecting HW controls to
        :   memory, meaning that a guest could setup a timer and never see it
        :   firing until the next exit
        :
        : - We go try hard to reflect the timer state in memory, but that's not
        :   great.
        :
        : - With FEAT_ECV, we can finally correctly emulate the virtual timer,
        :   but this emulation is pretty costly
        :
        : - As a way to make things suck less, we handle timer reads as early as
        :   possible, and only defer writes to the normal trap handling
        :
        : - Finally, some implementations are badly broken, and require some
        :   hand-holding, irrespective of NV support. So we try and reuse the NV
        :   infrastructure to make them usable. This could be further optimised,
        :   but I'm running out of patience for this sort of HW.
        :
        : [...]"
        : .
        KVM: arm64: nv: Fix doc header layout for timers
        KVM: arm64: nv: Document EL2 timer API
        KVM: arm64: Work around x1e's CNTVOFF_EL2 bogosity
        KVM: arm64: nv: Sanitise CNTHCTL_EL2
        KVM: arm64: nv: Propagate CNTHCTL_EL2.EL1NV{P,V}CT bits
        KVM: arm64: nv: Add trap routing for CNTHCTL_EL2.EL1{NVPCT,NVVCT,TVT,TVCT}
        KVM: arm64: Handle counter access early in non-HYP context
        KVM: arm64: nv: Accelerate EL0 counter accesses from hypervisor context
        KVM: arm64: nv: Accelerate EL0 timer read accesses when FEAT_ECV in use
        KVM: arm64: nv: Use FEAT_ECV to trap access to EL0 timers
        KVM: arm64: nv: Publish emulated timer interrupt state in the in-memory state
        KVM: arm64: nv: Sync nested timer state with FEAT_NV2
        KVM: arm64: nv: Add handling of EL2-specific timer registers
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      080612b2
  3. Jan 16, 2025
  4. Jan 14, 2025
  5. Jan 13, 2025
  6. Jan 12, 2025
    • James Clark's avatar
      coresight: Pass guest TRFCR value to KVM · aaf69eff
      James Clark authored
      
      Currently the userspace and kernel filters for guests are never set, so
      no trace will be generated for them. Add support for tracing guests by
      passing the desired TRFCR value to KVM so it can be applied to the
      guest.
      
      By writing either E1TRE or E0TRE, filtering on either guest kernel or
      guest userspace is also supported. And if both E1TRE and E0TRE are
      cleared when exclude_guest is set, that option is supported too. This
      change also brings exclude_host support which is difficult to add as a
      separate commit without excess churn and resulting in no trace at all.
      
      cpu_prohibit_trace() gets moved to TRBE because the ETM driver doesn't
      need the read, it already has the base TRFCR value. TRBE only needs
      the read to disable it and then restore.
      
      Testing
      =======
      
      The addresses were counted with the following:
      
        $ perf report -D | grep -Eo 'EL2|EL1|EL0' | sort | uniq -c
      
      Guest kernel only:
      
        $ perf record -e cs_etm//Gk -a -- true
          535 EL1
            1 EL2
      
      Guest user only (only 5 addresses because the guest runs slowly in the
      model):
      
        $ perf record -e cs_etm//Gu -a -- true
          5 EL0
      
      Host kernel only:
      
        $  perf record -e cs_etm//Hk -a -- true
         3501 EL2
      
      Host userspace only:
      
        $  perf record -e cs_etm//Hu -a -- true
          408 EL0
            1 EL2
      
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Link: https://lore.kernel.org/r/20250106142446.628923-8-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      aaf69eff
    • James Clark's avatar
      KVM: arm64: Support trace filtering for guests · 054b8839
      James Clark authored
      
      For nVHE, switch the filter value in and out if the Coresight driver
      asks for it. This will support filters for guests when sinks other than
      TRBE are used.
      
      For VHE, just write the filter directly to TRFCR_EL1 where trace can be
      used even with TRBE sinks.
      
      Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
      Link: https://lore.kernel.org/r/20250106142446.628923-7-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      054b8839
    • James Clark's avatar
      KVM: arm64: coresight: Give TRBE enabled state to KVM · a665e3bc
      James Clark authored
      
      Currently in nVHE, KVM has to check if TRBE is enabled on every guest
      switch even if it was never used. Because it's a debug feature and is
      more likely to not be used than used, give KVM the TRBE buffer status to
      allow a much simpler and faster do-nothing path in the hyp.
      
      Protected mode now disables trace regardless of TRBE (because
      trfcr_while_in_guest is always 0), which was not previously done.
      However, it continues to flush whenever the buffer is enabled
      regardless of the filter status. This avoids the hypothetical case of a
      host that had disabled the filter but not flushed which would arise if
      only doing the flush when the filter was enabled.
      
      Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
      Link: https://lore.kernel.org/r/20250106142446.628923-6-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      a665e3bc
    • James Clark's avatar
      coresight: trbe: Remove redundant disable call · a2b579c4
      James Clark authored
      
      trbe_drain_and_disable_local() just clears TRBLIMITR and drains.
      TRBLIMITR is already cleared on the next line after this call, so
      replace it with only drain. This is so we can make a kvm call that has a
      preempt enabled warning from set_trbe_disabled() in the next commit,
      where trbe_reset_local() is called from a preemptible hotplug path.
      
      Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
      Link: https://lore.kernel.org/r/20250106142446.628923-5-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      a2b579c4
    • James Clark's avatar
      arm64/sysreg/tools: Move TRFCR definitions to sysreg · c382ee67
      James Clark authored
      
      Convert TRFCR to automatic generation. Add separate definitions for ELx
      and EL2 as TRFCR_EL1 doesn't have CX. This also mirrors the previous
      definition so no code change is required.
      
      Also add TRFCR_EL12 which will start to be used in a later commit.
      
      Unfortunately, to avoid breaking the Perf build with duplicate
      definition errors, the tools copy of the sysreg.h header needs to be
      updated at the same time rather than the usual second commit. This is
      because the generated version of sysreg
      (arch/arm64/include/generated/asm/sysreg-defs.h), is currently shared
      and tools/ does not have its own copy.
      
      Reviewed-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
      Link: https://lore.kernel.org/r/20250106142446.628923-4-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      c382ee67
    • James Clark's avatar
      tools: arm64: Update sysreg.h header files · 38138762
      James Clark authored
      
      Created with the following:
      
        cp include/linux/kasan-tags.h tools/include/linux/
        cp arch/arm64/include/asm/sysreg.h tools/arch/arm64/include/asm/
      
      Update the tools copy of sysreg.h so that the next commit to add a new
      register doesn't have unrelated changes in it. Because the new version
      of sysreg.h includes kasan-tags.h, that file also now needs to be copied
      into tools.
      
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Reviewed-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: default avatarJames Clark <james.clark@arm.com>
      Signed-off-by: default avatarJames Clark <james.clark@linaro.org>
      Link: https://lore.kernel.org/r/20250106142446.628923-3-james.clark@linaro.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      38138762
    • Quentin Perret's avatar
      KVM: arm64: Drop pkvm_mem_transition for host/hyp donations · 6f91d31d
      Quentin Perret authored
      
      Simplify the __pkvm_host_donate_hyp() and pkvm_hyp_donate_host() paths
      by not using the pkvm_mem_transition machinery. As the last users of
      this, also remove all the now unused code.
      
      No functional changes intended.
      
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Link: https://lore.kernel.org/r/20250110121936.1559655-4-qperret@google.com
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      6f91d31d
    • Quentin Perret's avatar
      KVM: arm64: Drop pkvm_mem_transition for host/hyp sharing · 7cbf7c37
      Quentin Perret authored
      
      Simplify the __pkvm_host_{un}share_hyp() paths by not using the
      pkvm_mem_transition machinery. As there are the last users of the
      do_share()/do_unshare(), remove all the now-unused code as well.
      
      No functional changes intended.
      
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Link: https://lore.kernel.org/r/20250110121936.1559655-3-qperret@google.com
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      7cbf7c37
    • Quentin Perret's avatar
      KVM: arm64: Drop pkvm_mem_transition for FF-A · 7a068883
      Quentin Perret authored
      
      Simplify the __pkvm_host_{un}share_ffa() paths by using
      {check,set}_page_state_range().
      
      No functional changes intended.
      
      Signed-off-by: default avatarQuentin Perret <qperret@google.com>
      Link: https://lore.kernel.org/r/20250110121936.1559655-2-qperret@google.com
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      7a068883
    • Marc Zyngier's avatar
      Merge branch 'kvmarm-fixes-6.13-3' · 60f20d82
      Marc Zyngier authored
      60f20d82
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/pkvm-fixed-features-6.14 into kvmarm-master/next · e880b16e
      Marc Zyngier authored
      
      * kvm-arm64/pkvm-fixed-features-6.14: (24 commits)
        : .
        : Complete rework of the pKVM handling of features, catching up
        : with the rest of the code deals with it these days.
        : Patches courtesy of Fuad Tabba. From the cover letter:
        :
        : "This patch series uses the vm's feature id registers to track the
        : supported features, a framework similar to nested virt to set the
        : trap values, and removes the need to store cptr_el2 per vcpu in
        : favor of setting its value when traps are activated, as VHE mode
        : does."
        :
        : This branch drags the arm64/for-next/cpufeature branch to solve
        : ugly conflicts in -next.
        : .
        KVM: arm64: Fix FEAT_MTE in pKVM
        KVM: arm64: Use kvm_vcpu_has_feature() directly for struct kvm
        KVM: arm64: Convert the SVE guest vcpu flag to a vm flag
        KVM: arm64: Remove PtrAuth guest vcpu flag
        KVM: arm64: Fix the value of the CPTR_EL2 RES1 bitmask for nVHE
        KVM: arm64: Refactor kvm_reset_cptr_el2()
        KVM: arm64: Calculate cptr_el2 traps on activating traps
        KVM: arm64: Remove redundant setting of HCR_EL2 trap bit
        KVM: arm64: Remove fixed_config.h header
        KVM: arm64: Rework specifying restricted features for protected VMs
        KVM: arm64: Set protected VM traps based on its view of feature registers
        KVM: arm64: Fix RAS trapping in pKVM for protected VMs
        KVM: arm64: Initialize feature id registers for protected VMs
        KVM: arm64: Use KVM extension checks for allowed protected VM capabilities
        KVM: arm64: Remove KVM_ARM_VCPU_POWER_OFF from protected VMs allowed features in pKVM
        KVM: arm64: Move checking protected vcpu features to a separate function
        KVM: arm64: Group setting traps for protected VMs by control register
        KVM: arm64: Consolidate allowed and restricted VM feature checks
        arm64/sysreg: Get rid of CPACR_ELx SysregFields
        arm64/sysreg: Convert *_EL12 accessors to Mapping
        ...
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      
      # Conflicts:
      #	arch/arm64/kvm/fpsimd.c
      #	arch/arm64/kvm/hyp/nvhe/pkvm.c
      e880b16e
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/pkvm-np-guest into kvmarm-master/next · d0670128
      Marc Zyngier authored
      
      * kvm-arm64/pkvm-np-guest:
        : .
        : pKVM support for non-protected guests using the standard MM
        : infrastructure, courtesy of Quentin Perret. From the cover letter:
        :
        : "This series moves the stage-2 page-table management of non-protected
        : guests to EL2 when pKVM is enabled. This is only intended as an
        : incremental step towards a 'feature-complete' pKVM, there is however a
        : lot more that needs to come on top.
        :
        : With that series applied, pKVM provides near-parity with standard KVM
        : from a functional perspective all while Linux no longer touches the
        : stage-2 page-tables itself at EL1. The majority of mm-related KVM
        : features work out of the box, including MMU notifiers, dirty logging,
        : RO memslots and things of that nature. There are however two gotchas:
        :
        :  - We don't support mapping devices into guests: this requires
        :    additional hypervisor support for tracking the 'state' of devices,
        :    which will come in a later series. No device assignment until then.
        :
        :  - Stage-2 mappings are forced to page-granularity even when backed by a
        :    huge page for the sake of simplicity of this series. I'm only aiming
        :    at functional parity-ish (from userspace's PoV) for now, support for
        :    HP can be added on top later as a perf improvement."
        : .
        KVM: arm64: Plumb the pKVM MMU in KVM
        KVM: arm64: Introduce the EL1 pKVM MMU
        KVM: arm64: Introduce __pkvm_tlb_flush_vmid()
        KVM: arm64: Introduce __pkvm_host_mkyoung_guest()
        KVM: arm64: Introduce __pkvm_host_test_clear_young_guest()
        KVM: arm64: Introduce __pkvm_host_wrprotect_guest()
        KVM: arm64: Introduce __pkvm_host_relax_guest_perms()
        KVM: arm64: Introduce __pkvm_host_unshare_guest()
        KVM: arm64: Introduce __pkvm_host_share_guest()
        KVM: arm64: Introduce __pkvm_vcpu_{load,put}()
        KVM: arm64: Add {get,put}_pkvm_hyp_vm() helpers
        KVM: arm64: Make kvm_pgtable_stage2_init() a static inline function
        KVM: arm64: Pass walk flags to kvm_pgtable_stage2_relax_perms
        KVM: arm64: Pass walk flags to kvm_pgtable_stage2_mkyoung
        KVM: arm64: Move host page ownership tracking to the hyp vmemmap
        KVM: arm64: Make hyp_page::order a u8
        KVM: arm64: Move enum pkvm_page_state to memory.h
        KVM: arm64: Change the layout of enum pkvm_page_state
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      
      # Conflicts:
      #	arch/arm64/kvm/arm.c
      d0670128
    • Marc Zyngier's avatar
      Merge branch kvm-arm64/debug-6.14 into kvmarm-master/next · b7bf7c87
      Marc Zyngier authored
      
      * kvm-arm64/debug-6.14:
        : .
        : Large rework of the debug code to make it a bit less horrid,
        : courtesy of Oliver Upton. From the original cover letter:
        :
        : "The debug code has become a bit difficult to reason about, especially
        : all the hacks and bandaids for state tracking + trap configuration.
        :
        : This series reworks the entire mess around using a single enumeration to
        : track the state of the debug registers (free, guest-owned, host-owned),
        : using that to drive trap configuration and save/restore.
        :
        : On top of that, this series wires most of the implementation into vCPU
        : load/put rather than the main KVM_RUN loop. This has been a long time
        : coming for VHE, as a lot of the trap configuration and EL1 state gets
        : loaded into hardware at that point anyway.
        :
        : The save/restore of the debug registers is simplified quite a bit as
        : well. KVM will now restore the registers for *any* access rather than
        : just writes, and keep doing so until the next vcpu_put() instead of
        : dropping it on the floor after the next exception."
        : .
        KVM: arm64: Promote guest ownership for DBGxVR/DBGxCR reads
        KVM: arm64: Fold DBGxVR/DBGxCR accessors into common set
        KVM: arm64: Avoid reading ID_AA64DFR0_EL1 for debug save/restore
        KVM: arm64: nv: Honor MDCR_EL2.TDE routing for debug exceptions
        KVM: arm64: Manage software step state at load/put
        KVM: arm64: Don't hijack guest context MDSCR_EL1
        KVM: arm64: Compute MDCR_EL2 at vcpu_load()
        KVM: arm64: Reload vCPU for accesses to OSLAR_EL1
        KVM: arm64: Use debug_owner to track if debug regs need save/restore
        KVM: arm64: Remove vestiges of debug_ptr
        KVM: arm64: Remove debug tracepoints
        KVM: arm64: Select debug state to save/restore based on debug owner
        KVM: arm64: Clean up KVM_SET_GUEST_DEBUG handler
        KVM: arm64: Evaluate debug owner at vcpu_load()
        KVM: arm64: Write MDCR_EL2 directly from kvm_arm_setup_mdcr_el2()
        KVM: arm64: Move host SME/SVE tracking flags to host data
        KVM: arm64: Track presence of SPE/TRBE in kvm_host_data instead of vCPU
        KVM: arm64: Get rid of __kvm_get_mdcr_el2() and related warts
        KVM: arm64: Drop MDSCR_EL1_DEBUG_MASK
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      b7bf7c87
  7. Jan 11, 2025
    • Marc Zyngier's avatar
      Merge remote-tracking branch 'arm64/for-next/cpufeature' into kvm-arm64/pkvm-fixed-features-6.14 · 4e26de25
      Marc Zyngier authored
      
      Merge arm64/for-next/cpufeature to solve extensive conflicts
      caused by the CPACR_ELx->CPACR_EL1 repainting.
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      4e26de25
    • Mark Rutland's avatar
      KVM: arm64: Explicitly handle BRBE traps as UNDEFINED · a7f1fa55
      Mark Rutland authored
      The Branch Record Buffer Extension (BRBE) adds a number of system
      registers and instructions which we don't currently intend to expose to
      guests. Our existing logic handles this safely, but this could be
      improved with some explicit handling of BRBE.
      
      KVM currently hides BRBE from guests: the cpufeature code's
      ftr_id_aa64dfr0[] table doesn't have an entry for the BRBE field, and so
      this will be zero in the sanitised value of ID_AA64DFR0 exposed to
      guests via read_sanitised_id_aa64dfr0_el1().
      
      KVM currently traps BRBE usage from guests: the default configuration of
      the fine-grained trap controls HDFGRTR_EL2.{nBRBDATA,nBRBCTL,nBRBIDR}
      and HFGITR_EL2.{nBRBINJ_nBRBIALL} cause these to be trapped to EL2.
      
      Well-behaved guests shouldn't try to use the registers or instructions,
      but badly-behaved guests could use these, resulting in unnecessary
      warnings from KVM before it injects an UNDEF, e.g.
      
      | kvm [197]: Unsupported guest access at: 401c98
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 0), Op2( 0), func_read },
      | kvm [197]: Unsupported guest access at: 401d04
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 0), Op2( 1), func_read },
      | kvm [197]: Unsupported guest access at: 401d70
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 2), Op2( 0), func_read },
      | kvm [197]: Unsupported guest access at: 401ddc
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 1), Op2( 0), func_read },
      | kvm [197]: Unsupported guest access at: 401e48
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 1), Op2( 1), func_read },
      | kvm [197]: Unsupported guest access at: 401eb4
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 1), Op2( 2), func_read },
      | kvm [197]: Unsupported guest access at: 401f20
      |  { Op0( 2), Op1( 1), CRn( 9), CRm( 0), Op2( 2), func_read },
      | kvm [197]: Unsupported guest access at: 401f8c
      |  { Op0( 1), Op1( 1), CRn( 7), CRm( 2), Op2( 4), func_write },
      | kvm [197]: Unsupported guest access at: 401ff8
      |  { Op0( 1), Op1( 1), CRn( 7), CRm( 2), Op2( 5), func_write },
      
      As with other features that we know how to handle, these warnings aren't
      particularly interesting, and we can simply treat these as UNDEFINED
      without any warning. Add the necessary fine-grained undef configuration
      to make this happen, as suggested by Marc Zyngier:
      
        https://lore.kernel.org/linux-arm-kernel/86r0czk6wd.wl-maz@kernel.org/
      
      
      
      At the same time, update read_sanitised_id_aa64dfr0_el1() to hide BRBE
      from guests, as we do for SPE. This will prevent accidentally exposing
      BRBE to guests if/when ftr_id_aa64dfr0[] gains a BRBE entry.
      
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Signed-off-by: default avatarRob Herring (Arm) <robh@kernel.org>
      Link: https://lore.kernel.org/r/20250109223836.419240-1-robh@kernel.org
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      a7f1fa55
    • Thorsten Blum's avatar
      KVM: arm64: vgic: Use str_enabled_disabled() in vgic_v3_probe() · dea88381
      Thorsten Blum authored
      
      Remove hard-coded strings by using the str_enabled_disabled() helper
      function.
      
      Suggested-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarThorsten Blum <thorsten.blum@linux.dev>
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Link: https://lore.kernel.org/r/20250110225310.369980-2-thorsten.blum@linux.dev
      
      
      Signed-off-by: default avatarMarc Zyngier <maz@kernel.org>
      dea88381
  8. Jan 08, 2025
  9. Jan 02, 2025
Loading