From patchwork Tue Nov 19 14:12:00 2019 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: 179761 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp704847ilf; Tue, 19 Nov 2019 06:23:05 -0800 (PST) X-Google-Smtp-Source: APXvYqyc+/4wx0cjPL2T8Njnk0tfUMX962o3KxHnwyNP1akpC2Y3mTVwdl2N+wk6jyQL94RvXroH X-Received: by 2002:ac8:60da:: with SMTP id i26mr34090364qtm.43.1574173385249; Tue, 19 Nov 2019 06:23:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173385; cv=none; d=google.com; s=arc-20160816; b=wiITsmqTSxu4ATxLAg3Wy+DvU/NFjWmtkgY1sAVKPnozJLEzO3o/03FIdS0RNZODR4 COE1kRvSD0d4DsttfE1L8x2cNzz2xvXDEYwCIG0I8HH/4ZNJKiwy0FLRh31LE7icYWND 73C6XjwmnQtxTj5R1dmA3EggYZWbql0CmLGA/gTacklZ249fztlDXrhF0viD+xwnFL1s FqjN6cXG3COIvAYNc9fboH/ymHuM2sgOb0ffc3Kr3TAKybJR5+fRegcDgjtOYpOxoLJf Ennjf+bpqu/bjrqhz8QjwWNey3dxoQDB2eQoGwINyGRzgwjG3vhV+R5uFrWAhrVY7IgS tsng== 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=CiMZVCM1hG9aAFYPU+6GGtNjOBEB2Y61z+wCa9XJVQw=; b=otLgHx8xdwgRfl2pl+aXBri3+foRKit43Rv9b+ygJZ2zOZm8amYE/656ifUK8Z6U68 dP41kCXJwa8sUxuvP8v9v6u6tNkglpmKX78SL+kPv+5R/Xyu5sszSPGTHLrDrfaplsKH uer6ILqMsau5m9wSvJ7Qm4eIzf8Ao22QQwz9Uq0WmmwRV+H619wSBjW74IXwmoQIVC82 BKITQ5VZOQEf2PZzXwVhKmcYljyxHc6cHu5FgGUY1bzHOrSbmmdCd9ob2cgRTJX5pbYM ux9LayYHBpWec9qgp4rONWakjz0aPes3Xm507PzVItprV96h3GYwf/IqJVAaDwObMKdL HL5A== 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 m56si14062867qta.375.2019.11.19.06.23.05 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2019 06:23:05 -0800 (PST) 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]:46040 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4PI-0000c4-OX for patch@linaro.org; Tue, 19 Nov 2019 09:23:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:41969) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4Fn-0006GS-TC for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iX4Fm-0005NW-Pd for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:15 -0500 Received: from 15.mo4.mail-out.ovh.net ([91.121.62.11]:46214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iX4Fm-0005Mo-JX for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:14 -0500 Received: from player795.ha.ovh.net (unknown [10.108.57.76]) by mo4.mail-out.ovh.net (Postfix) with ESMTP id 985F220DAF2 for ; Tue, 19 Nov 2019 15:13:12 +0100 (CET) Received: from kaod.org (deibp9eh1--blueice1n4.emea.ibm.com [195.212.29.166]) (Authenticated sender: clg@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPSA id EEE2AC18AA3E; Tue, 19 Nov 2019 14:13:03 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Subject: [PATCH 06/17] aspeed/sdmc: Make ast2600 default 1G Date: Tue, 19 Nov 2019 15:12:00 +0100 Message-Id: <20191119141211.25716-7-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191119141211.25716-1-clg@kaod.org> References: <20191119141211.25716-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 17904060320515590929 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegkedgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpudelhedrvdduvddrvdelrdduieeinecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleehrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 91.121.62.11 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: Andrew Jeffery , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley Most boards have this much. Reviewed-by: Cédric Le Goater Reviewed-by: Alex Bennée Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- hw/misc/aspeed_sdmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) -- 2.21.0 diff --git a/hw/misc/aspeed_sdmc.c b/hw/misc/aspeed_sdmc.c index f3a63a2e01db..2df3244b53c8 100644 --- a/hw/misc/aspeed_sdmc.c +++ b/hw/misc/aspeed_sdmc.c @@ -208,10 +208,10 @@ static int ast2600_rambits(AspeedSDMCState *s) } /* use a common default */ - warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 512M", + warn_report("Invalid RAM size 0x%" PRIx64 ". Using default 1024M", s->ram_size); - s->ram_size = 512 << 20; - return ASPEED_SDMC_AST2600_512MB; + s->ram_size = 1024 << 20; + return ASPEED_SDMC_AST2600_1024MB; } static void aspeed_sdmc_reset(DeviceState *dev) From patchwork Tue Nov 19 14:12:01 2019 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: 179762 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp706072ilf; Tue, 19 Nov 2019 06:24:03 -0800 (PST) X-Google-Smtp-Source: APXvYqzsNuvpe3XDY4Yu1ydZeM0KlRag5Iav7nqyiUfe1ii3cTlrSayrCOXeAXMggm4OmyC5q8CS X-Received: by 2002:ac8:118d:: with SMTP id d13mr33201176qtj.249.1574173443708; Tue, 19 Nov 2019 06:24:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173443; cv=none; d=google.com; s=arc-20160816; b=gessnwY2jgThqJ0Bwi3Q5wIi4rkLQf5vwyLb00h3qpprx23NAZJJF4WhOKeIbEulUK YQk9bq8Crg1VENXlETZMv43E84eR3JEr30emNu1xKRtSE4XwlU1l1+SvQhqa9HbzBWzw buECPflINFmo7uHkl+TDbqij6VnAb2bGUMzosWsifuyVOu2LgkjSMAwgCn5EXg3fy60N 1s+39X6NOl9gmI7BmLDwY931qS6/My75zygfhfbIpVWFlaaJ59vzIq+f4rJOSo9GvHFG zkI1wOWNzVoGXGm6LjIqhOTueibqP3KmpUaQiG4mifdINtO5jbeSZqO36CrZ3LrBq0WS gkiA== 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=leWo8XBnS/d7vN61dRYnOAncbw+pMzfCkH2LRBkyqwE=; b=AHDjq7heR61QnVGlxqN8U6iWUCAn6XMaDDlPalev4M8yM/1gScZ+j//AjBy1XyvsoU qazH88v2qxvTGAdP6avXxwThO4FOVUvORK+LmqDK+jiUdXSaw2zTP9g6TtdOcNjEyXoP 9R0TVYoSUuatT4CNu6cF0IInizDkwE5oQAfwJWsVojM7bnZfZ26l3XVIn5dh5rxsVkIh r/brrp9OU6uIgh+dSRg9VJH2kHNv8o5V2zbLi45MwXc07aIeIzbOEn+ZEgfDeYYZBed2 JBKH0DQfhgliOVOhCJM1P9axcNalInGSf1l82QyW4etywU9Z8JTgtK+VrOAkKZYBcQz1 02Fg== 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 g40si13628363qtk.252.2019.11.19.06.24.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2019 06:24:03 -0800 (PST) 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]:46056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4QE-0001cx-HI for patch@linaro.org; Tue, 19 Nov 2019 09:24:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42005) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4Fy-0006Qp-L7 for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:28 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iX4Fw-0005R3-Hb for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:26 -0500 Received: from 5.mo1.mail-out.ovh.net ([178.33.45.107]:60327) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iX4Fv-0005Po-Hu for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:24 -0500 Received: from player795.ha.ovh.net (unknown [10.108.57.211]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id 85C9319BC9B for ; Tue, 19 Nov 2019 15:13:20 +0100 (CET) Received: from kaod.org (deibp9eh1--blueice1n4.emea.ibm.com [195.212.29.166]) (Authenticated sender: clg@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPSA id 9BA1DC18AAE1; Tue, 19 Nov 2019 14:13:12 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Subject: [PATCH 07/17] aspeed/scu: Fix W1C behavior Date: Tue, 19 Nov 2019 15:12:01 +0100 Message-Id: <20191119141211.25716-8-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191119141211.25716-1-clg@kaod.org> References: <20191119141211.25716-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 17906312122056477457 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegkedgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpudelhedrvdduvddrvdelrdduieeinecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleehrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpeef X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.45.107 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: Andrew Jeffery , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley This models the clock write one to clear registers, and fixes up some incorrect behavior in all of the write to clear registers. There was also a typo in one of the register definitions. Reviewed-by: Cédric Le Goater Reviewed-by: Alex Bennée Signed-off-by: Joel Stanley [clg: checkpatch.pl fixes ] Signed-off-by: Cédric Le Goater --- hw/misc/aspeed_scu.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 2.21.0 diff --git a/hw/misc/aspeed_scu.c b/hw/misc/aspeed_scu.c index 717509bc5460..f62fa25e3474 100644 --- a/hw/misc/aspeed_scu.c +++ b/hw/misc/aspeed_scu.c @@ -98,7 +98,7 @@ #define AST2600_CLK_STOP_CTRL TO_REG(0x80) #define AST2600_CLK_STOP_CTRL_CLR TO_REG(0x84) #define AST2600_CLK_STOP_CTRL2 TO_REG(0x90) -#define AST2600_CLK_STOP_CTR2L_CLR TO_REG(0x94) +#define AST2600_CLK_STOP_CTRL2_CLR TO_REG(0x94) #define AST2600_SDRAM_HANDSHAKE TO_REG(0x100) #define AST2600_HPLL_PARAM TO_REG(0x200) #define AST2600_HPLL_EXT TO_REG(0x204) @@ -532,11 +532,13 @@ static uint64_t aspeed_ast2600_scu_read(void *opaque, hwaddr offset, return s->regs[reg]; } -static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data, - unsigned size) +static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, + uint64_t data64, unsigned size) { AspeedSCUState *s = ASPEED_SCU(opaque); int reg = TO_REG(offset); + /* Truncate here so bitwise operations below behave as expected */ + uint32_t data = data64; if (reg >= ASPEED_AST2600_SCU_NR_REGS) { qemu_log_mask(LOG_GUEST_ERROR, @@ -563,15 +565,22 @@ static void aspeed_ast2600_scu_write(void *opaque, hwaddr offset, uint64_t data, /* fall through */ case AST2600_SYS_RST_CTRL: case AST2600_SYS_RST_CTRL2: + case AST2600_CLK_STOP_CTRL: + case AST2600_CLK_STOP_CTRL2: /* W1S (Write 1 to set) registers */ s->regs[reg] |= data; return; case AST2600_SYS_RST_CTRL_CLR: case AST2600_SYS_RST_CTRL2_CLR: + case AST2600_CLK_STOP_CTRL_CLR: + case AST2600_CLK_STOP_CTRL2_CLR: case AST2600_HW_STRAP1_CLR: case AST2600_HW_STRAP2_CLR: - /* W1C (Write 1 to clear) registers */ - s->regs[reg] &= ~data; + /* + * W1C (Write 1 to clear) registers are offset by one address from + * the data register + */ + s->regs[reg - 1] &= ~data; return; case AST2600_RNG_DATA: From patchwork Tue Nov 19 14:12:02 2019 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: 179763 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp709811ilf; Tue, 19 Nov 2019 06:26:58 -0800 (PST) X-Google-Smtp-Source: APXvYqxUCialSieBHGIrdn2ICBF5456+WoOPxjYrx/yoYzqquwpf+tbaQsZdqcIjLibTiZFwd1cy X-Received: by 2002:adf:e78c:: with SMTP id n12mr34802316wrm.94.1574173618491; Tue, 19 Nov 2019 06:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173618; cv=none; d=google.com; s=arc-20160816; b=ml2y9DtIp7XLRqGu8AlNv2XRf5hE/SyV9qWcwXBXmDO7Kvj5wpBpoqv+zSG/hpGoMn T59Qw994DH1Uljd3BrDdIStSKWQiP6JqrOjHPV3RD4oLNoy7NGOdKjw+JrqrXi2/YCJF xku4GlcNPAFTy62hMhH0nnp8oqq1D38Z37ZAI74pT/lgrBlwr/qA5BP89o8F1mJOmOCt X3qkFF996Zt6BRZPVq1TzvLyamD02mtIY8/M+HPVy9LMCwPuiyjq2MaJ8wXj+hCfhwke so5tT6BOyArd1ycYQ5NWDb8cNJBtmbYz7veXgxJDXpKWx3Vg0J4AAVex0yNQBwzR4NEF gZCw== 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=PtqjRBaGybWs39PwwvBLI4BES0N7Q9slA6bV9+LiiCM=; b=E1SvAJfjOoEH6RhNj6SPWl7KERhhMmh8OSTHhSFvcyh+UQZTThtuyhfO3HVj9RSEGJ DksHN8XoPU48PyPsmvvvvFpEqVzfnzgKo4yY0UKa675mtgS63tK18LJQVb5YKy8Ul4Az SAglgQeoyXMQG2emgdI9wKU2QG86yCGoIPol1fjztKnlVxIG9ZeQ4HcySBQ802/VI2pu D4Mn2s9eItA1HB65uDjVbxsjUUJ9h75Dcn+pdZHpnY4ZGyVt+6Id5oYCjGg79JshzIcf 1zVK4yBvL2v1YmKkLs+gWYpYUPG7c6OrRZMXrm6EvH8HZxH/C8jYES32QOHnM0kB8uBW JGEw== 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 u93si18008356edc.184.2019.11.19.06.26.58 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2019 06:26:58 -0800 (PST) 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]:46078 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4T3-0005T8-7i for patch@linaro.org; Tue, 19 Nov 2019 09:26:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42045) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4G3-0006XW-Qz for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iX4G2-0005Tr-OS for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:31 -0500 Received: from 3.mo68.mail-out.ovh.net ([46.105.58.60]:41182) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iX4G2-0005T6-IA for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:30 -0500 Received: from player795.ha.ovh.net (unknown [10.108.57.43]) by mo68.mail-out.ovh.net (Postfix) with ESMTP id 3008914CEDE for ; Tue, 19 Nov 2019 15:13:29 +0100 (CET) Received: from kaod.org (deibp9eh1--blueice1n4.emea.ibm.com [195.212.29.166]) (Authenticated sender: clg@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPSA id 8EA5CC18AB7F; Tue, 19 Nov 2019 14:13:20 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Subject: [PATCH 08/17] watchdog/aspeed: Improve watchdog timeout message Date: Tue, 19 Nov 2019 15:12:02 +0100 Message-Id: <20191119141211.25716-9-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191119141211.25716-1-clg@kaod.org> References: <20191119141211.25716-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 17908845394972281617 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegkedgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpudelhedrvdduvddrvdelrdduieeinecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleehrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpeeh X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.58.60 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: Andrew Jeffery , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley Users benefit from knowing which watchdog timer has expired. The address of the watchdog's registers unambiguously indicates which has expired, so log that. Reviewed-by: Cédric Le Goater Reviewed-by: Alex Bennée Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- hw/watchdog/wdt_aspeed.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.21.0 diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index 145be6f99ce2..d283d07d6546 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -219,7 +219,8 @@ static void aspeed_wdt_timer_expired(void *dev) return; } - qemu_log_mask(CPU_LOG_RESET, "Watchdog timer expired.\n"); + qemu_log_mask(CPU_LOG_RESET, "Watchdog timer %" HWADDR_PRIx " expired.\n", + s->iomem.addr); watchdog_perform_action(); timer_del(s->timer); } From patchwork Tue Nov 19 14:12:03 2019 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: 179760 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp700055ilf; Tue, 19 Nov 2019 06:19:22 -0800 (PST) X-Google-Smtp-Source: APXvYqwRO9Z+ac/w4PjSgRS/KLYnBlbXj/0jza3wPAPoFtjBDtSS01t6RP0kKwSIIKYe9RM3YqGX X-Received: by 2002:adf:ab4c:: with SMTP id r12mr36137610wrc.3.1574173162314; Tue, 19 Nov 2019 06:19:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574173162; cv=none; d=google.com; s=arc-20160816; b=L+fCsgGyMbOkPcgjoZPaCUfNkg4xfFIXB7whBISW1ibK4PLOdNfGQhe+YPELxt3sgo NPWPDtdG+sAsVolhLDhQM8kAp2QAaCIAKiEPa7Q3dEckDWsPrxGvGfuEMibA0B1jT6X5 xMNeRM99Vlf/1gIbjDW4wBC6AXwIWvGAsuPTChAjgzQvCFVGqmOg/c9tKcAhPGAp1Y6l sgQo2PsQ2R13r2KMlOAKeDzvvUiHYLXRqnkHHQgFZUxVLY6E3h1SZbJ1cxCr5vESUDrw My1WivVkeS7TfC7Y+mTtXLmDUOwIPznnZJbufcu1as5R7pF0p+iwaRBjqGiybgeApZ+s n53A== 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=a3+nfSEqg2VnzQhjWEuUUXKobfSoTNE3AZFeSZDUAsk=; b=0PN/+bQvllz9z8MzqwfpeoEGbPPSkoLgkjhfp8tGZFXTdbO/LxURrHfJkgwJlRUeUY H+Y1LxScgWtyZQiWH7moBFg1z4eTfeoTUKJGqVWmuZXpPLoq1ApbIT+N5tIym49XqpRV ESL3d1s5U6dHy/npwEAiHMyDdZfQ5kYmGV4syRs1u+fQaaPlk9L15A2xUaGoh0rqNfdO fTuvWh5Bs9RR+5ljVvHjPNOlsCC2hc5iowIfP8+lyBhuRhwfgmRpA1hsFsNSuv7Ok58S 3wyoRv+oLBH9kXbPDutf5od02EtuviOxgeFq4vJfbUEY3wNEsEgLeFMQB6rWc41GPFwl f0vA== 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 r4si15555673edx.365.2019.11.19.06.19.22 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Nov 2019 06:19:22 -0800 (PST) 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]:46002 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4Lh-0004am-1j for patch@linaro.org; Tue, 19 Nov 2019 09:19:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42086) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iX4GC-0006kf-4s for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iX4GA-0005Yt-Sk for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:39 -0500 Received: from 6.mo179.mail-out.ovh.net ([46.105.56.76]:51207) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iX4GA-0005Xq-Mu for qemu-devel@nongnu.org; Tue, 19 Nov 2019 09:13:38 -0500 Received: from player795.ha.ovh.net (unknown [10.108.35.124]) by mo179.mail-out.ovh.net (Postfix) with ESMTP id 45B5714AE01 for ; Tue, 19 Nov 2019 15:13:37 +0100 (CET) Received: from kaod.org (deibp9eh1--blueice1n4.emea.ibm.com [195.212.29.166]) (Authenticated sender: clg@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPSA id 469EFC18AC24; Tue, 19 Nov 2019 14:13:29 +0000 (UTC) From: =?utf-8?q?C=C3=A9dric_Le_Goater?= To: Peter Maydell Subject: [PATCH 09/17] watchdog/aspeed: Fix AST2600 frequency behaviour Date: Tue, 19 Nov 2019 15:12:03 +0100 Message-Id: <20191119141211.25716-10-clg@kaod.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191119141211.25716-1-clg@kaod.org> References: <20191119141211.25716-1-clg@kaod.org> MIME-Version: 1.0 X-Ovh-Tracer-Id: 17911097193377270545 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedufedrudegkedgiedvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdqfffguegfifdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufffkffojghfgggtgfesthekredtredtjeenucfhrhhomhepveorughrihgtucfnvgcuifhorghtvghruceotghlgheskhgrohgurdhorhhgqeenucfkpheptddrtddrtddrtddpudelhedrvdduvddrvdelrdduieeinecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehplhgrhigvrhejleehrdhhrgdrohhvhhdrnhgvthdpihhnvghtpedtrddtrddtrddtpdhmrghilhhfrhhomheptghlgheskhgrohgurdhorhhgpdhrtghpthhtohepqhgvmhhuqdguvghvvghlsehnohhnghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpeeg X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 46.105.56.76 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: Andrew Jeffery , qemu-devel@nongnu.org, qemu-arm@nongnu.org, =?utf-8?q?C=C3=A9dric_Le_Goater?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Joel Stanley Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Joel Stanley The AST2600 control register sneakily changed the meaning of bit 4 without anyone noticing. It no longer controls the 1MHz vs APB clock select, and instead always runs at 1MHz. The AST2500 was always 1MHz too, but it retained bit 4, making it read only. We can model both using the same fixed 1MHz calculation. Fixes: 6b2b2a703cad ("hw: wdt_aspeed: Add AST2600 support") Reviewed-by: Cédric Le Goater Reviewed-by: Alex Bennée Signed-off-by: Joel Stanley Signed-off-by: Cédric Le Goater --- include/hw/watchdog/wdt_aspeed.h | 1 + hw/watchdog/wdt_aspeed.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) -- 2.21.0 diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h index dfedd7662dd1..819c22993a6e 100644 --- a/include/hw/watchdog/wdt_aspeed.h +++ b/include/hw/watchdog/wdt_aspeed.h @@ -47,6 +47,7 @@ typedef struct AspeedWDTClass { uint32_t ext_pulse_width_mask; uint32_t reset_ctrl_reg; void (*reset_pulse)(AspeedWDTState *s, uint32_t property); + void (*wdt_reload)(AspeedWDTState *s); } AspeedWDTClass; #endif /* WDT_ASPEED_H */ diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index d283d07d6546..122aa8daaadf 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -93,11 +93,11 @@ static uint64_t aspeed_wdt_read(void *opaque, hwaddr offset, unsigned size) } -static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk) +static void aspeed_wdt_reload(AspeedWDTState *s) { uint64_t reload; - if (pclk) { + if (!(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK)) { reload = muldiv64(s->regs[WDT_RELOAD_VALUE], NANOSECONDS_PER_SECOND, s->pclk_freq); } else { @@ -109,6 +109,16 @@ static void aspeed_wdt_reload(AspeedWDTState *s, bool pclk) } } +static void aspeed_wdt_reload_1mhz(AspeedWDTState *s) +{ + uint64_t reload = s->regs[WDT_RELOAD_VALUE] * 1000ULL; + + if (aspeed_wdt_is_enabled(s)) { + timer_mod(s->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + reload); + } +} + + static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data, unsigned size) { @@ -130,13 +140,13 @@ static void aspeed_wdt_write(void *opaque, hwaddr offset, uint64_t data, case WDT_RESTART: if ((data & 0xFFFF) == WDT_RESTART_MAGIC) { s->regs[WDT_STATUS] = s->regs[WDT_RELOAD_VALUE]; - aspeed_wdt_reload(s, !(s->regs[WDT_CTRL] & WDT_CTRL_1MHZ_CLK)); + awc->wdt_reload(s); } break; case WDT_CTRL: if (enable && !aspeed_wdt_is_enabled(s)) { s->regs[WDT_CTRL] = data; - aspeed_wdt_reload(s, !(data & WDT_CTRL_1MHZ_CLK)); + awc->wdt_reload(s); } else if (!enable && aspeed_wdt_is_enabled(s)) { s->regs[WDT_CTRL] = data; timer_del(s->timer); @@ -283,6 +293,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data) awc->offset = 0x20; awc->ext_pulse_width_mask = 0xff; awc->reset_ctrl_reg = SCU_RESET_CONTROL1; + awc->wdt_reload = aspeed_wdt_reload; } static const TypeInfo aspeed_2400_wdt_info = { @@ -317,6 +328,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data) awc->ext_pulse_width_mask = 0xfffff; awc->reset_ctrl_reg = SCU_RESET_CONTROL1; awc->reset_pulse = aspeed_2500_wdt_reset_pulse; + awc->wdt_reload = aspeed_wdt_reload_1mhz; } static const TypeInfo aspeed_2500_wdt_info = { @@ -336,6 +348,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data) awc->ext_pulse_width_mask = 0xfffff; /* TODO */ awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1; awc->reset_pulse = aspeed_2500_wdt_reset_pulse; + awc->wdt_reload = aspeed_wdt_reload_1mhz; } static const TypeInfo aspeed_2600_wdt_info = {