Skip to content

Commit

Permalink
hw/intc/loongarch_ipi: Bring back all 4 IPI mailboxes
Browse files Browse the repository at this point in the history
As per "Loongson 3A5000/3B5000 Processor Reference Manual",
Loongson 3A5000's IPI implementation have 4 mailboxes per
core.

However, in 78464f0 ("hw/loongarch/virt: Modify ipi as
percpu device"), the number of IPI mailboxes was reduced to
one, which mismatches actual hardware.

It won't affect LoongArch based system as LoongArch boot code
only uses the first mailbox, however MIPS based Loongson boot
code uses all 4 mailboxes.

Fixes Coverity CID: 1512452, 1512453
Fixes: 78464f0 ("hw/loongarch/virt: Modify ipi as percpu device")
Signed-off-by: Jiaxun Yang <[email protected]>
Reviewed-by: Song Gao <[email protected]>
Message-Id: <[email protected]>
Signed-off-by: Song Gao <[email protected]>
  • Loading branch information
FlyGoat authored and gaosong-loongson committed Jun 5, 2023
1 parent 848a6ca commit 8555ddc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions hw/intc/loongarch_ipi.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,14 @@ static void loongarch_ipi_init(Object *obj)

static const VMStateDescription vmstate_ipi_core = {
.name = "ipi-single",
.version_id = 1,
.minimum_version_id = 1,
.version_id = 2,
.minimum_version_id = 2,
.fields = (VMStateField[]) {
VMSTATE_UINT32(status, IPICore),
VMSTATE_UINT32(en, IPICore),
VMSTATE_UINT32(set, IPICore),
VMSTATE_UINT32(clear, IPICore),
VMSTATE_UINT32_ARRAY(buf, IPICore, 2),
VMSTATE_UINT32_ARRAY(buf, IPICore, IPI_MBX_NUM * 2),
VMSTATE_END_OF_LIST()
}
};
Expand Down
4 changes: 3 additions & 1 deletion include/hw/intc/loongarch_ipi.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
#define MAIL_SEND_OFFSET 0
#define ANY_SEND_OFFSET (IOCSR_ANY_SEND - IOCSR_MAIL_SEND)

#define IPI_MBX_NUM 4

#define TYPE_LOONGARCH_IPI "loongarch_ipi"
OBJECT_DECLARE_SIMPLE_TYPE(LoongArchIPI, LOONGARCH_IPI)

Expand All @@ -37,7 +39,7 @@ typedef struct IPICore {
uint32_t set;
uint32_t clear;
/* 64bit buf divide into 2 32bit buf */
uint32_t buf[2];
uint32_t buf[IPI_MBX_NUM * 2];
qemu_irq irq;
} IPICore;

Expand Down

0 comments on commit 8555ddc

Please sign in to comment.