• Heyi Guo's avatar
    irqchip/gic-v4: Fix occasional VLPI drop · 6479450f
    Heyi Guo authored
    1. In current implementation, every VLPI will temporarily be mapped to
    the first CPU in system (normally CPU0) and then moved to the real
    scheduled CPU later.
    
    2. So there is a time window and a VLPI may be sent to CPU0 instead of
    the real scheduled vCPU, in a multi-CPU virtual machine.
    
    3. However, CPU0 may have not been scheduled as a virtual CPU after
    system boots up, so the value of its GICR_VPROPBASER is unknown at
    that moment.
    
    4. If the INTID of VLPI is larger than 2^(GICR_VPROPBASER.IDbits+1),
    while IDbits is also in unknown state, GIC will behave as if the VLPI
    is out of range and simply drop it, which results in interrupt missing
    in Guest.
    
    As no code will clear GICR_VPROPBASER at runtime, we can safely
    initialize the IDbits field at boot time for each CPU to get rid of
    this issue.
    
    We also clear Valid bit of GICR_VPENDBASER in case any ancient
    programming gets left in and causes memory corrupting. A new function
    its_clear_vpend_valid() is added to reuse the code in
    its_vpe_deschedule().
    
    Fixes: e643d803 ("irqchip/gic-v3-its: Add VPE scheduling")
    Signed-off-by: default avatarHeyi Guo <guoheyi@huawei.com>
    Signed-off-by: default avatarHeyi Guo <heyi.guo@linaro.org>
    Signed-off-by: default avatarMarc Zyngier <marc.zyngier@arm.com>
    6479450f
irq-gic-v3-its.c 97.1 KB