All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Emilio G. Cota" <cota@braap.org>
To: qemu-devel@nongnu.org
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Alex Bennée" <alex.bennee@linaro.org>
Subject: [Qemu-devel] [PATCH v5 43/73] i386/hvf: convert to cpu_request_interrupt
Date: Thu, 13 Dec 2018 00:04:23 -0500	[thread overview]
Message-ID: <20181213050453.9677-44-cota@braap.org> (raw)
In-Reply-To: <20181213050453.9677-1-cota@braap.org>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Emilio G. Cota <cota@braap.org>
---
 target/i386/hvf/hvf.c    |  8 +++++---
 target/i386/hvf/x86hvf.c | 26 +++++++++++++++-----------
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
index c1ff220985..619a4dd565 100644
--- a/target/i386/hvf/hvf.c
+++ b/target/i386/hvf/hvf.c
@@ -249,7 +249,7 @@ void update_apic_tpr(CPUState *cpu)
 
 static void hvf_handle_interrupt(CPUState * cpu, int mask)
 {
-    cpu->interrupt_request |= mask;
+    cpu_interrupt_request_or(cpu, mask);
     if (!qemu_cpu_is_self(cpu)) {
         qemu_cpu_kick(cpu);
     }
@@ -706,10 +706,12 @@ int hvf_vcpu_exec(CPUState *cpu)
         ret = 0;
         switch (exit_reason) {
         case EXIT_REASON_HLT: {
+            uint32_t interrupt_request = cpu_interrupt_request(cpu);
+
             macvm_set_rip(cpu, rip + ins_len);
-            if (!((cpu->interrupt_request & CPU_INTERRUPT_HARD) &&
+            if (!((interrupt_request & CPU_INTERRUPT_HARD) &&
                 (EFLAGS(env) & IF_MASK))
-                && !(cpu->interrupt_request & CPU_INTERRUPT_NMI) &&
+                && !(interrupt_request & CPU_INTERRUPT_NMI) &&
                 !(idtvec_info & VMCS_IDT_VEC_VALID)) {
                 cpu_halted_set(cpu, 1);
                 ret = EXCP_HLT;
diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
index e8b13ed534..91feafeedc 100644
--- a/target/i386/hvf/x86hvf.c
+++ b/target/i386/hvf/x86hvf.c
@@ -358,6 +358,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state)
 
     uint8_t vector;
     uint64_t intr_type;
+    uint32_t interrupt_request;
     bool have_event = true;
     if (env->interrupt_injected != -1) {
         vector = env->interrupt_injected;
@@ -400,7 +401,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state)
         };
     }
 
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_NMI) {
+    if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_NMI) {
         if (!(env->hflags2 & HF2_NMI_MASK) && !(info & VMCS_INTR_VALID)) {
             cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_NMI);
             info = VMCS_INTR_VALID | VMCS_INTR_T_NMI | NMI_VEC;
@@ -411,7 +412,7 @@ bool hvf_inject_interrupts(CPUState *cpu_state)
     }
 
     if (!(env->hflags & HF_INHIBIT_IRQ_MASK) &&
-        (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) &&
+        (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) &&
         (EFLAGS(env) & IF_MASK) && !(info & VMCS_INTR_VALID)) {
         int line = cpu_get_pic_interrupt(&x86cpu->env);
         cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_HARD);
@@ -420,39 +421,42 @@ bool hvf_inject_interrupts(CPUState *cpu_state)
                   VMCS_INTR_VALID | VMCS_INTR_T_HWINTR);
         }
     }
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_HARD) {
+    if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_HARD) {
         vmx_set_int_window_exiting(cpu_state);
     }
-    return (cpu_state->interrupt_request
-            & (CPU_INTERRUPT_INIT | CPU_INTERRUPT_TPR));
+    return cpu_interrupt_request(cpu_state) & (CPU_INTERRUPT_INIT |
+                                               CPU_INTERRUPT_TPR);
 }
 
 int hvf_process_events(CPUState *cpu_state)
 {
     X86CPU *cpu = X86_CPU(cpu_state);
     CPUX86State *env = &cpu->env;
+    uint32_t interrupt_request;
 
     EFLAGS(env) = rreg(cpu_state->hvf_fd, HV_X86_RFLAGS);
 
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_INIT) {
+    if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_INIT) {
         hvf_cpu_synchronize_state(cpu_state);
         do_cpu_init(cpu);
     }
 
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_POLL) {
+    if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_POLL) {
         cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_POLL);
         apic_poll_irq(cpu->apic_state);
     }
-    if (((cpu_state->interrupt_request & CPU_INTERRUPT_HARD) &&
+
+    interrupt_request = cpu_interrupt_request(cpu_state);
+    if (((interrupt_request & CPU_INTERRUPT_HARD) &&
         (EFLAGS(env) & IF_MASK)) ||
-        (cpu_state->interrupt_request & CPU_INTERRUPT_NMI)) {
+        (interrupt_request & CPU_INTERRUPT_NMI)) {
         cpu_halted_set(cpu_state, 0);
     }
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_SIPI) {
+    if (interrupt_request & CPU_INTERRUPT_SIPI) {
         hvf_cpu_synchronize_state(cpu_state);
         do_cpu_sipi(cpu);
     }
-    if (cpu_state->interrupt_request & CPU_INTERRUPT_TPR) {
+    if (cpu_interrupt_request(cpu_state) & CPU_INTERRUPT_TPR) {
         cpu_reset_interrupt(cpu_state, CPU_INTERRUPT_TPR);
         hvf_cpu_synchronize_state(cpu_state);
         apic_handle_tpr_access_report(cpu->apic_state, env->eip,
-- 
2.17.1

  parent reply	other threads:[~2018-12-13  5:06 UTC|newest]

Thread overview: 82+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13  5:03 [Qemu-devel] [PATCH v5 00/73] per-CPU locks Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 01/73] cpu: convert queued work to a QSIMPLEQ Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 02/73] cpu: rename cpu->work_mutex to cpu->lock Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 03/73] cpu: introduce cpu_mutex_lock/unlock Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 04/73] cpu: make qemu_work_cond per-cpu Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 05/73] cpu: move run_on_cpu to cpus-common Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 06/73] cpu: introduce process_queued_cpu_work_locked Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 07/73] cpu: make per-CPU locks an alias of the BQL in TCG rr mode Emilio G. Cota
2018-12-15  1:51   ` Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 08/73] tcg-runtime: define helper_cpu_halted_set Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 09/73] ppc: convert to helper_cpu_halted_set Emilio G. Cota
2018-12-15  9:00   ` David Gibson
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 10/73] cris: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 11/73] hppa: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 12/73] m68k: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 13/73] alpha: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 14/73] microblaze: " Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 15/73] cpu: define cpu_halted helpers Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 16/73] tcg-runtime: convert to cpu_halted_set Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 17/73] arm: convert to cpu_halted Emilio G. Cota
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 18/73] ppc: " Emilio G. Cota
2018-12-15  9:02   ` David Gibson
2018-12-13  5:03 ` [Qemu-devel] [PATCH v5 19/73] sh4: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 20/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 21/73] lm32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 22/73] m68k: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 23/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 24/73] riscv: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 25/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 26/73] sparc: " Emilio G. Cota
2018-12-17 12:53   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 27/73] xtensa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 28/73] gdbstub: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 29/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 30/73] cpu-exec: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 31/73] cpu: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 32/73] cpu: define cpu_interrupt_request helpers Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 33/73] ppc: use cpu_reset_interrupt Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 34/73] exec: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 35/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 36/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 37/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 38/73] arm: convert to cpu_interrupt_request Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 39/73] i386: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 40/73] i386/kvm: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 41/73] i386/hax-all: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 42/73] i386/whpx-all: " Emilio G. Cota
2018-12-13  5:04 ` Emilio G. Cota [this message]
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 44/73] ppc: " Emilio G. Cota
2018-12-15  9:06   ` David Gibson
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 45/73] sh4: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 46/73] cris: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 47/73] hppa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 48/73] lm32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 49/73] m68k: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 50/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 51/73] nios: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 52/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 53/73] alpha: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 54/73] moxie: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 55/73] sparc: " Emilio G. Cota
2018-12-17 12:57   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 56/73] openrisc: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 57/73] unicore32: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 58/73] microblaze: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 59/73] accel/tcg: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 60/73] cpu: convert to interrupt_request Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 61/73] cpu: call .cpu_has_work with the CPU lock held Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 62/73] cpu: introduce cpu_has_work_with_iothread_lock Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 63/73] ppc: convert to cpu_has_work_with_iothread_lock Emilio G. Cota
2018-12-15  9:07   ` David Gibson
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 64/73] mips: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 65/73] s390x: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 66/73] riscv: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 67/73] sparc: " Emilio G. Cota
2018-12-17 12:58   ` Mark Cave-Ayland
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 68/73] xtensa: " Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 69/73] cpu: rename all_cpu_threads_idle to qemu_tcg_rr_all_cpu_threads_idle Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 70/73] cpu: protect CPU state with cpu->lock instead of the BQL Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 71/73] cpus-common: release BQL earlier in run_on_cpu Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 72/73] cpu: add async_run_on_cpu_no_bql Emilio G. Cota
2018-12-13  5:04 ` [Qemu-devel] [PATCH v5 73/73] cputlb: queue async flush jobs without the BQL Emilio G. Cota

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=20181213050453.9677-44-cota@braap.org \
    --to=cota@braap.org \
    --cc=alex.bennee@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.