diff mbox series

[RFC,v1,4/9] target/i386/misc_helper: wrap BQL around another IRQ generator

Message ID 20170403124524.10824-5-alex.bennee@linaro.org
State Superseded
Headers show
Series MTTCG and record/replay fixes for rc3 | expand

Commit Message

Alex Bennée April 3, 2017, 12:45 p.m. UTC
Anything that calls into HW emulation must be protected by the BQL.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

---
 target/i386/misc_helper.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.11.0

Comments

Richard Henderson April 4, 2017, 4:53 p.m. UTC | #1
On 04/03/2017 05:45 AM, Alex Bennée wrote:
> Anything that calls into HW emulation must be protected by the BQL.

>

> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> ---

>  target/i386/misc_helper.c | 3 +++

>  1 file changed, 3 insertions(+)


Reviewed-by: Richard Henderson <rth@twiddle.net>



r~
Eduardo Habkost April 4, 2017, 5:36 p.m. UTC | #2
On Tue, Apr 04, 2017 at 09:53:15AM -0700, Richard Henderson wrote:
> On 04/03/2017 05:45 AM, Alex Bennée wrote:

> > Anything that calls into HW emulation must be protected by the BQL.

> > 

> > Signed-off-by: Alex Bennée <alex.bennee@linaro.org>

> > ---

> >  target/i386/misc_helper.c | 3 +++

> >  1 file changed, 3 insertions(+)

> 

> Reviewed-by: Richard Henderson <rth@twiddle.net>


In case somebody is going to queue the whole series in one take:

Acked-by: Eduardo Habkost <ehabkost@redhat.com>


-- 
Eduardo
diff mbox series

Patch

diff --git a/target/i386/misc_helper.c b/target/i386/misc_helper.c
index ca2ea09f54..628f64aad5 100644
--- a/target/i386/misc_helper.c
+++ b/target/i386/misc_helper.c
@@ -18,6 +18,7 @@ 
  */
 
 #include "qemu/osdep.h"
+#include "qemu/main-loop.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
@@ -156,7 +157,9 @@  void helper_write_crN(CPUX86State *env, int reg, target_ulong t0)
         break;
     case 8:
         if (!(env->hflags2 & HF2_VINTR_MASK)) {
+            qemu_mutex_lock_iothread();
             cpu_set_apic_tpr(x86_env_get_cpu(env)->apic_state, t0);
+            qemu_mutex_unlock_iothread();
         }
         env->v_tpr = t0 & 0x0f;
         break;