From patchwork Tue Dec 12 16:29:28 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: 753117 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp2013366wrs; Tue, 12 Dec 2023 08:36:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlEaAWQ2E/gvnaa2WrJzaUPbKxcYKaj/+0EmUbkuQELpVHp1Y038CER+hWGPyqevdOqCcC X-Received: by 2002:a05:620a:146d:b0:77f:878:b58 with SMTP id j13-20020a05620a146d00b0077f08780b58mr7947857qkl.153.1702399000673; Tue, 12 Dec 2023 08:36:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702399000; cv=none; d=google.com; s=arc-20160816; b=ao0e0EhPWmaokuFHBjWNnGF2Wf/9XgdJf+Wn1lr5ftVdvZaoWrevWmPsttgNyZb17q zrbNFkQkdkE1YFHBhqdnZEFBksT48reHZ049yEOgGUbbaXl/BpYxQU+AUV2fRxzybAPj pYxvscmq66bbWruQadIHBRal1axffBq3/HbejE0pK5x6jdmUTfF3uAZzvn1Ph/FualYC efWtzJq/dAV4RxZqj/QD/+P5tTE4Yi+BvWMU1Xlhnf2jHj7BEolIIhiB6i7uESnyXPGY DA73MI9IoCFfFmFhHyYjxo8AfRgitnG1PDV7sJrtVdfZmfzQzVXRqMfetyqMrDSioRcD 0sMA== 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=HtRA1ZcQFW7z3eKOx2yAyRkVJ7SlDZA04aMcZUs1m4I=; fh=CkupYgn1Qmdh7jizui9HJgGegpqbRR5NXz1VyjRE1Hs=; b=MMBvYFMrO8nOxbgH4Io9upOcxdF/Jt8UWo2jct9DLpjDE++SaEw4ojYKAFoq89bLeZ a3FHQR1hdnXcLEzGhyl7d1fPtXVJ7BrXlkd3a9sBne7YW0g3MkgcajvZuimhDiH+DkgI RVXVdRjOWRq9jAWa/+MDopIL/vI6n1pWaRxkC3pffgY4iZyVs38BD4ANQNC3rV+gmZM8 YIDxGe6Hk+fdGqYMzLoSgkaf6cvy+QWOeNMpM0OW1xzKhiTcK75rjUqIS++GmgItG1+1 QcSf79GS2OTLTsZQve0EYCYTj5AeZcVAi7wybTT2Wh1/diqSmhNAZeucClrdT/h04kTE 2HDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZVIFuzmL; 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 j25-20020a05620a0a5900b0077dcbb1fedfsi10303254qka.593.2023.12.12.08.36.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 08:36:40 -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=ZVIFuzmL; 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 1rD5hB-0001Fl-5p; Tue, 12 Dec 2023 11:33:21 -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 1rD5gz-0000FF-1h for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:33:13 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD5gv-0007wS-DY for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:33:08 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40c2bb872e2so55198325e9.3 for ; Tue, 12 Dec 2023 08:33:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702398783; x=1703003583; 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=HtRA1ZcQFW7z3eKOx2yAyRkVJ7SlDZA04aMcZUs1m4I=; b=ZVIFuzmLchDjDB3OkfjbMZXVKMgYwOO0S7whNc7TlESvzffg/pX3xTSev92pWsuFIv R02c9U8UvYwvO7l6tyJUfWr4J4xbO7b6xtrku2REbGptcPu3sWjfXcLHfD+8UtsUq4oH p4Be110cat34XfxwujbHVBGeqtNXtgXezqOFw88PJtEAe+tzdruz/hx5A6dJrD1QDUwF T1yjyA8nGbOzmiHEJCN8j3ALC/SeXV+OjsNkYQYZfqQeTm1CeyDonkKwxuolrIki6isD r46rJlzP5oWhuS2wRnjJNyc7FQD89UFvyWtvdUtmTJ9EyourFloZkWnjOmiWK+WhFBz3 IYog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702398783; x=1703003583; 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=HtRA1ZcQFW7z3eKOx2yAyRkVJ7SlDZA04aMcZUs1m4I=; b=eJUUw4v5l1E+td8KM5SyOr/xGQVWE9Baf8QGnIz9BoIw1H3g7qiyvi6prDoJ3/xDDS Qfmj/Gpk5EzhHE0nA3eFVTnwlbSoVBNulxeKm7aK3ewr5Ow4q0o4olKkzq8JgJ2Kd4RN lq4wyP4J13R3NhzaYVO2o8g5nCMnkzaun6boU7tzfhqgiNGNwtZVRqVoGVaKiXDjt9F2 GBYjvjmQsjCQ5TayUPfMm0lyPKCRKtQ+0aoWvDdmo8lBfNkx8rn2Jp7NPYrrbUWewm9+ tn/H3m9FgQi00O9M/JVbSKyEsZzcJ8ImMt8D16pc3bRGWTSN0rL7nnLPnl8HZG1Zz4Ha 5fAQ== X-Gm-Message-State: AOJu0YzXILDL35+rUk6rR/li9X95Bg1yOmf1iyKAIzfOEx3QTFBsjbCI UPStPmT3LodfPFXt0onH9rYA4XVhWxMPN20A+S0= X-Received: by 2002:a1c:4c07:0:b0:40c:3419:6ed6 with SMTP id z7-20020a1c4c07000000b0040c34196ed6mr1818330wmf.85.1702398783009; Tue, 12 Dec 2023 08:33:03 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id p1-20020a05600c1d8100b0040b47c69d08sm19472560wms.18.2023.12.12.08.33.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 08:33:02 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Tyrone Ting , =?utf-8?q?Alex_Benn=C3=A9e?= , Manos Pitsidianakis , Eduardo Habkost , Joel Stanley , Alistair Francis , Anton Johansson , Andrey Smirnov , Peter Maydell , Hao Wu , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Jean-Christophe Dubois , Igor Mitsyanko , "Edgar E. Iglesias" , Andrew Jeffery , Rob Herring , qemu-arm@nongnu.org, Mark Cave-Ayland , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH 28/33] hw/arm/vexpress: Let the A9/A15MPcore create/wire the CPU cores Date: Tue, 12 Dec 2023 17:29:28 +0100 Message-ID: <20231212162935.42910-29-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231212162935.42910-1-philmd@linaro.org> References: <20231212162935.42910-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32d; envelope-from=philmd@linaro.org; helo=mail-wm1-x32d.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, T_SCC_BODY_TEXT_LINE=-0.01 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 Set the properties on the mpcore object to let it create and wire the CPU cores. Remove the redundant code. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/vexpress.c | 51 ++++++----------------------------------------- 1 file changed, 6 insertions(+), 45 deletions(-) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 294b6f15f2..c104759588 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -210,45 +210,19 @@ static void init_cpus(MachineState *ms, const char *cpu_type, qemu_irq *pic, bool secure, bool virt) { DeviceState *dev; - SysBusDevice *busdev; - int n; - unsigned int smp_cpus = ms->smp.cpus; - /* Create the actual CPUs */ - for (n = 0; n < smp_cpus; n++) { - Object *cpuobj = object_new(cpu_type); - - if (!secure) { - object_property_set_bool(cpuobj, "has_el3", false, NULL); - } - if (!virt) { - if (object_property_find(cpuobj, "has_el2")) { - object_property_set_bool(cpuobj, "has_el2", false, NULL); - } - } - - if (object_property_find(cpuobj, "reset-cbar")) { - object_property_set_int(cpuobj, "reset-cbar", periphbase, - &error_abort); - } - qdev_realize(DEVICE(cpuobj), NULL, &error_fatal); - } - - /* Create the private peripheral devices (including the GIC); - * this must happen after the CPUs are created because a15mpcore_priv - * wires itself up to the CPU's generic_timer gpio out lines. - */ dev = qdev_new(privdev); + qdev_prop_set_uint32(dev, "num-cores", ms->smp.cpus); + qdev_prop_set_string(dev, "cpu-type", cpu_type); if (!secure) { qdev_prop_set_bit(dev, "cpu-has-el3", false); } if (!virt) { qdev_prop_set_bit(dev, "cpu-has-el2", false); } - qdev_prop_set_uint32(dev, "num-cpu", smp_cpus); - busdev = SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(busdev, &error_fatal); - sysbus_mmio_map(busdev, 0, periphbase); + qdev_prop_set_uint64(dev, "cpu-reset-cbar", periphbase); + sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, periphbase); /* Interrupts [42:0] are from the motherboard; * [47:43] are reserved; [63:48] are daughterboard @@ -256,22 +230,9 @@ static void init_cpus(MachineState *ms, const char *cpu_type, * external interrupts starting from 32 (because there * are internal interrupts 0..31). */ - for (n = 0; n < 64; n++) { + for (int n = 0; n < 64; n++) { pic[n] = qdev_get_gpio_in(dev, n); } - - /* Connect the CPUs to the GIC */ - for (n = 0; n < smp_cpus; n++) { - DeviceState *cpudev = DEVICE(qemu_get_cpu(n)); - - sysbus_connect_irq(busdev, n, qdev_get_gpio_in(cpudev, ARM_CPU_IRQ)); - sysbus_connect_irq(busdev, n + smp_cpus, - qdev_get_gpio_in(cpudev, ARM_CPU_FIQ)); - sysbus_connect_irq(busdev, n + 2 * smp_cpus, - qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ)); - sysbus_connect_irq(busdev, n + 3 * smp_cpus, - qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ)); - } } static void a9_daughterboard_init(VexpressMachineState *vms,