From patchwork Tue Sep 1 12:45:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?C=C3=A9dric_Le_Goater?= X-Patchwork-Id: 248860 Delivered-To: patch@linaro.org Received: by 2002:a92:5b9c:0:0:0:0:0 with SMTP id c28csp4205281ilg; Tue, 1 Sep 2020 05:53:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsCxycyTUzp9iBk9xj5vT3xP3foyRyM+oiPEsHMmJiqvCWdSLFjF9wswXsuoZ0jdF74Htw X-Received: by 2002:ac8:857:: with SMTP id x23mr1523542qth.229.1598964790186; Tue, 01 Sep 2020 05:53:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598964790; cv=none; d=google.com; s=arc-20160816; b=AOMBDvYx1DPspxBN/LVuiC2nvaqdhSbAgJ88G5ZAhkawjcjbmWQXAE2UJYVsJMEWNC K8hwm95tKa1bywFdpVgwHrv82Q/tNzKRPzsQ9pyrYH/bWFbI0tK2nronKLAd6qEJg5Ho Wq8UL3jpI/o/wtx4lUnNie91plZl45KV1pKj2nZHxx7WjvstvwpseZB3axFXA2K+QYIl eKexQFsQqPxNAnTBPfYGb2QBWpqbcPTaJAwdIPC1mukohKhLwsUTYVBHjF38Kwtu3GnL Z1BoXkS8dIeUl6pGHtuIg8bzrtrsICjvSReOeY1UaQPWbf0kANXuWKYzuLFSzpROIif1 dC+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=jDJL+tBqlNBVp9owkmEy5OJtdL3mxmnC84qlbcvjRpo=; b=saTeoo1qs7khX8mG6nh/8IY9vCDBi1qdlakCKHp5SnocTMt9gjJdla/9h/xFmOuby+ g4q5UkdLLethOJ/tQEUHeKc3T+t0RXum7x6HWdLq5yONmJra3jPuaH051I7WlqfitfXP 6lN00a36B/XxJlNgcM3vfugVQyxDA1AbNCWBuxG392v+pBaJ8JbyRZNR5CaZ2QTdjppI DgEuFnWUAthXH/6BuD6H16QWScV5SHC9oHVrAFBG7DunlgzbLhKlLS0LDNZerlG682V4 lFN3rsuawkOt6bDMMl9bOMQ7La+QZnZwsC1uAh93MUlCUYMl7XPrtEv70yAXDE7najWQ 3EIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w21si817517qvf.95.2020.09.01.05.53.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Sep 2020 05:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:33898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kD5me-0001Kx-EM for patch@linaro.org; Tue, 01 Sep 2020 08:53:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33742) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD5fU-0004nR-GN for qemu-devel@nongnu.org; Tue, 01 Sep 2020 08:45:44 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:55293) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kD5fQ-0001UH-0q for qemu-devel@nongnu.org; Tue, 01 Sep 2020 08:45:44 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.8]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id 97B0D563B984; Tue, 1 Sep 2020 14:45:36 +0200 (CEST) Received: from kaod.org (37.59.142.99) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Tue, 1 Sep 2020 14:45:36 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-99G003c03a6c99-a9b2-4a87-8cd8-3b8d46a6d1b0, 38EE1E9FF4E34D4C85F4190D418CEE501B878519) smtp.auth=clg@kaod.org From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Subject: [PULL 16/20] aspeed/sdmc: Allow writes to unprotected registers Date: Tue, 1 Sep 2020 14:45:21 +0200 Message-ID: <20200901124525.220252-17-clg@kaod.org> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200901124525.220252-1-clg@kaod.org> References: <20200901124525.220252-1-clg@kaod.org> MIME-Version: 1.0 X-Originating-IP: [37.59.142.99] X-ClientProxiedBy: DAG7EX1.mxp5.local (172.16.2.61) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: f6dff2bb-3e28-4c35-8827-5f8863af130b X-Ovh-Tracer-Id: 4787326407464618976 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduiedrudefjedgheejucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfhisehtkeertdertdejnecuhfhrohhmpeevrogurhhitgcunfgvucfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepheehfeegjeeitdfffeetjeduveejueefuefgtdefueelueetveeliefhhffgtdelnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrdelleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehmgihplhgrnhehrdhmrghilhdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtoheptghlgheskhgrohgurdhorhhg Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/01 08:45:33 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley A subset of registers are not protected by the lock behaviour, so allow unconditionally writing to those. Signed-off-by: Joel Stanley Message-Id: <20200819100956.2216690-18-clg@kaod.org> Signed-off-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) -- 2.25.4 diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index ff2809a09965..81c73450ab5d 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -33,15 +33,28 @@ /* Configuration Register */ #define R_CONF (0x04 / 4) +/* Interrupt control/status */ +#define R_ISR (0x50 / 4) + /* Control/Status Register #1 (ast2500) */ #define R_STATUS1 (0x60 / 4) #define PHY_BUSY_STATE BIT(0) #define PHY_PLL_LOCK_STATUS BIT(4) +/* Reserved */ +#define R_MCR6C (0x6c / 4) + #define R_ECC_TEST_CTRL (0x70 / 4) #define ECC_TEST_FINISHED BIT(12) #define ECC_TEST_FAIL BIT(13) +#define R_TEST_START_LEN (0x74 / 4) +#define R_TEST_FAIL_DQ (0x78 / 4) +#define R_TEST_INIT_VAL (0x7c / 4) +#define R_DRAM_SW (0x88 / 4) +#define R_DRAM_TIME (0x8c / 4) +#define R_ECC_ERR_INJECT (0xb4 / 4) + /* * Configuration register Ox4 (for Aspeed AST2400 SOC) * @@ -449,6 +462,20 @@ static uint32_t aspeed_2600_sdmc_compute_conf(AspeedSDMCState *s, uint32_t data) static void aspeed_2600_sdmc_write(AspeedSDMCState *s, uint32_t reg, uint32_t data) { + /* Unprotected registers */ + switch (reg) { + case R_ISR: + case R_MCR6C: + case R_TEST_START_LEN: + case R_TEST_FAIL_DQ: + case R_TEST_INIT_VAL: + case R_DRAM_SW: + case R_DRAM_TIME: + case R_ECC_ERR_INJECT: + s->regs[reg] = data; + return; + } + if (s->regs[R_PROT] == PROT_HARDLOCKED) { qemu_log_mask(LOG_GUEST_ERROR, "%s: SDMC is locked until system reset!\n", __func__);