From patchwork Thu Dec 29 15:23:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637560 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2984121pvb; Thu, 29 Dec 2022 07:24:55 -0800 (PST) X-Google-Smtp-Source: AMrXdXt+1ewnReD1vuDsWDQ1P/yF547XV5thkU9htqQUlqr8NF+IWqUiMH3fFos4Id5KANqIjWtb X-Received: by 2002:ac8:7457:0:b0:3a8:2122:7c28 with SMTP id h23-20020ac87457000000b003a821227c28mr40491136qtr.47.1672327494961; Thu, 29 Dec 2022 07:24:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327494; cv=none; d=google.com; s=arc-20160816; b=UVCQEe/CCuaWjp7ZPtlWPliOeHt5D9cHq+me+pYdMV2hulz8x86Wb3pd/ZYOPqXULi sua4G1kZTTJHgbXIRdKRRtLyjHNaWRj68PoqEa40ddWi/nIhwIfoPqveukWWU0GUJV8Q jY6sRdA7UTZTfWaTAV8S9wldcyrzs36rqRrGn5KDW1AeWKQ2briUhYeNqDnMJiook8ed oGBTAdZd6yu45F7J3jE7r9OANp/iXnacXY/vmpTIri1syd0YDZXzdZEJb/mDjLeZB4m2 S1plqj21RzYlt6ebbyCZ2p4k1bwdwerOvr4SfQJvkmDRLQMHr2NWMKxmOBSocH+V8ivB +kuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=k5k8c2DRnpfQPYlpLD03/aEWvlkNTpIk4NrXQ2VnKoc=; b=da6CTX7CcjFHtXtKtRlLM+aX2G0Rk71rDse/kiQh1wFEEwuPnCFCPZhpWw9ekjK44L V8+YwzTZ+rAoPjmJO6UZwN+w1gsREPxFgrlfsbpHC3BxQg0VdHK+tA52uDTca5F7+puR yyukR6/2pNAyLdfHwFB3/7qphM+qNaBruQeJ8FCPqq4WQTodk1YA5qB4BTnRGkcy3VbJ b/bZdRk6TOLFv8PvXXoAeveWATZtH8DObBlil8hH5553Unq3KKPeAAXabrwhy+xSBWKx a5MdQv4yk3OHcbLDJ8EBMXqIoBIVkgEJA0K/R8pomzufBHW9s+Bjpjjga5o16oZdXh+x /mJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KAXUD+S6; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cb17-20020a05622a1f9100b0035cee17b7edsi8680650qtb.587.2022.12.29.07.24.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:24:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=KAXUD+S6; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAukv-0001DG-Ek; Thu, 29 Dec 2022 10:23:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAukt-0001Ci-FF for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:39 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAukp-0007pZ-LZ for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:39 -0500 Received: by mail-wm1-x331.google.com with SMTP id k22-20020a05600c1c9600b003d1ee3a6289so13378078wms.2 for ; Thu, 29 Dec 2022 07:23:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k5k8c2DRnpfQPYlpLD03/aEWvlkNTpIk4NrXQ2VnKoc=; b=KAXUD+S6funDczbi9FbIdpDfC4u3ZWSi3L+UUNhF1M24LDCw/EJT6kHGy3F7mvv/ju 59wmRLIuxJDvXl9c6JLi5VMIw+4cBG2TXEwuuMdT6V0hEwMXj+qN7YDde/KVx/ohvqrj MYWXnKEd9FMr5VbZR2C9v2jpT6vq34Bw7rlpk6Wx30b4NtcjSJpNSfE1aNO8JIvSt+0E 1CRXG4qcMqZfa1AsVgivIIGPPLfHLGSrfZ7vgEk9Lv42/33loVRNdq1b3/mYyNfk+8D4 CsDXDHM4VmPU/Hv6HyZk1pgwmmbRhSASRMj9+VHGO1aUNV86+Ih2KaXfl7x9/cUt6ukh uMTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k5k8c2DRnpfQPYlpLD03/aEWvlkNTpIk4NrXQ2VnKoc=; b=IQ01gL2v9AvhFauhB/usmHPF4H2HGep9bvJx20IbFB8eUTJGxmyD1SVipmZ1d9EBS4 nH0UA0ktCwHAvEflr+wdmKR4xNan1xjqvPaIvYGdHFil+IhNvs8/9PiesKtJiy5H2Xy5 Kj1vpzuOviQpWMDHPQIKd5OzckqbbELmJNeXVrhLf2fTwlK5arBnP8pxKTaUycP2zrWJ v56wVmbCwsPFJOQRH742hscSgDrO/reLt/1uQc+rLUc4r3drONJqiAaPgO8fRdacGJ3l QWDoFBOB1cQqLZGvQJxB8tvjMmjjD6jUThkGLJdL4aE7kZoz4aHe8FNlmGKj9SrTl2y1 +G5A== X-Gm-Message-State: AFqh2kqJeLmoVKqDURu/r85l4iCbbEdicXqFvoSbItwpMFBc0KmYIrwT /JvhMgSFu4ZMcXYi5IGU2Fy0eZfIHQSGYSL1 X-Received: by 2002:a1c:3887:0:b0:3d2:26cd:3b1e with SMTP id f129-20020a1c3887000000b003d226cd3b1emr20234600wma.28.1672327414020; Thu, 29 Dec 2022 07:23:34 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id v9-20020a05600c444900b003d997e5e679sm5428138wmn.14.2022.12.29.07.23.32 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:23:33 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 1/9] hw/watchdog/wdt_aspeed: Map the whole MMIO range Date: Thu, 29 Dec 2022 16:23:17 +0100 Message-Id: <20221229152325.32041-2-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Avoid confusing two different things: - the WDT I/O region size ('iosize') - at which offset the SoC map the WDT ('offset') While it is often the same, we can map smaller region sizes at larger offsets. Here we are interested in the I/O region size. Rename as 'iosize' and map the whole range, not only the first implemented registers. Unimplemented registers accesses are already logged as guest-errors. Otherwise when booting the demo in [*] we get: aspeed.io: unimplemented device write (size 4, offset 0x1851a8, value 0x030f1ff1) aspeed.io: unimplemented device write (size 4, offset 0x1851ac, value 0x03fffff1) aspeed.io: unimplemented device write (size 4, offset 0x185128, value 0x030f1ff1) aspeed.io: unimplemented device write (size 4, offset 0x18512c, value 0x03fffff1) [*] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07 Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 2 +- hw/arm/aspeed_ast2600.c | 2 +- hw/arm/aspeed_soc.c | 2 +- hw/watchdog/wdt_aspeed.c | 12 +++++++----- include/hw/watchdog/wdt_aspeed.h | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 4d0b9b115f..122b3fd3f3 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -325,7 +325,7 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) return; } aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, - sc->memmap[ASPEED_DEV_WDT] + i * awc->offset); + sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize); } /* GPIO */ diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index cd75465c2b..a79e05ddbd 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -472,7 +472,7 @@ static void aspeed_soc_ast2600_realize(DeviceState *dev, Error **errp) return; } aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, - sc->memmap[ASPEED_DEV_WDT] + i * awc->offset); + sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize); } /* RAM */ diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index b05b9dd416..2c0924d311 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -393,7 +393,7 @@ static void aspeed_soc_realize(DeviceState *dev, Error **errp) return; } aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->wdt[i]), 0, - sc->memmap[ASPEED_DEV_WDT] + i * awc->offset); + sc->memmap[ASPEED_DEV_WDT] + i * awc->iosize); } /* RAM */ diff --git a/hw/watchdog/wdt_aspeed.c b/hw/watchdog/wdt_aspeed.c index d753693a2e..c1311ce74c 100644 --- a/hw/watchdog/wdt_aspeed.c +++ b/hw/watchdog/wdt_aspeed.c @@ -260,6 +260,7 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); AspeedWDTState *s = ASPEED_WDT(dev); + AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(dev); assert(s->scu); @@ -270,8 +271,9 @@ static void aspeed_wdt_realize(DeviceState *dev, Error **errp) */ s->pclk_freq = PCLK_HZ; + assert(awc->iosize >= ASPEED_WDT_REGS_MAX * 4); memory_region_init_io(&s->iomem, OBJECT(s), &aspeed_wdt_ops, s, - TYPE_ASPEED_WDT, ASPEED_WDT_REGS_MAX * 4); + TYPE_ASPEED_WDT, awc->iosize); sysbus_init_mmio(sbd, &s->iomem); } @@ -309,7 +311,7 @@ static void aspeed_2400_wdt_class_init(ObjectClass *klass, void *data) AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass); dc->desc = "ASPEED 2400 Watchdog Controller"; - awc->offset = 0x20; + awc->iosize = 0x20; awc->ext_pulse_width_mask = 0xff; awc->reset_ctrl_reg = SCU_RESET_CONTROL1; awc->wdt_reload = aspeed_wdt_reload; @@ -346,7 +348,7 @@ static void aspeed_2500_wdt_class_init(ObjectClass *klass, void *data) AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass); dc->desc = "ASPEED 2500 Watchdog Controller"; - awc->offset = 0x20; + awc->iosize = 0x20; awc->ext_pulse_width_mask = 0xfffff; awc->reset_ctrl_reg = SCU_RESET_CONTROL1; awc->reset_pulse = aspeed_2500_wdt_reset_pulse; @@ -369,7 +371,7 @@ static void aspeed_2600_wdt_class_init(ObjectClass *klass, void *data) AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass); dc->desc = "ASPEED 2600 Watchdog Controller"; - awc->offset = 0x40; + awc->iosize = 0x40; awc->ext_pulse_width_mask = 0xfffff; /* TODO */ awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1; awc->reset_pulse = aspeed_2500_wdt_reset_pulse; @@ -392,7 +394,7 @@ static void aspeed_1030_wdt_class_init(ObjectClass *klass, void *data) AspeedWDTClass *awc = ASPEED_WDT_CLASS(klass); dc->desc = "ASPEED 1030 Watchdog Controller"; - awc->offset = 0x80; + awc->iosize = 0x80; awc->ext_pulse_width_mask = 0xfffff; /* TODO */ awc->reset_ctrl_reg = AST2600_SCU_RESET_CONTROL1; awc->reset_pulse = aspeed_2500_wdt_reset_pulse; diff --git a/include/hw/watchdog/wdt_aspeed.h b/include/hw/watchdog/wdt_aspeed.h index dfa5dfa424..db91ee6b51 100644 --- a/include/hw/watchdog/wdt_aspeed.h +++ b/include/hw/watchdog/wdt_aspeed.h @@ -40,7 +40,7 @@ struct AspeedWDTState { struct AspeedWDTClass { SysBusDeviceClass parent_class; - uint32_t offset; + uint32_t iosize; uint32_t ext_pulse_width_mask; uint32_t reset_ctrl_reg; void (*reset_pulse)(AspeedWDTState *s, uint32_t property); From patchwork Thu Dec 29 15:23:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637567 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2985214pvb; Thu, 29 Dec 2022 07:27:24 -0800 (PST) X-Google-Smtp-Source: AMrXdXvMU+a3mFu3ZSHg4jN5mFVTHxRa4mEeyLUJbj/aBzREnnKRQMDTvqmHJJq9Ga5H+n1riTI5 X-Received: by 2002:ac8:60cc:0:b0:3a8:12be:4136 with SMTP id i12-20020ac860cc000000b003a812be4136mr39372997qtm.8.1672327643903; Thu, 29 Dec 2022 07:27:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327643; cv=none; d=google.com; s=arc-20160816; b=HdUtMwgMGFIBBWASmcfPPbcuxoy6PfJhQTMvb3kOgcoMmpOfg4y7TgKdr9a+Lj6zxQ lZekPzDZ2PSoyJaPFAG7Mep3fbIPzNcbMh4g2hn8A9DjpZ1i949LRcAXpprplehbZtzv Sc03OVjXNGRpoJLHHK7KQda5aBJ/97ObH5SHVyn/7qEyPKnD66134T/uOzfUZ5pOBn+m m0NL0VAcM62i0+ImW7l3MG4aR29UrS4VWimgIZuqKJUgjBthtHrdwFStO+jhTWlvFAVV 9TCXdQanimYPhJeQhn3WtV2bRBiU61O4VoOgFn/eUgK3SS4rsfqYb0Xzg++Ne4wiW5c1 AFhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=QdQ1jhSiAeTlE9odBywW4XFvZU5ijZarJfBTLLFf7vU=; b=htj3ycKQi932Js4KEp++/nuDWohVt4J8oT5xltSDv4LMgVqc3OjujUepoTnXj4ZuE1 MSbbmiryh2QxhcOQkFFsfFR+bCtHvH+6g0553yFC44y6wMYQmnHMmDcTztDMbfxb0iB5 250jmSFf9/MG8wpNzAEVbujoPXyiLIeYoCENWdUyugROJ7ihnE/movQb2R6184ApsROr BGbojybeUtoeBT41OJzG8Q5y+KzRcMZtP6ID+p9S8BHcIhXGaWX4OGi/Ovqc5MTncE/i I9Y2aKI7Gsk8pUyoM6gYU3wxTAngg99svVJHiDiFxZqEiuGxdgpYzk3zHeJNN2wunMjw X4aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HXSpfGpy; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r6-20020ac85e86000000b003a53ae2db4esi7668475qtx.721.2022.12.29.07.27.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:27:23 -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; dkim=pass header.i=@linaro.org header.s=google header.b=HXSpfGpy; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAuky-0001EZ-Bv; Thu, 29 Dec 2022 10:23:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAukw-0001Do-Ok for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:42 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAukv-0007qp-7e for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:42 -0500 Received: by mail-wr1-x42c.google.com with SMTP id h16so17638919wrz.12 for ; Thu, 29 Dec 2022 07:23:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QdQ1jhSiAeTlE9odBywW4XFvZU5ijZarJfBTLLFf7vU=; b=HXSpfGpy1aFSVbilt9b4Olo6JiuHd8pS9IuiqUDKHj8nlHDfOwPiASwRCSWFlS3AIF Dp/eF5Six5956/LAi++jBk418gD3mSHnxdpj0SVGp6pW1q/44+Th9bgDyizN9mAllFur bAnkGBhUXs4npphtYW+nzfqipE9YW6yXjqdMmTI3mxqBjzqpvKaQF6b9yhsUceqZpC5/ AfoXU/4P9kW/5ZdfizBM1XGZYJuaw68/owlHWESEynidHipNYjrF7E1Z+hPsvxzkZtIu JVbbvIk7j0CkxP1xYxtsoIRzLRuOfng+vuwizLlXNTckLs0+sQ4OFiRG02+p+12u+QsT 73cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QdQ1jhSiAeTlE9odBywW4XFvZU5ijZarJfBTLLFf7vU=; b=bhlDEc8b8lL+dPaGDKralQ6eGTFtIbvY7kAqyJjvlcbZQrBui4G4knHPXsTcXE0FE1 356xikxBuAwaN+DZhlwrSYrCbbrLCzHC4SK0KeKRIdJE2syBqi8lRrfa49Hds9enoB83 3jKcT7G07b0KJgU8QtaHzw2/Gsk6tagU4tTToJsRx4H4RiDY3vQgraUGck9akLkDBi64 12CVwKPo6szUjRviRgl0UVZDY+pt9VY9yDonMnV6tzXm4oDxTl8u21kQt9q+34Oj63pW tA8zYdDb5dVlknw0L4qZN28qOiOgjwJGFWDSRBM3LQXb3ZtH/u2zuKglR4R7Ti8U54YS XNag== X-Gm-Message-State: AFqh2kq6oKBNgkLeX/M5I5AiuiHIWujCfwEWRpah1icOgNlO+30579Zk MjNybA8DobtvPTKBviRwd6ZPowXJ+dFYG0pp X-Received: by 2002:a5d:4008:0:b0:242:17d3:a9fc with SMTP id n8-20020a5d4008000000b0024217d3a9fcmr17708689wrp.30.1672327419544; Thu, 29 Dec 2022 07:23:39 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id l17-20020a056000023100b00241fab5a296sm18123222wrz.40.2022.12.29.07.23.38 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:23:39 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 2/9] hw/arm/aspeed: Use the IEC binary prefix definitions Date: Thu, 29 Dec 2022 16:23:18 +0100 Message-Id: <20221229152325.32041-3-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-x42c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org IEC binary prefixes ease code review: the unit is explicit. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 3 ++- hw/arm/aspeed_ast2600.c | 3 ++- hw/arm/aspeed_soc.c | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 122b3fd3f3..3500294df7 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -10,6 +10,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "exec/address-spaces.h" #include "sysemu/sysemu.h" @@ -348,7 +349,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) sc->name = "ast1030-a1"; sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); sc->silicon_rev = AST1030_A1_SILICON_REV; - sc->sram_size = 0xc0000; + sc->sram_size = 768 * KiB; sc->spis_num = 2; sc->ehcis_num = 0; sc->wdts_num = 4; diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c index a79e05ddbd..72df72a540 100644 --- a/hw/arm/aspeed_ast2600.c +++ b/hw/arm/aspeed_ast2600.c @@ -8,6 +8,7 @@ */ #include "qemu/osdep.h" +#include "qemu/units.h" #include "qapi/error.h" #include "hw/misc/unimp.h" #include "hw/arm/aspeed_soc.h" @@ -619,7 +620,7 @@ static void aspeed_soc_ast2600_class_init(ObjectClass *oc, void *data) sc->name = "ast2600-a3"; sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-a7"); sc->silicon_rev = AST2600_A3_SILICON_REV; - sc->sram_size = 0x16400; + sc->sram_size = 89 * KiB; sc->spis_num = 2; sc->ehcis_num = 2; sc->wdts_num = 4; diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c index 2c0924d311..677342c9ed 100644 --- a/hw/arm/aspeed_soc.c +++ b/hw/arm/aspeed_soc.c @@ -517,7 +517,7 @@ static void aspeed_soc_ast2400_class_init(ObjectClass *oc, void *data) sc->name = "ast2400-a1"; sc->cpu_type = ARM_CPU_TYPE_NAME("arm926"); sc->silicon_rev = AST2400_A1_SILICON_REV; - sc->sram_size = 0x8000; + sc->sram_size = 32 * KiB; sc->spis_num = 1; sc->ehcis_num = 1; sc->wdts_num = 2; @@ -544,7 +544,7 @@ static void aspeed_soc_ast2500_class_init(ObjectClass *oc, void *data) sc->name = "ast2500-a1"; sc->cpu_type = ARM_CPU_TYPE_NAME("arm1176"); sc->silicon_rev = AST2500_A1_SILICON_REV; - sc->sram_size = 0x9000; + sc->sram_size = 36 * KiB; sc->spis_num = 2; sc->ehcis_num = 2; sc->wdts_num = 3; From patchwork Thu Dec 29 15:23:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637561 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2984599pvb; Thu, 29 Dec 2022 07:26:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXvUUSA7cdUZ47H4xRY+dCgfciR++jHTHjdiu/gSrO1i/AoYCu0mtuXdAoS98zi9KdqX0WLw X-Received: by 2002:a25:8389:0:b0:794:a706:27dc with SMTP id t9-20020a258389000000b00794a70627dcmr314163ybk.21.1672327559963; Thu, 29 Dec 2022 07:25:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327559; cv=none; d=google.com; s=arc-20160816; b=tJdRQtWqixJVuNMRK8eUjP71I08QUXmh9aGblJxyxRduuymqzhl7XxGRGDGaZopyX9 GFQ5Xk4VyMO+z5LSayP8LeI4WTUCYUeeiuXwBYSyqfw9T4BMzJshDgrzjsSTCCYGnjaX y1X4Cb/crVq5OkoA2etta9H+TtccxqxI9RdzxFjDzZgL7BjqyBLjFTltp6Lt/bg+TTcE BMsgmI4cAlZdiTU/J24Ix7VIdnIHT21wjTz/Hc8OKxQStsRXwrl2eWUV+J/h9rweBlfq oTuJdJZlHjCR3kBH18HBzU5WQfc9AORyHhyPK8xoil1O3GMbwhUENq5o9je/nLRgrOTm JJvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=Xi5ZHXXGo8A6r2aP9t4KsthF9mgQVNhCtKP7hpHMuLs=; b=aYhTJzDsXUo9bonhRdA8bHgrkp0+ZLYz3Y5afYqbP2jNx1LVWJe0ISx3/hvKe8PU1p xL8r67IV9FHvLZJmrjuHbu6FPX0OS5+yINDRZWYCx0eSjJTx/Z/TXhLOXbDayQpfCZlm kwbCuexiMPym9zZJMGk2j/T0NNP3ViPscXypzTOgUf+aBzEpTqmfKJe6yCi8Y2ZiGiAz lBxKnQu8PDvFKkYVsTW8apygGxLiYlMIFvirB0QXZG4OpVu3smVI6+l/UjJre0m86MgV FSVwuO4wR091ac7datTvCoBl5PXW4Xv5aqZbCbWHo5RpJb4II4QMQliQfoDr0xIH3M1J 9G3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CySXw9IO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 195-20020a3703cc000000b007049d89b123si8255012qkd.364.2022.12.29.07.25.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:25:59 -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; dkim=pass header.i=@linaro.org header.s=google header.b=CySXw9IO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAul4-0001Gl-9Q; Thu, 29 Dec 2022 10:23:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAul2-0001GT-Oj for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:48 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAul0-0007rw-Si for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:48 -0500 Received: by mail-wm1-x333.google.com with SMTP id g25-20020a7bc4d9000000b003d97c8d4941so7887703wmk.4 for ; Thu, 29 Dec 2022 07:23:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xi5ZHXXGo8A6r2aP9t4KsthF9mgQVNhCtKP7hpHMuLs=; b=CySXw9IOxSOxxlfpHVwSDjtmWmCT3LdebuyyX/l6sxOsgNFFpbXlt+ItMSJeCGM9TQ AACl59NpwyNYIUKE3S0Ge5kUjqLC583VkJLdhRWxQymJXSD0ExQT2W4JyWhIM8ZJ0v0x gENCkDF6TNPOR9sk7WAEavCYC9GvBLCKSn6eqTw8r0pfmV/gH07K0eO9prndDi4mB5yA d/UvAcO0XGwMZo/uUrdgbWjHD6EY1HDXmrBSTFhXmvS5+F1A0yfF8bIWRK272COkP81d PcXg86aGgkPCmvLGqa+vLzz9b5uaXxF9N/n4rlhJvc00i3b8q6q+gkLwyX3vrez+/8St 5FiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xi5ZHXXGo8A6r2aP9t4KsthF9mgQVNhCtKP7hpHMuLs=; b=lGLxQfMv++Z3lIOyHBQtqd1LagSRvWh8EoE6/RgnCiDVQw8SoEBJhJCM4gpou8qTRX /g7qID2pTMqTEs2afZe2zfKQ4aF/4/ncjrouFoMw4jfFNN4kXXSn92aK+vNDJ7cUHYEZ n6CX8lzE8hbS21dMyJzNmMCMOjdMvyqSyFohZZRQJeYoQ4MgNYbeE9c3qSDU/SHUvcde p5Ar3WpFnxYujXs9BioFWAT5Im3wfGiCSzqH1VUaOgeqFmm+089XlCXv4W8wGSLDXr0N DzkAIIkqQqQO+IHG6ibWkg1adR72+sXaTv0sfkp9gssl+4zRfHAb6FXUnGeEfaS4crA1 ac7g== X-Gm-Message-State: AFqh2kraewbhvjR6Y7oBxPrkmLIS6vZ5tZp8bgvntJVwi5segC5GiSxM BoHDfubMUpxxhcaVQ+eGin2KL23ywpZD2Boa X-Received: by 2002:a05:600c:214a:b0:3cf:6910:51d4 with SMTP id v10-20020a05600c214a00b003cf691051d4mr20210202wml.29.1672327425109; Thu, 29 Dec 2022 07:23:45 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id k2-20020a05600c1c8200b003d974076f13sm21072528wms.3.2022.12.29.07.23.43 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:23:44 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 3/9] hw/arm/aspeed_ast10x0: Add various unimplemented peripherals Date: Thu, 29 Dec 2022 16:23:19 +0100 Message-Id: <20221229152325.32041-4-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::333; envelope-from=philmd@linaro.org; helo=mail-wm1-x333.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Based on booting Zephyr demo from [1] running QEMU with '-d unimp' and checking missing devices in [2]. [1] https://github.com/AspeedTech-BMC/zephyr/releases/tag/v00.01.07 [2] https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/arm/aspeed_soc.h | 11 +++++++++++ 2 files changed, 46 insertions(+) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 3500294df7..d7dbc1a801 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -28,10 +28,15 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_FMC] = 0x7E620000, [ASPEED_DEV_SPI1] = 0x7E630000, [ASPEED_DEV_SPI2] = 0x7E640000, + [ASPEED_DEV_UDC] = 0x7E6A2000, [ASPEED_DEV_SCU] = 0x7E6E2000, + [ASPEED_DEV_JTAG0] = 0x7E6E4000, + [ASPEED_DEV_JTAG1] = 0x7E6E4100, [ASPEED_DEV_ADC] = 0x7E6E9000, + [ASPEED_DEV_ESPI] = 0x7E6EE000, [ASPEED_DEV_SBC] = 0x7E6F2000, [ASPEED_DEV_GPIO] = 0x7E780000, + [ASPEED_DEV_SGPIOM] = 0x7E780500, [ASPEED_DEV_TIMER1] = 0x7E782000, [ASPEED_DEV_UART1] = 0x7E783000, [ASPEED_DEV_UART2] = 0x7E78D000, @@ -79,12 +84,17 @@ static const int aspeed_soc_ast1030_irqmap[] = { [ASPEED_DEV_LPC] = 35, [ASPEED_DEV_PECI] = 38, [ASPEED_DEV_FMC] = 39, + [ASPEED_DEV_ESPI] = 42, [ASPEED_DEV_PWM] = 44, [ASPEED_DEV_ADC] = 46, [ASPEED_DEV_SPI1] = 65, [ASPEED_DEV_SPI2] = 66, [ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */ [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ + [ASPEED_DEV_UDC] = 9, + [ASPEED_DEV_SGPIOM] = 51, + [ASPEED_DEV_JTAG0] = 27, + [ASPEED_DEV_JTAG1] = 53, }; static qemu_irq aspeed_soc_ast1030_get_irq(AspeedSoCState *s, int dev) @@ -155,6 +165,15 @@ static void aspeed_soc_ast1030_init(Object *obj) object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE); object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented, TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "pwm", &s->pwm, TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "espi", &s->espi, TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "udc", &s->udc, TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "sgpiom", &s->sgpiom, + TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "jtag[0]", &s->jtag[0], + TYPE_UNIMPLEMENTED_DEVICE); + object_initialize_child(obj, "jtag[1]", &s->jtag[1], + TYPE_UNIMPLEMENTED_DEVICE); } static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) @@ -337,6 +356,22 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) sc->memmap[ASPEED_DEV_GPIO]); sysbus_connect_irq(SYS_BUS_DEVICE(&s->gpio), 0, aspeed_soc_get_irq(s, ASPEED_DEV_GPIO)); + + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->pwm), "aspeed.pwm", + sc->memmap[ASPEED_DEV_PWM], 0x100); + + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->espi), "aspeed.espi", + sc->memmap[ASPEED_DEV_ESPI], 0x800); + + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->udc), "aspeed.udc", + sc->memmap[ASPEED_DEV_UDC], 0x1000); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->sgpiom), "aspeed.sgpiom", + sc->memmap[ASPEED_DEV_SGPIOM], 0x100); + + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[0]), "aspeed.jtag", + sc->memmap[ASPEED_DEV_JTAG0], 0x20); + aspeed_mmio_map_unimplemented(s, SYS_BUS_DEVICE(&s->jtag[1]), "aspeed.jtag", + sc->memmap[ASPEED_DEV_JTAG1], 0x20); } static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 8389200b2d..9a5e3c0bac 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -44,6 +44,7 @@ #define ASPEED_CPUS_NUM 2 #define ASPEED_MACS_NUM 4 #define ASPEED_UARTS_NUM 13 +#define ASPEED_JTAG_NUM 2 struct AspeedSoCState { /*< private >*/ @@ -87,6 +88,11 @@ struct AspeedSoCState { UnimplementedDeviceState video; UnimplementedDeviceState emmc_boot_controller; UnimplementedDeviceState dpmcu; + UnimplementedDeviceState pwm; + UnimplementedDeviceState espi; + UnimplementedDeviceState udc; + UnimplementedDeviceState sgpiom; + UnimplementedDeviceState jtag[ASPEED_JTAG_NUM]; }; #define TYPE_ASPEED_SOC "aspeed-soc" @@ -174,6 +180,11 @@ enum { ASPEED_DEV_DPMCU, ASPEED_DEV_DP, ASPEED_DEV_I3C, + ASPEED_DEV_ESPI, + ASPEED_DEV_UDC, + ASPEED_DEV_SGPIOM, + ASPEED_DEV_JTAG0, + ASPEED_DEV_JTAG1, }; qemu_irq aspeed_soc_get_irq(AspeedSoCState *s, int dev); From patchwork Thu Dec 29 15:23:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637565 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2985021pvb; Thu, 29 Dec 2022 07:26:59 -0800 (PST) X-Google-Smtp-Source: AMrXdXtBtXB1eLujqJ1Hru8STje9fzaw3ykNps6fv0l+saQytc6mLjNjB+s2v8pQRRmdhYHYaYVE X-Received: by 2002:a05:6214:16c8:b0:531:85ee:10db with SMTP id d8-20020a05621416c800b0053185ee10dbmr18155697qvz.34.1672327618926; Thu, 29 Dec 2022 07:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327618; cv=none; d=google.com; s=arc-20160816; b=tSqTD9e5qVY5iSjvYHi7yBkKmxnQZ4b4AC+0DCpRJDelghjiqSQJelq6++WfVebkpT ZifyCI+FL8WpoBAa8lAGktC9rWt57BfrcGysPZNN75DyYZh6EYWcaMhyXnt+7CcKsaIP AryneJXKqrdSEZqUpGjUAzC2ljk0o9oSfp4OeZS/y4XtDwLCnX8b/E815morxfoGl5Ss 6WAL6Mt4zvLKRv8cqvey1qUEwmecg+f4xXPwy5/EOR0UIr5H7erMaHo/G410en2pTKqd cxvn+h3uF6mHkFjyUVeWSj75mEGSzSUKlFrK6r0wnLGTFOV5GFpALaCNPTUFQlLYpc4f fBbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=Wtm2mfHrpS5K/nDn4meqp35AVTYNEJHCIxdRSmJIby4=; b=PHDDA82lUai/KbnhySGQywTWFpXb1L9XTsUdW9v/1+2BaGLunx8vmF0vPeivjCQifK X+j2xblFijmDM7eleFTg4X6FYr06Iches4locZVUK3oH6Q7j97VIcege3QrGSB+UGnmB umrVAi768LPSpL3fxL9IvxXTCPr6JXipoMScoqKL5TUaAdL21VxBFtbMSdjbYiLNuuJI coscIR4A1wMLeLn0veXEcrF0j/yBvLJzhlM2yOAtjftxK2ug+0ViyYNDCL6Wf+cAA8En 1YVf6Qf0fv/sygs6EUQlGwE5X7QjqRCROFj6nQIrcAEinspOY+JjM5Rw67240PhAyMtb n/Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IkQ+oIug; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id pt19-20020a056214049300b004c70a1623d6si8988624qvb.29.2022.12.29.07.26.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07: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; dkim=pass header.i=@linaro.org header.s=google header.b=IkQ+oIug; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulA-0001IB-5C; Thu, 29 Dec 2022 10:23:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAul8-0001HY-Kv for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:54 -0500 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAul6-0007t0-AE for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:54 -0500 Received: by mail-wm1-x332.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso10264876wms.5 for ; Thu, 29 Dec 2022 07:23:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Wtm2mfHrpS5K/nDn4meqp35AVTYNEJHCIxdRSmJIby4=; b=IkQ+oIugBj46dyLFu0+B1vV7hQw3FaQFHkfDXiwco3j3yRjbfjtW7hI4/I7qBSXPyp MjBNXIgunhARfqMKygIgQC6be5XFFM+oRJMbsh7bOWuJBNGaAy802OYOrBXQTOd/e5/V LnarijKPjZgyd7Q9jivb70xv/wfrVw4YUYMdoOBM8o26b7jax+/lryAsqGmytGt0nYP7 ftMlbs+LUU7R0iNVYtuSZ2OwvQvkX8t99VpCTpcOfU3BtViTVbDRLHatbDNlKUTyPMDE SrTLa+l1B4aLevx3f18LGXmamHgAc7ws7Ma09UW+3DQSpjS8nwHs2JhA5u+gnQBDTum6 Z4kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wtm2mfHrpS5K/nDn4meqp35AVTYNEJHCIxdRSmJIby4=; b=foAXQSYrwgNyQBsUXxeCtPmHd7ydpZVkWfWnGq468q+CEGoQuJQTlBv+J6DFgKmkLq pw0fYlICKykj/KegnZfX5BY54kpHVefSoszhq6s53YHYW7XpdCzHjOzfh7tXKxT7Of9p OXkJxAe5alQYzqxE7M7XB8mq964eYWwQw7xkfgHoVYhxw51xKR0Z/VHlMaSKaCl3xM4m tt5ib1PBB/BcMCqytlUkj66jojRSQlifAuTtjMBGCWeKUtmM3g3xnln54KOQMvbMnORB BRj3GAlLp9ZUXTMa2KtTbb+L8AmvAAQzdnC7cqDKgj1oBkq3OIhkFwtAnxiPeCkL4zFl 3HbQ== X-Gm-Message-State: AFqh2kro9Q5PuOn9RCWGC7K86rVzmgY3u9cQ6JjKc9K4Cq13lVSPE5Tp DKx2b84fJPnbXrPR7FeOxJ7HA5XaDu0TldfH X-Received: by 2002:a05:600c:1e18:b0:3d2:5e4e:701 with SMTP id ay24-20020a05600c1e1800b003d25e4e0701mr20264466wmb.31.1672327430750; Thu, 29 Dec 2022 07:23:50 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h10-20020a5d4fca000000b00281eab50380sm9641905wrw.117.2022.12.29.07.23.49 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:23:50 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 4/9] hw/arm/aspeed_ast10x0: Map I3C peripheral Date: Thu, 29 Dec 2022 16:23:20 +0100 Message-Id: <20221229152325.32041-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::332; envelope-from=philmd@linaro.org; helo=mail-wm1-x332.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since I don't have access to the datasheet, the relevant values were found in: https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index d7dbc1a801..53ea6d471f 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -54,6 +54,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_WDT] = 0x7E785000, [ASPEED_DEV_LPC] = 0x7E789000, [ASPEED_DEV_PECI] = 0x7E78B000, + [ASPEED_DEV_I3C] = 0x7E7A0000, [ASPEED_DEV_I2C] = 0x7E7B0000, }; @@ -89,6 +90,7 @@ static const int aspeed_soc_ast1030_irqmap[] = { [ASPEED_DEV_ADC] = 46, [ASPEED_DEV_SPI1] = 65, [ASPEED_DEV_SPI2] = 66, + [ASPEED_DEV_I3C] = 102, /* 102 -> 105 */ [ASPEED_DEV_I2C] = 110, /* 110 ~ 123 */ [ASPEED_DEV_KCS] = 138, /* 138 -> 142 */ [ASPEED_DEV_UDC] = 9, @@ -130,6 +132,8 @@ static void aspeed_soc_ast1030_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.i2c-%s", socname); object_initialize_child(obj, "i2c", &s->i2c, typename); + object_initialize_child(obj, "i3c", &s->i3c, TYPE_ASPEED_I3C); + snprintf(typename, sizeof(typename), "aspeed.timer-%s", socname); object_initialize_child(obj, "timerctrl", &s->timerctrl, typename); @@ -240,6 +244,18 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) sysbus_connect_irq(SYS_BUS_DEVICE(&s->i2c.busses[i]), 0, irq); } + /* I3C */ + if (!sysbus_realize(SYS_BUS_DEVICE(&s->i3c), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->i3c), 0, sc->memmap[ASPEED_DEV_I3C]); + for (i = 0; i < ASPEED_I3C_NR_DEVICES; i++) { + qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->armv7m), + sc->irqmap[ASPEED_DEV_I3C] + i); + /* The AST1030 I2C controller has one IRQ per bus. */ + sysbus_connect_irq(SYS_BUS_DEVICE(&s->i3c.devices[i]), 0, irq); + } + /* PECI */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->peci), errp)) { return; From patchwork Thu Dec 29 15:23:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637563 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2984666pvb; Thu, 29 Dec 2022 07:26:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXsV48b4FB9Cn/qHVWfhmcfg+rt0nzuRpA5oYqvnb5TlucU86sNiRDK4SCCqBcxaD6PXY+7w X-Received: by 2002:a05:6214:4507:b0:51e:677d:70f7 with SMTP id oo7-20020a056214450700b0051e677d70f7mr44259843qvb.9.1672327567505; Thu, 29 Dec 2022 07:26:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327567; cv=none; d=google.com; s=arc-20160816; b=RuBAOVCWUfjrqyuZJYxm6D8q6ilZnerm4ds+/ZtqhTUjt7RKwKqayrfRxcJqQja7Qt HAtnDCA6DznzioMeTxfE0ZPklkFPhttjUgi0Vvzt29aCrBY8yVaM+sqfgVAzz8KNqEeD m7XHkNPKfSVLAfwLePTBtllKE3Z53NZfJNXxXTf55jmYEpEvVCJ2hlzYhz9UnA2CQX9Y TKI+hJiV2h9EnDsKysAEXarpHS4GiUqbW/pz2pujS/uTr/OI0+YZgOD6zIyHwQT80LsL muCdQFrXv/hQd2vfnKpHs/i4K16At2sU2h80VMJejWw1cY0/86IiyGus5lu3VszXUt1k t/Rg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=vLkW5z989xZITlNC/reQ2vNDxNMW6GRxo4ZpBBEIA6U=; b=lXvFUTIadQ7VGlqvOZK004agRLdZWYnnBd1U1gniSlm6QiR6u2WgT3sa9P33sIr/Tz XV4EJsjxO25DmUjhMVlaMUXYxOUXoQHJVrysBXuxBjs8bmMLB0sUuwNtKSltW046ilo3 mG41yivcSS4yVT1yO1iznPAUQKC26VlFqxYTKvRVL3cif+ZP/mqzjEMYphxZcBFTDi8P wHSJMpk3GMp8xguW1NH1dFir8y7iqRXNhQMtdD+9b7soonsxucOA5hMbm9kEhB6BN/Vi FceQaAc8q6yobuhX35BbwLEal9u5DTqheVJ7DZuidPVsHZNQmkyicJjMUBIhv9q8I6K9 nUZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S8CqrhcW; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id dx5-20020a05620a608500b006fca6dde6aasi8369508qkb.658.2022.12.29.07.26.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:26:07 -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; dkim=pass header.i=@linaro.org header.s=google header.b=S8CqrhcW; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulG-0001Iq-LY; Thu, 29 Dec 2022 10:24:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAulD-0001IM-JB for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:00 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAulB-0007vO-PI for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:23:59 -0500 Received: by mail-wm1-x334.google.com with SMTP id o15so13336416wmr.4 for ; Thu, 29 Dec 2022 07:23:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vLkW5z989xZITlNC/reQ2vNDxNMW6GRxo4ZpBBEIA6U=; b=S8CqrhcWVBY0vqiquboZ8VYLsrSGMWChLVJEOrxOgmkClJGz30BOmnBRjLsv80Zd0E DhaHjfIZte7uQgjFBH09/Us48C9OJUEIm8bAvO+WNOdIbx11DS3u3lfNjoN3ih7o5JI2 8FxESzg1nOBTJEZTGbIwEYPV5F50Y9Gwsc2TCFNPqg5Qo5YTnVdy9HULKlNbu9H02VIh rs1zcFmFHQAzEuyGbzrOAqNBg1Fw0x+G7CDj2FCEHWk/9piUaqwWZXFWDvri5fB61tus WOBAqjUlv/k0FRlbtLZSVWes9nuwBC6m8QCMfDJdIs4ruPXQcm5Z870MUJcp07ujo+pT X+oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vLkW5z989xZITlNC/reQ2vNDxNMW6GRxo4ZpBBEIA6U=; b=4cmVpB3dkw567j2XCcmFCp/yc7oP+En555ZySfT3WZN1wXM8WXiovWLZefHbEungbG Gl8rIDy2N7gXCRGOZXnaMngbsKQV/d1r8NLoLH7dg5A+jyBacBOEnEIBK93UYRkGfBsZ Vf6abUuGRhKsZYGlw2PdwT6OW/XP1aG29S3Eg34v/c7VcoWrI5Q23H4wPA5Ucig1I2Wm gkptXJq9xPuSbLTmVsmxcTb/AzT8CRij1TdDTGSmVH65qdzfGE+SG1tfo96DOexShM+A TfY0ktvdF2fuzlJrDQnzjwVUNHK/5Ph+4OWTcVkCQ/1DJozyFj79q9lnqUKVHVkG2aG6 F/lw== X-Gm-Message-State: AFqh2kriIBkv3hNaycM3pZzE8rd3kOO5T6vX1uSiOCwLbplUQtnzDOlr UMuTCGHU/s+1eMZ7PXt93UksBlW9pxqaYbzk X-Received: by 2002:a05:600c:41c2:b0:3d3:5565:3617 with SMTP id t2-20020a05600c41c200b003d355653617mr23744544wmh.24.1672327436235; Thu, 29 Dec 2022 07:23:56 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id d22-20020a1c7316000000b003d9862ec435sm11936642wmb.20.2022.12.29.07.23.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:23:55 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 5/9] hw/arm/aspeed_ast10x0: Map the secure SRAM Date: Thu, 29 Dec 2022 16:23:21 +0100 Message-Id: <20221229152325.32041-6-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Some SRAM appears to be used by the Secure Boot unit and crypto accelerators. Name it 'secure sram'. Note, the SRAM base address was already present but unused (the 'SBC' index is used for the MMIO peripheral). Interestingly using CFLAGS=-Winitializer-overrides reports: ../hw/arm/aspeed_ast10x0.c:32:30: warning: initializer overrides prior initialization of this subobject [-Winitializer-overrides] [ASPEED_DEV_SBC] = 0x7E6F2000, ^~~~~~~~~~ ../hw/arm/aspeed_ast10x0.c:24:30: note: previous initialization is here [ASPEED_DEV_SBC] = 0x79000000, ^~~~~~~~~~ This fixes with Zephyr: uart:~$ rsa test rsa test vector[0]: [00:00:26.156,000] os: ***** BUS FAULT ***** [00:00:26.157,000] os: Precise data bus error [00:00:26.157,000] os: BFAR Address: 0x79000000 [00:00:26.158,000] os: r0/a1: 0x79000000 r1/a2: 0x00000000 r2/a3: 0x00001800 [00:00:26.158,000] os: r3/a4: 0x79001800 r12/ip: 0x00000800 r14/lr: 0x0001098d [00:00:26.158,000] os: xpsr: 0x81000000 [00:00:26.158,000] os: Faulting instruction address (r15/pc): 0x0001e1bc [00:00:26.158,000] os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0 [00:00:26.158,000] os: Current thread: 0x38248 (shell_uart) [00:00:26.165,000] os: Halting system Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 11 ++++++++++- include/hw/arm/aspeed_soc.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 53ea6d471f..21a2e62345 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -22,7 +22,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_SRAM] = 0x00000000, - [ASPEED_DEV_SBC] = 0x79000000, + [ASPEED_DEV_SECSRAM] = 0x79000000, [ASPEED_DEV_IOMEM] = 0x7E600000, [ASPEED_DEV_PWM] = 0x7E610000, [ASPEED_DEV_FMC] = 0x7E620000, @@ -222,6 +222,14 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SRAM], &s->sram); + memory_region_init_ram(&s->secsram, OBJECT(s), "sec.sram", + sc->secsram_size, &err); + if (err != NULL) { + error_propagate(errp, err); + return; + } + memory_region_add_subregion(s->memory, sc->memmap[ASPEED_DEV_SECSRAM], + &s->secsram); /* SCU */ if (!sysbus_realize(SYS_BUS_DEVICE(&s->scu), errp)) { @@ -401,6 +409,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); sc->silicon_rev = AST1030_A1_SILICON_REV; sc->sram_size = 768 * KiB; + sc->secsram_size = 9 * KiB; sc->spis_num = 2; sc->ehcis_num = 0; sc->wdts_num = 4; diff --git a/include/hw/arm/aspeed_soc.h b/include/hw/arm/aspeed_soc.h index 9a5e3c0bac..bd1e03e78a 100644 --- a/include/hw/arm/aspeed_soc.h +++ b/include/hw/arm/aspeed_soc.h @@ -71,6 +71,7 @@ struct AspeedSoCState { AspeedSMCState spi[ASPEED_SPIS_NUM]; EHCISysBusState ehci[ASPEED_EHCIS_NUM]; AspeedSBCState sbc; + MemoryRegion secsram; UnimplementedDeviceState sbc_unimplemented; AspeedSDMCState sdmc; AspeedWDTState wdt[ASPEED_WDTS_NUM]; @@ -105,6 +106,7 @@ struct AspeedSoCClass { const char *cpu_type; uint32_t silicon_rev; uint64_t sram_size; + uint64_t secsram_size; int spis_num; int ehcis_num; int wdts_num; @@ -143,6 +145,7 @@ enum { ASPEED_DEV_SCU, ASPEED_DEV_ADC, ASPEED_DEV_SBC, + ASPEED_DEV_SECSRAM, ASPEED_DEV_EMMC_BC, ASPEED_DEV_VIDEO, ASPEED_DEV_SRAM, From patchwork Thu Dec 29 15:23:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637566 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2985093pvb; Thu, 29 Dec 2022 07:27:08 -0800 (PST) X-Google-Smtp-Source: AMrXdXsQ93gzbETPFIFDRFHHAhFQwG4QOFUcoj2zH+JPwa6vqU6fDjtdh9zPT5wIWMnio+A9Kk18 X-Received: by 2002:a05:622a:1f99:b0:3a8:faf:296a with SMTP id cb25-20020a05622a1f9900b003a80faf296amr42714276qtb.54.1672327628773; Thu, 29 Dec 2022 07:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327628; cv=none; d=google.com; s=arc-20160816; b=bJ7OKp1Oh++mnjefxvMEZ/Q9geWHNmkUZf6QKTiadec8x/sZAtk/VVwDqs9wLNKpgJ /KWKpuAujOwmqMbH6w8K8Rhk5aVz811txIw5hpoNB2MrgE+mzniLG7QbxNUrNl8+kW3Z u+I5HawYsvQySG+DtOAVBh7GelOtepquai1+hKboyUFVvwrrWwJVgnGkBgK9rHpOZaAS rKtwKkWWW3nKKZMKvSUqHPvaoN6szfRX4+NqwhyGpckzpqW1lNsUMz28qa+uhk4ch0xr CkMai477Ca0BLm4lCVSCJSYuzu7PYnn9wMGwhEkc2E1M+eOCsI3gwDrsKc2DewHssHba qayg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=aCgnhtUtjHBW/yqoLfaL4OuLziOvgUY438yt3+i+waA=; b=oGluYPStoQPHbt2ltgfVrd36VCZpJvHcZftplLZd+6OpKQFo+wTIJQj/hfNXllLbUg XXKGk44tbv7Dm+bnJqoNB2bbkCghZNV088Pg1JMVa8uVBgVvdggBF4hyEk8E4cyhM1U0 WnrX4bCEcn6G+RP+ezJJ7IbSqJHPSBO+LCjH1STKgkg6nDE6aepk++Lk2IH/cdETWpZ6 a9K3mkhfF0uPjeG8KCG5HYgQDDJBpfGeRN2M+JY1nYqs/Hs0Eqd/CbsJmgazK9dITzoY 0m/mpGy+yZ3Sbcz/PnE01o8xwWqd5+Q36UVvI0QueQPWwaBMNCd8uwL1yV9ONp4WkhIm Zl4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="miLPU/S5"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r6-20020ac85e86000000b003a53ae2db4esi7668084qtx.721.2022.12.29.07.27.08 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:27:08 -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; dkim=pass header.i=@linaro.org header.s=google header.b="miLPU/S5"; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulL-0001KR-D3; Thu, 29 Dec 2022 10:24:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAulI-0001JK-Vh for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:05 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAulG-0007vO-Hx for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:04 -0500 Received: by mail-wm1-x334.google.com with SMTP id o15so13336586wmr.4 for ; Thu, 29 Dec 2022 07:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aCgnhtUtjHBW/yqoLfaL4OuLziOvgUY438yt3+i+waA=; b=miLPU/S5nvsYHRvE36PrDlhDT0rNGGSLx5NoaMCHU63dwzSX3HAAeO8pMg3ExVACBx kfNLnqyoNkcuDOOmcTMaLc46VIPpgYPurqdRQaKbBJ7dimXUFn04i0CwPZt948d9EX0f IJ7pT7CkBwQbKlImxqWI95t8veR+2NTOHtG8y2rA7jP4KNsJiAQuNAWrip+/ADjwG2ru a5UqNesTOyobcx3SyN+SwlVRa/4SHgBZJEuvv6HG+zedzRIPbnQop77AmCcw0+elYS6W DbjGK6a74KJNfgE8y+weJc04paNY11UX80LCbPwjGZhelY0S+GiD37Una+vkHEQPhRzu MnAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aCgnhtUtjHBW/yqoLfaL4OuLziOvgUY438yt3+i+waA=; b=Ojga91DQSF+fMSIGlVzGQGht9nJ4eO+M4fw7eNg3DfN6doHk9oy4CKhYrOmvwaNzd1 e+gyzCj5epLwVxtePifq62dctPnPFJM0vFKpV+C6hHDJoPoZRJzSME3W6Bz19nMTDL5c x+nZBjBkjonYMQoSAoGogD58fCI3XlBzMFtV1a5bO7Yt5dFvMIkVrT1NZm4k1NnF9oD1 VTE7zrYUQp449PbZ/aVd7e0nLkpHMt56bu6I7tGo3HRb8sqTcnGDmuzwM4qfvHbJk3uj jowmNJU8Yvo8TrIyqomSsYNSu4cR8sd8KkvtOgYWfBd8nBA0abyldRX+bYYfnxkFoLxh UXeg== X-Gm-Message-State: AFqh2koNZ3LWLxACJP4b5Kfhk/FGAdGkeJp/fdflJENdiHVPxDE4UQsG cyirVOkoTEBDCVU5R39drMY0ozGjSVbHS4zZ X-Received: by 2002:a05:600c:41d1:b0:3d2:3d7b:6118 with SMTP id t17-20020a05600c41d100b003d23d7b6118mr20309828wmh.24.1672327441621; Thu, 29 Dec 2022 07:24:01 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id f20-20020a1cc914000000b003a3170a7af9sm24426873wmb.4.2022.12.29.07.24.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:24:01 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 6/9] hw/arm/aspeed_ast10x0: Map HACE peripheral Date: Thu, 29 Dec 2022 16:23:22 +0100 Message-Id: <20221229152325.32041-7-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=philmd@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Since I don't have access to the datasheet, the relevant values were found in: https://github.com/AspeedTech-BMC/zephyr/blob/v00.01.08/dts/arm/aspeed/ast10x0.dtsi Before on Zephyr: uart:~$ crypto aes256_cbc_vault aes256_cbc vault key 1 [00:00:06.699,000] hace_global: aspeed_crypto_session_setup [00:00:06.699,000] hace_global: data->cmd: 1c2098 [00:00:06.699,000] hace_global: crypto_data_src: 93340 [00:00:06.699,000] hace_global: crypto_data_dst: 93348 [00:00:06.699,000] hace_global: crypto_ctx_base: 93300 [00:00:06.699,000] hace_global: crypto_data_len: 80000040 [00:00:06.699,000] hace_global: crypto_cmd_reg: 11c2098 [00:00:09.743,000] hace_global: HACE_STS: 0 [00:00:09.743,000] hace_global: HACE poll timeout [00:00:09.743,000] crypto: CBC mode ENCRYPT - Failed [00:00:09.743,000] hace_global: aspeed_crypto_session_free uart:~$ After: uart:~$ crypto aes256_cbc_vault aes256_cbc vault key 1 Was waiting for: 6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51 30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10 But got: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [00:00:05.771,000] hace_global: aspeed_crypto_session_setup [00:00:05.772,000] hace_global: data->cmd: 1c2098 [00:00:05.772,000] hace_global: crypto_data_src: 93340 [00:00:05.772,000] hace_global: crypto_data_dst: 93348 [00:00:05.772,000] hace_global: crypto_ctx_base: 93300 [00:00:05.772,000] hace_global: crypto_data_len: 80000040 [00:00:05.772,000] hace_global: crypto_cmd_reg: 11c2098 [00:00:05.772,000] hace_global: HACE_STS: 1000 [00:00:05.772,000] crypto: Output length (encryption): 80 [00:00:05.772,000] hace_global: aspeed_crypto_session_free [00:00:05.772,000] hace_global: aspeed_crypto_session_setup [00:00:05.772,000] hace_global: data->cmd: 1c2018 [00:00:05.772,000] hace_global: crypto_data_src: 93340 [00:00:05.772,000] hace_global: crypto_data_dst: 93348 [00:00:05.772,000] hace_global: crypto_ctx_base: 93300 [00:00:05.772,000] hace_global: crypto_data_len: 80000040 [00:00:05.772,000] hace_global: crypto_cmd_reg: 11c2018 [00:00:05.772,000] hace_global: HACE_STS: 1000 [00:00:05.772,000] crypto: Output length (decryption): 64 [00:00:05.772,000] crypto: CBC mode DECRYPT - Mismatch between plaintext and decrypted cipher text [00:00:05.774,000] hace_global: aspeed_crypto_session_free uart:~$ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- Should we rename HACE 'dram' as 'secram' / 'secure-ram'? --- hw/arm/aspeed_ast10x0.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 21a2e62345..02636705b6 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -29,6 +29,7 @@ static const hwaddr aspeed_soc_ast1030_memmap[] = { [ASPEED_DEV_SPI1] = 0x7E630000, [ASPEED_DEV_SPI2] = 0x7E640000, [ASPEED_DEV_UDC] = 0x7E6A2000, + [ASPEED_DEV_HACE] = 0x7E6D0000, [ASPEED_DEV_SCU] = 0x7E6E2000, [ASPEED_DEV_JTAG0] = 0x7E6E4000, [ASPEED_DEV_JTAG1] = 0x7E6E4100, @@ -166,6 +167,9 @@ static void aspeed_soc_ast1030_init(Object *obj) snprintf(typename, sizeof(typename), "aspeed.gpio-%s", socname); object_initialize_child(obj, "gpio", &s->gpio, typename); + snprintf(typename, sizeof(typename), "aspeed.hace-%s", socname); + object_initialize_child(obj, "hace", &s->hace, typename); + object_initialize_child(obj, "iomem", &s->iomem, TYPE_UNIMPLEMENTED_DEVICE); object_initialize_child(obj, "sbc-unimplemented", &s->sbc_unimplemented, TYPE_UNIMPLEMENTED_DEVICE); @@ -359,6 +363,17 @@ static void aspeed_soc_ast1030_realize(DeviceState *dev_soc, Error **errp) } aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->sbc), 0, sc->memmap[ASPEED_DEV_SBC]); + /* HACE */ + object_property_set_link(OBJECT(&s->hace), "dram", OBJECT(&s->secsram), + &error_abort); + if (!sysbus_realize(SYS_BUS_DEVICE(&s->hace), errp)) { + return; + } + aspeed_mmio_map(s, SYS_BUS_DEVICE(&s->hace), 0, + sc->memmap[ASPEED_DEV_HACE]); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->hace), 0, + aspeed_soc_get_irq(s, ASPEED_DEV_HACE)); + /* Watch dog */ for (i = 0; i < sc->wdts_num; i++) { AspeedWDTClass *awc = ASPEED_WDT_GET_CLASS(&s->wdt[i]); From patchwork Thu Dec 29 15:23:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637564 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2985018pvb; Thu, 29 Dec 2022 07:26:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXsWBMYMcXVt99kBdXPx6/DLhVrA5OmLf/urhCjUzgPkcMhiZJnpCXfjm91bIVZ1b3w61Dhp X-Received: by 2002:ac8:690d:0:b0:3a8:ef7:f29c with SMTP id bt13-20020ac8690d000000b003a80ef7f29cmr39560399qtb.46.1672327618676; Thu, 29 Dec 2022 07:26:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327618; cv=none; d=google.com; s=arc-20160816; b=awtgUa04o3RlPKstjIiHxnZKucuO8H5qrwWfleshEl6j/kcW85J5gUeNCh0R1+9TwU HNV9BmY1/0nP7+W0wOaDRzUlnTCGNsLJ5nXoP31+osqLg4MssdtWU/4cnxJRP9E6qRJh YOxtreEDUHGoO4mTQh6Lr7zuuZ7+UpIMq5OcTb2k2CON1VR8RmihEN167roa+mZQM7O3 sE85sENqxVAWAs8Es+YQQB58xQvk4TbNIPIRGh89MMO6USODt+5Jp7oFTg4KUNGJgp3f vJJUlJYXSphLzl9bpRvEPcujCyH6JLDWiz8vyrOKnxRs9jnCn6Mv0NVbWaJQCcUSxBjF arhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=y0SRe0Kx73w/5k1isHeaGbaMhDnp0SdPMUGkYoUAYuM=; b=WY6GVDi/K1pYfgVyOG6IIe7609PIl2Nu5Id+5DpA1go9R4nR7sN9JJgWdiQzixi++5 D4jlOUCgIwNcIr9DdzltAWtk+BDBJDZZFPusAohS54Bd9zsteyUM80U0WycfwI6VMSky BZAP0FGTUIQzDtuzSCMi50gLjae0YPKqXYivkO4CH088+l9vGP6cONVVkMYL/QMBy+82 ToSdFFezCK/6S1shIPDy61opsSqerlIiLNfxZ0vKRGd/aZEK/ibNo+3mqVrjwyze6pxW a+UOQ+u7WEiBP1AXvnMwa97on+u9rV/29YNc0OZFygEp0gckiAD2cU6TAaITk14Vc4vX UPEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EFbsYvbt; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d18-20020ac85452000000b003a7e9e92b99si8299039qtq.263.2022.12.29.07.26.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07: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; dkim=pass header.i=@linaro.org header.s=google header.b=EFbsYvbt; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulR-0001M6-SU; Thu, 29 Dec 2022 10:24:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAulQ-0001LT-Cv for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:12 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAulN-0007yF-AS for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:11 -0500 Received: by mail-wm1-x331.google.com with SMTP id bg10so13358267wmb.1 for ; Thu, 29 Dec 2022 07:24:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y0SRe0Kx73w/5k1isHeaGbaMhDnp0SdPMUGkYoUAYuM=; b=EFbsYvbtxuYDzfQPU3B3TXKY7DpVt3rVXi7GjVzdOHdeeLdy//12PPfbZ8Xm5hEJNp Bk0wfDIOxeudErO5OMFZv3+TOVcWY1Ut2SQDROADYwAv2NVfST5/Im++jCDLICOpj6fu AutsECPsGtXp/0dlKK5hsnxzfVOZFlIX3OFmzgusWyOI7fPs53cAtwPCwCBMmBgTsTZF v+aIny1ZXP2B1nit830t+fa9ib+KOGeCsqBpHVRkNGrc3pPl0MUghj/LA03n/HUrKTup nbsxSwhpy8EVECB1GFI5saO+TsJEa/IKis00jjSaG8jPlsW6+oimr3eJfBDqCyuRScG5 ksYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y0SRe0Kx73w/5k1isHeaGbaMhDnp0SdPMUGkYoUAYuM=; b=6+ptXClB7c8GNKkyd44MmSPm1sgYqHoNnXy6LmKDMe6j007//yaai85/BDdGDVBkV8 HMO6tEsYAumK8/dsUeyGqbVutlVrf0ozFVHcput14mY7QfFOOnXmoC3X/AvWuvsaz0b/ U8+/bZBCbdeK79AXe0likSlYqOZnHTl+ELRYlfleh0omblVYjNGo9u9qhsInUTE4ORrI 47iuDf6t/5mqKFk3QI2ophhjn2QREdMx356nh4IBlIyE0kmbYckl3DZlPFmLLOFdhy0j PWroM0PhwksP6UBRdk003P58O/i8ZBeuIbRPtoYdPzavNfOcnJmeDKr5anFERzqD2LBe 30zg== X-Gm-Message-State: AFqh2kooDYl84nv74vp7BqaVRzcHnKQnQsOegXD35fbs9Y0/oQLJmxmh vCyXAoF8hBsg/M6oU+rmntlHffJxdGL/s0Xl X-Received: by 2002:a05:600c:18a1:b0:3d2:3ec4:7eed with SMTP id x33-20020a05600c18a100b003d23ec47eedmr23502758wmp.10.1672327447927; Thu, 29 Dec 2022 07:24:07 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id h14-20020a05600c314e00b003d237d60318sm27062702wmo.2.2022.12.29.07.24.06 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:24:07 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 7/9] hw/misc/aspeed_hace: Do not crash if address_space_map() failed Date: Thu, 29 Dec 2022 16:23:23 +0100 Message-Id: <20221229152325.32041-8-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::331; envelope-from=philmd@linaro.org; helo=mail-wm1-x331.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org address_space_map() can fail: uart:~$ hash test sha256_test tv[0]: Segmentation fault: 11 Thread 3 "qemu-system-arm" received signal SIGSEGV, Segmentation fault. gen_acc_mode_iov (req_len=0x7ffff18b7778, id=, iov=0x7ffff18b7780, s=0x555556ce0bd0) at ../hw/misc/aspeed_hace.c:171 171 if (has_padding(s, &iov[id], *req_len, &total_msg_len, &pad_offset)) { (gdb) bt #0 gen_acc_mode_iov (req_len=0x7ffff18b7778, id=, iov=0x7ffff18b7780, s=0x555556ce0bd0) at ../hw/misc/aspeed_hace.c:171 #1 do_hash_operation (s=s@entry=0x555556ce0bd0, algo=3, sg_mode=sg_mode@entry=true, acc_mode=acc_mode@entry=true) at ../hw/misc/aspeed_hace.c:224 #2 0x00005555559bdbb8 in aspeed_hace_write (opaque=, addr=12, data=262488, size=) at ../hw/misc/aspeed_hace.c:358 This change doesn't fix much, but at least the guest can't crash QEMU anymore. Instead it is still usable: uart:~$ hash test sha256_test tv[0]:hash_final error sha384_test tv[0]:hash_final error sha512_test tv[0]:hash_final error [00:00:06.278,000] hace_global: HACE poll timeout [00:00:09.324,000] hace_global: HACE poll timeout [00:00:12.261,000] hace_global: HACE poll timeout uart:~$ Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/misc/aspeed_hace.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/hw/misc/aspeed_hace.c b/hw/misc/aspeed_hace.c index ac21be306c..12a761f1f5 100644 --- a/hw/misc/aspeed_hace.c +++ b/hw/misc/aspeed_hace.c @@ -193,6 +193,7 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, size_t digest_len = 0; int niov = 0; int i; + void *haddr; if (sg_mode) { uint32_t len = 0; @@ -217,9 +218,13 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, addr &= SG_LIST_ADDR_MASK; plen = len & SG_LIST_LEN_MASK; - iov[i].iov_base = address_space_map(&s->dram_as, addr, &plen, false, - MEMTXATTRS_UNSPECIFIED); - + haddr = address_space_map(&s->dram_as, addr, &plen, false, + MEMTXATTRS_UNSPECIFIED); + if (haddr == NULL) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__); + return; + } + iov[i].iov_base = haddr; if (acc_mode) { niov = gen_acc_mode_iov(s, iov, i, &plen); @@ -230,10 +235,14 @@ static void do_hash_operation(AspeedHACEState *s, int algo, bool sg_mode, } else { hwaddr len = s->regs[R_HASH_SRC_LEN]; + haddr = address_space_map(&s->dram_as, s->regs[R_HASH_SRC], + &len, false, MEMTXATTRS_UNSPECIFIED); + if (haddr == NULL) { + qemu_log_mask(LOG_GUEST_ERROR, "%s: qcrypto failed\n", __func__); + return; + } + iov[0].iov_base = haddr; iov[0].iov_len = len; - iov[0].iov_base = address_space_map(&s->dram_as, s->regs[R_HASH_SRC], - &len, false, - MEMTXATTRS_UNSPECIFIED); i = 1; if (s->iov_count) { From patchwork Thu Dec 29 15:23:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637562 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2984610pvb; Thu, 29 Dec 2022 07:26:01 -0800 (PST) X-Google-Smtp-Source: AMrXdXvTi9dzFWCeilnZn94iP1n/1bctA5zKRz0172tWrKM6LVLsUHKfoTzCtWJxFwzvFeCB+ET1 X-Received: by 2002:a05:6214:438a:b0:4e2:14e0:d7eb with SMTP id oh10-20020a056214438a00b004e214e0d7ebmr41372800qvb.11.1672327561475; Thu, 29 Dec 2022 07:26:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327561; cv=none; d=google.com; s=arc-20160816; b=AlpV9gEaxr4bdLzn1YZotX13MHQvsMKtogFDEl6A23KJAPQrkY7AQRFrbRYhTuGitn UUwhxXLItEtdmeB4YvvrR6xNatk78kssr05cTzjCgtsnbTwBYLbSJr+SDRN1txucuqkb 0/Z/v50gZ18rwue9Mlp3C6ejMD/9cpnSaiWOilMZAKm1kIFi36xTtRFk/5HiQ/kHWQtc IbXxbRaj20OrDlHwIUiynube2sdLK69OJxoGKWeI1YNNZpW3vcqZsW3hxRAq+Vxx445S 3QKcM4q6RxXk9mt8QHRdgfIWZYZN5V2WrffQJylvTbUtjD/EvnuuASHZrZEY3klQc6B2 ewVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=y0IR45+1k3KGq6akeAAYqfenh8SpGHNSxj9mXYNisiA=; b=j0kP+XHFHcUfIrwq59BOtDcgAGNgW6lzFxJ5nTKpJpGMdTYcJ61p/lE6fO6Bxp4SO5 w0rrYh0fetbIm+UlYCInazijLLc/X+fmuHvIv4blrHZcebqsqw7kUZI9C7dCpLxNm07S eRQpuWfO8sye3a0wog7tvA+MlcTVJ/XJoFRl3XekG/lKURcdmi6Kef52ZNvpLQIAAYNQ s+WdQ/bg7rGEUs/zuRvZRZg2OVdOugdpzow/JdtVpkjvhXSk9dj1IMIFRl5k/gXTUH24 4Heu7afqw1NRutgN+wKsT3XiuQ7kno4IFWRpTKbv8Aexo+lCmrch3LG9smaC4HesuTP/ F2wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gY1UHiIO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id iv15-20020ad45cef000000b0052fe5539dcasi7721968qvb.203.2022.12.29.07.26.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:26:01 -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; dkim=pass header.i=@linaro.org header.s=google header.b=gY1UHiIO; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulW-0001TR-DU; Thu, 29 Dec 2022 10:24:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAulU-0001MS-Gy for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:16 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAulT-000800-3k for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:16 -0500 Received: by mail-wm1-x32c.google.com with SMTP id m26-20020a05600c3b1a00b003d9811fcaafso6844780wms.5 for ; Thu, 29 Dec 2022 07:24:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=y0IR45+1k3KGq6akeAAYqfenh8SpGHNSxj9mXYNisiA=; b=gY1UHiIOTezzuKxOHGwrjy4/sPHP5UwkD45Y4v8JkZnsbSOVLcv1UGS8hDsQtj/n9e 3rVJiWXabt3HjcdQlbA9kE0oJoJ9+r+nJHNNj7caQgNTk+XsTjwTTKQynoRWFSOKBd3d kJe/KQK0BLvMdkEpNnrC4y6Y9sHieuGz2lc26fUFjMwCbbYc1JQptfUA60hh7j5PqfFp /9CDMSyqUALg5FzopukQ462tiv69gvvCgkCTOJZupFwZZpgbjqAmEm/wOM/aOrxW8x16 yVsIvg+d0BD0vHKVOz1Frxwd9XvLixoWrMd2uBRzEPsiQ8YpGSpzVKYU3nhZSdv2DlVA bbqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=y0IR45+1k3KGq6akeAAYqfenh8SpGHNSxj9mXYNisiA=; b=Fa2z6XC45CVaMGsoODZ3JEaF1Sx81F7D7n03IWrSyu2yls8df4aO5BRNCWqWLJVCf0 p5PPFCecAMrN4KSoOLiFToR/QgijLu/A2fR5d+hYbH1Mm1SOEezkQBLCmUWaZMqCOMHB NwfZH9SY4WnyCe7DrDOeaAkJoASmjnPd3bY+6+MeunZQCpS9NOdV6xD5vgmgUsROdadX cBWmraN3qtOTKU9GFULz9DRARDhECi2qLAZ4nLVkCsm4k0QSxoc0cPzSR1welYKT+Mng VH51fHD7qxIL6anq90lhYowqIKHiylyT/LVYpIvdJ9xfjvXlRaiqlNYXvK/bNPWEZwHS m33w== X-Gm-Message-State: AFqh2kppmdndD7oZrqkelNbg7qm6ERerdQJZ7BKKCEMpLOeRCD23BUiK WwGSyJYNfjVO8/9BV2V1n1x4W3VHKZqVLlYD X-Received: by 2002:a05:600c:538b:b0:3d9:72c1:62b7 with SMTP id hg11-20020a05600c538b00b003d972c162b7mr13091743wmb.7.1672327453689; Thu, 29 Dec 2022 07:24:13 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id v13-20020a05600c444d00b003d998412db6sm4185679wmn.28.2022.12.29.07.24.11 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:24:13 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 8/9] hw/arm/aspeed_ast10x0: Add TODO comment to use Cortex-M4F Date: Thu, 29 Dec 2022 16:23:24 +0100 Message-Id: <20221229152325.32041-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org This SoC uses a Cortex-M4F. QEMU only implements a M4, which is good enough. Add a TODO note in case the M4F is added. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- hw/arm/aspeed_ast10x0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/arm/aspeed_ast10x0.c b/hw/arm/aspeed_ast10x0.c index 02636705b6..788827ca9d 100644 --- a/hw/arm/aspeed_ast10x0.c +++ b/hw/arm/aspeed_ast10x0.c @@ -421,7 +421,7 @@ static void aspeed_soc_ast1030_class_init(ObjectClass *klass, void *data) dc->realize = aspeed_soc_ast1030_realize; sc->name = "ast1030-a1"; - sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); + sc->cpu_type = ARM_CPU_TYPE_NAME("cortex-m4"); /* TODO cortex-m4f */ sc->silicon_rev = AST1030_A1_SILICON_REV; sc->sram_size = 768 * KiB; sc->secsram_size = 9 * KiB; From patchwork Thu Dec 29 15:23:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 637568 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp2985312pvb; Thu, 29 Dec 2022 07:27:37 -0800 (PST) X-Google-Smtp-Source: AMrXdXtXpR3mKO55a/4mxHEr3qCdu0npDW6mp7IHhbPGGiGYDK1mT0UPQZLeDjkfczIXPzXN5uyL X-Received: by 2002:a05:6102:310e:b0:3b0:9355:4b85 with SMTP id e14-20020a056102310e00b003b093554b85mr12483240vsh.25.1672327657174; Thu, 29 Dec 2022 07:27:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672327657; cv=none; d=google.com; s=arc-20160816; b=kn96f/gF8QP4HuzqZZ2fMFo8d5ow7uL31Dcy1O2y8LK5/ZqpxZsYbOv7EUrlT8jY5D 48mY+XP7qrSB/zHSa3GsXNRL/q3tgXF5DocnCkNyhhUYXYwkjhg92WaP7MMhjS0EugHX g0VUXCgx72Q5Sj7SFBtuUJKdgmbiomjnc0Gl3a3eeO5tj4fpr4UopC5nJ5glckQ/8nJe LcaLtD7maE24lcmXIPPLkJ3lSCDbjjzaQSIpwWgS+IVvDJNQYZCyaofr6oB4faGMU+fq 1ZQpJ1zf/8DPLS6edvEBNa2HCrc0dOCiNBy4loQEUhVRUNDkHgvHLvrmALpqXv2T3mgb 1S3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=o1dV9rndKpMpZ6RbwwsYpa5BpL6sSZw04vUACIltoTk=; b=xJa3UmRZOpz3suFeF2j27BOi4ZtuRhfYLka5PQTGbDV5DtiNaOj8UOJtSZRzKhwVHG RqYIyejnDv2M5qseHFCGdri7diXAApPWcJrFg+bBS+CN8lD7yBNyYJrHtUJdXQQAJIbg rfENqWYLevzfXBDJM7vNg4dXF093s6x0Yxwt93Dtdrx9rKFSHwmpzWK9d/JheecbtpU5 Yf8tHL8mJNmgnbflycaLS1Cv0ciMnoMDZLHUeoZoO0WuuSp7iR+AurWTOPdntxpcAk1W nOUqU7FVC1846U+b+U1huVHRgTKRMh+9qZxmlGC7OTvhjYTNSBRNA9eJgGJ8kv6kRjYS RXNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y5hvrcpa; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10-20020a05620a270a00b00704c1f4e776si8500195qkp.660.2022.12.29.07.27.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Dec 2022 07:27:37 -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; dkim=pass header.i=@linaro.org header.s=google header.b=Y5hvrcpa; 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"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pAulx-0001os-EC; Thu, 29 Dec 2022 10:24:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pAulg-0001dq-P1 for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:31 -0500 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pAulc-00081F-N5 for qemu-devel@nongnu.org; Thu, 29 Dec 2022 10:24:27 -0500 Received: by mail-wr1-x42e.google.com with SMTP id z10so17652282wrh.10 for ; Thu, 29 Dec 2022 07:24:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=o1dV9rndKpMpZ6RbwwsYpa5BpL6sSZw04vUACIltoTk=; b=Y5hvrcpa404eZqRSo3sz2yDUHB73ak4Oyd5QFjWK5Ol/xLtnUkVxRYzoGu32lwlSan lizma/IILn2etOnrV9Q40WC3IDIzra02vK8NT4Z8T3KHsYfpXtu6m3X3r9hs0KHnTA3g J44ZsnKGHiPsieOF0TmXsPtmHgOxJM0o+HbGACZw8bPeDSccfejBEm5WnrePTGyapa7y 0+BNR8IT05ui0PiAZLdyuAidmdYZPwzdZATymaH3UHkeHzwJ1CEDw+JtwVzZE7A2YCff kYE+Ku85RPVgvMzWrALqrPas5C2EBBMMJqaISpH2cYfEguiokFzs/Cx2cD/MBC7GqVa+ EEHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o1dV9rndKpMpZ6RbwwsYpa5BpL6sSZw04vUACIltoTk=; b=Vdl24FRDHk3gr7gqaxIlhVyJjP+ieq5NBCxCmPBCWPNGX6BPrHv+skrPln7McdheCn wzqccLfuLVJBHdop1Q/QiaddPVBHbwZbPbSP8wcRJJmOtx6v44G9jmm2cCAnTAG+6VbZ 853vgst2PqPP5Ai06rBO6DnY5Xde2R4hPOrDI2DuhEYxCJpneGp4tN7N3uDczqlf/d69 yOx/hOT4WltAdltwSxMtWWToAAXYDOcJP4SkS9q7drXgA1bRYGPfPlLcMqLrCAEqXGTx n541ni1wjJH6zH2YirsCx467HUzyk9RcD512soCjcAUz/mho0vf/iu98npJgL0PoA2v6 UCEQ== X-Gm-Message-State: AFqh2krTd/EgtGaA0l1S5Xm52QkJejCtGhmmGLU+uFKhUuA21OOxgAu8 VbrxCkwb8UzzctUum64RJmHp7ekrMI9gKi37 X-Received: by 2002:a5d:5587:0:b0:288:c07a:bac5 with SMTP id i7-20020a5d5587000000b00288c07abac5mr3782177wrv.49.1672327461347; Thu, 29 Dec 2022 07:24:21 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id a18-20020a5d4d52000000b0028df2d57204sm461782wru.81.2022.12.29.07.24.17 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 29 Dec 2022 07:24:19 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Steven Lee , Peter Delevoryas , Peter Delevoryas , qemu-arm@nongnu.org, Cleber Rosa , Peter Maydell , Beraldo Leal , Wainer dos Santos Moschetta , Troy Lee , Andrew Jeffery , Joel Stanley , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Peter Delevoryas , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Jamin Lin Subject: [PATCH 9/9] tests/avocado: Test Aspeed Zephyr SDK v00.01.08 on AST1030 board Date: Thu, 29 Dec 2022 16:23:25 +0100 Message-Id: <20221229152325.32041-10-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221229152325.32041-1-philmd@linaro.org> References: <20221229152325.32041-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::42e; envelope-from=philmd@linaro.org; helo=mail-wr1-x42e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Add a very quick test that runs some commands in a Zephyr shell: $ tests/venv/bin/avocado --show=app,console run -t os:zephyr tests/avocado (2/2) tests/avocado/machine_aspeed.py:AST1030Machine.test_ast1030_zephyros_1_07: console: *** Booting Zephyr OS build v00.01.07 *** console: ast1030_evb demo console: SOC: AST1030-A1 console: uart:~$ kernel stacks console: 0x36910 wdt_background (real size 1024): unused 988 usage 36 / 1024 (3 %) console: 0x36ad8 shell_uart (real size 4096): unused 3084 usage 1012 / 4096 (24 %) console: 0x2edb8 ADC0 (real size 400): unused 260 usage 140 / 400 (35 %) console: 0x2f0f0 ADC1 (real size 400): unused 260 usage 140 / 400 (35 %) console: 0x3b098 sysworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36cc0 usbdworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36bd8 usbworkq (real size 1024): unused 860 usage 164 / 1024 (16 %) console: 0x36a10 logging (real size 768): unused 548 usage 220 / 768 (28 %) console: 0x36ef8 idle 00 (real size 320): unused 268 usage 52 / 320 (16 %) console: 0x47800 IRQ 00 (real size 2048): unused 1504 usage 544 / 2048 (26 %) console: uart:~$ otp info scu console: SCU BIT reg_protect Description console: ____________________________________________________________________ console: 0x500 0x0 0x0 Disable ARM CM4 CPU boot (TXD5) console: 0x500 0x1 0x0 /Reserved console: 0x500 0x2 0x0 \ " console: 0x500 0x3 0x0 Address offset of single chip ABR mode console: 0x500 0x4 0x0 /Reserved console: 0x500 0x5 0x0 | " console: 0x500 0x6 0x0 | " console: 0x500 0x7 0x0 | " console: 0x500 0x8 0x0 | " console: 0x500 0x9 0x0 | " console: 0x500 0xA 0x0 | " console: 0x500 0xB 0x0 | " console: 0x500 0xC 0x0 | " console: 0x500 0xD 0x0 | " console: 0x500 0xE 0x0 | " console: 0x500 0xF 0x0 | " console: 0x500 0x10 0x0 \ " console: 0x500 0x11 0x0 Disabl3 ARM JTAG debug console: 0x500 0x12 0x0 /Reserved console: 0x500 0x13 0x0 | " console: 0x500 0x14 0x0 | " console: 0x500 0x15 0x0 | " console: 0x500 0x16 0x0 | " console: 0x500 0x17 0x0 | " console: 0x500 0x18 0x0 | " console: 0x500 0x19 0x0 | " console: 0x500 0x1A 0x0 | " console: 0x500 0x1B 0x0 | " console: 0x500 0x1C 0x0 | " console: 0x500 0x1D 0x0 | " console: 0x500 0x1E 0x0 | " console: 0x500 0x1F 0x0 \ " console: 0x510 0x0 0x0 /Reserved console: 0x510 0x1 0x0 | " console: 0x510 0x2 0x0 | " console: 0x510 0x3 0x0 \ " console: 0x510 0x4 0x0 Disable debug interfaces console: 0x510 0x5 0x0 /Reserved console: 0x510 0x6 0x0 | " console: 0x510 0x7 0x0 \ " console: 0x510 0x8 0x0 Enable boot from Uart5 by Pin Strap console: 0x510 0x9 0x0 /Reserved console: 0x510 0xA 0x0 \ " console: 0x510 0xB 0x0 Enable boot SPI ABR console: 0x510 0xC 0x0 Boot SPI ABR Mode console: 0x510 0xD 0x0 /Boot SPI flash size console: 0x510 0xE 0x0 | " console: 0x510 0xF 0x0 \ " console: 0x510 0x10 0x0 /Reserved console: 0x510 0x11 0x0 | " console: 0x510 0x12 0x0 | " console: 0x510 0x13 0x0 | " console: 0x510 0x14 0x0 | " console: 0x510 0x15 0x0 \ " console: 0x510 0x16 0x0 Enable boot SPI auxiliary control pins console: 0x510 0x19 0x0 /Reserved console: 0x510 0x1A 0x0 | " console: 0x510 0x1B 0x0 | " console: 0x510 0x1C 0x0 | " console: 0x510 0x1D 0x0 | " console: 0x510 0x1E 0x0 | " console: 0x510 0x1F 0x0 \ " console: 0x510 0x1E 0x0 Enable dedicate GPIO strap pins console: 0x510 0x1F 0x0 Enable Secure Boot by Pin Strap console: uart:~$ hwinfo devid console: Length: 8 console: ID: 0x0000018000000180 console: uart:~$ crypto aes256_cbc_vault console: aes256_cbc vault key 1 console: Was waiting for: console: 6b c1 be e2 2e 40 9f 96 e9 3d 7e 11 73 93 17 2a console: ae 2d 8a 57 1e 03 ac 9c 9e b7 6f ac 45 af 8e 51 console: 30 c8 1c 46 a3 5c e4 11 e5 fb c1 19 1a 0a 52 ef console: f6 9f 24 45 df 4f 9b 17 ad 2b 41 7b e6 6c 37 10 console: But got: console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 console: uart:~$ random get console: 0x862460d console: uart:~$ i2c scan I2C_0 console: 0 1 2 3 4 5 6 7 8 9 a b c d e f console: 00: -- -- -- -- -- -- -- -- -- -- -- -- console: 10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- console: 70: -- -- -- -- -- -- -- -- console: 1 devices found on I2C_0 console: uart:~$ kernel uptime console: Uptime: 9897 ms console: uart:~$ kernel reboot warm console: *** Booting Zephyr OS build v00.01.07 *** PASS (1.08 s) Ref: https://github.com/AspeedTech-BMC/zephyr/releases/download/v00.01.07/Aspeed_Zephy_SDK_User_Guide_v00.01.07.pdf Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Peter Delevoryas --- tests/avocado/machine_aspeed.py | 41 ++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tests/avocado/machine_aspeed.py b/tests/avocado/machine_aspeed.py index 1fc385e1c8..11f5b17eb9 100644 --- a/tests/avocado/machine_aspeed.py +++ b/tests/avocado/machine_aspeed.py @@ -22,10 +22,11 @@ class AST1030Machine(QemuSystemTest): timeout = 10 - def test_ast1030_zephyros(self): + def test_ast1030_zephyros_1_04(self): """ :avocado: tags=arch:arm :avocado: tags=machine:ast1030-evb + :avocado: tags=os:zephyr """ tar_url = ('https://github.com/AspeedTech-BMC' '/zephyr/releases/download/v00.01.04/ast1030-evb-demo.zip') @@ -41,6 +42,44 @@ def test_ast1030_zephyros(self): exec_command_and_wait_for_pattern(self, "help", "Available commands") + def test_ast1030_zephyros_1_07(self): + """ + :avocado: tags=arch:arm + :avocado: tags=machine:ast1030-evb + :avocado: tags=os:zephyr + """ + tar_url = ('https://github.com/AspeedTech-BMC' + '/zephyr/releases/download/v00.01.07/ast1030-evb-demo.zip') + tar_hash = '40ac87eabdcd3b3454ce5aad11fedc72a33ecda2' + tar_path = self.fetch_asset(tar_url, asset_hash=tar_hash) + archive.extract(tar_path, self.workdir) + kernel_file = self.workdir + "/ast1030-evb-demo/zephyr.bin" + self.vm.set_console() + self.vm.add_args('-kernel', kernel_file, + '-nographic') + self.vm.launch() + wait_for_console_pattern(self, "Booting Zephyr OS") + for shell_cmd in [ + 'kernel stacks', + 'otp info conf', + 'otp info scu', + 'hwinfo devid', + 'crypto aes256_cbc_vault', + 'random get', + 'jtag JTAG1 sw_xfer high TMS', + 'adc ADC0 resolution 12', + 'adc ADC0 read 42', + 'adc ADC1 read 69', + 'i2c scan I2C_0', + 'i3c attach I3C_0', + 'hash test', + 'kernel uptime', + 'kernel reboot warm', + 'kernel uptime', + 'kernel reboot cold', + 'kernel uptime', + ]: exec_command_and_wait_for_pattern(self, shell_cmd, "uart:~$") + class AST2x00Machine(QemuSystemTest): timeout = 90