From patchwork Mon Apr 3 12:45:19 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: 96628 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp81948qgd; Mon, 3 Apr 2017 05:46:00 -0700 (PDT) X-Received: by 10.55.134.2 with SMTP id i2mr14907445qkd.43.1491223560456; Mon, 03 Apr 2017 05:46:00 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id 52si11784121qty.179.2017.04.03.05.45.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 03 Apr 2017 05:46:00 -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]:59128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv1Mr-0001Qa-PT for patch@linaro.org; Mon, 03 Apr 2017 08:45:57 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52451) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cv1MX-0001OU-AB for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cv1MR-00012T-56 for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:37 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:35108) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cv1MQ-000128-UY for qemu-devel@nongnu.org; Mon, 03 Apr 2017 08:45:31 -0400 Received: by mail-wr0-x230.google.com with SMTP id k6so162839031wre.2 for ; Mon, 03 Apr 2017 05:45:30 -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=UrCf0KGnZymZ954Aa8jexPBlPlEDO5TFNMXcFkZwz+s=; b=CTtnJSjIJdW8rj2jFBW3H5AO2tl13let6GZsp5vhl1rdvuB2/OZONEovj+vSKc0gmI QOP8FzogW1hTbNwABi3pxib0zklTH22TYoTuK5MgKMiWKnvbKPuptH2brdyNs0fB/xRO x6w28BS3sr3i5A0HKRMd/enr8XVAeJ3A+UmCo= 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=UrCf0KGnZymZ954Aa8jexPBlPlEDO5TFNMXcFkZwz+s=; b=XVzhaJRXYmXit+BdoZz9Rb0Kb1vcGd2e6AyVN7SAo492Xg8ssrQfi1Gv0Wux387wOp KZvORffzQHjYKCf2QXmdzMwIALK4XnE9mUE0cfWeygSl8RsgzOcsHt/OIjLyuwJn7rHk XeUuo/XspeE3Msw5lqoAAO43Rqz+/D+5q038mxDWBZvPaidcnHbuYRSYGSnUgWC4yUTr qyzjwWALkTu5xGO07pkUqBOgPVfVcPHO2cpuYD7RX5/MqnsSUT6PxGX23f/qzlEb5O7j W+o0kgIBMaqidzkX9fA7HHXTOYLigXbCKIVg3P1aNSToIEw6TXky3e6DOotVQzVeMIrS GxAQ== X-Gm-Message-State: AFeK/H2VpkCp04ozNoXgmAVnCZ5xddsSMhvs7053p+pac3Py2ImGBYS5zImNgCbF1bBgqo25 X-Received: by 10.223.180.69 with SMTP id v5mr16262377wrd.62.1491223529445; Mon, 03 Apr 2017 05:45:29 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id i130sm14186388wmf.26.2017.04.03.05.45.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Apr 2017 05:45:26 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0DFE53E1061; Mon, 3 Apr 2017 13:45:25 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: dovgaluk@ispras.ru, rth@twiddle.net, pbonzini@redhat.com Date: Mon, 3 Apr 2017 13:45:19 +0100 Message-Id: <20170403124524.10824-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170403124524.10824-1-alex.bennee@linaro.org> References: <20170403124524.10824-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::230 Subject: [Qemu-devel] [RFC PATCH v1 4/9] 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 --- target/i386/misc_helper.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 Reviewed-by: Richard Henderson Acked-by: Eduardo Habkost 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;