From nobody Wed Nov 27 06:37:58 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=1700562378; cv=none; d=zohomail.com; s=zohoarc; b=SpYlVdnGcv9LBe3tbkzrKh4fD8e9AF560WoJh7pe2bYq1Yy/38HV82HYmP+LNbmRdqH67WQkcYtMsl1aM7Mmhj66dDJ0LXW+DfSVtCk+F2EqU75upq0qvS724kTtKz4ELExNu57OXP/bacM4AWLFmc2b2mwAQoOhk7pXHlB1i28= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700562378; 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=DFKuHjN+ndUlQFTqRBZjDt9iBODNYrCuBl0JQxBqPME=; b=nrQ7zA5AdafnwebdOpiak9HALetA619EdvAbdFHeL2E31dche0ZT8EPowmR58MLswrtzDznmjxWcJOjWHMjUH6YzVOxm+j8gn9xnuU1qX2uM3VOBw4h2XSPX/WHPgn/y1tu8bAiwNExdzSbjl4bdXT8jIK9Mg+teNxesl/Ml3zg= 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 170056237833583.43684773722646; Tue, 21 Nov 2023 02:26:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r5Nw6-0004Lw-Cp; Tue, 21 Nov 2023 05:24:54 -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 1r5Nw1-0004Il-TZ for qemu-devel@nongnu.org; Tue, 21 Nov 2023 05:24:49 -0500 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r5Nvz-0007Em-0z for qemu-devel@nongnu.org; Tue, 21 Nov 2023 05:24:49 -0500 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4083ac51d8aso24019515e9.2 for ; Tue, 21 Nov 2023 02:24:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id n25-20020a05600c181900b00405442edc69sm20450835wmp.14.2023.11.21.02.24.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 02:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1700562285; x=1701167085; 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=DFKuHjN+ndUlQFTqRBZjDt9iBODNYrCuBl0JQxBqPME=; b=TPXj3r9ueDfXtQDyIuWUFvdMPjoqBf6MZQp33VXNKzOYVGdh4q9JSZULgZYJtEV0K2 Q6+u2/DRYTzyDmPZtJy23tIZesRqYnadAGJVvN3OzfhpQkeuG2OVzE+QJPSw48n+zkuH mq1j/P6Ek7QsVVsHWGU0yGPqfHpFbXI8AgPAbjkQhUIC4nH/YQ3JVwROa7qFiP3CpHKH wV1cS0FL5rMAASCzkNKcUGuSIbSHzshnOVBxGaVMlbxorFwkB+I71QxhNXYlaR+2nIZX K+CyOan+hZX2njH5rY+9BmDwnUvDnUp/itHFpRVeVts0h+eh3TdLJJhvIac2wxfCAPOM I5EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700562285; x=1701167085; 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=DFKuHjN+ndUlQFTqRBZjDt9iBODNYrCuBl0JQxBqPME=; b=DMelyUGDo871MzFys5BYcLanxT1E8Synhzj+QCEmuhKNwqOchR9G9iwXWRk30uFbvF pyvhIMYpY5SuFzbt3K6Sk3fX10Xs2ZopHEEpeYV8czYjYKjg1uaKhrjkEGqJziERE0kF ClZUj/mJu/Z4/GAp+lPtm5ieP2jF7tvmNrn0NLQt400yXNii7ZhhKsRX79D7b5yl20af vX2L46tYhP+527cE90oA0in5Sv+U4RDSOcyE5AT0meMHtZQq8UDQMw86abj3C9DL1jfM PC53kFQzgmHiw35L4KZJnpOpJjblgWz6ZD0hlxxH/sGvuqcY/cFtPVBLwd6rVZWBSzbO chNA== X-Gm-Message-State: AOJu0YxYv4ftL5Bg7nX8GqwDe7Mwgx6rNFxe9JXkEaKcCZXsM99wP17C TTxO8ELbJ1H9zKE1W+V8GKmBTammOGjMnnrrHcU= X-Google-Smtp-Source: AGHT+IHDe4bzKtVWfo7+7Vw51BGUaLqj/+w2fVVpgJw5pAybW5CU1ClQk2HoOyQ6doUkD1BmIKQZAw== X-Received: by 2002:a05:600c:3b84:b0:40b:2b86:c886 with SMTP id n4-20020a05600c3b8400b0040b2b86c886mr442704wms.31.1700562285364; Tue, 21 Nov 2023 02:24:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 4/8] hw/core/machine: Constify MachineClass::valid_cpu_types[] Date: Tue, 21 Nov 2023 10:24:37 +0000 Message-Id: <20231121102441.3872902-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231121102441.3872902-1-peter.maydell@linaro.org> References: <20231121102441.3872902-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::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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: 1700562379071100001 From: Gavin Shan Constify MachineClass::valid_cpu_types[i], as suggested by Richard Henderson. Suggested-by: Richard Henderson Signed-off-by: Gavin Shan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20231117071704.35040-2-philmd@linaro.org [PMD: Constify HPPA machines, restrict valid_cpu_types to machine_class_init() handlers] Signed-off-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Peter Maydell --- include/hw/boards.h | 2 +- hw/hppa/machine.c | 22 ++++++++++------------ hw/m68k/q800.c | 11 +++++------ 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/include/hw/boards.h b/include/hw/boards.h index a7359992980..da85f86efb9 100644 --- a/include/hw/boards.h +++ b/include/hw/boards.h @@ -273,7 +273,7 @@ struct MachineClass { bool has_hotpluggable_cpus; bool ignore_memory_transaction_failures; int numa_mem_align_shift; - const char **valid_cpu_types; + const char * const *valid_cpu_types; strList *allowed_dynamic_sysbus_devices; bool auto_enable_numa_with_memhp; bool auto_enable_numa_with_memdev; diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c index 9d08f39490e..c8da7c18d53 100644 --- a/hw/hppa/machine.c +++ b/hw/hppa/machine.c @@ -672,19 +672,18 @@ static void hppa_nmi(NMIState *n, int cpu_index, Erro= r **errp) } } =20 -static const char *HP_B160L_machine_valid_cpu_types[] =3D { - TYPE_HPPA_CPU, - NULL -}; - static void HP_B160L_machine_init_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + TYPE_HPPA_CPU, + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); NMIClass *nc =3D NMI_CLASS(oc); =20 mc->desc =3D "HP B160L workstation"; mc->default_cpu_type =3D TYPE_HPPA_CPU; - mc->valid_cpu_types =3D HP_B160L_machine_valid_cpu_types; + mc->valid_cpu_types =3D valid_cpu_types; mc->init =3D machine_HP_B160L_init; mc->reset =3D hppa_machine_reset; mc->block_default_type =3D IF_SCSI; @@ -709,19 +708,18 @@ static const TypeInfo HP_B160L_machine_init_typeinfo = =3D { }, }; =20 -static const char *HP_C3700_machine_valid_cpu_types[] =3D { - TYPE_HPPA64_CPU, - NULL -}; - static void HP_C3700_machine_init_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + TYPE_HPPA64_CPU, + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); NMIClass *nc =3D NMI_CLASS(oc); =20 mc->desc =3D "HP C3700 workstation"; mc->default_cpu_type =3D TYPE_HPPA64_CPU; - mc->valid_cpu_types =3D HP_C3700_machine_valid_cpu_types; + mc->valid_cpu_types =3D valid_cpu_types; mc->init =3D machine_HP_C3700_init; mc->reset =3D hppa_machine_reset; mc->block_default_type =3D IF_SCSI; diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 1d7cd5ff1c3..83d1571d02f 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -726,19 +726,18 @@ static GlobalProperty hw_compat_q800[] =3D { }; static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); =20 -static const char *q800_machine_valid_cpu_types[] =3D { - M68K_CPU_TYPE_NAME("m68040"), - NULL -}; - static void q800_machine_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] =3D { + M68K_CPU_TYPE_NAME("m68040"), + NULL + }; MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Macintosh Quadra 800"; mc->init =3D q800_machine_init; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m68040"); - mc->valid_cpu_types =3D q800_machine_valid_cpu_types; + mc->valid_cpu_types =3D valid_cpu_types; mc->max_cpus =3D 1; mc->block_default_type =3D IF_SCSI; mc->default_ram_id =3D "m68k_mac.ram"; --=20 2.34.1