[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 2/8] hw/intc/loongarch_ipi: Implement realize interface
From: |
Bibo Mao |
Subject: |
[PULL 2/8] hw/intc/loongarch_ipi: Implement realize interface |
Date: |
Thu, 16 Jan 2025 10:17:04 +0800 |
Add realize interface for loongarch ipi device.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Bibo Mao <maobibo@loongson.cn>
---
hw/intc/loongarch_ipi.c | 19 +++++++++++++++++++
include/hw/intc/loongarch_ipi.h | 1 +
2 files changed, 20 insertions(+)
diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c
index 2ae1a42c46..4e2f9acddf 100644
--- a/hw/intc/loongarch_ipi.c
+++ b/hw/intc/loongarch_ipi.c
@@ -7,6 +7,7 @@
#include "qemu/osdep.h"
#include "hw/boards.h"
+#include "qapi/error.h"
#include "hw/intc/loongarch_ipi.h"
#include "target/loongarch/cpu.h"
@@ -49,10 +50,26 @@ static CPUState *loongarch_cpu_by_arch_id(int64_t arch_id)
return NULL;
}
+static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
+{
+ LoongarchIPIClass *lic = LOONGARCH_IPI_GET_CLASS(dev);
+ Error *local_err = NULL;
+
+ lic->parent_realize(dev, &local_err);
+ if (local_err) {
+ error_propagate(errp, local_err);
+ return;
+ }
+}
+
static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
{
LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass);
+ LoongarchIPIClass *lic = LOONGARCH_IPI_CLASS(klass);
+ DeviceClass *dc = DEVICE_CLASS(klass);
+ device_class_set_parent_realize(dc, loongarch_ipi_realize,
+ &lic->parent_realize);
licc->get_iocsr_as = get_iocsr_as;
licc->cpu_by_arch_id = loongarch_cpu_by_arch_id;
}
@@ -61,6 +78,8 @@ static const TypeInfo loongarch_ipi_types[] = {
{
.name = TYPE_LOONGARCH_IPI,
.parent = TYPE_LOONGSON_IPI_COMMON,
+ .instance_size = sizeof(LoongarchIPIState),
+ .class_size = sizeof(LoongarchIPIClass),
.class_init = loongarch_ipi_class_init,
}
};
diff --git a/include/hw/intc/loongarch_ipi.h b/include/hw/intc/loongarch_ipi.h
index 276b3040a3..923bf21ecb 100644
--- a/include/hw/intc/loongarch_ipi.h
+++ b/include/hw/intc/loongarch_ipi.h
@@ -20,6 +20,7 @@ struct LoongarchIPIState {
struct LoongarchIPIClass {
LoongsonIPICommonClass parent_class;
+ DeviceRealize parent_realize;
};
#endif
--
2.43.5
- [PULL 0/8] loongarch-to-apply queue, Bibo Mao, 2025/01/15
- [PULL 3/8] hw/intc/loongson_ipi: Remove num_cpu from loongson_ipi_common, Bibo Mao, 2025/01/15
- [PULL 8/8] hw/intc/loongarch_ipi: Use alternative implemation for cpu_by_arch_id, Bibo Mao, 2025/01/15
- [PULL 6/8] hw/intc/loongarch_ipi: Remove property num-cpu, Bibo Mao, 2025/01/15
- [PULL 1/8] target/loongarch: Add page table walker support for debugger usage, Bibo Mao, 2025/01/15
- [PULL 4/8] hw/intc/loongson_ipi: Remove property num_cpu from loongson_ipi_common, Bibo Mao, 2025/01/15
- [PULL 5/8] hw/intc/loongarch_ipi: Get cpu number from possible_cpu_arch_ids, Bibo Mao, 2025/01/15
- [PULL 2/8] hw/intc/loongarch_ipi: Implement realize interface,
Bibo Mao <=
- [PULL 7/8] hw/intc/loongson_ipi: Add more input parameter for cpu_by_arch_id, Bibo Mao, 2025/01/15