From patchwork Wed Mar 5 00:52:15 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: 870500 Delivered-To: patch@linaro.org Received: by 2002:a05:6000:178f:b0:38f:210b:807b with SMTP id e15csp541069wrg; Tue, 4 Mar 2025 16:54:40 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCXUwqZGeK9AXdwFIRImsyDkXRarfutFPIxSIR4UweeEBUZteZryk8ueUc3P2kXJuK+y6jehAg==@linaro.org X-Google-Smtp-Source: AGHT+IFdHN6aUkv8A+EFTtStqPn5Yxba+9gWyI197t/buDYToakg68sXSKLd8h7vCrneZWIxwm8r X-Received: by 2002:a05:622a:590:b0:471:f447:3b62 with SMTP id d75a77b69052e-4750b23c584mr17971831cf.6.1741136080666; Tue, 04 Mar 2025 16:54:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1741136080; cv=none; d=google.com; s=arc-20240605; b=fUbXLSHVo31iW/hK2iJor6eK+MnXNs8OeVlrLLclMH4J8rlnuXTUse06qA0giWgSR2 geWSRCkV6N2aZdkMAgUEOpun3ml1z2pyWCdsuq7gk/tHXLru2gibHoyP+MSIXl6WXZnk Rxg7Tre1ptCWuF2kL974hnCKBDS7slZcal7Vzwy27d74X6aYi7lL6XhZ43/Himjx/jFt qM+UOvirYPlmDIWVIqO56SsMGnyVtOa2wiWXDG2U+jv0NIgbwkI5aYollyqm56iQryBm CcOP5vK1Tlinjmoppj+Mmip/7G/bKGy7o/YVE0OYZKfpsGuOMN0ICpXm/cOr0p59rdIm MqzA== 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=lk9TI+rSZkzKv7Njal1Wbs7A5Y+36v2tj7kLtziVEzo=; fh=BW2TZvblXUTHno32gRgjkSOAINcocKVvD//AVk+YV+0=; b=fZJuiYDmi4RdVrooMLEpD+oa4OV7XWfDoCQTnFdPxZytfNJ8tNQvO1kmQAI5nfTatr XP0srH3OdaqjdJth4c6DQZqh8Q/n6v53Ae1v3bBrcONNoWsJVf5NyTpvLtgro/dt5xBW 7d/ot2q8jvh7XUIg9LcLDa2WJx6vvPFPmwgfw4y8mpWFkF/bNgHyxyOP9muEVcopt9pq shJa+Jpa+5oC+yAQ0fhSN7zcEEbY4j5j8GM6i+3ZfGv2BwhOp8HYzoO72W9NMKoldYAW khs2MBN6zfIqCgQtWDRyRyPaAXcaQx7h/ApssOA1Vho7zT3jH4qNTDqZEnROIIYItx7k K7lA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ipNReLJR; 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 d75a77b69052e-474e637229bsi52969591cf.671.2025.03.04.16.54.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 04 Mar 2025 16:54:40 -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=ipNReLJR; 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 1tpd02-0001yX-GS; Tue, 04 Mar 2025 19:52:38 -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 1tpd01-0001yH-08 for qemu-devel@nongnu.org; Tue, 04 Mar 2025 19:52:37 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpczz-0007R8-5a for qemu-devel@nongnu.org; Tue, 04 Mar 2025 19:52:36 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-4394a0c65fcso66759665e9.1 for ; Tue, 04 Mar 2025 16:52:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741135953; x=1741740753; 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=lk9TI+rSZkzKv7Njal1Wbs7A5Y+36v2tj7kLtziVEzo=; b=ipNReLJRXOHXo+sPkQyGh2PL2R5IRoL8f9X+40CuLYGSMVZ8sGcpAzscO3OlB3lyxZ 6gH9naTiheXA4UariubfBippcI2RbfVY/Hk1b2SB7rJmJPAnzfsG8xrXRPUjHUXY6QKf JiIbq7/qWy06hPRRfnmf5frQrBhIFoyB9hFU6WaAh3uLuwPtoUcL+fVfrpbBuR6rwhQQ fbvppcBlyECVEiIMphAc60pCbACb5HJQTZplfWAwSD+7PsKQalubTEJziNSJqKv/C5V3 O8fjL81Y2KR2dASpy3es8oM0BXzhVenGmzB4P4oEU14FxJ618c804jeAikzc9UZhO1fR k5aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741135953; x=1741740753; 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=lk9TI+rSZkzKv7Njal1Wbs7A5Y+36v2tj7kLtziVEzo=; b=IWKt6Myqkkdh5yOhDbBGz1XUP9slqNeypBvjN2XqChTAib+FIil97LYAETKKiiaxzn iwDRkoPdcXTutT3M1P6ThFc+zooW50MRKxXkFMmYBCvKbtJ43QYUIvkUi7avRwRXzneQ RnRYGo8n4jN9XzgTulVTorNNY1M+qZEnXVHhkH5JpY+pWsGabKg41olVwFsSFln3F3dc hs6UbKzPEv5pnoEzqotwuQKDJePU1FfLUZD3ky+Wm3ENQnStVB0ATVqWKL5ttzci9/cD LoiFOutfSTkb9prx0oKTFT+SlY4rVRtskaXGItHx06vrHnEFXocLskokzKi6jUFUsUrV O18w== X-Gm-Message-State: AOJu0YyM41Cxy/iumxVkHpscy3fGf4fG1wGK0H394YPgkLtN57dA1u66 DfiZV0+HV3Z4a+GjTg+ccPVxceM78zsP9q6NrD3r4vdjfmmN+cugfFvA7gFf8SbIDCVPgqsXHcy YNGc= X-Gm-Gg: ASbGncv4+pQccMKCRfVsqKc5Ucs+dNQ1D7niFWmvV5aNf08Q7917NgdHcxgkS03qLVD Mf6WQAUylVOFrXJp47Nnal4+CB1Diz6QhB1AjnbRDrJ+WWqubkJFGJ2pw/EsESmHVBCywKEL11q gYa76MvHj2v/YME07nR5rB9KyO/m9L2cvCQslpCgvVYE0//QBg1nRBYlPVqcwN4OUN4bBRmMAry hkCgMuH0ocFYTiAdTYFMVMXX/5aNi1peRO7j5KHZ11JOuq4jnzPuaqnlC0zfDdo/XSpv/LNNpVQ y7nqDED9VCywINmVWgEZb8hwj/sTrFveVg+icv3hUGzo30ls4LhNKvbB/sN7wqPZm8Qie/0Wod6 Cx0s0M+uMYFjc/fPuCFY= X-Received: by 2002:a05:600c:5493:b0:439:9106:c09 with SMTP id 5b1f17b1804b1-43bd29d0497mr5548175e9.26.1741135953104; Tue, 04 Mar 2025 16:52:33 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43bcc13b23asm21499725e9.1.2025.03.04.16.52.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 04 Mar 2025 16:52:32 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Pierrick Bouvier , =?utf-8?q?Daniel_P=2E_Berra?= =?utf-8?q?ng=C3=A9?= , Richard Henderson , Thomas Huth , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Philippe_M?= =?utf-8?q?athieu-Daud=C3=A9?= Subject: [RFC PATCH 01/11] system: Extract target-specific globals to their own compilation unit Date: Wed, 5 Mar 2025 01:52:15 +0100 Message-ID: <20250305005225.95051-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250305005225.95051-1-philmd@linaro.org> References: <20250305005225.95051-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::335; envelope-from=philmd@linaro.org; helo=mail-wm1-x335.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. [*] https://lore.kernel.org/qemu-devel/e514d6db-781d-4afe-b057-9046c70044dc@redhat.com/ Signed-off-by: Philippe Mathieu-Daudé --- 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 d2c32f84887..ea0842b7410 100644 --- a/system/arch_init.c +++ b/system/arch_init.c @@ -25,20 +25,6 @@ #include "qemu/module.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; void qemu_init_arch_modules(void) 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 4952f4b2c7d..181195410fb 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', 'watchpoint.c',