mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-09 02:24:58 -06:00
hw: intc: Use cpu_by_arch_id to fetch CPU state
Qemu_get_cpu uses the logical CPU id assigned during init to fetch the CPU state. However APLIC, IMSIC and ACLINT contain registers and states which are specific to physical hart Ids. The hart Ids in any given system might be sparse and hence calls to qemu_get_cpu need to be replaced by cpu_by_arch_id which performs lookup based on the sparse physical hart IDs. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com> Message-ID: <20230303065055.915652-3-mchitale@ventanamicro.com> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
This commit is contained in:
parent
f1bd6f8ef6
commit
64452a09c5
3 changed files with 13 additions and 13 deletions
|
@ -316,8 +316,8 @@ static const MemoryRegionOps riscv_imsic_ops = {
|
|||
static void riscv_imsic_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
RISCVIMSICState *imsic = RISCV_IMSIC(dev);
|
||||
RISCVCPU *rcpu = RISCV_CPU(qemu_get_cpu(imsic->hartid));
|
||||
CPUState *cpu = qemu_get_cpu(imsic->hartid);
|
||||
RISCVCPU *rcpu = RISCV_CPU(cpu_by_arch_id(imsic->hartid));
|
||||
CPUState *cpu = cpu_by_arch_id(imsic->hartid);
|
||||
CPURISCVState *env = cpu ? cpu->env_ptr : NULL;
|
||||
|
||||
imsic->num_eistate = imsic->num_pages * imsic->num_irqs;
|
||||
|
@ -413,7 +413,7 @@ DeviceState *riscv_imsic_create(hwaddr addr, uint32_t hartid, bool mmode,
|
|||
uint32_t num_pages, uint32_t num_ids)
|
||||
{
|
||||
DeviceState *dev = qdev_new(TYPE_RISCV_IMSIC);
|
||||
CPUState *cpu = qemu_get_cpu(hartid);
|
||||
CPUState *cpu = cpu_by_arch_id(hartid);
|
||||
uint32_t i;
|
||||
|
||||
assert(!(addr & (IMSIC_MMIO_PAGE_SZ - 1)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue