From patchwork Tue Dec 12 16:29:30 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: 753103 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp2011976wrs; Tue, 12 Dec 2023 08:34:09 -0800 (PST) X-Google-Smtp-Source: AGHT+IHEJ92k9NMtkCm7hU7j17WW//+8CmVCMabvPeIgxo4MupLyd/aENTDsRUkojh8iuvCOQel5 X-Received: by 2002:ac8:4e52:0:b0:423:724a:9a26 with SMTP id e18-20020ac84e52000000b00423724a9a26mr5119630qtw.68.1702398849342; Tue, 12 Dec 2023 08:34:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702398849; cv=none; d=google.com; s=arc-20160816; b=FTK0Ut5i5J2MJs7YPFQZevEFNZ1eKaDy4yu+lEtsdICBCzPpi4/i9PdvPeaR5AXXhq ttinjlpEMgS8nhM7I/2L6baVrlKvFCIfpfvOiuk2S7Pz8XYuCZ7/d5gzFekVvs+QvdWG i1RdnzWKaPi32HxSs4i5yP/0gZUE4C2LzblvY0WLMkdF7eLwOoXbj+eNSucgorqHajfE OMl7enhv6+xuBuVxG8mJbWO82uEahS0cKoxeNX2VWlzpPay4o//qDjYzz++NkU0NPmcs QHkWBPCbKT0POeO9DFXJi7GcHoighzajnVD2uev+fhMJ2xqDDGL3rMGelcMTBKTtpPn8 LqyA== 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=SFB3NxAZWWbFr7FqoB9z01YE2CJXVAN7E7QlxKJ0g+s=; fh=CkupYgn1Qmdh7jizui9HJgGegpqbRR5NXz1VyjRE1Hs=; b=cxf8mOjbxYxW+v6H1vgSY6p1qQVA1E9k968DhYJW7QkZyNwIItoXgjfQoYUooLulFF rHMdMGkFpGUaaxupz4DouDmIb0a1zu3JXlHgEiLBT6yd96EoNKhvfb7pc36eoikoVyO5 9iGfcnl0oxtPTq/6yYC2r3lCUg0rXC2+8VEiFIOdaDkYLI58uvB6HafKYN+VKTtYD7qv oYDQRlBSSahkahbJHK8nzapqfA8foFrJ/N4DMKZ6xPNhKmV+rCEiy5wN+fwIfvoeRoEu 9P3UyaPGkFit4yvdCRYZ5SCsM8z9FGyKque6pyy6zYmEJ3TiH7DdYnnnC0zkNn6eGQfE iqVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NGIrTjeH; 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 ff26-20020a05622a4d9a00b0040fd27851cbsi1960563qtb.652.2023.12.12.08.34.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 08:34:09 -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=NGIrTjeH; 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 1rD5hO-0003K7-Ts; Tue, 12 Dec 2023 11:33:35 -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 1rD5hM-0002tG-H4 for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:33:32 -0500 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD5h9-0007z9-VE for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:33:32 -0500 Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-3333131e08dso6405755f8f.2 for ; Tue, 12 Dec 2023 08:33:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702398797; x=1703003597; 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=SFB3NxAZWWbFr7FqoB9z01YE2CJXVAN7E7QlxKJ0g+s=; b=NGIrTjeHHJHMhmSXLiKBD1mY35zbC5HOSrVxuWBXpzNRXnCze1CdPtJXhyNaGM1ey2 IFeothpMHOS4IaCcLZdRrp93h8UpcbI8hp2k9NuuOjlD5aN+c3zWY7Br52tg6DzfXJQR AwWOEH+QgPlzmNp7wBlbqzE2/Sm0UhwMN/aQoxU2Rrn/8AVdc9Z5tmCICDSWlvase6AM 8mGVZVmUDIIe93vQKy9T9vYgY0mzCekJ0cQai+1DHvA48jtuKxlXPuz+27Svj9+Hv9eH oR1q/7sbAPFquWUi85EKFr2tmmUHVdUhYYfUoeEFORJacWGnU5BzJeYSrjKnU3nXJdbY tGGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702398797; x=1703003597; 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=SFB3NxAZWWbFr7FqoB9z01YE2CJXVAN7E7QlxKJ0g+s=; b=cgs6RxZTrj1AeZvDyouQkUlBnZwu1nnuYjsvg9tD2C/Lg+JvypX9/j1vfaBfV7udjA W8AqQJPlmHmkNOXofigpUC5k42B8zVxzGnhHgFjDPyPujlLCFAtJkD59P6jyKdAW9yFs Vsi3LQHaJumqCCFx4RAojqLBIPIbTQY6Zo9H1IfYFZeCD/3qrKTLWFKjm4v7X3zHyohf mR9wcQqaUE35ekpeGALQi9i7Cde2vpX5yICW0AcF6DrQEsHxMOjJYbaGAC8QDio0zkPS uRHwQeX/FLfauEfvqPl3l4bonkDCLYidTVZtxVYZMirNKB3R5qNC4699oeIdTyEpg/d7 YFTQ== X-Gm-Message-State: AOJu0Yx21SG+11dlP19gg9tEVn2U3isev3GT2LMdX4/9ITkzQhpy+Yb7 sQ9SgHCjClDVXfEpgOCLlLLBdGoK+kBouiqRK2Y= X-Received: by 2002:adf:faca:0:b0:333:85e:a122 with SMTP id a10-20020adffaca000000b00333085ea122mr2648323wrs.7.1702398797275; Tue, 12 Dec 2023 08:33:17 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id k17-20020a5d4291000000b0033335d9dcc5sm11246500wrq.64.2023.12.12.08.33.14 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 08:33:16 -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 30/33] hw/arm/npcm7xx: Let the A9MPcore create/wire the CPU cores Date: Tue, 12 Dec 2023 17:29:30 +0100 Message-ID: <20231212162935.42910-31-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::435; envelope-from=philmd@linaro.org; helo=mail-wr1-x435.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, 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é --- include/hw/arm/npcm7xx.h | 1 - hw/arm/npcm7xx.c | 48 ++++++++++------------------------------ 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/include/hw/arm/npcm7xx.h b/include/hw/arm/npcm7xx.h index 7abbf85cbf..e0737fa4de 100644 --- a/include/hw/arm/npcm7xx.h +++ b/include/hw/arm/npcm7xx.h @@ -80,7 +80,6 @@ typedef struct NPCM7xxMachineClass { struct NPCM7xxState { DeviceState parent; - ARMCPU cpu[NPCM7XX_MAX_NUM_CPUS]; A9MPPrivState a9mpcore; MemoryRegion sram; diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c index 5b6e968fa9..1154a0f0a5 100644 --- a/hw/arm/npcm7xx.c +++ b/hw/arm/npcm7xx.c @@ -363,9 +363,11 @@ static struct arm_boot_info npcm7xx_binfo = { void npcm7xx_load_kernel(MachineState *machine, NPCM7xxState *soc) { + CortexMPPrivState *mp = CORTEX_MPCORE_PRIV(&soc->a9mpcore); + npcm7xx_binfo.ram_size = machine->ram_size; - arm_load_kernel(&soc->cpu[0], machine, &npcm7xx_binfo); + arm_load_kernel(mp->cpu[0], machine, &npcm7xx_binfo); } static void npcm7xx_init_fuses(NPCM7xxState *s) @@ -400,11 +402,6 @@ static void npcm7xx_init(Object *obj) NPCM7xxState *s = NPCM7XX(obj); int i; - for (i = 0; i < NPCM7XX_MAX_NUM_CPUS; i++) { - object_initialize_child(obj, "cpu[*]", &s->cpu[i], - ARM_CPU_TYPE_NAME("cortex-a9")); - } - object_initialize_child(obj, "a9mpcore", &s->a9mpcore, TYPE_A9MPCORE_PRIV); object_initialize_child(obj, "gcr", &s->gcr, TYPE_NPCM7XX_GCR); object_property_add_alias(obj, "power-on-straps", OBJECT(&s->gcr), @@ -471,40 +468,19 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp) return; } - /* CPUs */ - for (i = 0; i < nc->num_cpus; i++) { - object_property_set_int(OBJECT(&s->cpu[i]), "mp-affinity", - arm_cpu_mp_affinity(i, NPCM7XX_MAX_NUM_CPUS), - &error_abort); - object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar", - NPCM7XX_GIC_CPU_IF_ADDR, &error_abort); - object_property_set_bool(OBJECT(&s->cpu[i]), "reset-hivecs", true, - &error_abort); - - /* Disable security extensions. */ - object_property_set_bool(OBJECT(&s->cpu[i]), "has_el3", false, - &error_abort); - - if (!qdev_realize(DEVICE(&s->cpu[i]), NULL, errp)) { - return; - } - } - /* A9MPCORE peripherals. Can only fail if we pass bad parameters here. */ - object_property_set_int(OBJECT(&s->a9mpcore), "num-cores", nc->num_cpus, - &error_abort); - object_property_set_int(OBJECT(&s->a9mpcore), "num-irq", NPCM7XX_NUM_IRQ, - &error_abort); + qdev_prop_set_uint32(DEVICE(&s->a9mpcore), "num-cores", nc->num_cpus); + qdev_prop_set_string(DEVICE(&s->a9mpcore), "cpu-type", + ARM_CPU_TYPE_NAME("cortex-a9")); + /* Disable security extensions. */ + qdev_prop_set_bit(DEVICE(&s->a9mpcore), "cpu-has-el3", false); + qdev_prop_set_uint64(DEVICE(&s->a9mpcore), "cpu-reset-cbar", + NPCM7XX_GIC_CPU_IF_ADDR); + qdev_prop_set_bit(DEVICE(&s->a9mpcore), "cpu-reset-hivecs", true); + qdev_prop_set_uint32(DEVICE(&s->a9mpcore), "gic-spi-num", NPCM7XX_NUM_IRQ); sysbus_realize(SYS_BUS_DEVICE(&s->a9mpcore), &error_abort); sysbus_mmio_map(SYS_BUS_DEVICE(&s->a9mpcore), 0, NPCM7XX_CPUP_BA); - for (i = 0; i < nc->num_cpus; i++) { - sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i, - qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_IRQ)); - sysbus_connect_irq(SYS_BUS_DEVICE(&s->a9mpcore), i + nc->num_cpus, - qdev_get_gpio_in(DEVICE(&s->cpu[i]), ARM_CPU_FIQ)); - } - /* L2 cache controller */ sysbus_create_simple("l2x0", NPCM7XX_L2C_BA, NULL);