* [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation
@ 2024-10-29 8:55 Yong-Xuan Wang
2024-11-05 5:11 ` Anup Patel
2024-12-11 22:32 ` patchwork-bot+linux-riscv
0 siblings, 2 replies; 3+ messages in thread
From: Yong-Xuan Wang @ 2024-10-29 8:55 UTC (permalink / raw)
To: linux-kernel, linux-riscv, kvm-riscv, kvm
Cc: greentime.hu, vincent.chen, Yong-Xuan Wang, Anup Patel,
Atish Patra, Paul Walmsley, Palmer Dabbelt, Albert Ou
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: d8dd9f113e16 ("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>
---
v2;
- add fixes tag (Anup)
- follow the suggestion from Anup
---
arch/riscv/kvm/aia_aplic.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/kvm/aia_aplic.c b/arch/riscv/kvm/aia_aplic.c
index da6ff1bade0d..f59d1c0c8c43 100644
--- a/arch/riscv/kvm/aia_aplic.c
+++ b/arch/riscv/kvm/aia_aplic.c
@@ -143,7 +143,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
if (sm == APLIC_SOURCECFG_SM_LEVEL_HIGH ||
sm == APLIC_SOURCECFG_SM_LEVEL_LOW) {
if (!pending)
- goto skip_write_pending;
+ goto noskip_write_pending;
if ((irqd->state & APLIC_IRQ_STATE_INPUT) &&
sm == APLIC_SOURCECFG_SM_LEVEL_LOW)
goto skip_write_pending;
@@ -152,6 +152,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
goto skip_write_pending;
}
+noskip_write_pending:
if (pending)
irqd->state |= APLIC_IRQ_STATE_PENDING;
else
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation
2024-10-29 8:55 [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation Yong-Xuan Wang
@ 2024-11-05 5:11 ` Anup Patel
2024-12-11 22:32 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: Anup Patel @ 2024-11-05 5:11 UTC (permalink / raw)
To: Yong-Xuan Wang
Cc: linux-kernel, linux-riscv, kvm-riscv, kvm, greentime.hu,
vincent.chen, Atish Patra, Paul Walmsley, Palmer Dabbelt,
Albert Ou
On Tue, Oct 29, 2024 at 2:25 PM Yong-Xuan Wang <yongxuan.wang@sifive.com> wrote:
>
> 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: d8dd9f113e16 ("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>
Looks good to me.
Reviewed-by: Anup Patel <anup@brainfault.org>
Queued this patch for Linux-6.13.
Thanks,
Anup
> ---
> v2;
> - add fixes tag (Anup)
> - follow the suggestion from Anup
> ---
> arch/riscv/kvm/aia_aplic.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/riscv/kvm/aia_aplic.c b/arch/riscv/kvm/aia_aplic.c
> index da6ff1bade0d..f59d1c0c8c43 100644
> --- a/arch/riscv/kvm/aia_aplic.c
> +++ b/arch/riscv/kvm/aia_aplic.c
> @@ -143,7 +143,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
> if (sm == APLIC_SOURCECFG_SM_LEVEL_HIGH ||
> sm == APLIC_SOURCECFG_SM_LEVEL_LOW) {
> if (!pending)
> - goto skip_write_pending;
> + goto noskip_write_pending;
> if ((irqd->state & APLIC_IRQ_STATE_INPUT) &&
> sm == APLIC_SOURCECFG_SM_LEVEL_LOW)
> goto skip_write_pending;
> @@ -152,6 +152,7 @@ static void aplic_write_pending(struct aplic *aplic, u32 irq, bool pending)
> goto skip_write_pending;
> }
>
> +noskip_write_pending:
> if (pending)
> irqd->state |= APLIC_IRQ_STATE_PENDING;
> else
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation
2024-10-29 8:55 [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation Yong-Xuan Wang
2024-11-05 5:11 ` Anup Patel
@ 2024-12-11 22:32 ` patchwork-bot+linux-riscv
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-12-11 22:32 UTC (permalink / raw)
To: Yong-Xuan Wang
Cc: linux-riscv, linux-kernel, kvm-riscv, kvm, greentime.hu,
vincent.chen, anup, atishp, paul.walmsley, palmer, aou
Hello:
This patch was applied to riscv/linux.git (fixes)
by Anup Patel <anup@brainfault.org>:
On Tue, 29 Oct 2024 16:55:39 +0800 you wrote:
> 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."
>
> [...]
Here is the summary with links:
- [v2,1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation
https://git.kernel.org/riscv/c/60821fb4dd73
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-11 22:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-29 8:55 [PATCH v2 1/1] RISC-V: KVM: Fix APLIC in_clrip and clripnum write emulation Yong-Xuan Wang
2024-11-05 5:11 ` Anup Patel
2024-12-11 22:32 ` patchwork-bot+linux-riscv
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox