Skip to content

Commit 558a7c8

Browse files
filippofontanajosecm
authored andcommitted
fix(riscv/interrupts): call generic IRQC function for sending IPIs
When using IMSIC, IPIs are sent through direct MSI write in the interrupt file of the target hart. The path through OpenSBI (sbi_send_ipi) is not suitable since SUPERVISOR SOFTWARE INTERRUPTS (SSI) are not enabled in this scenario. By using the generic irqc_send_ipi() function, the IPI sending process is handled correctly in all the possible configurations (PLIC, APLIC, IMSIC). Signed-off-by: Filippo Fontana <[email protected]> Signed-off-by: Jose Martins <[email protected]>
1 parent 9d0e29c commit 558a7c8

File tree

5 files changed

+7
-13
lines changed

5 files changed

+7
-13
lines changed

src/arch/riscv/interrupts.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void interrupts_arch_ipi_send(cpuid_t target_cpu)
4545
if (USE_ACLINT_IPI()) {
4646
aclint_send_ipi(target_cpu);
4747
} else {
48-
sbi_send_ipi(1UL << target_cpu, 0);
48+
irqc_send_ipi(target_cpu);
4949
}
5050
}
5151

src/arch/riscv/irqc/aia/imsic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,9 @@ void imsic_inject_pend(size_t guest_file, irqid_t intp_id)
8080
csrs_vsireg_clear(1UL << imsic_eie_bit(intp_id));
8181
}
8282

83-
void imsic_send_msi(cpuid_t target_cpu, irqid_t ipi_id)
83+
void imsic_send_msi(cpuid_t target_cpu)
8484
{
85-
imsic[target_cpu]->s_file.seteipnum_le = ipi_id;
85+
imsic[target_cpu]->s_file.seteipnum_le = interrupts_ipi_id;
8686
}
8787

8888
void imsic_handle(void)

src/arch/riscv/irqc/aia/inc/imsic.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,8 @@ void imsic_set_enbl(irqid_t intp_id);
7171
* Only little endian is supported.
7272
*
7373
* @param target_cpu The ID of the target CPU
74-
* @param imsic_file the target interrupt file.
75-
* 0 is the hypervisor interrupt file;
76-
* N is for guest N;
77-
* @param ipi_id The ID of the IPI to send.
7874
*/
79-
void imsic_send_msi(cpuid_t target_cpu, irqid_t ipi_id);
75+
void imsic_send_msi(cpuid_t target_cpu);
8076

8177
/**
8278
* @brief Inject an interrupt into a guest.

src/arch/riscv/irqc/aia/inc/irqc.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,12 @@ static inline irqid_t irqc_reserve(irqid_t pintp_id)
6464
#endif
6565
}
6666

67-
static inline void irqc_send_ipi(cpuid_t target_cpu, irqid_t ipi_id)
67+
static inline void irqc_send_ipi(cpuid_t target_cpu)
6868
{
6969
#if (IRQC == APLIC)
70-
UNUSED_ARG(ipi_id);
7170
sbi_send_ipi(1UL << target_cpu, 0);
7271
#elif (IRQC == AIA)
73-
imsic_send_msi(target_cpu, ipi_id);
72+
imsic_send_msi(target_cpu);
7473
#endif
7574
}
7675

src/arch/riscv/irqc/plic/inc/irqc.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@ static inline irqid_t irqc_reserve(irqid_t pintp_id)
3131
return pintp_id;
3232
}
3333

34-
static inline void irqc_send_ipi(cpuid_t target_cpu, irqid_t ipi_id)
34+
static inline void irqc_send_ipi(cpuid_t target_cpu)
3535
{
36-
UNUSED_ARG(ipi_id);
3736
sbi_send_ipi(1UL << target_cpu, 0);
3837
}
3938

0 commit comments

Comments
 (0)