[PATCH v4 06/14] KVM: arm64: Set protected VM traps based on its view of feature registers
Quentin Perret
qperret at google.com
Fri Dec 6 09:31:57 PST 2024
On Monday 02 Dec 2024 at 15:47:33 (+0000), Fuad Tabba wrote:
> static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu)
> {
> - const u64 id_aa64pfr0 = pvm_read_id_reg(vcpu, SYS_ID_AA64PFR0_EL1);
> - const u64 id_aa64pfr1 = pvm_read_id_reg(vcpu, SYS_ID_AA64PFR1_EL1);
> - const u64 id_aa64mmfr1 = pvm_read_id_reg(vcpu, SYS_ID_AA64MMFR1_EL1);
> + struct kvm *kvm = vcpu->kvm;
> u64 val = vcpu->arch.hcr_el2;
>
> /* No support for AArch32. */
> @@ -70,25 +68,20 @@ static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu)
> */
> val |= HCR_TACR | HCR_TIDCP | HCR_TID3 | HCR_TID1;
>
> - /* Trap RAS unless all current versions are supported */
> - if (FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_RAS), id_aa64pfr0) <
> - ID_AA64PFR0_EL1_RAS_V1P1) {
> + if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, IMP)) {
I'm admittedly getting a bit lost in the kvm_has_feat() macro maze, but
should this be:
if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, V1P1))
to replicate the existing check?
> val |= HCR_TERR | HCR_TEA;
> val &= ~(HCR_FIEN);
> }
More information about the linux-arm-kernel
mailing list