From patchwork Tue Mar 7 15:50:48 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: 95013 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp1954987qgd; Tue, 7 Mar 2017 08:12:57 -0800 (PST) X-Received: by 10.176.24.218 with SMTP id d26mr663412uah.117.1488903177789; Tue, 07 Mar 2017 08:12:57 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d25si204073uab.229.2017.03.07.08.12.57 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 07 Mar 2017 08:12:57 -0800 (PST) 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]:51457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clHjL-0004p5-Ec for patch@linaro.org; Tue, 07 Mar 2017 11:12:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clHOD-0002dh-RJ for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:51:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clHO9-0005tQ-QN for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:51:05 -0500 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:38614) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1clHO9-0005sz-7c for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:51:01 -0500 Received: by mail-wm0-x22e.google.com with SMTP id t189so8507409wmt.1 for ; Tue, 07 Mar 2017 07:51:01 -0800 (PST) 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=0/mBL8YEDIrXOvgwP6BHyMKtW3bqPjUnWf8pMW7K7m4=; b=FHcRvxrelfprMg8vZTS6uMVgHNfv7NjRaSkRT4apXMbxqOHd738o7dx7pZUSqqBVfc XBd7gEJeyMusLqK7HaQ4JtRQe4njdRgkQmJvon8XrPphfN8qplBkyYhbh7DbQ4fydcz/ LtrX7on1uqCJGoO7euRX0U3BHC933HJCUvxNY= 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=0/mBL8YEDIrXOvgwP6BHyMKtW3bqPjUnWf8pMW7K7m4=; b=Y14cYy/CcQbujvrr7lYwVgtsCN/ddJJes5C36DPMozverQXHTJ9W/goOd8DB8sikkD ptmvd4gMImqegdum+5Gd6mM5bRLKaTF0zmZthz9Ip8ca4gGBwvOBe5h4O9ZHLxl0C2+L dpxMG8AGVF/Ur73z7jGUulEh5aoP19C6uvGCZjXpefhHMXr4YLvWS4CnYJJkBa9ZPqpx MnbnYpA+pKmt5QGKr/vHa+PqszS3c8VSkuk61a/Kmdr8ZoQ+a66Z7+xot2ODcWO2REuf Uo/EbSvy/S+qUzw8GZ1saJDB9grxL2+U7d9T9BeaiUnEdea4q4WT74sCIgOOIiYDVGEf TMuA== X-Gm-Message-State: AMke39lXH+zJAGRR6FLp5hTYD/6yWZmEV1pr9h0RhL+4K9f2feLqRNG9abnwyM97mALQigg3 X-Received: by 10.28.214.146 with SMTP id n140mr1461191wmg.58.1488901860012; Tue, 07 Mar 2017 07:51:00 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o15sm462742wra.61.2017.03.07.07.50.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 07 Mar 2017 07:50:53 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id CAD763E301B; Tue, 7 Mar 2017 15:50:54 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, pbonzini@redhat.com Date: Tue, 7 Mar 2017 15:50:48 +0000 Message-Id: <20170307155054.5833-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170307155054.5833-1-alex.bennee@linaro.org> References: <20170307155054.5833-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::22e Subject: [Qemu-devel] [PATCH v3 05/11] s390x/misc_helper.c: wrap IO instructions in BQL 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, Alexander Graf , 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" Helpers that can trigger IO events (including interrupts) need to be protected by the BQL. I've updated all the helpers that call into an ioinst_handle_* functions. Reported-by: Thomas Huth Signed-off-by: Alex Bennée --- target/s390x/misc_helper.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.11.0 Reviewed-by: Philippe Mathieu-Daudé diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index 3cb942e8bb..93b0e61366 100644 --- a/target/s390x/misc_helper.c +++ b/target/s390x/misc_helper.c @@ -19,6 +19,7 @@ */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "cpu.h" #include "exec/memory.h" #include "qemu/host-utils.h" @@ -551,61 +552,81 @@ uint32_t HELPER(sigp)(CPUS390XState *env, uint64_t order_code, uint32_t r1, void HELPER(xsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_xsch(cpu, r1); + qemu_mutex_unlock_iothread(); } void HELPER(csch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_csch(cpu, r1); + qemu_mutex_unlock_iothread(); } void HELPER(hsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_hsch(cpu, r1); + qemu_mutex_unlock_iothread(); } void HELPER(msch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_msch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } void HELPER(rchp)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_rchp(cpu, r1); + qemu_mutex_unlock_iothread(); } void HELPER(rsch)(CPUS390XState *env, uint64_t r1) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_rsch(cpu, r1); + qemu_mutex_unlock_iothread(); } void HELPER(ssch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_ssch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } void HELPER(stsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_stsch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } void HELPER(tsch)(CPUS390XState *env, uint64_t r1, uint64_t inst) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_tsch(cpu, r1, inst >> 16); + qemu_mutex_unlock_iothread(); } void HELPER(chsc)(CPUS390XState *env, uint64_t inst) { S390CPU *cpu = s390_env_get_cpu(env); + qemu_mutex_lock_iothread(); ioinst_handle_chsc(cpu, inst >> 16); + qemu_mutex_unlock_iothread(); } #endif