From nobody Tue Feb 10 22:18:26 2026 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 1529294871357883.6548833090882; Sun, 17 Jun 2018 21:07:51 -0700 (PDT) Received: from localhost ([::1]:60952 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUlSI-00009d-Ch for importer@patchew.org; Mon, 18 Jun 2018 00:07:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUlEb-0005OY-MP for qemu-devel@nongnu.org; Sun, 17 Jun 2018 23:53:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUlEZ-00042h-VK for qemu-devel@nongnu.org; Sun, 17 Jun 2018 23:53:41 -0400 Received: from ozlabs.org ([203.11.71.1]:39375) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fUlEZ-0003zB-GG; Sun, 17 Jun 2018 23:53:39 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 418HJB3bPrz9s8J; Mon, 18 Jun 2018 13:53:30 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1529294010; bh=WJgkq+ELtFhviU+hWZePvtyxutE2VeIHKjiolEM7VqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=apN+ErpHfhZKiNY/ZGpYiK174xTy1du2Iu1h7OGCr/3xqkJM3PWBxP569pQhWysLL KQKmbiaT6hUAa7gZIqhtr2SBhWJcIutAVjiYz+rqRgkf2kDUKdo1Nxjh6ahgehDp2v Qz0zho8ga9mlYLmS1wujTXqJKMHEKgODyRr1MIm4= From: David Gibson To: peter.maydell@linaro.org Date: Mon, 18 Jun 2018 13:53:12 +1000 Message-Id: <20180618035324.19907-17-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618035324.19907-1-david@gibson.dropbear.id.au> References: <20180618035324.19907-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 16/28] sm501: Do not clear read only bits when writing registers 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: aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson 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" From: BALATON Zoltan When writing registers that have read only bits we have to avoid changing these bits as they may have non zero values. Make sure we use the correct masks to mask out read only and reserved bits when changing registers. Also remove extra spaces from dram_control and arbitration_control assignments. Signed-off-by: BALATON Zoltan Signed-off-by: David Gibson --- hw/display/sm501.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/hw/display/sm501.c b/hw/display/sm501.c index e47be99451..ca0840f6fa 100644 --- a/hw/display/sm501.c +++ b/hw/display/sm501.c @@ -836,27 +836,30 @@ static void sm501_system_config_write(void *opaque, h= waddr addr, =20 switch (addr) { case SM501_SYSTEM_CONTROL: - s->system_control =3D value & 0xE300B8F7; + s->system_control &=3D 0x10DB0000; + s->system_control |=3D value & 0xEF00B8F7; break; case SM501_MISC_CONTROL: - s->misc_control =3D value & 0xFF7FFF20; + s->misc_control &=3D 0xEF; + s->misc_control |=3D value & 0xFF7FFF10; break; case SM501_GPIO31_0_CONTROL: s->gpio_31_0_control =3D value; break; case SM501_GPIO63_32_CONTROL: - s->gpio_63_32_control =3D value; + s->gpio_63_32_control =3D value & 0xFF80FFFF; break; case SM501_DRAM_CONTROL: s->local_mem_size_index =3D (value >> 13) & 0x7; /* TODO : check validity of size change */ - s->dram_control |=3D value & 0x7FFFFFC3; + s->dram_control &=3D 0x80000000; + s->dram_control |=3D value & 0x7FFFFFC3; break; case SM501_ARBTRTN_CONTROL: - s->arbitration_control =3D value & 0x37777777; + s->arbitration_control =3D value & 0x37777777; break; case SM501_IRQ_MASK: - s->irq_mask =3D value; + s->irq_mask =3D value & 0xFFDF3F5F; break; case SM501_MISC_TIMING: s->misc_timing =3D value & 0xF31F1FFF; --=20 2.17.1