[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/31] target/loongarch: cpu: Implement get_arch_id callback
From: |
Song Gao |
Subject: |
[PULL 28/31] target/loongarch: cpu: Implement get_arch_id callback |
Date: |
Thu, 24 Aug 2023 17:24:06 +0800 |
From: Bibo Mao <maobibo@loongson.cn>
Implement the callback for getting the architecture-dependent CPU
ID, the cpu ID is physical id described in ACPI MADT table, this
will be used for cpu hotplug.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Reviewed-by: Song Gao <gaosong@loongson.cn>
Message-Id: <20230824005007.2000525-1-maobibo@loongson.cn>
Signed-off-by: Song Gao <gaosong@loongson.cn>
---
hw/loongarch/virt.c | 2 ++
target/loongarch/cpu.c | 8 ++++++++
target/loongarch/cpu.h | 1 +
3 files changed, 11 insertions(+)
diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
index af15bf5aaa..2629128aed 100644
--- a/hw/loongarch/virt.c
+++ b/hw/loongarch/virt.c
@@ -810,6 +810,8 @@ static void loongarch_init(MachineState *machine)
cpu = cpu_create(machine->cpu_type);
cpu->cpu_index = i;
machine->possible_cpus->cpus[i].cpu = OBJECT(cpu);
+ lacpu = LOONGARCH_CPU(cpu);
+ lacpu->phy_id = machine->possible_cpus->cpus[i].arch_id;
}
fdt_add_cpu_nodes(lams);
diff --git a/target/loongarch/cpu.c b/target/loongarch/cpu.c
index d3c3e0d8a1..27fc6e1f33 100644
--- a/target/loongarch/cpu.c
+++ b/target/loongarch/cpu.c
@@ -722,6 +722,13 @@ static struct TCGCPUOps loongarch_tcg_ops = {
static const struct SysemuCPUOps loongarch_sysemu_ops = {
.get_phys_page_debug = loongarch_cpu_get_phys_page_debug,
};
+
+static int64_t loongarch_cpu_get_arch_id(CPUState *cs)
+{
+ LoongArchCPU *cpu = LOONGARCH_CPU(cs);
+
+ return cpu->phy_id;
+}
#endif
static void loongarch_cpu_class_init(ObjectClass *c, void *data)
@@ -742,6 +749,7 @@ static void loongarch_cpu_class_init(ObjectClass *c, void
*data)
cc->set_pc = loongarch_cpu_set_pc;
cc->get_pc = loongarch_cpu_get_pc;
#ifndef CONFIG_USER_ONLY
+ cc->get_arch_id = loongarch_cpu_get_arch_id;
dc->vmsd = &vmstate_loongarch_cpu;
cc->sysemu_ops = &loongarch_sysemu_ops;
#endif
diff --git a/target/loongarch/cpu.h b/target/loongarch/cpu.h
index 25a0ef7e41..4d7201995a 100644
--- a/target/loongarch/cpu.h
+++ b/target/loongarch/cpu.h
@@ -376,6 +376,7 @@ struct ArchCPU {
CPUNegativeOffsetState neg;
CPULoongArchState env;
QEMUTimer timer;
+ uint32_t phy_id;
/* 'compatible' string for this CPU for Linux device trees */
const char *dtb_compatible;
--
2.39.1
- [PULL 29/31] hw/intc/loongarch_pch: fix edge triggered irq handling, (continued)
- [PULL 29/31] hw/intc/loongarch_pch: fix edge triggered irq handling, Song Gao, 2023/08/24
- [PULL 25/31] target/loongarch: Add avail_LAM to check atomic instructions, Song Gao, 2023/08/24
- [PULL 17/31] target/loongarch: Truncate high 32 bits of address in VA32 mode, Song Gao, 2023/08/24
- [PULL 21/31] target/loongarch: Add LoongArch32 cpu la132, Song Gao, 2023/08/24
- [PULL 19/31] target/loongarch: Add a check parameter to the TRANS macro, Song Gao, 2023/08/24
- [PULL 11/31] target/loongarch: Support LoongArch32 VPPN, Song Gao, 2023/08/24
- [PULL 26/31] target/loongarch: Add avail_LSX to check LSX instructions, Song Gao, 2023/08/24
- [PULL 31/31] hw/loongarch: Fix ACPI processor id off-by-one error, Song Gao, 2023/08/24
- [PULL 30/31] target/loongarch: Split fcc register to fcc0-7 in gdbstub, Song Gao, 2023/08/24
- [PULL 14/31] target/loongarch: Extract make_address_i() helper, Song Gao, 2023/08/24
- [PULL 28/31] target/loongarch: cpu: Implement get_arch_id callback,
Song Gao <=
- [PULL 10/31] target/loongarch: Support LoongArch32 DMW, Song Gao, 2023/08/24
- [PULL 13/31] target/loongarch: Extract make_address_x() helper, Song Gao, 2023/08/24
- Re: [PULL 00/31] loongarch-to-apply queue, Stefan Hajnoczi, 2023/08/24