[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 07/15] target/i386: Added V_INTR_PRIO check to virtual interrupts
From: |
Paolo Bonzini |
Subject: |
[PULL 07/15] target/i386: Added V_INTR_PRIO check to virtual interrupts |
Date: |
Thu, 22 Jul 2021 17:36:04 +0200 |
From: Lara Lazier <laramglazier@gmail.com>
The APM2 states that The processor takes a virtual INTR interrupt
if V_IRQ and V_INTR_PRIO indicate that there is a virtual interrupt pending
whose priority is greater than the value in V_TPR.
Signed-off-by: Lara Lazier <laramglazier@gmail.com>
Message-Id: <20210721152651.14683-1-laramglazier@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
target/i386/tcg/sysemu/svm_helper.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/target/i386/tcg/sysemu/svm_helper.c
b/target/i386/tcg/sysemu/svm_helper.c
index 00618cff23..72b03a345d 100644
--- a/target/i386/tcg/sysemu/svm_helper.c
+++ b/target/i386/tcg/sysemu/svm_helper.c
@@ -65,6 +65,16 @@ static inline void svm_load_seg_cache(CPUX86State *env,
hwaddr addr,
sc->base, sc->limit, sc->flags);
}
+static inline bool ctl_has_irq(uint32_t int_ctl)
+{
+ uint32_t int_prio;
+ uint32_t tpr;
+
+ int_prio = (int_ctl & V_INTR_PRIO_MASK) >> V_INTR_MASKING_SHIFT;
+ tpr = int_ctl & V_TPR_MASK;
+ return (int_ctl & V_IRQ_MASK) && (int_prio >= tpr);
+}
+
void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
{
CPUState *cs = env_cpu(env);
@@ -290,7 +300,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int
next_eip_addend)
env->hflags2 |= HF2_GIF_MASK;
- if (int_ctl & V_IRQ_MASK) {
+ if (ctl_has_irq(int_ctl)) {
CPUState *cs = env_cpu(env);
cs->interrupt_request |= CPU_INTERRUPT_VIRQ;
--
2.31.1
- [PULL 09/15] target/i386: Added consistency checks for EFER, (continued)
- [PULL 09/15] target/i386: Added consistency checks for EFER, Paolo Bonzini, 2021/07/22
- [PULL 08/15] target/i386: Added consistency checks for CR4, Paolo Bonzini, 2021/07/22
- [PULL 04/15] chardev-spice: add missing module_obj directive, Paolo Bonzini, 2021/07/22
- [PULL 02/15] qemu-config: fix memory leak on ferror(), Paolo Bonzini, 2021/07/22
- [PULL 11/15] meson: fix dependencies for modinfo, Paolo Bonzini, 2021/07/22
- [PULL 10/15] configure: Drop obsolete check for the alloc_size attribute, Paolo Bonzini, 2021/07/22
- [PULL 13/15] configure: Allow vnc to get disabled with --without-default-features, Paolo Bonzini, 2021/07/22
- [PULL 15/15] configure: Let --without-default-features disable vhost-kernel and vhost-vdpa, Paolo Bonzini, 2021/07/22
- [PULL 03/15] vl: Parse legacy default_machine_opts, Paolo Bonzini, 2021/07/22
- [PULL 07/15] target/i386: Added V_INTR_PRIO check to virtual interrupts,
Paolo Bonzini <=
- [PULL 05/15] usb: fix usb-host dependency check, Paolo Bonzini, 2021/07/22
- [PULL 14/15] configure: Fix the default setting of the "xen" feature, Paolo Bonzini, 2021/07/22
- [PULL 12/15] configure: Fix --without-default-features propagation to meson, Paolo Bonzini, 2021/07/22
- Re: [PULL 00/15] Misc bugfix patches for 2021-07-22, Peter Maydell, 2021/07/23