From nobody Mon May 6 22:14:24 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 152690382926765.47950937079202; Mon, 21 May 2018 04:57:09 -0700 (PDT) Received: from localhost ([::1]:50002 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjR6-0001s5-Ib for importer@patchew.org; Mon, 21 May 2018 07:57:08 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44195) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjNX-0007A3-4Q for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKjNT-0005WU-AM for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:27 -0400 Received: from ssl.serverraum.org ([213.133.101.245]:49741) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKjNT-0005W8-4e for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:23 -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 F0C0D22D84; Mon, 21 May 2018 13:53:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1526903586; bh=tbdv1n3UdamEC4aHldQB+MF+fKr412XKOYUfkn5gkeQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OyY1c6IrjZJfuqDcpAb9CUpIaGhHgHn3MYsomHdfXu9I1Bdb8V2Y5jgaPuQr2lFYL Ph7iBJg45c6RRL8mQCJGG6QPl82cZCG2VhaYLTzv362+ygy5FIHuMxIn7w+Jn/WUJE dREvJAAzSJg1OEsXeKj4AhNoX3ndQb7kqUPDXUn8= From: Michael Walle To: qemu-devel@nongnu.org Date: Mon, 21 May 2018 13:52:51 +0200 Message-Id: <20180521115252.10759-2-michael@walle.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180521115252.10759-1-michael@walle.cc> References: <20180521115252.10759-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: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 213.133.101.245 Subject: [Qemu-devel] [PATCH 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 Mon May 6 22:14:24 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1526903727226411.6732899765849; Mon, 21 May 2018 04:55:27 -0700 (PDT) Received: from localhost ([::1]:49990 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjPS-0000fN-2w for importer@patchew.org; Mon, 21 May 2018 07:55:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fKjNV-00079w-VU for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fKjNV-0005XJ-9s for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:26 -0400 Received: from ssl.serverraum.org ([2a01:4f8:222:d45::1:2]:37391) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fKjNV-0005Wu-41 for qemu-devel@nongnu.org; Mon, 21 May 2018 07:53:25 -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 4F8CB22D9B; Mon, 21 May 2018 13:53:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1526903586; bh=b3xF5ENoLTd278I1UgNjWFxOcMoVeaGffGamCxXVn+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=soEwpBD4o+HmJEDFwUiQ/mX+4OOTm2dg/ecj6hOyTAQ8xF192kyVoAbF4Jl2CbY/m s1k4VJ8pQt/6PWqnpA6ouuDQdYm05ivsksigNiBSUJndy2ollG/Ea6GTsffpUPcPM3 mUWLfDJr2QSFpZHR5ldaeZwwAwbfzqJyu7cMCC8E= From: Michael Walle To: qemu-devel@nongnu.org Date: Mon, 21 May 2018 13:52:52 +0200 Message-Id: <20180521115252.10759-3-michael@walle.cc> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180521115252.10759-1-michael@walle.cc> References: <20180521115252.10759-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 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 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/target/lm32/gdbstub.c b/target/lm32/gdbstub.c index cf929dd392..2cdeef8f5e 100644 --- a/target/lm32/gdbstub.c +++ b/target/lm32/gdbstub.c @@ -82,10 +82,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