diff options
| author | Bibo Mao <maobibo@loongson.cn> | 2025-01-07 11:08:18 +0800 |
|---|---|---|
| committer | Bibo Mao <maobibo@loongson.cn> | 2025-01-15 14:33:49 +0800 |
| commit | 999b112d90be8404547eec0793f8d7c0b5d2a547 (patch) | |
| tree | 4c2c9ddc1f7d5610d25e9bdf47619d23132b0f7c /hw/intc/loongarch_ipi.c | |
| parent | 1b3aa347044966a69e16a821eb44fbc16d0d58c9 (diff) | |
| download | focaccia-qemu-999b112d90be8404547eec0793f8d7c0b5d2a547.tar.gz focaccia-qemu-999b112d90be8404547eec0793f8d7c0b5d2a547.zip | |
hw/intc/loongson_ipi: Add more input parameter for cpu_by_arch_id
Add logic cpu index input parameter for function cpu_by_arch_id, CPUState::cpu_index is logic cpu slot index for possible_cpus. At the same time it is logic index with LoongsonIPICommonState::IPICore, here hide access for CPUState::cpu_index directly, it comes from function cpu_by_arch_id(). Signed-off-by: Bibo Mao <maobibo@loongson.cn> Reviewed-by: Bibo Mao <maobibo@loongson.cn>
Diffstat (limited to 'hw/intc/loongarch_ipi.c')
| -rw-r--r-- | hw/intc/loongarch_ipi.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/hw/intc/loongarch_ipi.c b/hw/intc/loongarch_ipi.c index 41d9625dcb..515549e8a5 100644 --- a/hw/intc/loongarch_ipi.c +++ b/hw/intc/loongarch_ipi.c @@ -38,17 +38,28 @@ static CPUArchId *find_cpu_by_archid(MachineState *ms, uint32_t id) return found_cpu; } -static CPUState *loongarch_cpu_by_arch_id(int64_t arch_id) +static int loongarch_cpu_by_arch_id(LoongsonIPICommonState *lics, + int64_t arch_id, int *index, CPUState **pcs) { MachineState *machine = MACHINE(qdev_get_machine()); CPUArchId *archid; + CPUState *cs; archid = find_cpu_by_archid(machine, arch_id); - if (archid) { - return CPU(archid->cpu); + if (archid && archid->cpu) { + cs = archid->cpu; + if (index) { + *index = cs->cpu_index; + } + + if (pcs) { + *pcs = cs; + } + + return MEMTX_OK; } - return NULL; + return MEMTX_ERROR; } static void loongarch_ipi_realize(DeviceState *dev, Error **errp) |