mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
KVM: arm64: Disable guest access to trace filter controls
Disable guest access to the Trace Filter control registers. We do not advertise the Trace filter feature to the guest (ID_AA64DFR0_EL1: TRACE_FILT is cleared) already, but the guest can still access the TRFCR_EL1 unless we trap it. This will also make sure that the guest cannot fiddle with the filtering controls set by a nvhe host. Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20210323120647.454211-3-suzuki.poulose@arm.com
This commit is contained in:
parent
1d676673d6
commit
a354a64d91
2 changed files with 3 additions and 0 deletions
|
@ -278,6 +278,7 @@
|
||||||
#define CPTR_EL2_DEFAULT CPTR_EL2_RES1
|
#define CPTR_EL2_DEFAULT CPTR_EL2_RES1
|
||||||
|
|
||||||
/* Hyp Debug Configuration Register bits */
|
/* Hyp Debug Configuration Register bits */
|
||||||
|
#define MDCR_EL2_TTRF (1 << 19)
|
||||||
#define MDCR_EL2_TPMS (1 << 14)
|
#define MDCR_EL2_TPMS (1 << 14)
|
||||||
#define MDCR_EL2_E2PB_MASK (UL(0x3))
|
#define MDCR_EL2_E2PB_MASK (UL(0x3))
|
||||||
#define MDCR_EL2_E2PB_SHIFT (UL(12))
|
#define MDCR_EL2_E2PB_SHIFT (UL(12))
|
||||||
|
|
|
@ -89,6 +89,7 @@ void kvm_arm_reset_debug_ptr(struct kvm_vcpu *vcpu)
|
||||||
* - Debug ROM Address (MDCR_EL2_TDRA)
|
* - Debug ROM Address (MDCR_EL2_TDRA)
|
||||||
* - OS related registers (MDCR_EL2_TDOSA)
|
* - OS related registers (MDCR_EL2_TDOSA)
|
||||||
* - Statistical profiler (MDCR_EL2_TPMS/MDCR_EL2_E2PB)
|
* - Statistical profiler (MDCR_EL2_TPMS/MDCR_EL2_E2PB)
|
||||||
|
* - Self-hosted Trace Filter controls (MDCR_EL2_TTRF)
|
||||||
*
|
*
|
||||||
* Additionally, KVM only traps guest accesses to the debug registers if
|
* Additionally, KVM only traps guest accesses to the debug registers if
|
||||||
* the guest is not actively using them (see the KVM_ARM64_DEBUG_DIRTY
|
* the guest is not actively using them (see the KVM_ARM64_DEBUG_DIRTY
|
||||||
|
@ -112,6 +113,7 @@ void kvm_arm_setup_debug(struct kvm_vcpu *vcpu)
|
||||||
vcpu->arch.mdcr_el2 = __this_cpu_read(mdcr_el2) & MDCR_EL2_HPMN_MASK;
|
vcpu->arch.mdcr_el2 = __this_cpu_read(mdcr_el2) & MDCR_EL2_HPMN_MASK;
|
||||||
vcpu->arch.mdcr_el2 |= (MDCR_EL2_TPM |
|
vcpu->arch.mdcr_el2 |= (MDCR_EL2_TPM |
|
||||||
MDCR_EL2_TPMS |
|
MDCR_EL2_TPMS |
|
||||||
|
MDCR_EL2_TTRF |
|
||||||
MDCR_EL2_TPMCR |
|
MDCR_EL2_TPMCR |
|
||||||
MDCR_EL2_TDRA |
|
MDCR_EL2_TDRA |
|
||||||
MDCR_EL2_TDOSA);
|
MDCR_EL2_TDOSA);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue