From nobody Wed Nov 27 04:52:33 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=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1700332051; cv=none; d=zohomail.com; s=zohoarc; b=donae+2/DtupY/T+Fx7wJvBprf3IqOCOw/P3UbSL/vtjk+NF4v8fnmAf6An41Gjv45VZJiLw+5ca4x77lwz88D0vWLZkicwRnvf846IR7ENfTvwd0JsNZ0iR4MdAliOZTWhh7qLe9j/38SUdD8tkePK6Rfbh5Ty4yjXndZ+rBqE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1700332051; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=yp6QoVwJvjvNngNM4cZnjf0zeYba0gsZwUeMxVOgmHw=; b=kQRaCCmj/jXtCSMuVTvy6mj7PTwGO+wOmazpUxvRhLvtCOkuJlEZVACVxH0oV32Zx3eiQwg1kl7lmsDduCHPaYMXWVA8pvNuNEQCZUdVxgFRQAwdlddW2ESZxA+6IBTaLasnXixMxGtnuMz8atORxYKGJYgNYnGf7kSOaYy2emM= 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 17003320510811014.9990099540773; Sat, 18 Nov 2023 10:27:31 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r4Q1T-0007su-5n; Sat, 18 Nov 2023 13:26:27 -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 1r4Q1R-0007sb-DQ; Sat, 18 Nov 2023 13:26:25 -0500 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r4Q1P-0005T8-TQ; Sat, 18 Nov 2023 13:26:25 -0500 Received: by mail-pg1-x52d.google.com with SMTP id 41be03b00d2f7-5bd85b1939aso1917446a12.2; Sat, 18 Nov 2023 10:26:22 -0800 (PST) Received: from dhoffman-NUC13RNGi9.hsd1.or.comcast.net ([2601:1c0:577f:e480:7761:abec:4d36:7df4]) by smtp.gmail.com with ESMTPSA id 27-20020a17090a001b00b00268b439a0cbsm3507932pja.23.2023.11.18.10.26.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Nov 2023 10:26:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700331981; x=1700936781; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yp6QoVwJvjvNngNM4cZnjf0zeYba0gsZwUeMxVOgmHw=; b=GcNEieGpj9uO4hbYcjzygwILWH1apo71aclQPOXzLlMsIDuLCJ6JJK8JyFapr/7MHg Vt2YX+CUhydQfWt6fCHmf1TGDU7CJeHu9VM+i92dOQvO+0JH1urdns9QaDZG12YaYm1o G8OhbCyFwU/d4GaTUz5FKlPmo6SsDbGn0Bj57XXcK8hLG8o8toTkVTGNPit8o8owSPZb E250uN6ZNoC4Il3SadTEPyZUAXaj+BmfSYJI/x2Dm3Pfm0ac2pB8X4UnnAcbg35hCIUQ XBZMOxX+jf6uBJ02AXDanXpyJ07HM7gdb7C/BcdpZk7rjr09ivev4ZZv2SIkoTt5v7cL Mjcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700331981; x=1700936781; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yp6QoVwJvjvNngNM4cZnjf0zeYba0gsZwUeMxVOgmHw=; b=g4pWO2I7A68R32bCJq/eXIHC8va47yHHrdPXCoEGEhjQ/DGQ0KcDlV8oeZhi+o6N6R ouDGeID+x7DWjQ2OcV2SG5QqC9hFfYLC5ccNz5xzGw31EwiyF2y55eqbAkfi5QXHdn49 U550mjI9lWxw1grofVFL6lNyZ5G+fIXWu1AaUZklFX5PwjMG6o+9/XPYa2s4RW5IMLxh xlXzoo71H1k85L9fpuLvvINkCO8ZCcODceK36S2h/J4cfYYu40+jeCYz7ArDh6ZSLtxB gBXIGbklRVhmPF+vPnFhlD7XrsSPbR14v5J1h21lHmrAnHlREyOOXjjrKr61OggOMivf 3iPQ== X-Gm-Message-State: AOJu0Yzm8Skdy6GmG/dF+cZGJhlqKF/+iZo/4hSWTXzq662gKqq/HDFZ yyDQ34qoZBtfVNi5VSwd7THSj2B1hkY8kw== X-Google-Smtp-Source: AGHT+IHgJ0H4mFlsQWSO6ediiYDFLAJERiIy9xWatUjUDy/uq5zsOOo6MdfL280dsnkC5y91PVMHpQ== X-Received: by 2002:a17:90b:1e07:b0:280:767:d3eb with SMTP id pg7-20020a17090b1e0700b002800767d3ebmr2603158pjb.30.1700331981205; Sat, 18 Nov 2023 10:26:21 -0800 (PST) From: Daniel Hoffman To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Daniel Hoffman , "Michael S. Tsirkin" , Marcel Apfelbaum , Paolo Bonzini , Richard Henderson , Eduardo Habkost Subject: [PATCH] hw/i386: fix short-circuit logic with non-optimizing builds Date: Sat, 18 Nov 2023 10:25:31 -0800 Message-Id: <20231118182531.2619772-1-dhoff749@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 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=2607:f8b0:4864:20::52d; envelope-from=dhoff749@gmail.com; helo=mail-pg1-x52d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, 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 @gmail.com) X-ZM-MESSAGEID: 1700332052772100002 Content-Type: text/plain; charset="utf-8" `kvm_enabled()` is compiled down to `0` and short-circuit logic is used to remmove references to undefined symbols at the compile stage. Some build configurations with some compilers don't attempt to simplify this logic down in some cases (the pattern appears to be that the literal false must be the first term) and this was causing some builds to emit references to undefined symbols. Signed-off-by: Daniel Hoffman --- hw/i386/x86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/i386/x86.c b/hw/i386/x86.c index b3d054889bb..d339c8f3ef8 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -132,7 +132,7 @@ void x86_cpus_init(X86MachineState *x86ms, int default_= cpu_version) * Can we support APIC ID 255 or higher? With KVM, that requires * both in-kernel lapic and X2APIC userspace API. */ - if (x86ms->apic_id_limit > 255 && kvm_enabled() && + if (kvm_enabled() && x86ms->apic_id_limit > 255 && (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) { error_report("current -smp configuration requires kernel " "irqchip and X2APIC API support."); @@ -418,8 +418,8 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev, } cpu->thread_id =3D topo_ids.smt_id; =20 - if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) && - kvm_enabled() && !kvm_hv_vpindex_settable()) { + if (kvm_enabled() && hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) && + !kvm_hv_vpindex_settable()) { error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX"); return; } --=20 2.40.1