From: Kunkun Jiang jiangkunkun@huawei.com
driver inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I9KBKD
------------------------------------------------------------------
The variable 'is_pending' is ineffective, and replace it with 'val' to fix the issue. Change the hisi cpu type hip09 to hip10.
Fixes: cb0003ae0500 ("irqchip: gicv3: Add workaround for hip09 erratum 162200806") Signed-off-by: Kunkun Jiang jiangkunkun@huawei.com --- Documentation/arch/arm64/silicon-errata.rst | 2 +- arch/arm64/kvm/vgic/vgic-mmio.c | 15 +++++++-------- arch/arm64/kvm/vgic/vgic-mmio.h | 2 +- drivers/irqchip/irq-gic-v3.c | 14 +++++++++----- 4 files changed, 18 insertions(+), 15 deletions(-)
diff --git a/Documentation/arch/arm64/silicon-errata.rst b/Documentation/arch/arm64/silicon-errata.rst index db761bb448b1..a79b22be9eb2 100644 --- a/Documentation/arch/arm64/silicon-errata.rst +++ b/Documentation/arch/arm64/silicon-errata.rst @@ -218,7 +218,7 @@ stable kernels. +----------------+-----------------+-----------------+-----------------------------+ | Hisilicon | Hip{10,10C} | #162200803 | N/A | +----------------+-----------------+-----------------+-----------------------------+ -| Hisilicon | Hip09 | #162200806 | N/A | +| Hisilicon | Hip10 | #162200806 | N/A | +----------------+-----------------+-----------------+-----------------------------+ | Qualcomm Tech. | Kryo/Falkor v1 | E1003 | QCOM_FALKOR_ERRATUM_1003 | +----------------+-----------------+-----------------+-----------------------------+ diff --git a/arch/arm64/kvm/vgic/vgic-mmio.c b/arch/arm64/kvm/vgic/vgic-mmio.c index 56549ee4313c..1b4a959601af 100644 --- a/arch/arm64/kvm/vgic/vgic-mmio.c +++ b/arch/arm64/kvm/vgic/vgic-mmio.c @@ -259,24 +259,23 @@ static unsigned long __read_pending(struct kvm_vcpu *vcpu,
if (irq->hw && vgic_irq_is_sgi(irq->intid) && (kvm_vgic_global_state.flags & - FLAGS_WORKAROUND_HIP09_ERRATUM_162200806)) { + FLAGS_WORKAROUND_HIP10_ERRATUM_162200806)) { void *va; u8 *ptr; int mask; - bool is_pending;
mask = BIT(irq->intid % BITS_PER_BYTE); va = page_address(vpe->vpt_page); ptr = va + VIRTUAL_SGI_PENDING_OFFSET + irq->intid / BITS_PER_BYTE; - is_pending = *ptr & mask; - } - - val = false; - err = irq_get_irqchip_state(irq->host_irq, + val = *ptr & mask; + } else { + val = false; + err = irq_get_irqchip_state(irq->host_irq, IRQCHIP_STATE_PENDING, &val); - WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); + WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); + } } else if (!is_user && vgic_irq_is_mapped_level(irq)) { val = vgic_get_phys_line_level(irq); } else { diff --git a/arch/arm64/kvm/vgic/vgic-mmio.h b/arch/arm64/kvm/vgic/vgic-mmio.h index b50235ffb002..bc6046b0fbbb 100644 --- a/arch/arm64/kvm/vgic/vgic-mmio.h +++ b/arch/arm64/kvm/vgic/vgic-mmio.h @@ -6,7 +6,7 @@ #define __KVM_ARM_VGIC_MMIO_H__
#define FLAGS_WORKAROUND_HIP10_ERRATUM_162200803 (1ULL << 4) -#define FLAGS_WORKAROUND_HIP09_ERRATUM_162200806 (1ULL << 5) +#define FLAGS_WORKAROUND_HIP10_ERRATUM_162200806 (1ULL << 5)
struct vgic_register_region { unsigned int reg_offset; diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 9a7a710aa281..4cc8b95d533f 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -46,7 +46,7 @@ #define FLAGS_WORKAROUND_MTK_GICR_SAVE (1ULL << 2) #define FLAGS_WORKAROUND_ASR_ERRATUM_8601001 (1ULL << 3) #define FLAGS_WORKAROUND_HIP10_ERRATUM_162200803 (1ULL << 4) -#define FLAGS_WORKAROUND_HIP09_ERRATUM_162200806 (1ULL << 5) +#define FLAGS_WORKAROUND_HIP10_ERRATUM_162200806 (1ULL << 5)
#define GIC_IRQ_TYPE_PARTITION (GIC_IRQ_TYPE_LPI + 1)
@@ -2125,11 +2125,11 @@ static bool gic_enable_quirk_hip10_10c_162200803(void *data) return true; }
-static bool __maybe_unused gic_enable_quirk_hip09_162200806(void *data) +static bool __maybe_unused gic_enable_quirk_hip10_162200806(void *data) { struct gic_chip_data *d = data;
- d->flags |= FLAGS_WORKAROUND_HIP09_ERRATUM_162200806; + d->flags |= FLAGS_WORKAROUND_HIP10_ERRATUM_162200806;
return true; } @@ -2218,10 +2218,10 @@ static const struct gic_quirk gic_quirks[] = { .init = gic_enable_quirk_hip10_10c_162200803, }, { - .desc = "GICv3: HIP09 erratum 162200806", + .desc = "GICv3: HIP10 erratum 162200806", .iidr = 0x01050736, .mask = 0xffffffff, - .init = gic_enable_quirk_hip09_162200806, + .init = gic_enable_quirk_hip10_162200806, }, { } @@ -2536,6 +2536,8 @@ static void __init gic_of_setup_kvm_info(struct device_node *node) #endif if (gic_v3_kvm_info.has_v4 && !gic_v3_kvm_info.has_v4_1) gic_v3_kvm_info.flags |= gic_data.flags & FLAGS_WORKAROUND_HIP10_ERRATUM_162200803; + if (gic_v3_kvm_info.has_v4_1) + gic_v3_kvm_info.flags |= gic_data.flags & FLAGS_WORKAROUND_HIP10_ERRATUM_162200806; vgic_set_kvm_info(&gic_v3_kvm_info); }
@@ -2890,6 +2892,8 @@ static void __init gic_acpi_setup_kvm_info(void) #endif if (gic_v3_kvm_info.has_v4 && !gic_v3_kvm_info.has_v4_1) gic_v3_kvm_info.flags |= gic_data.flags & FLAGS_WORKAROUND_HIP10_ERRATUM_162200803; + if (gic_v3_kvm_info.has_v4_1) + gic_v3_kvm_info.flags |= gic_data.flags & FLAGS_WORKAROUND_HIP10_ERRATUM_162200806; vgic_set_kvm_info(&gic_v3_kvm_info); }