qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Xiaojuan Yang <yangxiaojuan@loongson.cn>, qemu-devel@nongnu.org
Cc: mark.cave-ayland@ilande.co.uk, Song Gao <gaosong@loongson.cn>
Subject: Re: [RFC PATCH v7 20/29] hw/loongarch: Add irq hierarchy for the system
Date: Mon, 28 Mar 2022 17:16:22 -0600	[thread overview]
Message-ID: <e2738a15-f6e7-7d0b-7412-690c8363b7c9@linaro.org> (raw)
In-Reply-To: <20220328125749.2918087-21-yangxiaojuan@loongson.cn>

On 3/28/22 06:57, Xiaojuan Yang wrote:
> +static struct DeviceState *ipi, *extioi;

Static variables can't be right.
These need to be somewhere else, or ...

> @@ -107,12 +115,101 @@ static void loongarch_cpu_init(LoongArchCPU *la_cpu, int cpu_num)
>                             NULL, "iocsr_misc", IOCSR_MEM_SIZE);
>   
>       memory_region_add_subregion(&env->system_iocsr, 0, &env->iocsr_mem);
> +    /* ipi memory region */
> +    ipi_addr = SMP_IPI_MAILBOX + cpu_num * 0x100;
> +    memory_region_add_subregion(&env->system_iocsr, ipi_addr,
> +                                sysbus_mmio_get_region(SYS_BUS_DEVICE(ipi),
> +                                cpu_num));
> +    /* extioi memory region */
> +    memory_region_add_subregion(&env->system_iocsr, APIC_BASE,
> +                                sysbus_mmio_get_region(SYS_BUS_DEVICE(extioi),
> +                                cpu_num));

... this code needs to be moved somewhere else.

> +static void loongarch_irq_init(LoongArchMachineState *lams,
> +                               DeviceState *ipi, DeviceState *extioi)
> +{
> +    MachineState *ms = MACHINE(lams);
> +    DeviceState *pch_pic, *pch_msi, *cpudev;
> +
> +    SysBusDevice *d;
> +    int cpu, pin, i;
> +
> +    for (cpu = 0; cpu < ms->smp.cpus; cpu++) {
> +        cpudev = DEVICE(qemu_get_cpu(cpu));
> +        /* connect ipi irq to cpu irq */
> +        qdev_connect_gpio_out(ipi, cpu, qdev_get_gpio_in(cpudev, IRQ_IPI));
> +    }
> +
> +    for (i = 0; i < EXTIOI_IRQS; i++) {
> +        sysbus_connect_irq(SYS_BUS_DEVICE(extioi),
> +                           i, qdev_get_gpio_in(extioi, i));
> +    }

Um... connecting extioi to itself?

I think that graphic that you used in the description of patch 15 belongs here as a comment.

> diff --git a/include/hw/pci-host/ls7a.h b/include/hw/pci-host/ls7a.h
> new file mode 100644
> index 0000000000..bf80e99ce1
> --- /dev/null
> +++ b/include/hw/pci-host/ls7a.h
> @@ -0,0 +1,30 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +/*
> + * QEMU LoongArch CPU
> + *
> + * Copyright (c) 2021 Loongson Technology Corporation Limited
> + */
> +
> +#ifndef HW_LS7A_H
> +#define HW_LS7A_H
> +
> +#include "hw/pci/pci.h"
> +#include "hw/pci/pcie_host.h"
> +#include "hw/pci-host/pam.h"
> +#include "qemu/units.h"
> +#include "qemu/range.h"
> +#include "qom/object.h"
> +
> +#define LS7A_PCH_REG_BASE       0x10000000UL
> +#define LS7A_IOAPIC_REG_BASE    (LS7A_PCH_REG_BASE)
> +#define LS7A_PCH_MSI_ADDR_LOW   0x2FF00000UL
> +
> +/*
> + * According to the kernel pch irq start from 64 offset
> + * 0 ~ 16 irqs used for non-pci device while 16 ~ 64 irqs
> + * used for pci device.
> + */
> +#define PCH_PIC_IRQ_OFFSET      64
> +#define LS7A_DEVICE_IRQS        16
> +#define LS7A_PCI_IRQS           48
> +#endif

Why is this file in this patch?
It seems like it should be in either patch 17 or 18?


r~


  reply	other threads:[~2022-03-28 23:17 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 12:57 [RFC PATCH v7 00/29] Add LoongArch softmmu support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 01/29] target/loongarch: Add system emulation introduction Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 02/29] target/loongarch: Add CSRs definition Xiaojuan Yang
2022-03-28 19:16   ` Richard Henderson
2022-03-30 10:04     ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 03/29] target/loongarch: Add basic vmstate description of CPU Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 04/29] target/loongarch: Implement qmp_query_cpu_definitions() Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 05/29] target/loongarch: Add constant timer support Xiaojuan Yang
2022-03-28 19:46   ` Richard Henderson
2022-03-31  0:59     ` yangxiaojuan
2022-03-28 20:58   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 06/29] target/loongarch: Add MMU support for LoongArch CPU Xiaojuan Yang
2022-03-28 20:06   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 07/29] target/loongarch: Add LoongArch CSR instruction Xiaojuan Yang
2022-03-28 18:34   ` Richard Henderson
2022-03-30 10:01     ` yangxiaojuan
2022-03-30 13:46       ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 08/29] target/loongarch: Add LoongArch IOCSR instruction Xiaojuan Yang
2022-03-28 18:55   ` Richard Henderson
2022-03-30 10:02     ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 09/29] target/loongarch: Add TLB instruction support Xiaojuan Yang
2022-03-28 20:12   ` Richard Henderson
2022-03-31  1:09     ` yangxiaojuan
2022-03-28 22:50   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 10/29] target/loongarch: Add other core instructions support Xiaojuan Yang
2022-03-28 20:16   ` Richard Henderson
2022-03-31  1:22     ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 11/29] target/loongarch: Add LoongArch interrupt and exception handle Xiaojuan Yang
2022-03-28 20:19   ` Richard Henderson
2022-03-31  1:29     ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 12/29] target/loongarch: Add timer related instructions support Xiaojuan Yang
2022-03-28 20:33   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 13/29] target/loongarch: Add gdb support Xiaojuan Yang
2022-03-28 20:35   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 14/29] hw/loongarch: Add support loongson3 virt machine type Xiaojuan Yang
2022-03-28 20:49   ` Richard Henderson
2022-03-28 21:02     ` Mark Cave-Ayland
2022-04-15  7:52       ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 15/29] hw/loongarch: Add LoongArch cpu interrupt support(CPUINTC) Xiaojuan Yang
2022-03-28 20:57   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 16/29] hw/loongarch: Add LoongArch ipi interrupt support(IPI) Xiaojuan Yang
2022-03-28 20:15   ` Mark Cave-Ayland
2022-03-31  1:16     ` yangxiaojuan
2022-03-28 22:04   ` Richard Henderson
2022-03-28 22:06   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 17/29] hw/intc: Add LoongArch ls7a interrupt controller support(PCH-PIC) Xiaojuan Yang
2022-03-28 20:18   ` Mark Cave-Ayland
2022-03-31  1:25     ` yangxiaojuan
2022-03-28 12:57 ` [RFC PATCH v7 18/29] hw/intc: Add LoongArch ls7a msi interrupt controller support(PCH-MSI) Xiaojuan Yang
2022-03-28 20:22   ` Mark Cave-Ayland
2022-03-28 12:57 ` [RFC PATCH v7 19/29] hw/intc: Add LoongArch extioi interrupt controller(EIOINTC) Xiaojuan Yang
2022-03-28 20:27   ` Mark Cave-Ayland
2022-03-28 22:43   ` Richard Henderson
2022-03-31 12:28     ` yangxiaojuan
2022-03-28 22:46   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 20/29] hw/loongarch: Add irq hierarchy for the system Xiaojuan Yang
2022-03-28 23:16   ` Richard Henderson [this message]
2022-03-28 12:57 ` [RFC PATCH v7 21/29] Enable common virtio pci support for LoongArch Xiaojuan Yang
2022-03-28 23:18   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 22/29] hw/loongarch: Add some devices support for 3A5000 Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 23/29] hw/loongarch: Add LoongArch ls7a rtc device support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 24/29] hw/loongarch: Add default bios startup support Xiaojuan Yang
2022-03-29  3:27   ` Richard Henderson
2022-03-28 12:57 ` [RFC PATCH v7 25/29] hw/loongarch: Add -kernel and -initrd options support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 26/29] hw/loongarch: Add LoongArch smbios support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 27/29] hw/loongarch: Add LoongArch acpi support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 28/29] hw/loongarch: Add fdt support Xiaojuan Yang
2022-03-28 12:57 ` [RFC PATCH v7 29/29] tests/tcg/loongarch64: Add hello/memory test in loongarch64 system Xiaojuan Yang
2022-03-29  3:29   ` Richard Henderson
2022-03-28 18:13 ` [RFC PATCH v7 00/29] Add LoongArch softmmu support Richard Henderson
2022-03-30  9:34   ` yangxiaojuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2738a15-f6e7-7d0b-7412-690c8363b7c9@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=yangxiaojuan@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).