From patchwork Fri Oct 20 16:36:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 736263 Delivered-To: patch@linaro.org Received: by 2002:adf:dd81:0:b0:32d:baff:b0ca with SMTP id x1csp400845wrl; Fri, 20 Oct 2023 09:40:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF5F/Gz+Z8ZucLUEmHu+dUf4XUreg8rCLAkVjgDAMLDdrWhLs9Fqy/WeaQ2E+PiV0SSG9Xz X-Received: by 2002:a05:620a:1a9f:b0:775:cf5f:8a77 with SMTP id bl31-20020a05620a1a9f00b00775cf5f8a77mr2630251qkb.34.1697820006162; Fri, 20 Oct 2023 09:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697820006; cv=none; d=google.com; s=arc-20160816; b=wcavHr2S+V2cdLocOuxv2DJlWam8MHQQE6rpQKJreAqaETLNNEnet9P1NztHTRtAjS ygSgqzGAeJaIELGfaV8v8sH1hLgYbvOjFZXDrQcTILzIVSVVgQ1Ry3+5HY0MAaTe4wv0 aXv8aaTXhpz7m6PJN90lYL+6BPCllu9ABSkP4d4WvI6YdFBSx/gVip+0aEej1a02gCJw urB2KbhDYE4ngaX6CAGQ+RGrVAXo8ow/PDIHQtgrrzEptXYPWeqsamW1b7OHa07iTKEP hY5FPwy58I0pKyfIM5Dct5UihkthOwzE58OE8W0gxfubZMGOLSoluGDsWqKMZxsvFs3Q 7Vmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lIfqIPgjXaT+HDThdwR33vMHRV/AQLZXNgmR/zi6+zY=; fh=Nz4lhZ0AnKqvLF3aq2NyUZF0BmcdTN93FX5XK7mwXmE=; b=JypcyZLE81gG/KtACRsJnF70nY0XkOA2B+P5Yj4w0unXzz11BfLt+ZETWFv5TRW61j 7EkyYfky9uj40xRLAn1SuiiuoOiMsqIhU15+Ta+K16Ij3L8dE3F3nfHpP9uPch9zsXII xoAy7lA3cDSElxPdTILzP1gURDzYSkwVy4OnN6fxa9jWK3YnxynQ+as2YH28lPP2ZUMJ gW9dSf4oFy3xW1jMUT6uFwxXiJDcLT5OsfhAvF07jmAv4IRknSTTTEeDQL1lN5SfZ+j6 NWSrdOtRbK29zwi3FhfZcr93BjQFvvzVEQ70yuJq8m2Od0dnEqkX1R9yZ36TnX/sSD5g ZOkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=szzuUPkK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i9-20020a05620a144900b00773d05a1403si1503299qkl.542.2023.10.20.09.40.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2023 09:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=szzuUPkK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtsVc-0003VN-UG; Fri, 20 Oct 2023 12:38:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qtsVY-0003J3-JA for qemu-devel@nongnu.org; Fri, 20 Oct 2023 12:37:58 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtsVN-0002WM-Ck for qemu-devel@nongnu.org; Fri, 20 Oct 2023 12:37:51 -0400 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-523100882f2so1512230a12.2 for ; Fri, 20 Oct 2023 09:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697819863; x=1698424663; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lIfqIPgjXaT+HDThdwR33vMHRV/AQLZXNgmR/zi6+zY=; b=szzuUPkKTNsnv2t0fwjExL1sKpkTOcPVMA6IXkOmzpnrB6qP9vnhOn1tVPm2tH9Liw vVGMXVNacKwDSP0whtCMpIfFZqkPBvnUFAad1CMTSPI594iBY7OgGZ5ZNMGNa+soJ90o PGPa53g1mBYrM7B4gPIQ7hVFQ53TnhSQHpZ8mKsjga5iiXngbpGjL60qLhTFOtzSVYYd ZWoaejGs8uBW4T4b1C0kCuaMZXG3UlspHvg8iRbbTWMGSlApDQ0hmFhz7+u3JHN1norT s1WTtyy7EaLtLqC1n48tEabRDjTNWRWc+Myh5KMWqdME90L4+B8kvSaJA0NypAluDTqA 7zkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697819863; x=1698424663; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lIfqIPgjXaT+HDThdwR33vMHRV/AQLZXNgmR/zi6+zY=; b=lBtkhvo/abPxmUQx1kQw8VgjeB3dY0rfLsLO4v2u9GV9EY8PXoE9iNlpQkaFvogiO/ Clj7TdFXUlCygoA+IFFJPF201aU8rKlyYQiFTKhDtgkA3XRHUAT7BZ9WVfB7MkiLiSxw E6iMRxPR1kOujZKP3EJWkpxu1x04176zVyIWSeZd4+rmpLujIUSkr3u/l7M9LID7uw8M oBl6AePu5J5b9Ouxmxg1x/9PVuZwXex34K0TAWwzDoEqV5sJsQOhRDSZYKGQmPecOJJn nQUakeD3v8EBV8WkHTNJJDNmEFhhvba+NMQIubkWlIWmkhR/A528DraaJQpbyToQIaZJ tTyg== X-Gm-Message-State: AOJu0YxeGseha8Fu/IcnTAPgkTIsE7tskUZPjv64xm4rcRXCuf184rE7 3GxwrvbuxTONYZ/sBn4rK4/aGaiWmZ+VHf7JyV8= X-Received: by 2002:a50:ab12:0:b0:530:7ceb:33c with SMTP id s18-20020a50ab12000000b005307ceb033cmr1872603edc.4.1697819863159; Fri, 20 Oct 2023 09:37:43 -0700 (PDT) Received: from m1x-phil.lan (tbo33-h01-176-171-212-97.dsl.sta.abo.bbox.fr. [176.171.212.97]) by smtp.gmail.com with ESMTPSA id m14-20020a50ef0e000000b0053f0e4e0411sm1747279eds.76.2023.10.20.09.37.40 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 20 Oct 2023 09:37:42 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Thomas Huth , Richard Henderson , Paolo Bonzini , Alistair Francis , qemu-arm@nongnu.org, qemu-riscv@nongnu.org, "Edgar E. Iglesias" , qemu-ppc@nongnu.org, Eduardo Habkost , "Michael S. Tsirkin" , qemu-s390x@nongnu.org, Peter Maydell , =?utf-8?q?Alex_Benn=C3=A9e?= , Zhao Liu , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Alistair Francis , Bin Meng , Palmer Dabbelt , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei Subject: [PATCH 07/19] cpus: Filter for target specific CPU (riscv) Date: Fri, 20 Oct 2023 18:36:29 +0200 Message-ID: <20231020163643.86105-8-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231020163643.86105-1-philmd@linaro.org> References: <20231020163643.86105-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::536; envelope-from=philmd@linaro.org; helo=mail-ed1-x536.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.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é --- 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 */