diff mbox series

[2/4] KVM: arm64: ensure guest access to CTR_EL0 is trapped

Message ID 20240318111636.10613-3-sebott@redhat.com (mailing list archive)
State New, archived
Headers show
Series KVM: arm64: emulation for CTR_EL0 | expand

Commit Message

Sebastian Ott March 18, 2024, 11:16 a.m. UTC
Ensure that guest access to the CTR_EL0 register is trapped
independent of cpu errata.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 arch/arm64/include/asm/kvm_emulate.h | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Marc Zyngier March 18, 2024, 11:47 a.m. UTC | #1
On Mon, 18 Mar 2024 11:16:34 +0000,
Sebastian Ott <sebott@redhat.com> wrote:
> 
> Ensure that guest access to the CTR_EL0 register is trapped
> independent of cpu errata.
> 
> Signed-off-by: Sebastian Ott <sebott@redhat.com>
> ---
>  arch/arm64/include/asm/kvm_emulate.h | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> index b804fe832184..daaaf7664219 100644
> --- a/arch/arm64/include/asm/kvm_emulate.h
> +++ b/arch/arm64/include/asm/kvm_emulate.h
> @@ -91,12 +91,7 @@ static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
>  		vcpu->arch.hcr_el2 |= HCR_TVM;
>  	}
>  
> -	if (cpus_have_final_cap(ARM64_HAS_EVT) &&
> -	    !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE))
> -		vcpu->arch.hcr_el2 |= HCR_TID4;
> -	else
> -		vcpu->arch.hcr_el2 |= HCR_TID2;
> -
> +	vcpu->arch.hcr_el2 |= HCR_TID2;

NAK. This is a huge performance sync. You should only revert to this
when absolutely necessary.

	M.
diff mbox series

Patch

diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
index b804fe832184..daaaf7664219 100644
--- a/arch/arm64/include/asm/kvm_emulate.h
+++ b/arch/arm64/include/asm/kvm_emulate.h
@@ -91,12 +91,7 @@  static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
 		vcpu->arch.hcr_el2 |= HCR_TVM;
 	}
 
-	if (cpus_have_final_cap(ARM64_HAS_EVT) &&
-	    !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE))
-		vcpu->arch.hcr_el2 |= HCR_TID4;
-	else
-		vcpu->arch.hcr_el2 |= HCR_TID2;
-
+	vcpu->arch.hcr_el2 |= HCR_TID2;
 	if (vcpu_el1_is_32bit(vcpu))
 		vcpu->arch.hcr_el2 &= ~HCR_RW;