From nobody Tue Nov 26 15:38:55 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=1706888340; cv=none; d=zohomail.com; s=zohoarc; b=Qjpm7Rx27rQ9KigKNpho+/Y1vjQ63gpO4KY5kiOr3uh96NrDBK9exkNr4wV9y5B+XOr0Kao4nZjB0I4MmH4z+UQDPMjq1Cj+VUd7UilSzsEgL2HI9kMnq2NTbIdefgd/RxecFSp0RemS16egdnba49tYXna842ogExPPHyUH2+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706888340; h=Content-Type:Content-Transfer-Encoding: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:Cc; bh=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=c5EM7Zl8tRPNh3d+T5Icy1rX0joKwQRtaCTQfwVv7WwsUmQ/zY6otB3k/aOWvySxnyyQ8PytHtOOyHE7MMIVrPT8yEDBitlXIv37vyXwyYoZ5vVd9cTTN4V8qCvBip4+Ef63zC/wz6Cx4aNqxI/LGPh9O4VeoCY51t175N39MzU= 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 1706888340500677.8656435263738; Fri, 2 Feb 2024 07:39:00 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVvb2-0000Kh-6n; Fri, 02 Feb 2024 10:36:52 -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 1rVvb0-0000JA-9n for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:50 -0500 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVvay-0004TU-ME for qemu-devel@nongnu.org; Fri, 02 Feb 2024 10:36:49 -0500 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-40fb020de65so19239145e9.2 for ; Fri, 02 Feb 2024 07:36:47 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b0040fafd84095sm214735wms.41.2024.02.02.07.36.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:36:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706888206; x=1707493006; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=IL0+I6LW9TtehitUbFW7SGqCZzHYkyhX126hWj3NjoTa92O8+Sl2qVL2kCfEm/N00A mOZg8jQgNzgshLOXTmPOR1mNCHM9NAsWfT9RMr1u12I3zR1KADrtFVdPXhSxEebELcrP fZXD7omcAzfPzkOW+HApdraHToTAKoV4rKXJi4dVqOSxsyYHC1QTclF6ORPh+bClEqoT MRVW/uN9A19t3Bc4u/noPiILayDnxzOT5D1Jv1L9gMyxvFp+EO6PtsfjBExa34Dhs6j1 w0NgH/le5EiPaTFlXVPXXcQlWqjUkxUJq8IV+BmXcqsizHbrwMEImVKDxGodMFSb4k6O lxIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706888206; x=1707493006; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=RYd3QrmHD9UKjdfu51z5VjEqtJezN+iOtcmmSJ3N4Eo=; b=hjmCslTMMxJv12Y2bEj+AqOU+3b6QBGg/noq0qDRaLoao7ulzltgvcXpMTBg2UcZTG 6FWJfjVnU4/5ihhuDvnZpCUQuB0cug1iIiYX64NuCE7a9tXXztVOZ60uvIRI9oIqayr6 ViQRQwxrQOCRlHu/AXcQMGp5LP9HFRVwuJ/tHA7zu1XPcbuD7WGdk3hkHenj+qp9OT7V nBiaMCrZvR8agr3CpanKUolSa7G3m0MCpXmTdZ/1Lzhf7Ns9aO6oAZlwMd45TDdeZMR+ qTt8nzJmXrAANFwRLUheijV1Idckw363hRp840Fcirmpkz46UldlXzUiWNEWIWv0rOay ox4Q== X-Gm-Message-State: AOJu0YyK5gCmSj5hFT6dEYNYMTtZTrOrfHHp1hRUv3ayLy5LBpeQk8Ld /HD3Eke7VIqyJU1vrmVSaF9G11PUkn/8MocTtXU6geaXNKvHom07Oe828cw8B6S4QOwB7L5Xwd4 p X-Google-Smtp-Source: AGHT+IG2iplXt4MJz53vrW6Dk82/noLxmrcqdxW91c4qAfwyRlwzUnkg8bja0nR+zsrWX23hwfpgaA== X-Received: by 2002:a05:600c:3152:b0:40e:7852:bc85 with SMTP id h18-20020a05600c315200b0040e7852bc85mr6665943wmo.41.1706888206343; Fri, 02 Feb 2024 07:36:46 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/36] hw/arm/highbank: Check for CPU types in machine_run_board_init() Date: Fri, 2 Feb 2024 15:36:17 +0000 Message-Id: <20240202153637.3710444-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240202153637.3710444-1-peter.maydell@linaro.org> References: <20240202153637.3710444-1-peter.maydell@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::32f; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: 1706888342068100001 From: Philippe Mathieu-Daud=C3=A9 Restrict MachineClass::valid_cpu_types[] to the single valid CPU types. Instead of ignoring invalid CPU type requested by the user: $ qemu-system-arm -M midway -cpu cortex-a7 -S -monitor stdio QEMU 8.2.50 monitor - type 'help' for more information (qemu) info qom-tree /machine (midway-machine) /cpu[0] (cortex-a15-arm-cpu) ... we now display an error: $ qemu-system-arm -M midway -cpu cortex-a7 qemu-system-arm: Invalid CPU model: cortex-a7 The only valid type is: cortex-a15 Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Reviewed-by: Gavin Shan Message-id: 20240129151828.59544-5-philmd@linaro.org Signed-off-by: Peter Maydell --- hw/arm/highbank.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index b8d702c82cc..03670506974 100644 --- a/hw/arm/highbank.c +++ b/hw/arm/highbank.c @@ -345,10 +345,15 @@ static void midway_init(MachineState *machine) =20 static void highbank_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a9"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Calxeda Highbank (ECX-1000)"; mc->init =3D highbank_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->block_default_type =3D IF_IDE; mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; @@ -364,10 +369,15 @@ static const TypeInfo highbank_type =3D { =20 static void midway_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + ARM_CPU_TYPE_NAME("cortex-a15"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Calxeda Midway (ECX-2000)"; mc->init =3D midway_init; + mc->valid_cpu_types =3D valid_cpu_types; mc->block_default_type =3D IF_IDE; mc->units_per_default_bus =3D 1; mc->max_cpus =3D 4; --=20 2.34.1