From nobody Tue Nov 26 22:31:17 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=1704547641; cv=none; d=zohomail.com; s=zohoarc; b=mEyxCmC5o00HvLot7JadSRTB5PSjCCsf0gmexD4d1hnv+a4c1canUzSnD3zRyR5//OA94HI9M88oOcT4KDtA2naDvXEL8kvT+Hs6OR+lR37BtJN7C2JjLb3FZbP2gNhRuz1vjZngimwkkhUjlmiP9Wo9fwVMG/lHZFPTrYPsYiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1704547641; h=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=/a3uZAXmye1jvF0NadDhii00zuAt23ZrEREzrYmaBKk=; b=JVVH0FCYM48qQOCkI6C333xVUdVEodIk8CwcVtAejdBjVZHKgcfMLPsBcJEE0X+r3t6+j5ESdYFJVui1Vw13dyVsx5DMUQSUzzMmzkdC/eILD7ly0DTh9oiSU9FtT6V0iXHAOKiYGOyB+pcMAKbhKXtr1XlGSF50DPyqgx0ktHU= 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 1704547641601508.09095133983374; Sat, 6 Jan 2024 05:27:21 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rM6go-0000d7-9G; Sat, 06 Jan 2024 08:26:14 -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 1rM6ga-0000Y8-7U for qemu-devel@nongnu.org; Sat, 06 Jan 2024 08:26:00 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rM6gY-0005xz-Lw for qemu-devel@nongnu.org; Sat, 06 Jan 2024 08:25:59 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-55778f7662bso49959a12.1 for ; Sat, 06 Jan 2024 05:25:57 -0800 (PST) Received: from Provence.localdomain (dynamic-077-011-174-094.77.11.pool.telefonica.de. [77.11.174.94]) by smtp.gmail.com with ESMTPSA id 3-20020a508e03000000b0055515b40464sm2159752edw.81.2024.01.06.05.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 06 Jan 2024 05:25:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704547556; x=1705152356; 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=/a3uZAXmye1jvF0NadDhii00zuAt23ZrEREzrYmaBKk=; b=XupCpiCHktwONwXEAlDxzN6I90WOExCjfJPMDcyKUFaSsq70AUx0Wb+J15xXgTEeYk G95hpJAuwehoaHmi7M7svrt9ycx3JewHyXq+q62OX2gsa6VhICgVh2CBfn9uAdXMTVyg 2MJxke19iURP/qY3Xol8zrbI8YDgG7axtJ5wAV/A2sXAzyifqIngH3PafxCax2O6ry0u NFKf6A/PX3kDosd4w29TYpvZxn/0DCNeNMGMAM4pcuMSoMWARf/NFDHlL1fba3gwPS+p 4X/UnNYMpzeV2dTjqwQxhwiet4SjN2oYD1ZYndJZT+CwjCUlg7xOzayBHqF/PGWYvg1r Ixyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704547556; x=1705152356; 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=/a3uZAXmye1jvF0NadDhii00zuAt23ZrEREzrYmaBKk=; b=vK/n1LYOFORALxGbuRqt5QZYVxsZe7HJtPE4ruQh6HZLAfiwePlShaG4vjtS+FJ/xU IPp1H/qtscRiv8XzfxiYbi1TNGVTRf6hRyF5fYdElXzuTncFmCVjQldB7Ywenyg9ip2p dfaHzVXp0bHwNwDcDOiJVPBPneH0lb0GuZvIXC17ovrT5PZMgAKDdkXz9ayMmTTALNSG SGMdmS3dEAjqAkg4Gw7yjsbs9DLCkMUx0Sr6rK90bJOtKOgbZaGw48htgPjSXWsfSaay c5N+5wqVT9/pC/gBTFdC5i0xTo4/FPxn1mBIhIIGfVqNsXtWbw2JxkPYOjedokls7SHO lEuw== X-Gm-Message-State: AOJu0YxNhdGT/sToZDL5aDb3Qley9WdFgtbqpH6LdCOWjiqmcFcBdIAW AEPTcUT/bRlXvIGXgcOROt3InZyb+vI= X-Google-Smtp-Source: AGHT+IGru39AzgFUl0fww+fXcbcpXmnkSQGe5mnCd/pUwsnBTy70LBw+WRdunCourTIWu814KcIrkw== X-Received: by 2002:a05:6402:2684:b0:557:4a49:26b0 with SMTP id w4-20020a056402268400b005574a4926b0mr1270310edd.20.1704547556199; Sat, 06 Jan 2024 05:25:56 -0800 (PST) From: Bernhard Beschow To: qemu-devel@nongnu.org Cc: "Michael S. Tsirkin" , Eduardo Habkost , Richard Henderson , Paolo Bonzini , Marcel Apfelbaum , Bernhard Beschow Subject: [PATCH v2 1/3] hw/i386/x86: Reverse if statement Date: Sat, 6 Jan 2024 14:25:44 +0100 Message-ID: <20240106132546.21248-2-shentey@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240106132546.21248-1-shentey@gmail.com> References: <20240106132546.21248-1-shentey@gmail.com> 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=2a00:1450:4864:20::536; envelope-from=shentey@gmail.com; helo=mail-ed1-x536.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, 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: 1704547642754100003 Content-Type: text/plain; charset="utf-8" The if statement currently uses double negation when executing the else bra= nch. So swap the branches and simplify the condition to make the code more comprehensible. Signed-off-by: Bernhard Beschow --- 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 2b6291ad8d..61af705e90 100644 --- a/hw/i386/x86.c +++ b/hw/i386/x86.c @@ -516,10 +516,10 @@ static void x86_nmi(NMIState *n, int cpu_index, Error= **errp) CPU_FOREACH(cs) { X86CPU *cpu =3D X86_CPU(cs); =20 - if (!cpu->apic_state) { - cpu_interrupt(cs, CPU_INTERRUPT_NMI); - } else { + if (cpu->apic_state) { apic_deliver_nmi(cpu->apic_state); + } else { + cpu_interrupt(cs, CPU_INTERRUPT_NMI); } } } --=20 2.43.0