qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Thomas Huth" <thuth@redhat.com>,
	"Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	qemu-arm@nongnu.org, qemu-riscv@nongnu.org,
	"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
	qemu-ppc@nongnu.org, "Eduardo Habkost" <eduardo@habkost.net>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-s390x@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
	"Alex Bennée" <alex.bennee@linaro.org>,
	"Zhao Liu" <zhao1.liu@intel.com>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Palmer Dabbelt" <palmer@dabbelt.com>,
	"Weiwei Li" <liweiwei@iscas.ac.cn>,
	"Daniel Henrique Barboza" <dbarboza@ventanamicro.com>,
	"Liu Zhiwei" <zhiwei_liu@linux.alibaba.com>
Subject: [PATCH 07/19] cpus: Filter for target specific CPU (riscv)
Date: Fri, 20 Oct 2023 18:36:29 +0200	[thread overview]
Message-ID: <20231020163643.86105-8-philmd@linaro.org> (raw)
In-Reply-To: <20231020163643.86105-1-philmd@linaro.org>

Enforce qemu_get_cpu() to return RISCV CPUs in RISCV specific files.

Mechanical change using the following coccinelle script:

  @@ expression index; @@
  -   qemu_get_cpu(index, NULL)
  +   qemu_get_cpu(index, TYPE_RISCV_CPU)

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/intc/sifive_plic.c | 2 +-
 hw/riscv/boot.c       | 2 +-
 hw/riscv/opentitan.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/intc/sifive_plic.c b/hw/intc/sifive_plic.c
index 3e2534ac04..ea0e7af16e 100644
--- a/hw/intc/sifive_plic.c
+++ b/hw/intc/sifive_plic.c
@@ -499,7 +499,7 @@ DeviceState *sifive_plic_create(hwaddr addr, char *hart_config,
 
     for (i = 0; i < plic->num_addrs; i++) {
         int cpu_num = plic->addr_config[i].hartid;
-        CPUState *cpu = qemu_get_cpu(cpu_num, NULL);
+        CPUState *cpu = qemu_get_cpu(cpu_num, TYPE_RISCV_CPU);
 
         if (plic->addr_config[i].mode == PLICMode_M) {
             qdev_connect_gpio_out(dev, cpu_num - hartid_base + num_harts,
diff --git a/hw/riscv/boot.c b/hw/riscv/boot.c
index ea733b3df1..1d004660d4 100644
--- a/hw/riscv/boot.c
+++ b/hw/riscv/boot.c
@@ -49,7 +49,7 @@ char *riscv_plic_hart_config_string(int hart_count)
     int i;
 
     for (i = 0; i < hart_count; i++) {
-        CPUState *cs = qemu_get_cpu(i, NULL);
+        CPUState *cs = qemu_get_cpu(i, TYPE_RISCV_CPU);
         CPURISCVState *env = &RISCV_CPU(cs)->env;
 
         if (kvm_enabled()) {
diff --git a/hw/riscv/opentitan.c b/hw/riscv/opentitan.c
index e98361de19..106ef5d2d0 100644
--- a/hw/riscv/opentitan.c
+++ b/hw/riscv/opentitan.c
@@ -190,7 +190,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
     sysbus_mmio_map(SYS_BUS_DEVICE(&s->plic), 0, memmap[IBEX_DEV_PLIC].base);
 
     for (i = 0; i < ms->smp.cpus; i++) {
-        CPUState *cpu = qemu_get_cpu(i, NULL);
+        CPUState *cpu = qemu_get_cpu(i, TYPE_RISCV_CPU);
 
         qdev_connect_gpio_out(DEVICE(&s->plic), ms->smp.cpus + i,
                               qdev_get_gpio_in(DEVICE(cpu), IRQ_M_EXT));
@@ -223,7 +223,7 @@ static void lowrisc_ibex_soc_realize(DeviceState *dev_soc, Error **errp)
                        0, qdev_get_gpio_in(DEVICE(&s->plic),
                        IBEX_TIMER_TIMEREXPIRED0_0));
     qdev_connect_gpio_out(DEVICE(&s->timer), 0,
-                          qdev_get_gpio_in(DEVICE(qemu_get_cpu(0, NULL)),
+                          qdev_get_gpio_in(DEVICE(qemu_get_cpu(0, TYPE_RISCV_CPU)),
                                            IRQ_M_TIMER));
 
     /* SPI-Hosts */
-- 
2.41.0



  parent reply	other threads:[~2023-10-20 16:40 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-20 16:36 [PATCH 00/19] cpus: Step toward removing global 'first_cpu' Philippe Mathieu-Daudé
2023-10-20 16:36 ` [RFC PATCH 01/19] cpus: Add argument to qemu_get_cpu() to filter CPUs by QOM type Philippe Mathieu-Daudé
2023-10-20 17:14   ` Peter Maydell
2023-10-20 17:29     ` Philippe Mathieu-Daudé
2023-10-20 17:40       ` Peter Maydell
2023-10-23 14:21   ` Zhao Liu
2023-10-23 15:12   ` David Woodhouse
2023-10-20 16:36 ` [PATCH 02/19] cpus: Filter for target specific CPU (generic) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 03/19] cpus: Filter for target specific CPU (arm) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 04/19] cpus: Filter for target specific CPU (loongarch) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 05/19] cpus: Filter for target specific CPU (mips) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 06/19] cpus: Filter for target specific CPU (s390x) Philippe Mathieu-Daudé
2023-10-20 16:36 ` Philippe Mathieu-Daudé [this message]
2023-10-20 16:36 ` [PATCH 08/19] cpus: Filter for target specific CPU (ppc) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 09/19] cpus: Filter for target specific CPU (x86) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 10/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_ARM_CPU) Philippe Mathieu-Daudé
2023-10-20 16:53   ` Cédric Le Goater
2023-10-20 16:36 ` [PATCH 11/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_POWERPC_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 12/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_MIPS_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 13/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_M68K_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 14/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_S390X_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 15/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_RISCV_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 16/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_TRICORE_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 17/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_SUPERH_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 18/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_RX_CPU) Philippe Mathieu-Daudé
2023-10-20 16:36 ` [PATCH 19/19] cpus: Replace first_cpu by qemu_get_cpu(0, TYPE_X86_CPU) Philippe Mathieu-Daudé
2023-10-23 13:59 ` [PATCH 00/19] cpus: Step toward removing global 'first_cpu' Zhao Liu

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=20231020163643.86105-8-philmd@linaro.org \
    --to=philmd@linaro.org \
    --cc=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=bin.meng@windriver.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=liweiwei@iscas.ac.cn \
    --cc=mst@redhat.com \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    --cc=zhao1.liu@intel.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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).