summary refs log tree commit diff stats
path: root/hw/intc
diff options
context:
space:
mode:
authorBibo Mao <maobibo@loongson.cn>2024-09-20 15:49:12 +0800
committerBibo Mao <maobibo@loongson.cn>2024-12-19 15:23:29 +0800
commitaa6330d50ccf7467a022dc348ab6ae2323c2b0b9 (patch)
tree839e9121b676c340ffe3d509c516889d82884225 /hw/intc
parentc169b51b1720c2722bfacb83896cd7100859ee4c (diff)
downloadfocaccia-qemu-aa6330d50ccf7467a022dc348ab6ae2323c2b0b9.tar.gz
focaccia-qemu-aa6330d50ccf7467a022dc348ab6ae2323c2b0b9.zip
hw/intc/loongarch_extioi: Add common realize interface
Add common realize function, it is only to check validity of property.

Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Diffstat (limited to 'hw/intc')
-rw-r--r--hw/intc/loongarch_extioi.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/hw/intc/loongarch_extioi.c b/hw/intc/loongarch_extioi.c
index 039fc4dd1e..dcc278a214 100644
--- a/hw/intc/loongarch_extioi.c
+++ b/hw/intc/loongarch_extioi.c
@@ -318,14 +318,26 @@ static const MemoryRegionOps extioi_virt_ops = {
     .endianness = DEVICE_LITTLE_ENDIAN,
 };
 
+static void loongarch_extioi_common_realize(DeviceState *dev, Error **errp)
+{
+    LoongArchExtIOICommonState *s = (LoongArchExtIOICommonState *)dev;
+
+    if (s->num_cpu == 0) {
+        error_setg(errp, "num-cpu must be at least 1");
+        return;
+    }
+}
+
 static void loongarch_extioi_realize(DeviceState *dev, Error **errp)
 {
     LoongArchExtIOI *s = LOONGARCH_EXTIOI(dev);
     SysBusDevice *sbd = SYS_BUS_DEVICE(dev);
+    Error *local_err = NULL;
     int i, pin;
 
-    if (s->num_cpu == 0) {
-        error_setg(errp, "num-cpu must be at least 1");
+    loongarch_extioi_common_realize(dev, &local_err);
+    if (local_err) {
+        error_propagate(errp, local_err);
         return;
     }