From patchwork Wed Apr 5 13:24:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 96855 Delivered-To: patch@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp260358obc; Wed, 5 Apr 2017 06:30:03 -0700 (PDT) X-Received: by 10.200.50.20 with SMTP id x20mr28548925qta.169.1491399003499; Wed, 05 Apr 2017 06:30:03 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h10si17801872qta.54.2017.04.05.06.30.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 05 Apr 2017 06:30:03 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40568 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvl0d-0000F1-2R for patch@linaro.org; Wed, 05 Apr 2017 09:30:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54586) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cvkvv-0004cd-AN for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cvkvr-0000Fs-4S for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:11 -0400 Received: from mail-wr0-x233.google.com ([2a00:1450:400c:c0c::233]:35407) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cvkvq-0000E2-Vc for qemu-devel@nongnu.org; Wed, 05 Apr 2017 09:25:07 -0400 Received: by mail-wr0-x233.google.com with SMTP id k6so14519971wre.2 for ; Wed, 05 Apr 2017 06:25:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vma+WY0g4IYtFBe1+uJbndMPoNWlWhlcNAqnBcBpzD0=; b=TEYXeY3dL2noLfUhsrZ89YYSPmU3dLkFjXw1oqdSgw53zpfe8wflY9fSTcG3JeVE7A JvDCPc47C/amMRKAlMZPAkWObSqDyAbZNt0TDFtGlVd8pDqaxT/V5f5cboAGW2UqKr9b LIk4MKvxwonE7a8KOjYx4+IxswI3GG9EuyvZA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vma+WY0g4IYtFBe1+uJbndMPoNWlWhlcNAqnBcBpzD0=; b=XKP19Ih6NAn+vUvMezIRvLjlGwLAil9/PGnoC9TGnSmersQg5/s+i97Q0uI2VPzX2E Oza3f/Z/fMAygeRabGmAhFcI+9GsB/5YAA8zJjaP72UkDVX3e4HSy+cMyixYnb4DuCgS UWtgc6h7NopOx/0x9ekYagj8XJxaNEKkLqaK+bNQ67gpl/Cw/MEYJDwj9q3aXLajXoVj FVtM0E+aNF9LNGVuPmCHrp9xqOP/SsLoGUXYMGgxTlpSUc0K/Bgk3fQKqErkqXWoGC3W eQlm2NhioEYKox7D9/MGP4Q8kDgzear/g+24tKsFgTzmjo4bKNuHsSWSbIJhcgM6K0hT MVsg== X-Gm-Message-State: AN3rC/52gnPqJkFMAlcwFuiczNGtHgPJZPP4LC4TT/L+g8lGKIDlM+0R 8KXWoijbAfgut232 X-Received: by 10.28.213.198 with SMTP id m189mr609463wmg.102.1491398705830; Wed, 05 Apr 2017 06:25:05 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id b199sm22362012wmb.13.2017.04.05.06.25.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Apr 2017 06:25:02 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 620FC3E087F; Wed, 5 Apr 2017 14:25:03 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: dovgaluk@ispras.ru, rth@twiddle.net, pbonzini@redhat.com Date: Wed, 5 Apr 2017 14:24:55 +0100 Message-Id: <20170405132503.32125-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170405132503.32125-1-alex.bennee@linaro.org> References: <20170405132503.32125-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::233 Subject: [Qemu-devel] [PATCH v2 04/12] target/i386/misc_helper: wrap BQL around another IRQ generator X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mttcg@listserver.greensocs.com, peter.maydell@linaro.org, Eduardo Habkost , nikunj@linux.vnet.ibm.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Anything that calls into HW emulation must be protected by the BQL. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson Acked-by: Eduardo Habkost --- target/i386/misc_helper.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 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;