From patchwork Tue Dec 12 16:29:19 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: 753113 Delivered-To: patch@linaro.org Received: by 2002:a5d:4c83:0:b0:333:3a04:f257 with SMTP id z3csp2012878wrs; Tue, 12 Dec 2023 08:35:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoO24HTwdFc8XgYKaYVexu7M60qe7zv93ZQNv+xr5nUj2tmnq+vcUgvyQASGDXidOxldTm X-Received: by 2002:a05:622a:1646:b0:425:4043:763c with SMTP id y6-20020a05622a164600b004254043763cmr9494070qtj.100.1702398945819; Tue, 12 Dec 2023 08:35:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702398945; cv=none; d=google.com; s=arc-20160816; b=Ret/fEkeCF/ir9lHHXWpqhlh9LCp8ldbOlNS3xBEqXN8N2CEIzBgMC5p8vS1N9SDHe sE46Msv2Aj/RE5RzxLPliejeoQCzBY8C4qShkWcvK4oTYfIQsZl0XuZMoNITeSZBydLs etQnGBPcxuj7paTQUihIpkTvzSqZopbR3v4Mt9qKIFsGlfyAiqcyPYQ4gpt+BWyfq/hw Gl1RFvuG06CG48iFJeAn9laassHgeSpVKsAI7ZvIN6KMTnZIsMXMDWKn1zGlXEQLg3sS 8aZdWMbgr3kr5Lkw4Vg+Zp4a7jyGVXjOsUaDAuA1QVaf4pW5+FWDhHT5vg8gxEA+JjQH JnGg== 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=7Pqc0Rrgak/xeltLwYcUfzRxHhc0ewXusv1vEQMSS3M=; fh=CkupYgn1Qmdh7jizui9HJgGegpqbRR5NXz1VyjRE1Hs=; b=CFhrdBnwyq/r7p5SGsR4sxg/hsiJhv5hR7ACRHf2JNnnyXQjrjMZcO2StgkFBExXdP 2OheTIcsKhFTYP1NeqOADe6rMs3YvYYApNa9Oc4qFnyYmlT881cZkNLDuYtpQD4EJ9yr uTY7SqkB0QCSTvXTjOF1Y8qXHH4L4hUwz3NsJaYxOHKMVyyNNguVMlxPBz7SXWSugOJJ Oq+i4eJRbV7No/uUiTqpCxoNVzoztrH2chk40X4E3F+Y84boDOj/rCE+Zw7Mu4ZSmzjD 7cs15Xf4cXtrDnzjvzjwoJ1FwxfhmmxC5Cj6sWR0dQ+akDF7A5iwQf6G75RWT4CedLYt 8MaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tASjU4XB; 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 kg13-20020a05622a760d00b00423dfb3e344si10285550qtb.280.2023.12.12.08.35.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Dec 2023 08:35:45 -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=tASjU4XB; 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 1rD5gL-0006nY-BF; Tue, 12 Dec 2023 11:32:31 -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 1rD5fy-0006Rw-5d for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:32:09 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rD5fw-0007h1-82 for qemu-devel@nongnu.org; Tue, 12 Dec 2023 11:32:05 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a22deb95d21so157565266b.3 for ; Tue, 12 Dec 2023 08:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702398719; x=1703003519; 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=7Pqc0Rrgak/xeltLwYcUfzRxHhc0ewXusv1vEQMSS3M=; b=tASjU4XB7PiG3bwiOhAHnlhNPu03UOMbzpMEKrdZ4RK27vWhwV39Ois23sHMwnYyQu bbILCoYCx7V3yQ/vbef9mG4i/XkZm2YPKSAN5KgiN6lZr/SwST/ZdFdCOe29Tdu7NbI5 E0aU9CVLrHPHO/wRlxRg8/UmXlI4rvaYqC1DUzijmdAbFb5FmtisS1gn7Ljrs7Vub5dx 3k1i68rkE8n/+pLSA5kdTx75o5NT7fJpH9kMfPTlDREZhh+XBOoF4UmzngpojVSHb6kp Qu5LAnOD9ef34/HbxkI/H/8flOtM6S5KpGTm34bJjhKSbJuAEGYpF+Ie8UNLwy8zo7pD J1zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702398719; x=1703003519; 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=7Pqc0Rrgak/xeltLwYcUfzRxHhc0ewXusv1vEQMSS3M=; b=QInOExky7WRpCWxGRQFmjuarFNQTWaiSgDRO5bJr7NqXQwrCEXhjydB37ZT2jxH46J YVyiZ+0sb93ichM7m1YKKk2Ne5Uoz3VJ516GcGHOEQymFMuh6myGMBa4slm46O7YVxWy fgOpgA5XTiH6GTjSuI6GSBSb86snn468CzgwHjMCPXwCVx8bISAQMbbYb4bXJq6tqaxN mBHobOF0VdVxwfdp/ujOnC0jK8uqEOFiS5aKJaY7qKeCsydiJP/R9LG+pj3NsFIU8YTh sihsIQIOPygVS5m5+ek3vlxJmS+h09tZPcEraVyHIgY9lBc4JmIKC+ou9nK3Ih423xwf y0hg== X-Gm-Message-State: AOJu0Yxo+01wYlUyaV+eezV03360OACXpT7lnEirmybuYiYOqNg7Jp1t vNgGzLv4wCtIq0TRE0jFNMLRZu0PXpqpWi3vXe8= X-Received: by 2002:a17:907:7156:b0:a1e:36e0:1c79 with SMTP id zs22-20020a170907715600b00a1e36e01c79mr2869141ejb.89.1702398719059; Tue, 12 Dec 2023 08:31:59 -0800 (PST) Received: from m1x-phil.lan ([176.176.175.193]) by smtp.gmail.com with ESMTPSA id v10-20020a170906564a00b009fea232316bsm6454240ejr.193.2023.12.12.08.31.56 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 12 Dec 2023 08:31:58 -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 19/33] hw/cpu/arm: Introduce TYPE_A7MPCORE_PRIV for Cortex-A7 MPCore Date: Tue, 12 Dec 2023 17:29:19 +0100 Message-ID: <20231212162935.42910-20-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::62d; envelope-from=philmd@linaro.org; helo=mail-ej1-x62d.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 For QEMU modelling, the only difference between the A15 and A7 MPCore is the latter can have up to 480 SPIs. In particular, since commit b151de69f6 ("hw/arm: ast2600: Set AST2600_MAX_IRQ to value from datasheet") the AST2600 machine initializes its GIC with 256 SPIs, which is more than the 224 maximum of the A15. Since the A7 was not available, few boards were using the A15. Replace them by a A7 MPCore. Signed-off-by: Philippe Mathieu-Daudé --- The comment in a7mp_priv_class_init() is a bit off. --- include/hw/cpu/cortex_mpcore.h | 2 ++ hw/arm/aspeed_ast2600.c | 3 +-- hw/arm/fsl-imx6ul.c | 3 +-- hw/arm/fsl-imx7.c | 3 +-- hw/cpu/a15mpcore.c | 30 ++++++++++++++++++++++++++++++ 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/include/hw/cpu/cortex_mpcore.h b/include/hw/cpu/cortex_mpcore.h index 7822d5cbc4..4e1aa9f7f7 100644 --- a/include/hw/cpu/cortex_mpcore.h +++ b/include/hw/cpu/cortex_mpcore.h @@ -118,4 +118,6 @@ struct A9MPPrivState { #define TYPE_A15MPCORE_PRIV "a15mpcore_priv" +#define TYPE_A7MPCORE_PRIV "a7mpcore_priv" + #endif diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index ca788e1cf0..88e2a23514 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -171,8 +171,7 @@ static void aspeed_soc_ast2600_init(Object *obj) object_property_add_alias(obj, "hw-prot-key", OBJECT(&s->scu), "hw-prot-key"); - object_initialize_child(obj, "a7mpcore", &a->a7mpcore, - TYPE_A15MPCORE_PRIV); + object_initialize_child(obj, "a7mpcore", &a->a7mpcore, TYPE_A7MPCORE_PRIV); object_initialize_child(obj, "rtc", &s->rtc, TYPE_ASPEED_RTC); diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index 93908811c5..6e4343efaa 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -40,8 +40,7 @@ static void fsl_imx6ul_init(Object *obj) /* * A7MPCORE */ - object_initialize_child(obj, "a7mpcore", &s->a7mpcore, - TYPE_A15MPCORE_PRIV); + object_initialize_child(obj, "a7mpcore", &s->a7mpcore, TYPE_A7MPCORE_PRIV); /* * CCM diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index 8a3e9933c4..bd9266b8b5 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -48,8 +48,7 @@ static void fsl_imx7_init(Object *obj) /* * A7MPCORE */ - object_initialize_child(obj, "a7mpcore", &s->a7mpcore, - TYPE_A15MPCORE_PRIV); + object_initialize_child(obj, "a7mpcore", &s->a7mpcore, TYPE_A7MPCORE_PRIV); /* * GPIOs diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c index 87b0786781..5f28a97adb 100644 --- a/hw/cpu/a15mpcore.c +++ b/hw/cpu/a15mpcore.c @@ -121,6 +121,30 @@ static void a15mp_priv_class_init(ObjectClass *klass, void *data) /* We currently have no saveable state */ } +static void a7mp_priv_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + CortexMPPrivClass *cc = CORTEX_MPCORE_PRIV_CLASS(klass); + + cc->container_size = 0x8000; + + cc->gic_class_name = gic_class_name(); + cc->gic_revision = 2; + /* + * The Cortex-A7MP may have anything from 0 to 480 external interrupt + * IRQ lines (with another 32 internal). We default to 128+32, which + * is the number provided by the Cortex-A15MP test chip in the + * Versatile Express A15 development board. + * Other boards may differ and should set this property appropriately. + */ + cc->gic_spi_default = 160; + cc->gic_spi_max = 480; + + device_class_set_parent_realize(dc, a15mp_priv_realize, + &cc->parent_realize); + /* We currently have no saveable state */ +} + static const TypeInfo a15mp_types[] = { { .name = TYPE_A15MPCORE_PRIV, @@ -128,6 +152,12 @@ static const TypeInfo a15mp_types[] = { .instance_size = sizeof(CortexMPPrivState), .class_init = a15mp_priv_class_init, }, + { + .name = TYPE_A7MPCORE_PRIV, + .parent = TYPE_CORTEX_MPCORE_PRIV, + .instance_size = sizeof(CortexMPPrivState), + .class_init = a7mp_priv_class_init, + }, }; DEFINE_TYPES(a15mp_types)