Skip to content

Commit 59c54c1

Browse files
committed
hw/intc/loongarch_ipi: Implement realize interface
Add realize interface for loongarch ipi device. Signed-off-by: Bibo Mao <[email protected]> Reviewed-by: Bibo Mao <[email protected]>
1 parent dd29117 commit 59c54c1

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

hw/intc/loongarch_ipi.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "qemu/osdep.h"
99
#include "hw/boards.h"
10+
#include "qapi/error.h"
1011
#include "hw/intc/loongarch_ipi.h"
1112
#include "target/loongarch/cpu.h"
1213

@@ -49,10 +50,26 @@ static CPUState *loongarch_cpu_by_arch_id(int64_t arch_id)
4950
return NULL;
5051
}
5152

53+
static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
54+
{
55+
LoongarchIPIClass *lic = LOONGARCH_IPI_GET_CLASS(dev);
56+
Error *local_err = NULL;
57+
58+
lic->parent_realize(dev, &local_err);
59+
if (local_err) {
60+
error_propagate(errp, local_err);
61+
return;
62+
}
63+
}
64+
5265
static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
5366
{
5467
LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass);
68+
LoongarchIPIClass *lic = LOONGARCH_IPI_CLASS(klass);
69+
DeviceClass *dc = DEVICE_CLASS(klass);
5570

71+
device_class_set_parent_realize(dc, loongarch_ipi_realize,
72+
&lic->parent_realize);
5673
licc->get_iocsr_as = get_iocsr_as;
5774
licc->cpu_by_arch_id = loongarch_cpu_by_arch_id;
5875
}
@@ -61,6 +78,8 @@ static const TypeInfo loongarch_ipi_types[] = {
6178
{
6279
.name = TYPE_LOONGARCH_IPI,
6380
.parent = TYPE_LOONGSON_IPI_COMMON,
81+
.instance_size = sizeof(LoongarchIPIState),
82+
.class_size = sizeof(LoongarchIPIClass),
6483
.class_init = loongarch_ipi_class_init,
6584
}
6685
};

include/hw/intc/loongarch_ipi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct LoongarchIPIState {
2020

2121
struct LoongarchIPIClass {
2222
LoongsonIPICommonClass parent_class;
23+
DeviceRealize parent_realize;
2324
};
2425

2526
#endif

0 commit comments

Comments
 (0)