From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090616; cv=none; d=zohomail.com; s=zohoarc; b=AcmM8rI3kex/mYTLDdPGPF92PAENXXa/uFc2FL6Gx9nCqrudsG4fPt3VTEtk95omJmAKx9bVdgDTylXQ3oLhrrlby0zDMoVdY40uvIXq/ATQ4OO0niEsvd880n9vy5GQ2bQooQOrVrJJNd1EC/9+Rn5stY60a3w8tPvD5kwNLnI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090616; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SjjgBM6Far3ZU6D7cHhKn6yCQMmOx1k1V2GiDQ4UpRs=; b=B3egj1AKJViM22HOqWyL4LftbHN61lPVikkGz2urROJJ4AaZp2VhiWqbIOrLe5Z2rBeLac3pZGz2QxNJaMs2PSDOV78OiIhBQXwQW/zBasASEAPWcAobEt4rLJ+0A3dvQ9EB6Z7VeUvxJxjp2/0QRyw8DchReu6pKe2ZVlCYv2s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700090616274591.9702862649983; Wed, 15 Nov 2023 15:23:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDN-0007c1-WF; Wed, 15 Nov 2023 18:22:34 -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 1r3PDL-0007b1-Sr for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:31 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PCw-0003KA-26 for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:31 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5435336ab0bso341988a12.1 for ; Wed, 15 Nov 2023 15:22:05 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id dt20-20020a170906b79400b009cb2fd85371sm7580944ejb.8.2023.11.15.15.22.02 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090524; x=1700695324; 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=SjjgBM6Far3ZU6D7cHhKn6yCQMmOx1k1V2GiDQ4UpRs=; b=cyUzvsLVbcaS9GosKcnf2v2lEJ6g6WNDhYKZZsMhU4A3QKV3vCHbrXt58iR709uaIK 9NGlPRb28Bv2ggUyY+ffBG2GAbZViYhyKWepsMbOyzS5BhmP069q+/HIhfEDFHUcM+ak yTqcInlSuB3OoqA6Mv3Oh8GGz2ib7U+nhRGa9XTY3g1AOCwvcAei3bYoL4Uakl67exsb ZkbK6LU6JkFeaCJs8+7irfCElBCtrxjANt35BRlggaDbG4SndIdPDefxbjuOgYi7Q2m8 mhPqJMgZNv0FFpes5UIXDnWQMwBizCRG8AzN3VyNCSTinFwLfp7BDbwh8qGUhGvSwocR utXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090524; x=1700695324; 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=SjjgBM6Far3ZU6D7cHhKn6yCQMmOx1k1V2GiDQ4UpRs=; b=Xy3TdBzWtmaQZQkt9MNnYOEIXAP5WU5XqZszq36Vjvxlu3HdhkZcOTUklb9GAcAc7C En7kvWoMQqQpOrvy7o2rkwOFBAhj0pwaHF/M93BDlv4M4bZznHNtaUmrl/BPPFBasGZz MS4/BOVrsOIuhpPwaCfTqOpxaSGQ72XUIwZCryUkHmoMJCoAcfD5Tt+92CMR/M4bG0hj H03fc616wbyv+JB1fyQx8KE62yQZYmqZcohy6JO9PhIO40z0bLlPUJBoRdyjLCxaFWKx brT8yCWjvVCiped+yDvDQ2extoQVvIXL7Yx0hqVXIhG3GxqYo4/EVv3CamKtSWVZmnM/ /2Fw== X-Gm-Message-State: AOJu0YwFcDTRFsZOz/Y2hD9DIrRUAvkRv9QQ33CjwREE660Mx92HQOSF 76/1zZPxyz6Ezs81NPezXFrwF6yJDZi20bUBjnM= X-Google-Smtp-Source: AGHT+IGVQqCH25wFx2mPGXXFA671mZ6zjwxmqsNg2TD/Xsv1XY+TFPFBWHOVllzxG6CPQL0hiUhETA== X-Received: by 2002:a17:907:c09:b0:9e7:de43:af91 with SMTP id ga9-20020a1709070c0900b009e7de43af91mr13824977ejc.41.1700090524467; Wed, 15 Nov 2023 15:22:04 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.2? 1/6] hw/arm/stm32f405: Report error when incorrect CPU is used Date: Thu, 16 Nov 2023 00:21:48 +0100 Message-ID: <20231115232154.4515-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=philmd@linaro.org; helo=mail-ed1-x534.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090618343100001 Both 'netduinoplus2' and 'olimex-stm32-h405' machines ignore the CPU type requested by the command line. This might confuse users, since the following will create a machine with a Cortex-M4 CPU: $ qemu-system-aarch64 -M netduinoplus2 -cpu cortex-r5f Set the MachineClass::valid_cpu_types field (introduced in commit c9cf636d48 "machine: Add a valid_cpu_types property"). Remove the now unused MachineClass::default_cpu_type field. We now get: $ qemu-system-aarch64 -M netduinoplus2 -cpu cortex-r5f qemu-system-aarch64: Invalid CPU type: cortex-r5f-arm-cpu The valid types are: cortex-m4-arm-cpu Since the SoC family can only use Cortex-M4 CPUs, hard-code the CPU type name at the SoC level, removing the QOM property entirely. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/arm/stm32f405_soc.h | 4 ---- hw/arm/netduinoplus2.c | 7 ++++++- hw/arm/olimex-stm32-h405.c | 8 ++++++-- hw/arm/stm32f405_soc.c | 8 +------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/include/hw/arm/stm32f405_soc.h b/include/hw/arm/stm32f405_soc.h index c968ce3ab2..d15c03c4b5 100644 --- a/include/hw/arm/stm32f405_soc.h +++ b/include/hw/arm/stm32f405_soc.h @@ -51,11 +51,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(STM32F405State, STM32F405_SOC) #define CCM_SIZE (64 * 1024) =20 struct STM32F405State { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ - - char *cpu_type; =20 ARMv7MState armv7m; =20 diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c index 515c081605..e411806dd7 100644 --- a/hw/arm/netduinoplus2.c +++ b/hw/arm/netduinoplus2.c @@ -44,7 +44,6 @@ static void netduinoplus2_init(MachineState *machine) clock_set_hz(sysclk, SYSCLK_FRQ); =20 dev =3D qdev_new(TYPE_STM32F405_SOC); - qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); qdev_connect_clock_in(dev, "sysclk", sysclk); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 @@ -55,7 +54,13 @@ static void netduinoplus2_init(MachineState *machine) =20 static void netduinoplus2_machine_init(MachineClass *mc) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m4"), + NULL + }; + mc->desc =3D "Netduino Plus 2 Machine (Cortex-M4)"; + mc->valid_cpu_types =3D machine_valid_cpu_types; mc->init =3D netduinoplus2_init; } =20 diff --git a/hw/arm/olimex-stm32-h405.c b/hw/arm/olimex-stm32-h405.c index 3aa61c91b7..694b1dd6ed 100644 --- a/hw/arm/olimex-stm32-h405.c +++ b/hw/arm/olimex-stm32-h405.c @@ -47,7 +47,6 @@ static void olimex_stm32_h405_init(MachineState *machine) clock_set_hz(sysclk, SYSCLK_FRQ); =20 dev =3D qdev_new(TYPE_STM32F405_SOC); - qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4")); qdev_connect_clock_in(dev, "sysclk", sysclk); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 @@ -58,9 +57,14 @@ static void olimex_stm32_h405_init(MachineState *machine) =20 static void olimex_stm32_h405_machine_init(MachineClass *mc) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m4"), + NULL + }; + mc->desc =3D "Olimex STM32-H405 (Cortex-M4)"; mc->init =3D olimex_stm32_h405_init; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m4"); + mc->valid_cpu_types =3D machine_valid_cpu_types; =20 /* SRAM pre-allocated as part of the SoC instantiation */ mc->default_ram_size =3D 0; diff --git a/hw/arm/stm32f405_soc.c b/hw/arm/stm32f405_soc.c index cef23d7ee4..a65bbe298d 100644 --- a/hw/arm/stm32f405_soc.c +++ b/hw/arm/stm32f405_soc.c @@ -149,7 +149,7 @@ static void stm32f405_soc_realize(DeviceState *dev_soc,= Error **errp) =20 armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 96); - qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m4"= )); qdev_prop_set_bit(armv7m, "enable-bitband", true); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); qdev_connect_clock_in(armv7m, "refclk", s->refclk); @@ -287,17 +287,11 @@ static void stm32f405_soc_realize(DeviceState *dev_so= c, Error **errp) create_unimplemented_device("RNG", 0x50060800, 0x400); } =20 -static Property stm32f405_soc_properties[] =3D { - DEFINE_PROP_STRING("cpu-type", STM32F405State, cpu_type), - DEFINE_PROP_END_OF_LIST(), -}; - static void stm32f405_soc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D stm32f405_soc_realize; - device_class_set_props(dc, stm32f405_soc_properties); /* No vmstate or reset required: device has no internal state */ } =20 --=20 2.41.0 From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090642; cv=none; d=zohomail.com; s=zohoarc; b=OIKXwUEGsNBF26Yy4OGMYLff1cE9EEnP8CWVo3FS9XpaqTtHCxydJnHjn01QIeASDBwBoMoFOJPFGu+krEaXka5FM2hmUFZD3mjWIBKbe0IEN8bZrCGZohHvNLOnkj6tAMUDE+T+Txcc1aT5hvNutAMzhem2g0JLDavDUiaPVCk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090642; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Z2Aez4pIK4BJ1WwRvt8loGDJ5oavAC3olsgV9rlMnB0=; b=iZMqh05gLbWfE+yPWcAFHHuHdZMeXpzBO7oNkQCv1TUXFhG/Ni+GXS7Sc76eAURxBW56zrma6vx7fXFRoEtqo1gELumKFEDTeOyQLaQ9yG/mkOGn5zblzXtrIFP6d8OWujoH1MXykr8rs9vRD4NoOZBLQ0j799QT9Usvid0/2CQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700090642083495.72355474877986; Wed, 15 Nov 2023 15:24:02 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDN-0007bV-Pv; Wed, 15 Nov 2023 18:22:33 -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 1r3PDK-0007ap-Ui for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:30 -0500 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PD2-0003MI-Bl for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:30 -0500 Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-543c3756521so306875a12.2 for ; Wed, 15 Nov 2023 15:22:12 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id v22-20020a50d096000000b0053e0f63ce33sm7104725edd.95.2023.11.15.15.22.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090531; x=1700695331; 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=Z2Aez4pIK4BJ1WwRvt8loGDJ5oavAC3olsgV9rlMnB0=; b=MHeh91/nrgkxfcXxOepPhhIyAPcIaBmG3xCVynwggyKytPPJUaKpQH2AjUptiQdup2 xQWg8MWFnzLwFkVUZ0Ob44G/nPW7WuWyiiPjW+wJ+qMli0c5d1iZd/rYdXXZOPnuzrZr bmFDBMRDUc1ouE7o3dQivK3692qpplsBmEba5qBABR0xEoLuSQqPjLXs/K5AgWldCvv6 pximfUh77jtf4jKti0n0/YvfphsSBfc0F8uifLmeni0XrFCycou71UO0f17i8H4UGf9E mhHtbzUKU13/r7+CR6TsK+GPTwIiImRf0tgJTYtNyR2aJxqsUFEi7iYz3QIJ8+FWLfj/ u0Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090531; x=1700695331; 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=Z2Aez4pIK4BJ1WwRvt8loGDJ5oavAC3olsgV9rlMnB0=; b=WbfD+oOpOk5HIWrLOJKHB7QbniouL4gH0KofK1qANL6FSiGuicQnfMI2hZDRvgs54z VrA8IQtm1fGYV9/EFAa5jxs2frql4mabyXVJjFGnwvUu3Zx6mrsb9yEKTmP2rxkBwhGk LvmMr3O7UyZDzWMMQJYxtdlzLXTcJUYbr8ZvyGnsvjtcZc/BFKXbdD+AJCFjGBcF61fB biZKdLKHxhj5UJdwUFARBgMgfTgjPLSRO65OCCOO1sz8jTEjfyVyD/JXGnarYpeK4qax vTiXePgNJXzD6fjxfra41nOS2e94Dqt49eGbIisKMcC2PEw4wU/Ei7n/RSilFtKgUq8g cbfw== X-Gm-Message-State: AOJu0Ywn5YZv6eJ09/p3+bRBbBJeFI1urQJmj0808oi7lXyaW19Odz4T Hq/097Em93FoiOm5dAgK1H2xzPodnPKHuFDq2ys= X-Google-Smtp-Source: AGHT+IH6pcxu1kWjOcPaZaHUx3lgxyc32KFhizicDskdUy/eWopRTo6phkGY/qFdaS3eJBR3hVYqmQ== X-Received: by 2002:a05:6402:5193:b0:543:5789:4d6c with SMTP id q19-20020a056402519300b0054357894d6cmr733971edd.2.1700090530804; Wed, 15 Nov 2023 15:22:10 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.2? 2/6] hw/arm/stm32f205: Report error when incorrect CPU is used Date: Thu, 16 Nov 2023 00:21:49 +0100 Message-ID: <20231115232154.4515-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::530; envelope-from=philmd@linaro.org; helo=mail-ed1-x530.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090642452100001 The 'netduino2' machine ignores the CPU type requested by the command line. This might confuse users, since the following will create a machine with a Cortex-M3 CPU: $ qemu-system-arm -M netduino2 -cpu cortex-a9 Set the MachineClass::valid_cpu_types field (introduced in commit c9cf636d48 "machine: Add a valid_cpu_types property"). Remove the now unused MachineClass::default_cpu_type field. We now get: $ qemu-system-arm -M netduino2 -cpu cortex-a9 qemu-system-arm: Invalid CPU type: cortex-a9-arm-cpu The valid types are: cortex-m3-arm-cpu Since the SoC family can only use Cortex-M3 CPUs, hard-code the CPU type name at the SoC level, removing the QOM property entirely. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/arm/stm32f205_soc.h | 4 ---- hw/arm/netduino2.c | 7 ++++++- hw/arm/stm32f205_soc.c | 9 ++------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h index 5a4f776264..4f4c8bbebc 100644 --- a/include/hw/arm/stm32f205_soc.h +++ b/include/hw/arm/stm32f205_soc.h @@ -49,11 +49,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(STM32F205State, STM32F205_SOC) #define SRAM_SIZE (128 * 1024) =20 struct STM32F205State { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ - - char *cpu_type; =20 ARMv7MState armv7m; =20 diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c index 83753d53a3..94b6b379d6 100644 --- a/hw/arm/netduino2.c +++ b/hw/arm/netduino2.c @@ -44,7 +44,6 @@ static void netduino2_init(MachineState *machine) clock_set_hz(sysclk, SYSCLK_FRQ); =20 dev =3D qdev_new(TYPE_STM32F205_SOC); - qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); qdev_connect_clock_in(dev, "sysclk", sysclk); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 @@ -54,8 +53,14 @@ static void netduino2_init(MachineState *machine) =20 static void netduino2_machine_init(MachineClass *mc) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; + mc->desc =3D "Netduino 2 Machine (Cortex-M3)"; mc->init =3D netduino2_init; + mc->valid_cpu_types =3D machine_valid_cpu_types; mc->ignore_memory_transaction_failures =3D true; } =20 diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c index c6b75a381d..1a548646f6 100644 --- a/hw/arm/stm32f205_soc.c +++ b/hw/arm/stm32f205_soc.c @@ -127,7 +127,7 @@ static void stm32f205_soc_realize(DeviceState *dev_soc,= Error **errp) =20 armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 96); - qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"= )); qdev_prop_set_bit(armv7m, "enable-bitband", true); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); qdev_connect_clock_in(armv7m, "refclk", s->refclk); @@ -201,17 +201,12 @@ static void stm32f205_soc_realize(DeviceState *dev_so= c, Error **errp) } } =20 -static Property stm32f205_soc_properties[] =3D { - DEFINE_PROP_STRING("cpu-type", STM32F205State, cpu_type), - DEFINE_PROP_END_OF_LIST(), -}; - static void stm32f205_soc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D stm32f205_soc_realize; - device_class_set_props(dc, stm32f205_soc_properties); + /* No vmstate or reset required: device has no internal state */ } =20 static const TypeInfo stm32f205_soc_info =3D { --=20 2.41.0 From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090602; cv=none; d=zohomail.com; s=zohoarc; b=XPKgp1CUEFUzIMkYFEKNol/Ja6J6KouFqi9ZjThEL+eI5vvBdRwJSfTdG0Z3MQk/18zjBYjMrTNauBpzwvmw+cmxmFQ6w4E4HoZA4msdoSEPlGeIIRy92FLvJ0cyn1nMDQqyPOpVtm7Yyx3YXNfj0jo4J2KwlsOvWMnJ11day8U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090602; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=no978ZTm2/H5gCS/ezA/0hjk4jjwIQ7oHQcjYSAByag=; b=Pok34G5I6o9hGbDw3jU6mxiGBO9y6kacFyX3jXHxdXmJ1VZb/saiDO9yFsGIq0ZyVZN+WbXdfF7dtQC2T8728LRVeW2C8iSGc5K1zP4DhMJ6GIVFG/rD3i2Hly13trsIWJgYXBOZHEbXUsKizk7SPHCFDcTXcXKVgPJGc3r5ScE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700090602309338.2444506762947; Wed, 15 Nov 2023 15:23:22 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDG-0007Yq-Pb; Wed, 15 Nov 2023 18:22:27 -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 1r3PDE-0007Y3-8h for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:24 -0500 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PD9-0003PU-4I for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:24 -0500 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-50a938dda08so275406e87.3 for ; Wed, 15 Nov 2023 15:22:18 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id r25-20020a50c019000000b0053dec545c8fsm7199198edb.3.2023.11.15.15.22.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090537; x=1700695337; 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=no978ZTm2/H5gCS/ezA/0hjk4jjwIQ7oHQcjYSAByag=; b=nOu528ysueLmE6vMzJxQyNux8y1y0gsrM9qpGKD5xMhM9pJPfmJVPkIUh0J0Fz87GE Y3L0MnrIY9Qb6ft9F5SsjSBzM82+0e4T2SNTnHb+j0cDKxNhF78JpQPNaH5yJzkQLwqS sz9rvvxA5XvWxXdfvovXR+aC7xQZUHe0ECGi0L/CdSR++y/neFZZ26qPreLzP9VqkH+x 3a6Y4XyDh+c+t3mST1WRKm0GDvmqheuuFFkP6bB3sBgiiL1/LgXepEq4yw1+MnB1IJ8t 7U/0omNaOGtsEq+0NB7ZeQvfoNsz04rTyKKWPbBH7ntoXmti9mHg9mzE6DFVjeyxW2ke 1+Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090537; x=1700695337; 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=no978ZTm2/H5gCS/ezA/0hjk4jjwIQ7oHQcjYSAByag=; b=JnpQxJnCJlHZxuglZa9VdcurSiH0iEHfn6nBHeKTex0V4v3G235JUwBY4pb1eSiclz m06nPIghq0n/EfHKXtBFkyA4hexywYTXjUoy+8TdzZWrGFholGpksDfu5WPM/cJgxq/J qpl7pONl97hpkGsBeK/yg32mJtLswQZD6fQktT+z9+7X8atmk/31RquvCS2c4pj53Zav Yh0gcaKlNAXJcbJhxWfXtBArJ+6R/k5htYLnZNe+xbcqnz7qAwlM6dSOSuZO+G1Sn88T yuV0QS6Kzx/6cKofHepMDYvwLImIFJUAFo7qPSPUadWWnE/TpKkqDSlY6Gftje4Mu56G smEQ== X-Gm-Message-State: AOJu0YzElsQijzABlxTHK+GqaQiYb48Vn/vs5n9A8cs7md7en5+uTI1s GvqD/xCqj20Ng4fB16DN8vaU+byQtjxLQugucE8= X-Google-Smtp-Source: AGHT+IGk5klarW5AAlHcwL9qKwCw0MKlJn6E/ETucSMaBn1N2mrTXzHfgrIr3pD1zUVD0a+xzth21Q== X-Received: by 2002:a19:9108:0:b0:50a:3c38:778c with SMTP id t8-20020a199108000000b0050a3c38778cmr10023893lfd.12.1700090536874; Wed, 15 Nov 2023 15:22:16 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.2? 3/6] hw/arm/stm32f100: Report error when incorrect CPU is used Date: Thu, 16 Nov 2023 00:21:50 +0100 Message-ID: <20231115232154.4515-4-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=philmd@linaro.org; helo=mail-lf1-x12b.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090604288100003 The 'stm32vldiscovery' machine ignores the CPU type requested by the command line. This might confuse users, since the following will create a machine with a Cortex-M3 CPU: $ qemu-system-aarch64 -M stm32vldiscovery -cpu neoverse-n1 Set the MachineClass::valid_cpu_types field (introduced in commit c9cf636d48 "machine: Add a valid_cpu_types property"). Remove the now unused MachineClass::default_cpu_type field. We now get: $ qemu-system-aarch64 -M stm32vldiscovery -cpu neoverse-n1 qemu-system-aarch64: Invalid CPU type: neoverse-n1-arm-cpu The valid types are: cortex-m3-arm-cpu Since the SoC family can only use Cortex-M3 CPUs, hard-code the CPU type name at the SoC level, removing the QOM property entirely. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/arm/stm32f100_soc.h | 4 ---- hw/arm/stm32f100_soc.c | 9 ++------- hw/arm/stm32vldiscovery.c | 7 ++++++- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/include/hw/arm/stm32f100_soc.h b/include/hw/arm/stm32f100_soc.h index 40cd415b28..a74d7b369c 100644 --- a/include/hw/arm/stm32f100_soc.h +++ b/include/hw/arm/stm32f100_soc.h @@ -43,12 +43,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(STM32F100State, STM32F100_SOC) #define SRAM_SIZE (8 * 1024) =20 struct STM32F100State { - /*< private >*/ SysBusDevice parent_obj; =20 - /*< public >*/ - char *cpu_type; - ARMv7MState armv7m; =20 STM32F2XXUsartState usart[STM_NUM_USARTS]; diff --git a/hw/arm/stm32f100_soc.c b/hw/arm/stm32f100_soc.c index f7b344ba9f..b90d440d7a 100644 --- a/hw/arm/stm32f100_soc.c +++ b/hw/arm/stm32f100_soc.c @@ -115,7 +115,7 @@ static void stm32f100_soc_realize(DeviceState *dev_soc,= Error **errp) /* Init ARMv7m */ armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 61); - qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"= )); qdev_prop_set_bit(armv7m, "enable-bitband", true); qdev_connect_clock_in(armv7m, "cpuclk", s->sysclk); qdev_connect_clock_in(armv7m, "refclk", s->refclk); @@ -180,17 +180,12 @@ static void stm32f100_soc_realize(DeviceState *dev_so= c, Error **errp) create_unimplemented_device("CRC", 0x40023000, 0x400); } =20 -static Property stm32f100_soc_properties[] =3D { - DEFINE_PROP_STRING("cpu-type", STM32F100State, cpu_type), - DEFINE_PROP_END_OF_LIST(), -}; - static void stm32f100_soc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->realize =3D stm32f100_soc_realize; - device_class_set_props(dc, stm32f100_soc_properties); + /* No vmstate or reset required: device has no internal state */ } =20 static const TypeInfo stm32f100_soc_info =3D { diff --git a/hw/arm/stm32vldiscovery.c b/hw/arm/stm32vldiscovery.c index 67675e952f..6300dca722 100644 --- a/hw/arm/stm32vldiscovery.c +++ b/hw/arm/stm32vldiscovery.c @@ -47,7 +47,6 @@ static void stm32vldiscovery_init(MachineState *machine) clock_set_hz(sysclk, SYSCLK_FRQ); =20 dev =3D qdev_new(TYPE_STM32F100_SOC); - qdev_prop_set_string(dev, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3")); qdev_connect_clock_in(dev, "sysclk", sysclk); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); =20 @@ -58,8 +57,14 @@ static void stm32vldiscovery_init(MachineState *machine) =20 static void stm32vldiscovery_machine_init(MachineClass *mc) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; + mc->desc =3D "ST STM32VLDISCOVERY (Cortex-M3)"; mc->init =3D stm32vldiscovery_init; + mc->valid_cpu_types =3D machine_valid_cpu_types; } =20 DEFINE_MACHINE("stm32vldiscovery", stm32vldiscovery_machine_init) --=20 2.41.0 From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090654; cv=none; d=zohomail.com; s=zohoarc; b=ER/jmkp4rPxR6lthJWP0E/X22Pr1VhRg0CtX3azJLdML03289zMcm2Z4gHv52St017EXFFq2C8WmzafBn5PSGW7KQTdU+AioQtStbrZ8ZXD77Mx06ZrgNHo9+7Rv0fXjLtKe9I2R7XGBTL6FpFNtoVVeTFK0PdQqXSIzm32VKeU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090654; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SyOSV1bHLb/8jtxLoF5k1Jl+S3gYGF1w2lu5Kj6Bo84=; b=MtUjGUONxQb/n4PpYOb0/8QTqUfCN7/BFusy19S9NxTx14ikhg9d6SAaT6SxRjYeU2nspp0sTlNGqDcsvqkRm0koeUR4oQ66SkZV7bXsZ51oYdDyj7an+gGCCJDfjPfjWGCm51yp+N4+JcnBFo4dTZM0fQcwDhjQK7pOYjJ55jQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700090654673310.69937472633876; Wed, 15 Nov 2023 15:24:14 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDL-0007ax-7n; Wed, 15 Nov 2023 18:22: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 1r3PDI-0007ZF-Pm for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:28 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PDG-0003Ri-1E for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:28 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-543923af573so339247a12.0 for ; Wed, 15 Nov 2023 15:22:24 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id kg4-20020a17090776e400b009e5e4ff01d4sm7563210ejc.129.2023.11.15.15.22.21 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090543; x=1700695343; 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=SyOSV1bHLb/8jtxLoF5k1Jl+S3gYGF1w2lu5Kj6Bo84=; b=VjtwpG9n89RgJcXUQrRQgGX3I840mcjcXzcJ8Ce1D8oglzQrU2HI9L04Q0zip8x/Nd 8r2pwkqkRFemG3ye5+xw187DKEUpqsXq+El2s8jUR3Iu4mMYfU60Zffr/RVmlUM3JR7l HiGoss38b+NgDq7r814G3KcuZ9MUoHPm0CF75f+9WAPzy0ps/shwNMOYa2RNZa6xSy5w ovyJT5cq3suIOO4mjDAI3NmrKkjifQr2x+u08RN8R5s8AkeBP7ct/AAhN87g8stD2/j3 RjBCL/GcDa8TLpmu4eACpDt5dAotuwPNv8fq2A9z1FI4GPTYCo1hIwypmTD5TiuAZAdg JWOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090543; x=1700695343; 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=SyOSV1bHLb/8jtxLoF5k1Jl+S3gYGF1w2lu5Kj6Bo84=; b=Vu+zGu9yimv+UnaTiIik8mXezsZNDQ3+OrqI+D+StAp81pheyw7TdTox7xqR0xY801 AzQQo0dwDeB5dygYYb9cGlipaf2VGxx6crsgMscgAKwnFXaBEyrRh1r2dQ4t6EoirRZL Nldeq8w4ymI3aNen2A4Ph4AroaSpzZuKR4z9qR4BQ7SIzCEy/kZOJ7ACamIjGtbG9f0B lGnBfB0QJIqWAGnNzzN/+KTY78kQ3z7yhQ9wkkYJGMLWb7sKhzYkiI9fw1UsEY5kqCxp wxHfCEqmiaMar4r83Ud+0PHRplNGKqFYDebK4UxdrAVvbb5f4U++qoQAFdX+IPiVr2H8 bMEQ== X-Gm-Message-State: AOJu0YxZAmYjuinX8M3TXERhBgMuth2KVggORUPxTCax82P+tGUqkLhj SqHgpAK5FoA2qj8jcvcMLGLphDbEO6Z/N6k8qlU= X-Google-Smtp-Source: AGHT+IHIM6cn5Vxxqz0UX96CZIBsY74AHM1gzlrcYOeExhpVxj2FJI6bPyKedy0AtXuLMQoXp9vCgw== X-Received: by 2002:a17:907:9688:b0:9e8:48e6:8e0a with SMTP id hd8-20020a170907968800b009e848e68e0amr11040286ejc.61.1700090543047; Wed, 15 Nov 2023 15:22:23 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 4/6] hw/arm/msf2: Simplify setting MachineClass::valid_cpu_types[] Date: Thu, 16 Nov 2023 00:21:51 +0100 Message-ID: <20231115232154.4515-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::52d; envelope-from=philmd@linaro.org; helo=mail-ed1-x52d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090656439100003 The M2Sxxx SoC family can only be used with Cortex-M3. Propagating the CPU type from the board level is pointless. Hard-code the CPU type at the SoC level. Remove the now ignored MachineClass::default_cpu_type field. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- include/hw/arm/msf2-soc.h | 3 --- hw/arm/msf2-soc.c | 3 +-- hw/arm/msf2-som.c | 16 ++++++---------- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/include/hw/arm/msf2-soc.h b/include/hw/arm/msf2-soc.h index ce417a6266..9300664e8e 100644 --- a/include/hw/arm/msf2-soc.h +++ b/include/hw/arm/msf2-soc.h @@ -47,13 +47,10 @@ OBJECT_DECLARE_SIMPLE_TYPE(MSF2State, MSF2_SOC) #define MSF2_NUM_TIMERS 2 =20 struct MSF2State { - /*< private >*/ SysBusDevice parent_obj; - /*< public >*/ =20 ARMv7MState armv7m; =20 - char *cpu_type; char *part_name; uint64_t envm_size; uint64_t esram_size; diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c index b5fe9f364d..d6eb9ec9ac 100644 --- a/hw/arm/msf2-soc.c +++ b/hw/arm/msf2-soc.c @@ -134,7 +134,7 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Er= ror **errp) =20 armv7m =3D DEVICE(&s->armv7m); qdev_prop_set_uint32(armv7m, "num-irq", 81); - qdev_prop_set_string(armv7m, "cpu-type", s->cpu_type); + qdev_prop_set_string(armv7m, "cpu-type", ARM_CPU_TYPE_NAME("cortex-m3"= )); qdev_prop_set_bit(armv7m, "enable-bitband", true); qdev_connect_clock_in(armv7m, "cpuclk", s->m3clk); qdev_connect_clock_in(armv7m, "refclk", s->refclk); @@ -231,7 +231,6 @@ static Property m2sxxx_soc_properties[] =3D { * part name specifies the type of SmartFusion2 device variant(this * property is for information purpose only. */ - DEFINE_PROP_STRING("cpu-type", MSF2State, cpu_type), DEFINE_PROP_STRING("part-name", MSF2State, part_name), DEFINE_PROP_UINT64("eNVM-size", MSF2State, envm_size, MSF2_ENVM_MAX_SI= ZE), DEFINE_PROP_UINT64("eSRAM-size", MSF2State, esram_size, diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c index 7b3106c790..ed399223b8 100644 --- a/hw/arm/msf2-som.c +++ b/hw/arm/msf2-som.c @@ -47,7 +47,6 @@ static void emcraft_sf2_s2s010_init(MachineState *machine) DeviceState *dev; DeviceState *spi_flash; MSF2State *soc; - MachineClass *mc =3D MACHINE_GET_CLASS(machine); DriveInfo *dinfo =3D drive_get(IF_MTD, 0, 0); qemu_irq cs_line; BusState *spi_bus; @@ -55,20 +54,12 @@ static void emcraft_sf2_s2s010_init(MachineState *machi= ne) MemoryRegion *ddr =3D g_new(MemoryRegion, 1); Clock *m3clk; =20 - if (strcmp(machine->cpu_type, mc->default_cpu_type) !=3D 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - memory_region_init_ram(ddr, NULL, "ddr-ram", DDR_SIZE, &error_fatal); memory_region_add_subregion(sysmem, DDR_BASE_ADDRESS, ddr); =20 dev =3D qdev_new(TYPE_MSF2_SOC); qdev_prop_set_string(dev, "part-name", "M2S010"); - qdev_prop_set_string(dev, "cpu-type", mc->default_cpu_type); - qdev_prop_set_uint64(dev, "eNVM-size", M2S010_ENVM_SIZE); qdev_prop_set_uint64(dev, "eSRAM-size", M2S010_ESRAM_SIZE); =20 @@ -106,9 +97,14 @@ static void emcraft_sf2_s2s010_init(MachineState *machi= ne) =20 static void emcraft_sf2_machine_init(MachineClass *mc) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m3"), + NULL + }; + mc->desc =3D "SmartFusion2 SOM kit from Emcraft (M2S010)"; mc->init =3D emcraft_sf2_s2s010_init; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m3"); + mc->valid_cpu_types =3D machine_valid_cpu_types; } =20 DEFINE_MACHINE("emcraft-sf2", emcraft_sf2_machine_init) --=20 2.41.0 From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090599; cv=none; d=zohomail.com; s=zohoarc; b=CkopGk331pyPcJG3VKakt0TuIyQ5PXUZbHfQT+RKjS+vRyb90oS4OhBowfXL6vvqqJ8hzTN/LwZsxYIOYsyt79Em981O2wcfS5LkExt9ASWg3f+lmSBtQRCOif/sjuDeQSGsU7+iFOO1gS3GXOk3L2zi+81agXd+Q01uX1EH2Dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090599; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2b/fiTOaFIPayjBXev06ScNhrp2HmeigNrv9VMh5ovk=; b=JpOfaOk++FgNxcRbTcfQvzpCc5ptzeMl7d13xb2FnJaOdOMA4LXTapi7+1IividkIaryjO1GgWBDFvyeFbcF+ibm+tPSjmgImhPEuIPz/kPAEBovFHiVd1RMcAvgtufSUKtJfCpLSTXFmXV/8/hOVQy5ei1dadHfSqZiMPNJeIQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 17000905991741005.559129126515; Wed, 15 Nov 2023 15:23:19 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDQ-0007cF-BT; Wed, 15 Nov 2023 18:22:36 -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 1r3PDN-0007bX-0a for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:33 -0500 Received: from mail-lj1-x230.google.com ([2a00:1450:4864:20::230]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PDL-0003T0-DK for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:32 -0500 Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2c83ffcdbe3so2446821fa.1 for ; Wed, 15 Nov 2023 15:22:30 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id o23-20020a17090611d700b009829d2e892csm7773426eja.15.2023.11.15.15.22.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090549; x=1700695349; 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=2b/fiTOaFIPayjBXev06ScNhrp2HmeigNrv9VMh5ovk=; b=kSp+JYLMDgnYLsCdGO7WBL65O7ChFMPwz8VB9cx+lWlsLPMB9Ts3cmKbTSnS+mQSZt irk5nrlWHbU52C4lbdrci5G8EPqzxuOkTPbvUTHszKyPWyojkiHIPdwsRO8EKPKO1td7 G85j8GFXrwcYhKmQ8Kn5HbZaXCGGdkGwwqopTX5nIFFRsy6ZQ2RrlbG4ozVLYbves/7i iYJ9yi0OjqakQC3wstKLkRAskBaBXw+UKD2XAgdw3m0oQVdo0m0ebiRibKdx0kvZ/CZ9 l4n/Py+UL42c/hrdSAbuCR/I4jHmTe4yOpdk1G9wmueufanK2aOpQYWGuXWi2lKaDv7y 9RlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090549; x=1700695349; 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=2b/fiTOaFIPayjBXev06ScNhrp2HmeigNrv9VMh5ovk=; b=dpH2DLMEtiTyuMT+rplgxm9XSLYo+pt3u+Zu8XaDnX5gKy96PPJNsdX85LbfHPoSB8 OOle0qMH0hBhrXPH5GN/XItmZHmyaOG7PQAIp0NJ1CLdmldlmkVD8tsosnAJLS0OU56m mQPYV/FaEp+xqxmSb1WG5aLEsH0z3pjEq76akxYXsPlHysjg/Wgw42rWKHjHPbUrOGYc W8VexHlgcGDqQQxGM2y5TXLeFE8IEDsY22z6WmjfSid50LpYq0S9q8BvRcxICrOsBcxk fwpk5TSXVHObO6eKSntDkAt6ByngZ/i5MBhFpPbtakFtVUB/FHumImLTggEgurLfBoLY sflg== X-Gm-Message-State: AOJu0YzGfE6u6RtpRur8RzZKT9bI81tCS0YNI65XVpykinUnzW7vbyjd qKuqHQvB4o5HW/sGVClpH82LZy10AOZmQP0UAdI= X-Google-Smtp-Source: AGHT+IHEbeePqx0jQtu88QOZNtD+dZ9Ms5p6Swi3vNEO+Zb/Qjl7zdx+dHncO06iF/Yw51YlPKFDBQ== X-Received: by 2002:a2e:be28:0:b0:2c0:20e3:990f with SMTP id z40-20020a2ebe28000000b002c020e3990fmr5655014ljq.10.1700090549239; Wed, 15 Nov 2023 15:22:29 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 5/6] hw/arm/npcm7xx_boards: Simplify setting MachineClass::valid_cpu_types[] Date: Thu, 16 Nov 2023 00:21:52 +0100 Message-ID: <20231115232154.4515-6-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::230; envelope-from=philmd@linaro.org; helo=mail-lj1-x230.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090600670100005 The npcm7xx Soc is created with a Cortex-A9 core, see in hw/arm/npcm7xx.c: static void npcm7xx_init(Object *obj) { NPCM7xxState *s =3D NPCM7XX(obj); for (int i =3D 0; i < NPCM7XX_MAX_NUM_CPUS; i++) { object_initialize_child(obj, "cpu[*]", &s->cpu[i], ARM_CPU_TYPE_NAME("cortex-a9")); } The MachineClass::default_cpu_type field is ignored: delete it. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/arm/npcm7xx_boards.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 2aef579aac..98f9af27e7 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -121,15 +121,8 @@ static NPCM7xxState *npcm7xx_create_soc(MachineState *= machine, uint32_t hw_straps) { NPCM7xxMachineClass *nmc =3D NPCM7XX_MACHINE_GET_CLASS(machine); - MachineClass *mc =3D MACHINE_CLASS(nmc); Object *obj; =20 - if (strcmp(machine->cpu_type, mc->default_cpu_type) !=3D 0) { - error_report("This board can only be used with %s", - mc->default_cpu_type); - exit(1); - } - obj =3D object_new_with_props(nmc->soc_type, OBJECT(machine), "soc", &error_abort, NULL); object_property_set_uint(obj, "power-on-straps", hw_straps, &error_abo= rt); @@ -462,13 +455,17 @@ static void npcm7xx_set_soc_type(NPCM7xxMachineClass = *nmc, const char *type) =20 static void npcm7xx_machine_class_init(ObjectClass *oc, void *data) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->no_floppy =3D 1; mc->no_cdrom =3D 1; mc->no_parallel =3D 1; mc->default_ram_id =3D "ram"; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-a9"); + mc->valid_cpu_types =3D machine_valid_cpu_types; } =20 /* --=20 2.41.0 From nobody Wed Nov 27 06:45:33 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1700090644; cv=none; d=zohomail.com; s=zohoarc; b=h+dHyvPv11guCXthX2zFRZwypIguvL41Fb4sngYwto3hoVkDV5Za7I2NsRg7VDGM99eyVdkzMii9DHvC2xx1xsJVgjzvSP4SL0YrPV1JSShyjLIaObGSLKNl3IyYYutdxVoWK4v/PMg9HFmFxc9aWV2Z1iJkEXpK3MgB8NpKkkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700090644; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XdaILDX0UTZX18ZacnU/N5Y1jh+ZT87BDkgwEDab2Z8=; b=i1F7FKrj2eFSeWCOSz/jBqUfts27YuVMi7Aj2RSsXz5mRPS7wWYTOvFloQ7+ZeiK+dIXs9ufAc8UcWtEsCGMqR7Pbi3xu7Cw27veRK7ZL0+8lzKaKN1wmjDHGaGVGntPtRwIDGH9KONMAI+hONp0K1XwcOBr2SNcMCL0ieRzOXo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1700090644268759.3239219089593; Wed, 15 Nov 2023 15:24:04 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3PDW-0007dC-1b; Wed, 15 Nov 2023 18:22:42 -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 1r3PDT-0007d1-LW for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:39 -0500 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3PDR-0003U4-4Q for qemu-devel@nongnu.org; Wed, 15 Nov 2023 18:22:38 -0500 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9f27af23443so33276566b.0 for ; Wed, 15 Nov 2023 15:22:36 -0800 (PST) Received: from m1x-phil.lan ([176.176.130.62]) by smtp.gmail.com with ESMTPSA id bh2-20020a170906a0c200b009e6b055fa88sm7750745ejb.148.2023.11.15.15.22.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 15 Nov 2023 15:22:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700090555; x=1700695355; 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=XdaILDX0UTZX18ZacnU/N5Y1jh+ZT87BDkgwEDab2Z8=; b=ZBGSnvPTjQN5h8fVPyZcQQicvqm24OPrOaxk6gSQ8aXzXknpZ1vHpwONBCgRr5k8qo 8b/tdOctbpFsiRs+N8tePfK4EuoiYLt/oyDCjm7VVY5hsBpI3tmzsWJEbPCrwF1NKc6Y smYZUk4KaVq63TP3V7WswqSAYz9EjfGui+ueTl8YSPNrdwHf8rpB505D0rxkEnQ1ZzYB X3gsVTB2EnegCr8TfTtE27FmNz2djtJ/oUq+mrhl3et3eu4/cD6qo8Iq6wpza2jafjCM Cfu4+hRbr2/UJSXUSaj7tRp10AQV8Ob1HUrI0Pqo0h3LSJ6F/9SGDAlsVCUU7YMlZGr+ hJtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700090555; x=1700695355; 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=XdaILDX0UTZX18ZacnU/N5Y1jh+ZT87BDkgwEDab2Z8=; b=cT0x0WYmwYQtPJNuuLJypE8iC71esLQhdQL+EW8tA2365flbFi2dEbvO5HOs0uM1BO fiaQGEfwU4OBCdufJQCbN9kK4uwcP1DPO6Eo3lYzuh7a/a8abSkPok1zi5u4pifqerSl 7KtOScEPJ2UVjGFTkza0b9kuwCSR/1YY8DlnUr3WWwZuNMzgh9ruB7bfX8g460B9iici SRdl+PuBRJ6rD8ahBbTbIyRWZoXTS1st8YxEzDUZ8O9HdHEb9o3opH6YSYTS4Eh/NT1R 1cdl6oSejKGPc+n2AgKysT/uqfA+n++bEMSxhJstMXZbCbQqFeSeNScSmPVXsP/eTCjo OqbQ== X-Gm-Message-State: AOJu0Yxn69u2AXqxzWmRsolwdj8j+pXM4hpw+udD8Acw00JPSEVG2pTr aqioGv6Z5Y9so+aagrYyyFYQsSa/uEnl6+uTwvY= X-Google-Smtp-Source: AGHT+IHVjGNPOwda86AXQFkb3vmYWTJzEzUmoQI1HYhGi+2FnU2uwdEcEOTkDQ/Z2WCxW81Xv0vtHw== X-Received: by 2002:a17:906:6c4:b0:9e4:121c:c292 with SMTP id v4-20020a17090606c400b009e4121cc292mr7264894ejb.77.1700090555672; Wed, 15 Nov 2023 15:22:35 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Arnaud Minier , =?UTF-8?q?In=C3=A8s=20Varhol?= , Tyrone Ting , Subbaraya Sundeep , Hao Wu , Felipe Balbi , Gavin Shan , Igor Mammedov , Subbaraya Sundeep , Peter Maydell , Eduardo Habkost , Alistair Francis , Alexandre Iooss , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 6/6] hw/arm/musca: Simplify setting MachineClass::valid_cpu_types[] Date: Thu, 16 Nov 2023 00:21:53 +0100 Message-ID: <20231115232154.4515-7-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231115232154.4515-1-philmd@linaro.org> References: <20231115232154.4515-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=philmd@linaro.org; helo=mail-ej1-x632.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=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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1700090646417100007 Musca boards use the embedded subsystems (SSE) tied to a specific Cortex core. Our models only use the Cortex-M33. Use the common code introduced in commit c9cf636d48 ("machine: Add a valid_cpu_types property") to check for valid CPU type at the board level. Remove the now unused MachineClass::default_cpu_type field. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson --- hw/arm/musca.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/hw/arm/musca.c b/hw/arm/musca.c index 6eeee57c9d..d3658354ba 100644 --- a/hw/arm/musca.c +++ b/hw/arm/musca.c @@ -355,7 +355,6 @@ static void musca_init(MachineState *machine) { MuscaMachineState *mms =3D MUSCA_MACHINE(machine); MuscaMachineClass *mmc =3D MUSCA_MACHINE_GET_CLASS(mms); - MachineClass *mc =3D MACHINE_GET_CLASS(machine); MemoryRegion *system_memory =3D get_system_memory(); DeviceState *ssedev; DeviceState *dev_splitter; @@ -366,12 +365,6 @@ static void musca_init(MachineState *machine) assert(mmc->num_irqs <=3D MUSCA_NUMIRQ_MAX); assert(mmc->num_mpcs <=3D MUSCA_MPC_MAX); =20 - if (strcmp(machine->cpu_type, mc->default_cpu_type) !=3D 0) { - error_report("This board can only be used with CPU %s", - mc->default_cpu_type); - exit(1); - } - mms->sysclk =3D clock_new(OBJECT(machine), "SYSCLK"); clock_set_hz(mms->sysclk, SYSCLK_FRQ); mms->s32kclk =3D clock_new(OBJECT(machine), "S32KCLK"); @@ -603,12 +596,16 @@ static void musca_init(MachineState *machine) =20 static void musca_class_init(ObjectClass *oc, void *data) { + static const char *machine_valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-m33"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->default_cpus =3D 2; mc->min_cpus =3D mc->default_cpus; mc->max_cpus =3D mc->default_cpus; - mc->default_cpu_type =3D ARM_CPU_TYPE_NAME("cortex-m33"); + mc->valid_cpu_types =3D machine_valid_cpu_types; mc->init =3D musca_init; } =20 --=20 2.41.0