From patchwork Tue Jan 21 16:18:14 2025 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: 858986 Delivered-To: patch@linaro.org Received: by 2002:adf:fb47:0:b0:385:e875:8a9e with SMTP id c7csp279546wrs; Tue, 21 Jan 2025 08:18:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWGmmWC5UKhbFSLGBdiNX3E4cbYqy+GK8EETxez34OdzVceymJkzjhN8xyY0NSz6Z4lXNqzdw==@linaro.org X-Google-Smtp-Source: AGHT+IH/VxmHC5d86sQshyiIqtYk2lE0aSGUNWN6RIozZkqwcDAKNdPzAWzLKH2D3esLW3Vb35SP X-Received: by 2002:a05:622a:15c9:b0:467:800f:f475 with SMTP id d75a77b69052e-46e12a583efmr253319451cf.19.1737476337350; Tue, 21 Jan 2025 08:18:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1737476337; cv=none; d=google.com; s=arc-20240605; b=L89MhmzCTShVv0WdOy8H3N0p1JCMIaR8s9hvGYmnU0BJ8HbcobcWbsN4C/e5xnSDex hEjCqzHFDvBH7uvjTFbRrC4ShjXoatHd7sSFXDErhe5XHGLZGk9NLOFUcsq5n9qVipT+ +OGXQgtpbhPrBMAK094x9D+5yQ1RlbAtGSoKUfl0QXwuxUv5+mwYhnaKhdtc8evetMzs nNVgKIEm/x/sXQCqbnc6xf0OMfY1c612gWqTvxgSHBFwkKeQSmUWC3LavmgMVMh8r4e5 Lhtjb9y2nwcdgwTV8bswHLTlsaxMCVxNhVo1KLmVgV9PzmgO0yeSaX1k614UGPaoNjWh jDqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=9F5G+EcENNTFhblljg4GhllRgsxg85NXRho6Bc5oIjk=; fh=ttUFIXncKnROn4jMCqYNmfYSvttcEqBfclMKrgbOAvs=; b=EHH5o/7t5+iUkYkLjMDzKLpYvFgCmRDVGvtHzPMMLcJHDWVQuz41YbUZHjoDE93wDP 0JhZwSKIbuG8NPv2XUrVly+3Cmxdj68SAW8IooH6UnFG1AoNl/5DMf3ep1orhU/DjNFi X+lAPxEUVPmrB5FNaHzgJk82TyEuqh3yTk+On7KM2yx+iv4D82gQ1gGrmk7uERJMLji7 3egWrl8DF06rOAhNw+6bWjo9YGzkrB50WRHr9GYwSWvq2aitM0jvVCU5BWrXcwGjgXy1 g211YSJNBYUqC+fJcAr6aOXzji2C5N4IM7EJwCkH7dZzKm+XmSqhYxGU5lF2jK7KXrLp tMpA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=riFpidDK; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e1afd16e27si127030686d6.438.2025.01.21.08.18.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Jan 2025 08:18:57 -0800 (PST) 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=riFpidDK; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1taGxa-0000RD-Jc; Tue, 21 Jan 2025 11:18:38 -0500 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 1taGxY-0000QL-Uu for qemu-devel@nongnu.org; Tue, 21 Jan 2025 11:18:36 -0500 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1taGxX-00060V-8C for qemu-devel@nongnu.org; Tue, 21 Jan 2025 11:18:36 -0500 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-385ef8b64b3so5145797f8f.0 for ; Tue, 21 Jan 2025 08:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737476313; x=1738081113; 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=9F5G+EcENNTFhblljg4GhllRgsxg85NXRho6Bc5oIjk=; b=riFpidDK/+rvtxGm2DB11zRvudWLvId8tHlNq+3yC0Y0gn8h+JKguAcJ8tJBk4DQoJ uHKlABB2BfEA1UHdUsMWHns4zVxUKC6Hv67Uv/lydhgrmOOA+KAzBUQRL4D7oi+dVXjv /OeUhIGXgMa2AI52UwLHmwGlZOv1DneP8HemDcq3eHgIoxiD6dtP2N4hceI9EYZRVXC5 aXEHcpjpVumC0i/lXAnv/ZlYwHfAtLa8a40CQndtpp+e7v1hfbnrBReGxK1MY5+BdxmP 8xNE+n8sv+VRCgd1Ukii0whnNDK6XDJtSmyBBYb/LBQ5R1oXskrwwvw+SdnvAlikf2/k degg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737476313; x=1738081113; 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=9F5G+EcENNTFhblljg4GhllRgsxg85NXRho6Bc5oIjk=; b=Iyj2/dX1YLUDE+H5Ii6l4PwN6C9fCJwq/gl5IUB/0cw7PThYaYrZ0oc7jQ5/1B3i9m OKHQvHuuP2rWazfnfIThQcJgU4Otv6A9y8VDCqXHFkjnlAzCOXPrF31u1/y+N8GTxJDW /Dfs2yAq2xLNe+7iqF8CntbisUKevty3jJDHbUCiQw8wEmetE58d4YizL74DVWGiMA+Z 56M/+c7W982Hj/5DOGu0VyJC+qWHdFe7Z6nYF/MzOV7ss38TPqJWeuslpVd1Elp0hLIo WiHK9XyRMEC0DELwZfLkkYdOwOFZTVDSfBkEHZ3MiOxWkgffLG1VG77aNRj7cEdL8LQk oKiw== X-Gm-Message-State: AOJu0YzwYp9QivpT+1/cV3tXC4M0SM40ncrdCTL5euCp9T4qSCDonGiu UKNkqIU+H8JsJM+HG/jLORlsR3L5JMmS66ckaG3IotaL/wkRyVX85dmhj/7k5LwImZOkN9Gr1h7 dHgA= X-Gm-Gg: ASbGncsqJskp0ipiqurdEd1PjKDw0cgXMWoEWvnV+lvrsLoks9ihlbedcZplmOzGJht uyGWjDLknsXskETvs9qd/gLCbfw0tNM+YzU7uotKsOKeJNZcyVCti/oRj+m/J0vzSL0QbKL+Pa0 04zd/k4iKf7oad7PazMcDJyV3LoqkzgbW+MEDFMJByz7xSjGB5+rQPoNqZxcfHilbt/+LWqX0sQ d71A5zothe6Ej1YeC1ekOwk2FF/XbRNper2cg+0G9sTFwaH0QDlemDyTnpyLaJq+Hd27BlOh6dW nfQdCPNErTTFjU/cRwxkb9VW4rOoGUeIRzGlDe1kTUOz X-Received: by 2002:a05:6000:1445:b0:386:37af:dd9a with SMTP id ffacd0b85a97d-38bf57b76a4mr17831665f8f.35.1737476313299; Tue, 21 Jan 2025 08:18:33 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322ad74sm13989453f8f.56.2025.01.21.08.18.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 21 Jan 2025 08:18:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Herv=C3=A9_Poussineau?= , Aleksandar Rikalo , Jiaxun Yang , Bernhard Beschow , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Huacai Chen , Aurelien Jarno Subject: [PATCH 3/6] target/mips: Initialize CPU-specific timer/IRQs once in DeviceRealize Date: Tue, 21 Jan 2025 17:18:14 +0100 Message-ID: <20250121161817.33654-4-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250121161817.33654-1-philmd@linaro.org> References: <20250121161817.33654-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42f; envelope-from=philmd@linaro.org; helo=mail-wr1-x42f.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=ham 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 The MIPS timer and IRQs are tied to the CPU. Creating them outside in board code isn't correct. Do it once in the DeviceRealize() handler. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Richard Henderson --- hw/mips/cps.c | 4 ---- hw/mips/fuloong2e.c | 4 ---- hw/mips/jazz.c | 4 ---- hw/mips/loongson3_virt.c | 4 ---- hw/mips/malta.c | 4 ---- hw/mips/mipssim.c | 4 ---- target/mips/cpu.c | 5 +++++ 7 files changed, 5 insertions(+), 24 deletions(-) diff --git a/hw/mips/cps.c b/hw/mips/cps.c index 0d8cbdc8924..f85fb4458af 100644 --- a/hw/mips/cps.c +++ b/hw/mips/cps.c @@ -91,10 +91,6 @@ static void mips_cps_realize(DeviceState *dev, Error **errp) return; } - /* Init internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); - if (cpu_mips_itu_supported(env)) { itu_present = true; /* Attach ITC Tag to the VP */ diff --git a/hw/mips/fuloong2e.c b/hw/mips/fuloong2e.c index 160ceb769dc..9a638f596bd 100644 --- a/hw/mips/fuloong2e.c +++ b/hw/mips/fuloong2e.c @@ -277,10 +277,6 @@ static void mips_fuloong2e_init(MachineState *machine) } } - /* Init internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); - /* North bridge, Bonito --> IP2 */ pci_bus = bonito_init(env->irq[2]); diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c index c89610639a9..ce4a702aa53 100644 --- a/hw/mips/jazz.c +++ b/hw/mips/jazz.c @@ -259,10 +259,6 @@ static void mips_jazz_init(MachineState *machine, exit(1); } - /* Init CPU internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); - /* Chipset */ rc4030 = rc4030_init(&dmas, &rc4030_dma_mr); sysbus = SYS_BUS_DEVICE(rc4030); diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c index f3cc7a8376f..91070824bbe 100644 --- a/hw/mips/loongson3_virt.c +++ b/hw/mips/loongson3_virt.c @@ -568,10 +568,6 @@ static void mips_loongson3_virt_init(MachineState *machine) /* init CPUs */ cpu = mips_cpu_create_with_clock(machine->cpu_type, cpuclk, false); - - /* Init internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); qemu_register_reset(main_cpu_reset, cpu); if (!kvm_enabled()) { diff --git a/hw/mips/malta.c b/hw/mips/malta.c index 4e9cccaa347..ac3b16229c8 100644 --- a/hw/mips/malta.c +++ b/hw/mips/malta.c @@ -1037,10 +1037,6 @@ static void create_cpu_without_cps(MachineState *ms, MaltaState *s, for (i = 0; i < ms->smp.cpus; i++) { cpu = mips_cpu_create_with_clock(ms->cpu_type, s->cpuclk, TARGET_BIG_ENDIAN); - - /* Init internal devices */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); qemu_register_reset(main_cpu_reset, cpu); } diff --git a/hw/mips/mipssim.c b/hw/mips/mipssim.c index a294779a82b..d4b3b043053 100644 --- a/hw/mips/mipssim.c +++ b/hw/mips/mipssim.c @@ -203,10 +203,6 @@ mips_mipssim_init(MachineState *machine) reset_info->vector = load_kernel(); } - /* Init CPU internal devices. */ - cpu_mips_irq_init_cpu(cpu); - cpu_mips_clock_init(cpu); - /* * Register 64 KB of ISA IO space at 0x1fd00000. But without interrupts * (except for the hardcoded serial port interrupt) -device cannot work, diff --git a/target/mips/cpu.c b/target/mips/cpu.c index 028a3c91afb..95df8985bc6 100644 --- a/target/mips/cpu.c +++ b/target/mips/cpu.c @@ -476,6 +476,11 @@ static void mips_cpu_realizefn(DeviceState *dev, Error **errp) fpu_init(env, env->cpu_model); mvp_init(env); + /* Init internal devices */ +#ifndef CONFIG_USER_ONLY + cpu_mips_irq_init_cpu(cpu); + cpu_mips_clock_init(cpu); +#endif if (!clock_get(cpu->clock)) { #ifndef CONFIG_USER_ONLY if (!qtest_enabled()) {