Received: from eggs.gnu.org ([2001:4830:134:3::10]:44943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1el4zL-0007hL-JA for qemu-devel@nongnu.org; Sun, 11 Feb 2018 22:41:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1el4zH-00067I-SR for qemu-devel@nongnu.org; Sun, 11 Feb 2018 22:41:07 -0500 From: David Gibson Date: Mon, 12 Feb 2018 14:40:46 +1100 Message-Id: <20180212034054.23441-5-david@gibson.dropbear.id.au> In-Reply-To: <20180212034054.23441-1-david@gibson.dropbear.id.au> References: <20180212034054.23441-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 04/12] cuda: don't allow writes to port output pins List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: groug@kaod.org, mark.cave-ayland@ilande.co.uk, qemu-ppc@nongnu.org, qemu-devel@nongnu.org, lvivier@redhat.com, David Gibson From: Mark Cave-Ayland Use the direction registers as a mask to ensure that only input pins are updated upon write. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: David Gibson --- hw/misc/macio/cuda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 6631017ca2..eaa8924f49 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -359,11 +359,11 @@ static void cuda_write(void *opaque, hwaddr addr, u= int64_t val, unsigned size) =20 switch(addr) { case CUDA_REG_B: - s->b =3D val; + s->b =3D (s->b & ~s->dirb) | (val & s->dirb); cuda_update(s); break; case CUDA_REG_A: - s->a =3D val; + s->a =3D (s->a & ~s->dira) | (val & s->dira); break; case CUDA_REG_DIRB: s->dirb =3D val; --=20 2.14.3