From nobody Tue Nov 26 17:32:52 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=1706541672; cv=none; d=zohomail.com; s=zohoarc; b=CMQyNkyXGuHyO4K+/qpBIg/6wMyC94hCe2JldHp6eziTxEivyOjaMpxNJDQwaHbhW9IVggl97StXY0VPxT2dfuddr9X72rFTciZJoh6WzIcs1o7EPlJ24UO/3GG9DJpSwfxetNhghVvSPH4jt/N7/VInDrcLX/AttYtULTDAuA4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1706541672; 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=dcxTw0DrdmCPot2iJuF6Ul0G9M2q8XR4FUwWiq3hCFw=; b=KMgufTchdjSmA8DIgH1p9a5I1mJECEwQpriL+zSZ29NmCVzHKYvugWqJoRaNE51Jzug3/uHGMTYX2yl0sqB5Vm2BJls5YqYd6dzxh5oEWyabyF57sgZkLTF7yZgTHfv+FGLfb8Ebhx9xcoLOIztYc+JEhjjM4hEt4F/d2YUI4Nc= 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 170654167255267.4348680289072; Mon, 29 Jan 2024 07:21:12 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rUTPj-0007d1-7H; Mon, 29 Jan 2024 10:19:11 -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 1rUTPa-0007Xd-Gl for qemu-devel@nongnu.org; Mon, 29 Jan 2024 10:19:04 -0500 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rUTPW-0007ST-G3 for qemu-devel@nongnu.org; Mon, 29 Jan 2024 10:19:00 -0500 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-51028fadfe2so3118860e87.0 for ; Mon, 29 Jan 2024 07:18:58 -0800 (PST) Received: from m1x-phil.lan ([176.187.219.39]) by smtp.gmail.com with ESMTPSA id fa7-20020a05600c518700b0040ec6d7420csm14208710wmb.14.2024.01.29.07.18.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 29 Jan 2024 07:18:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1706541536; x=1707146336; 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=dcxTw0DrdmCPot2iJuF6Ul0G9M2q8XR4FUwWiq3hCFw=; b=Kx01oTFgCyTWmyW3LEUdvqAl4WHKUbrvMjaEyiZxNW9xIsriFzf2PLjvdPlLLSQlmW 78lEMjdO6StqJ9vk7H3fV9RuO8LF2yVPTEDuR0Mzum6AcWsO5ZdllN+6LYoW69f7u8y3 1O32nSXOpPAZgy0cHk9pVoJhB+hVJA4AbaVuuYhK0DpuRfKi41rGXYxp1H7jBdroGosh qCytnTWqtiT6WbsrU0x3lKVox6cXMuK8kGJfCN6g0Rk8zDJzhDwasmIem6cxf+7XxHB9 6HdViVIuQAygjZGFbeqwr/6B8C0UlyemGje84RU7EajvOHgSZdfzZjgkr8PzQOT2bqlm xqCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706541536; x=1707146336; 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=dcxTw0DrdmCPot2iJuF6Ul0G9M2q8XR4FUwWiq3hCFw=; b=OYLUsrOU3agbSPsP1POF546o8n/QG2+xMvc2FbLhBaC7FoCvX47yIqgQrzQd0yIgaY BTUnkQsb1MXYDds3y3nE025AhCQwkJHagEDwD7FMiMcw3Itc28dbCrKUlNCbZkUAUq9H 3ki3tLpcYz4IEotOVcyYRc2QeifPu1pl0dKDwk8raCjfRFjoeVB+t+F5SGtphmKxgmNo Age7MLJqjaBGPHyjHDQ6pWnSBvBttIfaQXBQer6jjiqgXhWgGCCtmbFlpTKPEl/zd1sF Scp6QT1AIm7AZ+39xtf5H7+maLumpnoI4ihltSmp8MrCmCFjjWsHUaVkH/USX5eV3K28 Km2A== X-Gm-Message-State: AOJu0YzrNfKpdoBmvMUbWcmWBJabPRgTgvzJ0TGsweuSn2tCcw72ZRVb 1PnjXsDAZelzwyoNZujjZCkYyaaXi6Ru+aVimBwLANSQdi657ibdJbv/sG6Y2Wicx9JX1QRdQnr 9 X-Google-Smtp-Source: AGHT+IGJ+K2soQbrnFpE0uHIy3dUelT8wTnsBiwb6mjdWdSQoGzDAWhvlSaahpYUovWRPHn8Lfw8Vg== X-Received: by 2002:a05:6512:1194:b0:511:f63:142d with SMTP id g20-20020a056512119400b005110f63142dmr2403017lfr.29.1706541536685; Mon, 29 Jan 2024 07:18:56 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Tyrone Ting , Subbaraya Sundeep , Alistair Francis , Igor Mitsyanko , Hao Wu , "Edgar E. Iglesias" , Peter Maydell , Rob Herring , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Richard Henderson , Gavin Shan Subject: [PATCH v3 4/9] hw/arm/highbank: Check for CPU types in machine_run_board_init() Date: Mon, 29 Jan 2024 16:18:23 +0100 Message-ID: <20240129151828.59544-5-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240129151828.59544-1-philmd@linaro.org> References: <20240129151828.59544-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::131; envelope-from=philmd@linaro.org; helo=mail-lf1-x131.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: 1706541673204100001 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 --- hw/arm/highbank.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c index b8d702c82c..0367050697 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.41.0