From patchwork Tue Mar 11 19:51:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 872485 Delivered-To: patch@linaro.org Received: by 2002:a5d:64ce:0:b0:38f:210b:807b with SMTP id f14csp1659253wri; Tue, 11 Mar 2025 12:53:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUdb4AwSDflzw4jau5YUdy0Uz3+fDnKtiHuxv1JbsCU4RHRh4iPJtcrJ9B1eQ0teGed67pPLw==@linaro.org X-Google-Smtp-Source: AGHT+IERyqzH5zYVS9lXy+Vt51f8VSLmBixkmUaw1Y8QOJqrbMKTNUU44KyyuL/Obv+ggjSrTxH+ X-Received: by 2002:a05:622a:1ba5:b0:476:8f41:7b96 with SMTP id d75a77b69052e-4768f418049mr117106021cf.6.1741722813764; Tue, 11 Mar 2025 12:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1741722813; cv=none; d=google.com; s=arc-20240605; b=G+k4zeY50l42aPkxAWy/PM+PYM88gj2+JL908+cg/OPFUj2VDiVlm0yCRIFc1HynuU aBA/TpMtBz8RwLB7Chgdce579KOTQyzdZCq39BAg/aXfXZOLYH5HdUVREGC+Hu5OhzHt YB2QM0NNefxWt4Yf9/G4ILqOPHkRRJsiVmPmvexmVlFrr10bkP8HTRs0Ptge2ljTlVOk NmzXOkqub2qD2KtFQi/A7ImQe73kFQq7QnpcRG3JUVfkzTK4foTbTccaSedbjgMuUg5q zhvfqVjicin04FX4HO66g0rTHRwgW6iT+dmh4v1gRZY2AO0b5QYmDEE9FfxygB+5fyIJ 0H1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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:cc:to :from:dkim-signature; bh=HrpL1oseyxb240hBD3z5bIdJcGujCcN61+LmTdzxPbg=; fh=KEPLpLQVO77v+WBSDPeXmXKEnOIOhNHYNw7geHkyLGA=; b=ULiCW7Er2TwFHeDg7qpu2JTWwIRkutaqKiv0EDmww9x9T+7KfbWqyEJ4XEhK6V7had wN5KXvgXF6seBv8ZB6xOUBqMvOWE2CjiqIPi0ZH7e50QfS2zSB3DFo++Pk/syYEsYxke z/k2UV1M1d1yMJoQUXUklV4pp8qiGurtIM2qIh6kDktUNwMJ0GfzQPZ5f4V1kx7wN1Qg Lrnur3hlVTcy9P/vdFX6Gj8VVCe2ehrNsHYL6yCgRc+K1pqUtxVOGm+zm+hYFbj/HjYd i1t8Ykyn6bujAJuZMJylEYlC3fLldw26fxZ8T3aPkgGceHd+aHXoF0oNX+XAL/NxH0hQ x0qQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=uI4nO2OQ; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6e8f707d5a6si118917956d6.46.2025.03.11.12.53.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 11 Mar 2025 12:53:33 -0700 (PDT) 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=uI4nO2OQ; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ts5e5-0006yq-8s; Tue, 11 Mar 2025 15:52:10 -0400 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 1ts5e3-0006yC-0t for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:52:07 -0400 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ts5e0-0007VI-Fk for qemu-devel@nongnu.org; Tue, 11 Mar 2025 15:52:06 -0400 Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-390f5f48eafso2913775f8f.0 for ; Tue, 11 Mar 2025 12:52:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741722722; x=1742327522; 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=HrpL1oseyxb240hBD3z5bIdJcGujCcN61+LmTdzxPbg=; b=uI4nO2OQoOU2xPj2jKgsXf6tCVrDX6etPv3AJYg+EiZT0wCVRYxukilM2SU0ZzEBqG O7V3iiRJ6+N5fS+qddsRYLr6wAd4OIhOwNXJstFkYUADPb4BP/4SCbsje+xxf7UtQXj1 SqsWsKO1bSr+ALTFk3MfkDSnLUma9IdiQakoKlFAUxUIAz6aoMzI0Epp8Lopl3eQJClG kpIMwwHewkoflnHt7XXpnvc0k+aC49C68KZv0AtxcIxuuAt+PQ0o7BPP7dRj0W3j2HEB d1Y2Ey8tPGT84vfYUY7OCRXCpVqyaJdwhKfLhz5Tbhtophjm8gBafQbCBfYOvc77LY5y B6Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741722722; x=1742327522; 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=HrpL1oseyxb240hBD3z5bIdJcGujCcN61+LmTdzxPbg=; b=gvc0wAYLYfDluh5QJY4b/jBv0xXMgIa4cadjDgS5Hn0fW/VjuRwahAqglAc15SB0tX PEex6JKE9ZKH8v9I+XMjq4lJR6STU1w2YUPpHHWFgJouZ8ztR/l08ZpdM0TrVQ0gBo5B KImjMtyC51c4A0Rk3jjqxyGDvVLHuUSSvxsiwkJ9MsIcfcCRyH0h00XngaT3HSncbKRw udwonmDKyH5v6NFWcxfGk1P5E/poRk3lrrcSQuranK/Qlr7GoyMTVI+CPycG8xJu5gBr vwL92bJxJ9bIpUzWdQn+iviFpXF3Z62VZKfeFt7SYI9YiwUXIoEMBt6KARVcCli2X4q4 9Jow== X-Gm-Message-State: AOJu0Yzq3Yunjc/N+tzZOYABdqTRsNI3JGEBCCRCxOk4op0JjKAX5yMz aOuWcFybnYBTJTOWVe2hNd/8s0KCpvOq4Z3eKnPZkbqtUp1usbApoPDtwkudm8R7J2bijVWcot3 +/FI= X-Gm-Gg: ASbGnctgNodpuihxUEY5nn3DTRoLH2UASWdTWNrMJwLDSM56MD1GSHA9yooZJ6XjAdu R/XpdAFNZ+x948N9tEV7uZzLz2FM0uqZ5B6m1bETuBDO32wgdtfLrx4t+a3pqEK1HdtIStrbIHU KzXTKV8e9ftzciootlPWWCPTbtuB7vL2Ntnkre0B//M5GdUIC0bxRrFaQU7G9OzcPm61KNY8n/n XlrnxjN32KiTUulvCkxM1a6ch2c2wdzmdTxdOHKBFQI8shG2TE4GdfoPR6dhNSyzuwkznZ7tG9a DEVv0Kg2eRxBJbqEeItPzBWn83urxNl+0ax3XvgxREdldD7LxUYbzJOeb7q/4ZrkP+5KmC9tHRJ EEG2z5VobKte55nvK42E= X-Received: by 2002:a5d:6482:0:b0:38f:3e39:20ae with SMTP id ffacd0b85a97d-39132dc580amr18313104f8f.43.1741722721857; Tue, 11 Mar 2025 12:52:01 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43cf7c82566sm81786055e9.30.2025.03.11.12.52.01 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 11 Mar 2025 12:52:01 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?A?= =?utf-8?q?lex_Benn=C3=A9e?= Subject: [PULL 08/14] system: Extract target-specific globals to their own compilation unit Date: Tue, 11 Mar 2025 20:51:17 +0100 Message-ID: <20250311195123.94212-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250311195123.94212-1-philmd@linaro.org> References: <20250311195123.94212-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::432; envelope-from=philmd@linaro.org; helo=mail-wr1-x432.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 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 We shouldn't use target specific globals for machine properties. These ones could be desugarized, as explained in [*]. While certainly doable, not trivial nor my priority for now. Just move them to a different file to clarify they are *globals*, like the generic globals residing in system/globals.c. Since arch_init.c was introduced using the MIT license (see commit ad96090a01d), retain the same license for the new globals-target.c file. [*] https://lore.kernel.org/qemu-devel/e514d6db-781d-4afe-b057-9046c70044dc@redhat.com/ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20250305005225.95051-2-philmd@linaro.org> --- system/arch_init.c | 14 -------------- system/globals-target.c | 24 ++++++++++++++++++++++++ system/meson.build | 1 + 3 files changed, 25 insertions(+), 14 deletions(-) create mode 100644 system/globals-target.c diff --git a/system/arch_init.c b/system/arch_init.c index b1baed18a30..b9147af93cb 100644 --- a/system/arch_init.c +++ b/system/arch_init.c @@ -24,18 +24,4 @@ #include "qemu/osdep.h" #include "system/arch_init.h" -#ifdef TARGET_SPARC -int graphic_width = 1024; -int graphic_height = 768; -int graphic_depth = 8; -#elif defined(TARGET_M68K) -int graphic_width = 800; -int graphic_height = 600; -int graphic_depth = 8; -#else -int graphic_width = 800; -int graphic_height = 600; -int graphic_depth = 32; -#endif - const uint32_t arch_type = QEMU_ARCH; diff --git a/system/globals-target.c b/system/globals-target.c new file mode 100644 index 00000000000..989720591e7 --- /dev/null +++ b/system/globals-target.c @@ -0,0 +1,24 @@ +/* + * Global variables that should not exist (target specific) + * + * Copyright (c) 2003-2008 Fabrice Bellard + * + * SPDX-License-Identifier: MIT + */ + +#include "qemu/osdep.h" +#include "system/system.h" + +#ifdef TARGET_SPARC +int graphic_width = 1024; +int graphic_height = 768; +int graphic_depth = 8; +#elif defined(TARGET_M68K) +int graphic_width = 800; +int graphic_height = 600; +int graphic_depth = 8; +#else +int graphic_width = 800; +int graphic_height = 600; +int graphic_depth = 32; +#endif diff --git a/system/meson.build b/system/meson.build index c83d80fa248..eec07a94513 100644 --- a/system/meson.build +++ b/system/meson.build @@ -1,6 +1,7 @@ specific_ss.add(when: 'CONFIG_SYSTEM_ONLY', if_true: [files( 'arch_init.c', 'ioport.c', + 'globals-target.c', 'memory.c', 'physmem.c', )])