From: Bernhard Beschow <shentey@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
Eduardo Habkost <eduardo@habkost.net>,
Richard Henderson <richard.henderson@linaro.org>,
Paolo Bonzini <pbonzini@redhat.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Bernhard Beschow <shentey@gmail.com>
Subject: [PATCH v2 1/3] hw/i386/x86: Reverse if statement
Date: Sat, 6 Jan 2024 14:25:44 +0100 [thread overview]
Message-ID: <20240106132546.21248-2-shentey@gmail.com> (raw)
In-Reply-To: <20240106132546.21248-1-shentey@gmail.com>
The if statement currently uses double negation when executing the else branch.
So swap the branches and simplify the condition to make the code more
comprehensible.
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
---
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 = X86_CPU(cs);
- 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);
}
}
}
--
2.43.0
next prev parent reply other threads:[~2024-01-06 13:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-06 13:25 [PATCH v2 0/3] Fix PIC interrupt handling of x86 CPUs if APIC is globally disabled Bernhard Beschow
2024-01-06 13:25 ` Bernhard Beschow [this message]
2024-01-06 13:25 ` [PATCH v2 2/3] hw/i386/x86: Fix PIC interrupt handling " Bernhard Beschow
2024-01-06 13:25 ` [PATCH v2 3/3] target/i386/cpu: Fix typo in comment Bernhard Beschow
2024-01-14 10:52 ` [PATCH v2 0/3] Fix PIC interrupt handling of x86 CPUs if APIC is globally disabled Bernhard Beschow
2024-01-14 10:55 ` Michael S. Tsirkin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240106132546.21248-2-shentey@gmail.com \
--to=shentey@gmail.com \
--cc=eduardo@habkost.net \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).