RISC-V: KVM: Fix APLIC in_clrip[x] read emulation
authorAnup Patel <apatel@ventanamicro.com>
Thu, 21 Mar 2024 08:50:41 +0000 (14:20 +0530)
committerAnup Patel <anup@brainfault.org>
Tue, 26 Mar 2024 04:10:55 +0000 (09:40 +0530)
commit8e936e98718f005c986be0bfa1ee6b355acf96be
treeabd4452da97f4956e435554661b05f8d97a1c63a
parentd8dd9f113e16bef3b29c9dcceb584a6f144f55e4
RISC-V: KVM: Fix APLIC in_clrip[x] read emulation

The reads to APLIC in_clrip[x] registers returns rectified input values
of the interrupt sources.

A rectified input value of an interrupt source is defined by the section
"4.5.2 Source configurations (sourcecfg[1]–sourcecfg[1023])" of the
RISC-V AIA specification as:

    rectified input value = (incoming wire value) XOR (source is inverted)

Update the riscv_aplic_input() implementation to match the above.

Cc: stable@vger.kernel.org
Fixes: 74967aa208e2 ("RISC-V: KVM: Add in-kernel emulation of AIA APLIC")
Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240321085041.1955293-3-apatel@ventanamicro.com
arch/riscv/kvm/aia_aplic.c