From nobody Tue May 7 11:40:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526905406866451.98920158810813; Mon, 21 May 2018 05:23:26 -0700 (PDT) Received: from localhost ([::1]:50382 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjqP-0003Fj-DP for importer@patchew.org; Mon, 21 May 2018 08:23:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjoL-0002Fd-Vh for qemu-devel@nongnu.org; Mon, 21 May 2018 08:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKjoK-0007lf-Ee for qemu-devel@nongnu.org; Mon, 21 May 2018 08:21:09 -0400 Received: from ssl.serverraum.org ([2a01:4f8:222:d45::1:2]:57177) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKjoK-0007lL-90; Mon, 21 May 2018 08:21:08 -0400 Received: from thanatos.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:56be:f7ff:fe37:9af7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 7F79822D9B; Mon, 21 May 2018 14:21:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1526905266; bh=tbdv1n3UdamEC4aHldQB+MF+fKr412XKOYUfkn5gkeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOigpzpvfquCL9sRK92FLvapIyR1fKr4ZH3DJG6ojl+lM5g8lQk9IXg7ncSlD9rMQ JwqAQwOCj1p17VdcPXp9YVQ6vALtnxVEK5O+VB2jJW1qbjvO2sHkTtzHEsu/hfO13c to9pYf0PTXksa/RgQNT6g2Nj5jTRiIHJ9Hj7V4p0= From: Michael Walle To: qemu-devel@nongnu.org Date: Mon, 21 May 2018 14:20:59 +0200 Message-Id: <20180521122100.22602-2-michael@walle.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180521122100.22602-1-michael@walle.cc> References: <20180521122100.22602-1-michael@walle.cc> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.4 at web X-Virus-Status: Clean Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a01:4f8:222:d45::1:2 Subject: [Qemu-devel] [PATCH v2 1/2] lm32: take BQL before writing IP/IM register 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: Paolo Bonzini , Michael Walle , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Writing to these registers may raise an interrupt request. Actually, this prevents the milkymist board from starting. Cc: qemu-stable@nongnu.org Signed-off-by: Michael Walle Tested-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Alex Benn=C3=A9e --- target/lm32/op_helper.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/lm32/op_helper.c b/target/lm32/op_helper.c index 577f8306e3..234d55e056 100644 --- a/target/lm32/op_helper.c +++ b/target/lm32/op_helper.c @@ -102,12 +102,16 @@ void HELPER(wcsr_dc)(CPULM32State *env, uint32_t dc) =20 void HELPER(wcsr_im)(CPULM32State *env, uint32_t im) { + qemu_mutex_lock_iothread(); lm32_pic_set_im(env->pic_state, im); + qemu_mutex_unlock_iothread(); } =20 void HELPER(wcsr_ip)(CPULM32State *env, uint32_t im) { + qemu_mutex_lock_iothread(); lm32_pic_set_ip(env->pic_state, im); + qemu_mutex_unlock_iothread(); } =20 void HELPER(wcsr_jtx)(CPULM32State *env, uint32_t jtx) --=20 2.11.0 From nobody Tue May 7 11:40:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526905406948654.9218001728693; Mon, 21 May 2018 05:23:26 -0700 (PDT) Received: from localhost ([::1]:50383 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjqP-0003Fy-7I for importer@patchew.org; Mon, 21 May 2018 08:23:17 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjoL-0002Fc-Rm for qemu-devel@nongnu.org; Mon, 21 May 2018 08:21:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKjoK-0007lq-Og for qemu-devel@nongnu.org; Mon, 21 May 2018 08:21:09 -0400 Received: from ssl.serverraum.org ([2a01:4f8:222:d45::1:2]:53127) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKjoK-0007lQ-IH; Mon, 21 May 2018 08:21:08 -0400 Received: from thanatos.fritz.box (unknown [IPv6:2a02:810c:c200:2e91:56be:f7ff:fe37:9af7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 5409522DAF; Mon, 21 May 2018 14:21:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1526905267; bh=7gRPvH6Vghm0vzOtkptAh8K4J5eAfx6u4ERQbGwlKEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oPmD6inWoaAEyTcat2TGm217+wtLkhCWTbljbXmRAiAtYSldLfguPGC7T4itK7SLV 40hxGWg2nyCBmvHN+AEX+kTMssOAp9m/tQGEtPeSzSYCvQ4lXuDgF8XldGXGXeRMuy bp67lokUx7J9TUjsgtvtTR1pV20UMTCffIQV/22E= From: Michael Walle To: qemu-devel@nongnu.org Date: Mon, 21 May 2018 14:21:00 +0200 Message-Id: <20180521122100.22602-3-michael@walle.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180521122100.22602-1-michael@walle.cc> References: <20180521122100.22602-1-michael@walle.cc> X-Virus-Scanned: clamav-milter 0.99.4 at web X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a01:4f8:222:d45::1:2 Subject: [Qemu-devel] [PATCH v2 2/2] target/lm32: hold BQL in gdbstub 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: Paolo Bonzini , Michael Walle , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-stable@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Changing the IP/IM registers may cause interrupts, so hold the BQL. Cc: qemu-stable@nongnu.org Signed-off-by: Michael Walle --- target/lm32/gdbstub.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c index cf929dd392..dac9418a2b 100644 --- a/target/lm32/gdbstub.c +++ b/target/lm32/gdbstub.c @@ -18,6 +18,7 @@ * License along with this library; if not, see . */ #include "qemu/osdep.h" +#include "qemu/main-loop.h" #include "qemu-common.h" #include "cpu.h" #include "exec/gdbstub.h" @@ -82,10 +83,14 @@ int lm32_cpu_gdb_write_register(CPUState *cs, uint8_t *= mem_buf, int n) env->ie =3D tmp; break; case 37: + qemu_mutex_lock_iothread(); lm32_pic_set_im(env->pic_state, tmp); + qemu_mutex_unlock_iothread(); break; case 38: + qemu_mutex_lock_iothread(); lm32_pic_set_ip(env->pic_state, tmp); + qemu_mutex_unlock_iothread(); break; } } --=20 2.11.0