whpx: i386: apic: bring closer to MSHV code path
PATCH 1/1 whpx: i386: apic: bring closer to MSHV code path
MSHV doesn't have a dedicated apic_type and uses the common class. Make WHPX do the same thing.
As VM save/restore isn't currently supported anyway, this doesn't break functionality.
Signed-off-by Mohamed Mediouni <[email protected]>
--- hw/intc/apic.c | 9 ++ include/system/whpx-internal.h | 2 - target/i386/cpu-apic.c | 3 - target/i386/whpx/irq.c | 76 +++++++++ target/i386/whpx/irq.h | 8 + target/i386/whpx/meson.build | 2 +- target/i386/whpx/whpx-all.c | 15 -- target/i386/whpx/whpx-apic.c | 286 --------------------------------- 8 files changed, 94 insertions(+), 307 deletions(-) create mode 100644 target/i386/whpx/irq.c create mode 100644 target/i386/whpx/irq.h delete mode 100644 target/i386/whpx/whpx-apic.c
hw/intc/apic.c +9 -0
@@ -28,6 +28,8 @@#include "qemu/host-utils.h" #include "system/kvm.h" #include "system/mshv.h" +#include "system/whpx.h" +#include "whpx/irq.h" #include "trace.h" #include "hw/i386/apic-msidef.h" #include "exec/cpu-common.h"
@@ -915,6 +917,13 @@ static void apic_send_msi(MSIMessage *msi) dest_mode, trigger_mode); return; } +#endif +#ifdef CONFIG_WHPX +if (whpx_enabled () &&whpx_irqchip_in_kernel ()) { +whpx_request_interrupt (delivery, vector, dest, + dest_mode, trigger_mode); +return ; + }#endif apic_deliver_irq (dest, dest_mode, delivery, vector, trigger_mode); }
include/system/whpx-internal.h +0 -2
@@ -4,7 +4,6 @@#include <windows.h> #include <winhvplatform.h> -#include "hw/i386/apic.h" #include "exec/vaddr.h" typedef enum WhpxBreakpointState {
@@ -45,7 +44,6 @@ struct whpx_state { };extern struct whpx_state whpx_global; -void whpx_apic_get (APICCommonState *s);#define WHV_E_UNKNOWN_CAPABILITY 0x80370300L
target/i386/cpu-apic.c +0 -3
@@ -33,10 +33,7 @@ APICCommonClass *apic_get_class(Error **errp) apic_type ="kvm-apic" ; }else if (xen_enabled ()) { apic_type ="xen-apic" ; - }else if (whpx_irqchip_in_kernel ()) { - apic_type ="whpx-apic" ; } -return APIC_COMMON_CLASS (object_class_by_name (apic_type)); }
target/i386/whpx/irq.c new file +76 -0
76 lines not on this page · raw message
target/i386/whpx/irq.h new file +8 -0
@@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +#ifndef QEMU_X86_WHPX_H +#define QEMU_X86_WHPX_H + +int whpx_request_interrupt (uint32_t interrupt_type,uint32_t vector, +uint32_t vp_index,bool logical_dest_mode, +bool level_triggered); +#endif /* QEMU_X86_WHPX_H */
target/i386/whpx/meson.build +1 -1
@@ -1,4 +1,4 @@ i386_system_ss.add(when: 'CONFIG_WHPX', if_true: files( 'whpx-all.c', - 'whpx-apic.c', + 'irq.c' ))
target/i386/whpx/whpx-all.c +0 -15
@@ -619,17 +619,6 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLevel level) hr); } -if (level >WHPX_LEVEL_FAST_RUNTIME_STATE &&whpx_irqchip_in_kernel ()) { -/* -* Fetch the TPR value from the emulated APIC. It may get overwritten -* below with the value from CR8 returned by -* WHvGetVirtualProcessorRegisters(). -*/ -whpx_apic_get (x86_cpu->apic_state); - vcpu->tpr =whpx_apic_tpr_to_cr8 ( -cpu_get_apic_tpr (x86_cpu->apic_state)); - } - idx =0 ;/* Indexes for first 16 registers match between HV and QEMU definitions */
@@ -762,10 +751,6 @@ void whpx_get_registers(CPUState *cpu, WHPXStateLevel level)assert (idx ==RTL_NUMBER_OF (whpx_register_names)); -if (level >WHPX_LEVEL_FAST_RUNTIME_STATE &&whpx_irqchip_in_kernel ()) { -whpx_apic_get (x86_cpu->apic_state); - } -x86_update_hflags (env); }
target/i386/whpx/whpx-apic.c deleted +0 -286
286 lines not on this page · raw message
Signature · 1 line
2.50.1 (Apple Git-155)