From nobody Thu Apr 3 11:26:38 2025 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=1741189305; cv=none; d=zohomail.com; s=zohoarc; b=gVTPSx6DRNulywEwZOA9pv0kq3DrLtaoO+wJ4h1eMJzgvdQdYXnUS4OqbJQusGmIdVDw0L3lDkpJj/GZDcUAV19X99LH94LZtgbEmGL38YsIDH1hQ+arvGgBNy2mDsZngjvEd/Hr7gPPfHbWGl4ZnhKLh4hCoQaLzD78fDpVCrk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1741189305; 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=RHsIUy8sKMvdJC/jiaNf5NT96KaTYh580z1CwMPFXu8=; b=LW9xIeJVr2iA9iVvELJUjTH2kwf/wZ8dfFqEv7v9mmXPzg+/lirW1r4p6tUYeJQWYMTBIGTtz9ow2cyb8P8U5uV5gJ4xzXxhV5xWgsMcMCcn2r1Ls8YD9gi/FQONL7I5/TqpnsikGZ03NA90K0jcElTmvDP4kUIIBnq2DV4yu5s= 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 1741189305400982.9435584724091; Wed, 5 Mar 2025 07:41:45 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tpqr3-0008Sk-G8; Wed, 05 Mar 2025 10:40:17 -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 1tpqr0-0008SE-TQ for qemu-devel@nongnu.org; Wed, 05 Mar 2025 10:40:14 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tpqqx-0002Lw-Mw for qemu-devel@nongnu.org; Wed, 05 Mar 2025 10:40:14 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-43bc4b16135so21693585e9.1 for ; Wed, 05 Mar 2025 07:40:11 -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-43bd42badefsm20744025e9.18.2025.03.05.07.40.08 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 05 Mar 2025 07:40:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1741189210; x=1741794010; 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=RHsIUy8sKMvdJC/jiaNf5NT96KaTYh580z1CwMPFXu8=; b=wDy7Pt6qy/l45gXtOt+d7wRwhG7cRfJXeP1LSoklQ4PhqbKzpiuCcBHfzmGexNM53W MQ7bLSkpmco19KnRaJ5K4K+SV8dtgQnGfs5aXsKSiySIr9dx1m+Z2BgeHrUn0n+OI0kL SGsduy/0VnJf+YRQDY76HgdUB2kNA1F4yaFO4wW4yZlciiXN0POABNKbf83paCvzOGg6 uqln6Ppin9HhPc5ZAKxwPybYoDB3c6hLllsmSgOl1rEB2ET94AO5gTsX6e4eu2JPOX2m Ke23OyGSjujky8WCn8mZAAit+yfM+girGJYYn2g5rRhdtL0g6EZ9EH8Z7TcsR9EDupJk Eulw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741189210; x=1741794010; 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=RHsIUy8sKMvdJC/jiaNf5NT96KaTYh580z1CwMPFXu8=; b=SvXMSpyKD5mmmRNSSQM4JF+DNG9QVbAxzXYr6INQIu47FtVruSY0r/ptq9k+Z6pjX4 SPwoeW4iaVr1TsjdgeV/6cAwYaoBWQHJq85LuLtl25HVbtTGxLQtSbMZCdDlWi603ZEF C3DFv8KphXilD68XnfA/ALE/+oJdWQXglFOzKoI7jc9Fh/u/KVUC/oCmbplvQ2Gb/E1M E+9rY1UPD9U0TLKgh2pLEUchjiBUsI2nyoUDOxlTHrka2dzkw06jJWUQAkzHrCMVirdE 2/skwt6r/r/OMVRlExZYtnWcGuiDVFighG7w55nPPBC79zuvu35MYShPvC0rSwQeKvX6 TNPw== X-Gm-Message-State: AOJu0YxejBjjKZApm6fkjAz8QByNkDNbkcpEZQQl7Y05ugt0B3g8T/kA KrA3HRSVTxnkAD7PKGceiuZTY5ohLi9OBYbeLODeXUMLtK/tdP0pwppvmSxQToH915z+7PIE66w Hf/s= X-Gm-Gg: ASbGnct/F3d6fUQoI0XoaNg2/LqciktLiSZHG1GsH5GnyzQh6nEWw3kX0WO5Za/kRVk z00IdPAfbKbrXmCkOqZfgHyXyGKd3klMD8eQ0O96GqQ438cGW2k4ytZqFvJ1odRG6HvIid6FVSO kSHrNVXvV1ccJczA8qhbKnL96o+RDWlC7TonQV4Ia8I2JWT3Dlq23Q6JdCK7s1ZZtaepk9berI+ ViGx/BH/MXIt5tWaVJ/jpRYEBEqLm8TLIv4h+BOyV7tPzMG6WqNWZYwNqZjGQZ86XoIfrhVMDmz 6SbXLbBKVvZHWLj2cphFe2AbI8vpmGi5yR9dCOzALuWXirv6aaYb5PUiC4eemN8sSnn5MjB+mW+ DcVFmdQ9mjICGjtezxqE= X-Google-Smtp-Source: AGHT+IHOUVpD+bGIsn9N3xpYujRIAoxMaeIxhOt1BddFy+SOh08mb7/IAJ0D2a6iA7SvK7QD0LFQCA== X-Received: by 2002:a05:600c:468e:b0:43b:bdf4:1c9 with SMTP id 5b1f17b1804b1-43bd2af4b26mr26941585e9.29.1741189209779; Wed, 05 Mar 2025 07:40:09 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= , Paolo Bonzini , Richard Henderson , Pierrick Bouvier , Thomas Huth , =?UTF-8?q?Alex=20Benn=C3=A9e?= , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [RFC PATCH 08/18] hw/i386: Inline TARGET_DEFAULT_CPU_TYPE definition Date: Wed, 5 Mar 2025 16:39:18 +0100 Message-ID: <20250305153929.43687-9-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250305153929.43687-1-philmd@linaro.org> References: <20250305153929.43687-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::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1741189305957019000 For legacy x86 binaries, legacy_binary_is_64bit() is equivalent of the compile time TARGET_X86_64 definition. Use it in place in machine class_init() handlers, removing the need on TARGET_X86_64. Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- target/i386/cpu.h | 6 ------ hw/i386/microvm.c | 5 ++++- hw/i386/pc.c | 5 ++++- hw/i386/xen/xen-pvh.c | 5 ++++- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0ab2e1bdb40..7f3c1ceaca7 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -2555,12 +2555,6 @@ uint64_t cpu_get_tsc(CPUX86State *env); =20 #define CPU_RESOLVING_TYPE TYPE_X86_CPU =20 -#ifdef TARGET_X86_64 -#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu64") -#else -#define TARGET_DEFAULT_CPU_TYPE X86_CPU_TYPE_NAME("qemu32") -#endif - #define cpu_list x86_cpu_list =20 /* MMU modes definitions */ diff --git a/hw/i386/microvm.c b/hw/i386/microvm.c index d0a236c74f3..cc94e1408c6 100644 --- a/hw/i386/microvm.c +++ b/hw/i386/microvm.c @@ -19,6 +19,7 @@ #include "qemu/error-report.h" #include "qemu/cutils.h" #include "qemu/units.h" +#include "qemu/legacy_binary_info.h" #include "qapi/error.h" #include "qapi/visitor.h" #include "qapi/qapi-visit-common.h" @@ -654,7 +655,9 @@ static void microvm_class_init(ObjectClass *oc, void *d= ata) mc->has_hotpluggable_cpus =3D false; mc->auto_enable_numa_with_memhp =3D false; mc->auto_enable_numa_with_memdev =3D false; - mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; + mc->default_cpu_type =3D legacy_binary_is_64bit() + ? X86_CPU_TYPE_NAME("qemu64") + : X86_CPU_TYPE_NAME("qemu32"); mc->nvdimm_supported =3D false; mc->default_ram_id =3D "microvm.ram"; =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 63a96cd23f8..936a770aad8 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -24,6 +24,7 @@ =20 #include "qemu/osdep.h" #include "qemu/units.h" +#include "qemu/legacy_binary_info.h" #include "hw/i386/pc.h" #include "hw/char/serial-isa.h" #include "hw/char/parallel.h" @@ -1794,7 +1795,9 @@ static void pc_machine_class_init(ObjectClass *oc, vo= id *data) hc->plug =3D pc_machine_device_plug_cb; hc->unplug_request =3D pc_machine_device_unplug_request_cb; hc->unplug =3D pc_machine_device_unplug_cb; - mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; + mc->default_cpu_type =3D legacy_binary_is_64bit() + ? X86_CPU_TYPE_NAME("qemu64") + : X86_CPU_TYPE_NAME("qemu32"); mc->nvdimm_supported =3D true; mc->smp_props.dies_supported =3D true; mc->smp_props.modules_supported =3D true; diff --git a/hw/i386/xen/xen-pvh.c b/hw/i386/xen/xen-pvh.c index 33c10279763..f0080c83021 100644 --- a/hw/i386/xen/xen-pvh.c +++ b/hw/i386/xen/xen-pvh.c @@ -8,6 +8,7 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/legacy_binary_info.h" #include "qemu/error-report.h" #include "hw/boards.h" #include "system/system.h" @@ -81,7 +82,9 @@ static void xen_pvh_machine_class_init(ObjectClass *oc, v= oid *data) MachineClass *mc =3D MACHINE_CLASS(oc); =20 mc->desc =3D "Xen PVH x86 machine"; - mc->default_cpu_type =3D TARGET_DEFAULT_CPU_TYPE; + mc->default_cpu_type =3D legacy_binary_is_64bit() + ? X86_CPU_TYPE_NAME("qemu64") + : X86_CPU_TYPE_NAME("qemu32"); =20 /* mc->max_cpus holds the MAX value allowed in the -smp cmd-line opts.= */ mc->max_cpus =3D HVM_MAX_VCPUS; --=20 2.47.1