Skip to content

Commit 60821fb

Browse files
yong-xuanavpatel
authored andcommitted
RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation
In the section "4.7 Precise effects on interrupt-pending bits" of the RISC-V AIA specification defines that: "If the source mode is Level1 or Level0 and the interrupt domain is configured in MSI delivery mode (domaincfg.DM = 1): The pending bit is cleared whenever the rectified input value is low, when the interrupt is forwarded by MSI, or by a relevant write to an in_clrip register or to clripnum." Update the aplic_write_pending() to match the spec. Fixes: d8dd9f1 ("RISC-V: KVM: Fix APLIC setipnum_le/be write emulation") Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com> Reviewed-by: Vincent Chen <vincent.chen@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20241029085542.30541-1-yongxuan.wang@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
1 parent 5bdecd8 commit 60821fb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/riscv/kvm/aia_aplic.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
143143
if (sm == APLIC_SOURCECFG_SM_LEVEL_HIGH ||
144144
sm == APLIC_SOURCECFG_SM_LEVEL_LOW) {
145145
if (!pending)
146-
goto skip_write_pending;
146+
goto noskip_write_pending;
147147
if ((irqd->state & APLIC_IRQ_STATE_INPUT) &&
148148
sm == APLIC_SOURCECFG_SM_LEVEL_LOW)
149149
goto skip_write_pending;
@@ -152,6 +152,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
152152
goto skip_write_pending;
153153
}
154154

155+
noskip_write_pending:
155156
if (pending)
156157
irqd->state |= APLIC_IRQ_STATE_PENDING;
157158
else

0 commit comments

Comments
 (0)