mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 09:13:55 -06:00
hw/intc/loongarch_ipi: Add basic hotplug framework
LoongArch ipi can send interrupt to multiple CPUs, interrupt routing to CPU comes from destination physical cpu id. Here hotplug interface is added for IPI object, so that parent irq line can be connected, and routing table can be added for new created cpu. Here only basic hotplug framework is added, it is stub function. Signed-off-by: Bibo Mao <maobibo@loongson.cn>
This commit is contained in:
parent
661c2e1ab2
commit
9d71149a64
1 changed files with 32 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/boards.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/intc/loongarch_ipi.h"
|
||||
|
@ -76,9 +77,34 @@ static void loongarch_ipi_realize(DeviceState *dev, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
static void loongarch_ipi_cpu_plug(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
Object *obj = OBJECT(dev);
|
||||
|
||||
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
|
||||
warn_report("LoongArch extioi: Invalid %s device type",
|
||||
object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void loongarch_ipi_cpu_unplug(HotplugHandler *hotplug_dev,
|
||||
DeviceState *dev, Error **errp)
|
||||
{
|
||||
Object *obj = OBJECT(dev);
|
||||
|
||||
if (!object_dynamic_cast(obj, TYPE_LOONGARCH_CPU)) {
|
||||
warn_report("LoongArch extioi: Invalid %s device type",
|
||||
object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
LoongsonIPICommonClass *licc = LOONGSON_IPI_COMMON_CLASS(klass);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);
|
||||
LoongarchIPIClass *lic = LOONGARCH_IPI_CLASS(klass);
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
|
@ -86,6 +112,8 @@ static void loongarch_ipi_class_init(ObjectClass *klass, void *data)
|
|||
&lic->parent_realize);
|
||||
licc->get_iocsr_as = get_iocsr_as;
|
||||
licc->cpu_by_arch_id = loongarch_cpu_by_arch_id;
|
||||
hc->plug = loongarch_ipi_cpu_plug;
|
||||
hc->unplug = loongarch_ipi_cpu_unplug;
|
||||
}
|
||||
|
||||
static const TypeInfo loongarch_ipi_types[] = {
|
||||
|
@ -95,6 +123,10 @@ static const TypeInfo loongarch_ipi_types[] = {
|
|||
.instance_size = sizeof(LoongarchIPIState),
|
||||
.class_size = sizeof(LoongarchIPIClass),
|
||||
.class_init = loongarch_ipi_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_HOTPLUG_HANDLER },
|
||||
{ }
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue