[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [RFC v3 52/56] sparc: acquire the BQL in cpu_has_work
From: |
Emilio G. Cota |
Subject: |
[Qemu-devel] [RFC v3 52/56] sparc: acquire the BQL in cpu_has_work |
Date: |
Thu, 18 Oct 2018 21:06:21 -0400 |
Soon we will call cpu_has_work without the BQL.
Cc: Mark Cave-Ayland <address@hidden>
Cc: Artyom Tarasenko <address@hidden>
Signed-off-by: Emilio G. Cota <address@hidden>
---
target/sparc/cpu.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
index 88427283c1..854c1733c8 100644
--- a/target/sparc/cpu.c
+++ b/target/sparc/cpu.c
@@ -18,6 +18,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
#include "qapi/error.h"
#include "cpu.h"
#include "qemu/error-report.h"
@@ -704,15 +705,30 @@ static void sparc_cpu_synchronize_from_tb(CPUState *cs,
TranslationBlock *tb)
cpu->env.npc = tb->cs_base;
}
-static bool sparc_cpu_has_work(CPUState *cs)
+static bool sparc_cpu_has_work_locked(CPUState *cs)
{
SPARCCPU *cpu = SPARC_CPU(cs);
CPUSPARCState *env = &cpu->env;
+ g_assert(qemu_mutex_iothread_locked());
+
return (cpu_interrupt_request(cs) & CPU_INTERRUPT_HARD) &&
cpu_interrupts_enabled(env);
}
+static bool sparc_cpu_has_work(CPUState *cs)
+{
+ if (!qemu_mutex_iothread_locked()) {
+ bool ret;
+
+ qemu_mutex_lock_iothread();
+ ret = sparc_cpu_has_work_locked(cs);
+ qemu_mutex_unlock_iothread();
+ return ret;
+ }
+ return sparc_cpu_has_work_locked(cs);
+}
+
static char *sparc_cpu_type_name(const char *cpu_model)
{
char *name = g_strdup_printf(SPARC_CPU_TYPE_NAME("%s"), cpu_model);
--
2.17.1
- Re: [Qemu-devel] [RFC v3 43/56] openrisc: convert to cpu_interrupt_request, (continued)
- [Qemu-devel] [RFC v3 37/56] mips: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 42/56] sparc: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 30/56] i386: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 49/56] mips: acquire the BQL in cpu_has_work, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 51/56] riscv: acquire the BQL in cpu_has_work, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 52/56] sparc: acquire the BQL in cpu_has_work,
Emilio G. Cota <=
- [Qemu-devel] [RFC v3 31/56] ppc: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 48/56] ppc: acquire the BQL in cpu_has_work, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 50/56] s390: acquire the BQL in cpu_has_work, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 39/56] s390x: convert to cpu_interrupt_request, Emilio G. Cota, 2018/10/18
- [Qemu-devel] [RFC v3 27/56] s390x: use cpu_reset_interrupt, Emilio G. Cota, 2018/10/18