• H
    irqchip/gic-v4: Fix occasional VLPI drop · 48ea47f0
    Heyi Guo 提交于
    mainline inclusion
    from mainline-5.0
    commit 6479450f72c1
    category: bugfix
    bugzilla: 9462
    CVE: NA
    
    -------------------------------------------------
    
    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: NHeyi Guo <guoheyi@huawei.com>
    Signed-off-by: NHeyi Guo <heyi.guo@linaro.org>
    Signed-off-by: NMarc Zyngier <marc.zyngier@arm.com>
    Signed-off-by: NBixuan Cui <cuibixuan@huawei.com>
    Reviewed-by: NHanjun Guo <guohanjun@huawei.com>
    Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
    48ea47f0
irq-gic-v3-its.c 97.8 KB