From patchwork Thu Feb 1 14:12:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 768863 Delivered-To: patch@linaro.org Received: by 2002:adf:9bca:0:b0:33a:e5bd:fedd with SMTP id e10csp410553wrc; Thu, 1 Feb 2024 06:16:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEIR2F+aA+LiPaSjZlIG21fqZ4GZNajDk8udxv8X/GqvG/MwC0WO+zwLp42HoCLWX6IK5i/ X-Received: by 2002:a05:6214:400a:b0:68c:689d:92ec with SMTP id kd10-20020a056214400a00b0068c689d92ecmr5663839qvb.25.1706796965524; Thu, 01 Feb 2024 06:16:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706796965; cv=none; d=google.com; s=arc-20160816; b=zqQNOucEntvGIzlSX1jfkxzK6hXCxSoi85jWbzcJkGAGyFnDfCH+5Qs3f2Oii33T6L QU+xWi6wQflZwVkXTETBLDI9qw+mkOxSaixPCMl7RUacj07OJg1ocAOPwjopN0NkEEzj ij5eHLwo6n4P2iOGyLCQ3lCxyDdD238iKUT9HeHKXMDNvKa36Evj04JrBLdTrSzOi2ER 2hkeIO+9YvObnjTKQfCArMg0gxmJKnAjx6XhzlSGakiMz269k02KgPAQ274QF9IIjMRq mC1iGmfVpp12PAdyjE0zC+GcroBbUeFkYp9wLKvHRCtVdmmO4XkDOCuakG8mwtlRUGwq WOsA== 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; bh=bd8XyG+OFDecPO1GD/AJ7IsTnxWyWtqfhTTnnGyxqLo=; fh=Onq6BbFQySN/MNkLVmRTbXNKxqiybAG30DxCuG7oyWY=; b=U9zi542wKD1mzER0X/5jl4OInBgLUUWAwOp3LJ9UeAIqf8Cbtng9PAbgSl/qCzyge1 EziQeo+MfxuBwAOgaqsMx5E6Ql6PfYBvKo1uitI4BkeN5Qxhxtpm7V7YgtCG4TQmeNSW oGFtBlPrFlaq7esHKn7BrJf7K5JTwJBi+dAwf5R6btQrfuvWeBaBO00Nj9Z22uS19OLM KUjiupDKRfj2Fj+XwSu4flF7PFoi4hsPIPla6A76dEEItdlU9TanVnHX01VbDbNNU/qz nMsS+FGvEEKxHTSte49kTdj6SKIdloc8JpKGOPWnidq9gmN3mjfrm1jrQzusPXktCps4 qXJQ==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; 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" X-Forwarded-Encrypted: i=0; AJvYcCVPuBQ1hbed8bxFca3fz9l8UOchZnd2NSM8PQT4s4fOYTIDt7mEJq13BxbjdO+o8IHd9K22Yh0nEFuE1ALZcZ40 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o5-20020a0cfa85000000b0068c4d79a61bsi809616qvn.500.2024.02.01.06.16.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2024 06:16:05 -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; 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" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVXp7-00016A-Vp; Thu, 01 Feb 2024 09:13:51 -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 1rVXod-0000x6-Vu; Thu, 01 Feb 2024 09:13:20 -0500 Received: from gandalf.ozlabs.org ([150.107.74.76]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rVXoZ-0007mj-Jr; Thu, 01 Feb 2024 09:13:18 -0500 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by gandalf.ozlabs.org (Postfix) with ESMTP id 4TQgqF1ShYz4wcP; Fri, 2 Feb 2024 01:13:13 +1100 (AEDT) Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4TQgqC19jQz4wcM; Fri, 2 Feb 2024 01:13:10 +1100 (AEDT) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson , Gavin Shan Subject: [PULL 05/17] hw/arm/aspeed: Introduce aspeed_soc_cpu_type() helper Date: Thu, 1 Feb 2024 15:12:41 +0100 Message-ID: <20240201141253.806055-6-clg@kaod.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240201141253.806055-1-clg@kaod.org> References: <20240201141253.806055-1-clg@kaod.org> MIME-Version: 1.0 Received-SPF: pass client-ip=150.107.74.76; envelope-from=SRS0=Qo6T=JK=kaod.org=clg@ozlabs.org; helo=gandalf.ozlabs.org X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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 From: Philippe Mathieu-Daudé In order to alter AspeedSoCClass::cpu_type in the next commit, introduce the aspeed_soc_cpu_type() helper to retrieve the per-SoC CPU type from AspeedSoCClass. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Signed-off-by: Cédric Le Goater --- include/hw/arm/aspeed_soc.h | 1 + hw/arm/aspeed_ast10x0.c | 2 +- hw/arm/aspeed_ast2400.c | 3 ++- hw/arm/aspeed_ast2600.c | 3 ++- hw/arm/aspeed_soc_common.c | 5 +++++ 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index cb832bc1ee14..a060a5991874 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -143,6 +143,7 @@ struct AspeedSoCClass { qemu_irq (*get_irq)(AspeedSoCState *s, int dev); }; +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc); enum { ASPEED_DEV_SPI_BOOT, diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 8becb146a8df..dca601a3f9b6 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -211,7 +211,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) /* AST1030 CPU Core */ armv7m = DEVICE(&a->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 256); - qdev_prop_set_string(armv7m, "cpu-type", sc->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", aspeed_soc_cpu_type(sc)); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); object_property_set_link(OBJECT(&a->armv7m), "memory", OBJECT(s->memory), &error_abort); diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c index ad76035528fd..3baf95916d46 100644 --- a/hw/arm/aspeed_ast2400.c +++ b/hw/arm/aspeed_ast2400.c @@ -156,7 +156,8 @@ static void aspeed_ast2400_soc_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index 386a88d4e0f9..b264433cf095 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -158,7 +158,8 @@ static void aspeed_soc_ast2600_init(Object *obj) } for (i = 0; i < sc->num_cpus; i++) { - object_initialize_child(obj, "cpu[*]", &a->cpu[i], sc->cpu_type); + object_initialize_child(obj, "cpu[*]", &a->cpu[i], + aspeed_soc_cpu_type(sc)); } snprintf(typename, sizeof(typename), "aspeed.scu-%s", socname); diff --git a/hw/arm/aspeed_soc_common.c b/hw/arm/aspeed_soc_common.c index 828f61093bfa..36ca189ce960 100644 --- a/hw/arm/aspeed_soc_common.c +++ b/hw/arm/aspeed_soc_common.c @@ -18,6 +18,11 @@ #include "hw/char/serial.h" +const char *aspeed_soc_cpu_type(AspeedSoCClass *sc) +{ + return sc->cpu_type; +} + qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev) { return ASPEED_SOC_GET_CLASS(s)->get_irq(s, dev);