From patchwork Tue Nov 21 10:24:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 745690 Delivered-To: patch@linaro.org Received: by 2002:a5d:5052:0:b0:32d:baff:b0ca with SMTP id h18csp1793214wrt; Tue, 21 Nov 2023 02:26:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IGnwiYxpR12yS62IIZkzo+5BBZBjy5Z6JsuFxOvOY7n8ebNHkXF9Ua1C7mxaEubJMXxVsir X-Received: by 2002:a05:622a:130d:b0:418:1059:dfb9 with SMTP id v13-20020a05622a130d00b004181059dfb9mr13199862qtk.1.1700562378002; Tue, 21 Nov 2023 02:26:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700562377; cv=none; d=google.com; s=arc-20160816; b=HX/Cv2Yf80p/zo9ReA31l19ZEN0qxeTKGWt7mw4KLIqHraAF70TMRqDpydTDhQRc3I wHw3k3hUVCGs9NtVhWN3YZQ035WrVhNfpAUFQ99jJe2kr2OLkfZmJt2oZx9mxkFdPq+h ViWm1v6f9cbosO3bZcpfQXArtfg2j3hSVBANEDwmedY29PyOJbaiYbYC4LtsJ1+EwLk/ Q2AMsGk+LTJmLsc05D8lCckWeloAVoYq6jwXKPTvE0vA2a0w+jN5TzFZcc0traEP3U9k 9eH9iBeQywOHJMSQsfx/tsO9pxVB+XcV3cQlwoXCY7VNDjiuraAZCN/3F+sRBkhuwpHT X4RQ== 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:to:from :dkim-signature; bh=DFKuHjN+ndUlQFTqRBZjDt9iBODNYrCuBl0JQxBqPME=; fh=PnYt+qEB9tAfMKoqBm2xjKOFpYyFFGPudh5cVIoieJM=; b=tqD9jyZ5W4rW5eQGfhLVUKkIZPiO02thIBNd6u0h6BL0wR3zKMpTFopGr6BmEUCu/9 Fikr6j3qUlHTU0KJLcXkrz+lXz1EOsaRW2BU1x8VuJl+g+pb/sMTOm4ccFjQhwJGRO1+ shzktjP4sLnK9dl38vL46vtxMkdn+G6onwt8R3nDBirMCWVxgp434GPyzyMk+BtU9znP QUxEGFow8tXhcd+JC1bvurpU/tIN6hDEOZMRBIG9YkpYrpIavgsJ26yIFj+E0gD7miHe XhVSmEx8rucq+d52BNCDH1tlldqiJRbMMsyItNjGlvQZPyUyvmDs8Dkmh/tVNXtz3fXi 0mzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TPXj3r9u; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z7-20020a05622a028700b00419629f778csi9318038qtw.703.2023.11.21.02.26.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 21 Nov 2023 02:26:17 -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; dkim=pass header.i=@linaro.org header.s=google header.b=TPXj3r9u; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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) 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-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) 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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é Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé 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é 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, Error **errp) } } -static const char *HP_B160L_machine_valid_cpu_types[] = { - TYPE_HPPA_CPU, - NULL -}; - static void HP_B160L_machine_init_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + TYPE_HPPA_CPU, + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); mc->desc = "HP B160L workstation"; mc->default_cpu_type = TYPE_HPPA_CPU; - mc->valid_cpu_types = HP_B160L_machine_valid_cpu_types; + mc->valid_cpu_types = valid_cpu_types; mc->init = machine_HP_B160L_init; mc->reset = hppa_machine_reset; mc->block_default_type = IF_SCSI; @@ -709,19 +708,18 @@ static const TypeInfo HP_B160L_machine_init_typeinfo = { }, }; -static const char *HP_C3700_machine_valid_cpu_types[] = { - TYPE_HPPA64_CPU, - NULL -}; - static void HP_C3700_machine_init_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + TYPE_HPPA64_CPU, + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); NMIClass *nc = NMI_CLASS(oc); mc->desc = "HP C3700 workstation"; mc->default_cpu_type = TYPE_HPPA64_CPU; - mc->valid_cpu_types = HP_C3700_machine_valid_cpu_types; + mc->valid_cpu_types = valid_cpu_types; mc->init = machine_HP_C3700_init; mc->reset = hppa_machine_reset; mc->block_default_type = 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[] = { }; static const size_t hw_compat_q800_len = G_N_ELEMENTS(hw_compat_q800); -static const char *q800_machine_valid_cpu_types[] = { - M68K_CPU_TYPE_NAME("m68040"), - NULL -}; - static void q800_machine_class_init(ObjectClass *oc, void *data) { + static const char * const valid_cpu_types[] = { + M68K_CPU_TYPE_NAME("m68040"), + NULL + }; MachineClass *mc = MACHINE_CLASS(oc); mc->desc = "Macintosh Quadra 800"; mc->init = q800_machine_init; mc->default_cpu_type = M68K_CPU_TYPE_NAME("m68040"); - mc->valid_cpu_types = q800_machine_valid_cpu_types; + mc->valid_cpu_types = valid_cpu_types; mc->max_cpus = 1; mc->block_default_type = IF_SCSI; mc->default_ram_id = "m68k_mac.ram";