[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v6 43/73] i386/hvf: convert to cpu_request_interrupt
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [PATCH v6 43/73] i386/hvf: convert to cpu_request_interrupt |
Date: |
Tue, 29 Jan 2019 19:47:41 -0500 |
Reviewed-by: Richard Henderson <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
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
- [Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock held, (continued)
- [Qemu-devel] [PATCH v6 61/73] cpu: call .cpu_has_work with the CPU lock held, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 37/73] openrisc: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 51/73] nios: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 41/73] i386/hax-all: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 53/73] alpha: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 47/73] hppa: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 50/73] mips: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 56/73] openrisc: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 60/73] cpu: convert to interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 49/73] m68k: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 43/73] i386/hvf: convert to cpu_request_interrupt,
Emilio G. Cota <=
- [Qemu-devel] [PATCH v6 59/73] accel/tcg: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 36/73] s390x: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 52/73] s390x: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 54/73] moxie: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 33/73] ppc: use cpu_reset_interrupt, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 66/73] riscv: convert to cpu_has_work_with_iothread_lock, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 64/73] mips: convert to cpu_has_work_with_iothread_lock, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 62/73] cpu: introduce cpu_has_work_with_iothread_lock, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 70/73] cpu: protect CPU state with cpu->lock instead of the BQL, Emilio G. Cota, 2019/01/29
- [Qemu-devel] [PATCH v6 44/73] ppc: convert to cpu_interrupt_request, Emilio G. Cota, 2019/01/29