Skip to content

Commit af040a9

Browse files
rhythm16Marc Zyngier
authored andcommitted
KVM: arm64: nv: Fix MI line level calculation in vgic_v3_nested_update_mi()
The state of the vcpu's MI line should be asserted when its ICH_HCR_EL2.En is set and ICH_MISR_EL2 is non-zero. Using bitwise AND (&=) directly for this calculation will not give us the correct result when the LSB of the vcpu's ICH_MISR_EL2 isn't set. Correct this by directly computing the line level with a logical AND operation. Signed-off-by: Wei-Lin Chang <[email protected]> Link: https://lore.kernel.org/r/[email protected] [maz: drop the level check from the original code] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 04c5355 commit af040a9

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

arch/arm64/kvm/vgic/vgic-v3-nested.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,7 @@ void vgic_v3_nested_update_mi(struct kvm_vcpu *vcpu)
401401
{
402402
bool level;
403403

404-
level = __vcpu_sys_reg(vcpu, ICH_HCR_EL2) & ICH_HCR_EL2_En;
405-
if (level)
406-
level &= vgic_v3_get_misr(vcpu);
404+
level = (__vcpu_sys_reg(vcpu, ICH_HCR_EL2) & ICH_HCR_EL2_En) && vgic_v3_get_misr(vcpu);
407405
kvm_vgic_inject_irq(vcpu->kvm, vcpu,
408406
vcpu->kvm->arch.vgic.mi_intid, level, vcpu);
409407
}

0 commit comments

Comments
 (0)