Received: by 2002:ac2:4841:0:0:0:0:0 with SMTP id 1csp1059019lfy; Wed, 19 Aug 2020 22:29:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwJHbcXe4LK1qTP0osP5nxdoAYCJBWnVBDyHJRvpwSpaujQmwkGEl+9mFK2Pp2bsGruRwLM X-Received: by 2002:a25:bbc2:: with SMTP id c2mr2643206ybk.174.1597901368830; Wed, 19 Aug 2020 22:29:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597901368; cv=none; d=google.com; s=arc-20160816; b=zbWKr8BXufKIe0o1MmF6hHqKx9TdlIbmeQ27FmyBlrPHxTaIml6dmOlTkTHWoiSk3c To8py4l81bhqdu+JFK+Z9ebDg2OfF5yKmj9PHuXHTqA+C/Tb9r3OCUb86gfvPa3xoF5k TcqqsY9R4aQxr+iffL0CwOxhvWQYteoJXU6ZonR2Mf5eOfaPPlDvUGpPYZbw41NlHMYO VPo/651//ZH6DxJR5rN1lNeNfvr6as+OceZ8iKnRsW/I7dEkgNon3cB1KD4Lc68sCktJ 3RGsvCW9s86+Ibh3wLsoRxjyN1EypcKlCa56eDoeIFitAS4KslJDaWuZDFr5KqU7GLqU lrxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject:dkim-signature; bh=bZMYDU3bN9MTRIT/lUf7fiDWoggXE5c6pzgwRUkTJD4=; b=aCIIgiLAlyLlsaxZ6LxfIy7PhuQHpLvOtbp3MxANkY30jWGRIvziSX5946atbx5MME 0qm5FR5ztEjcqp4XBIHgu27YH2uaXX7iez3TNHeyFq1ngfHbfGFDFl5wojfuVz4iDGHk GtVc/NU5rb6bagdMNbWD7SoaQv8AnqqEHEJ0fcwIbypyCtl4659hDmbaqBzUb8rj/FxO XEt/q28f4ad/e5B98u5OZ4sZUV1b6kyldNQpv+e4/jVMbMYYZutnfPLm72w/uIWsDcyG QkWgMykWVE/c4Ab0BiRKp2/1/HcNoN+VCQWh7hAif8mUgAk6iLx3Gr2RqI0Fh6fCbLIb kNXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qCVQpbRR; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r9si1406680ybr.120.2020.08.19.22.29.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 19 Aug 2020 22:29:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=qCVQpbRR; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=amsat.org Received: from localhost ([::1]:38732 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8d8i-0005u8-7M for alex.bennee@linaro.org; Thu, 20 Aug 2020 01:29:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43152) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8d8b-0005ty-CG; Thu, 20 Aug 2020 01:29:21 -0400 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:39953) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8d8Z-0000Ov-QK; Thu, 20 Aug 2020 01:29:21 -0400 Received: by mail-wm1-x343.google.com with SMTP id k20so492018wmi.5; Wed, 19 Aug 2020 22:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=bZMYDU3bN9MTRIT/lUf7fiDWoggXE5c6pzgwRUkTJD4=; b=qCVQpbRRy2Pk2uENfSkTU6o9RggdlydBukF7qULoHNFahTjj38GzCE+k7duUw9GeUO zBO/4QRv+ZOZHn0fedKuhv69Atc63hyuUt32BhUMxduPjYsVbnqRaxzYe08MICE/QJ2P KbqAvmBnTDw3Hc1XsIBN3xsLX9OBFpTX9VuJDgUz2O/s/AOhX9Vl8+WOz1Kd4aIrKdNt RE9hdf25tMp3bEuiOnhozc1ajvYeKGTeeVfnr4TxkdUi+ZsOK7HtitNuE71QYtmLbuSN agZxtzerxT8Qyj0xwNimfl590W2xqkT+k9kjmzUjIPoyLulFjDh9OgkZGY+jn+JHJZSA UplQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=bZMYDU3bN9MTRIT/lUf7fiDWoggXE5c6pzgwRUkTJD4=; b=gvWfNtKXhk7KnmEl+PHgPiKBtSc+HuQfZRz+Muw6Tkef95V89qVnTFnswjdVIYg4MW 0xTjGOrxkIwC4Br+DUpEsOv/y3MtpjjoJ1/cUB3BLMryFIDHCwiYwyLPSjPj7GdXeXKz G0OJHRB6qmFbsEtk6wNfvDV6YNmKPDNIGH4vQNM/Z6lkVmXKLE98JFt66ZUKd6ghD4UW d/GC5IedI9jOObNObEXi4kJCNAs3G51dwC2vB5J0jPvyz3ic/mdPwOonkQHs0RX36Xey 0Wder0EQmVg7L3D7BOKv8jZT+ntrdXZGoe6Ir+ZQeXxvd9YohWx4xN5WInXZjrypMKKH nZew== X-Gm-Message-State: AOAM5337Zqx22I3bC5Ca8V1s6RcgYSr8t7ZV5dulLcxpBb4Om+t1G5cp C5RzpFVNIOU2sAbcJGgWuvk= X-Received: by 2002:a7b:c38e:: with SMTP id s14mr1637916wmj.124.1597901357470; Wed, 19 Aug 2020 22:29:17 -0700 (PDT) Received: from [192.168.1.36] (121.red-81-40-121.staticip.rima-tde.net. [81.40.121.121]) by smtp.gmail.com with ESMTPSA id p22sm1889782wmc.38.2020.08.19.22.29.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Aug 2020 22:29:16 -0700 (PDT) Subject: Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj To: Havard Skinnemoen , Peter Maydell References: <20200811004607.2133149-1-hskinnemoen@google.com> <20200811004607.2133149-14-hskinnemoen@google.com> <64f8cd56-306e-4961-488b-36c666894a54@amsat.org> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <28a30c64-7cc5-4b4f-2be2-b3d3af511cb1@amsat.org> Date: Thu, 20 Aug 2020 07:29:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2a00:1450:4864:20::343; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x343.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=1, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: QEMU Developers , Wainer dos Santos Moschetta , Joel Stanley , CS20 KFTing , qemu-arm , =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , Cleber Rosa , Richard Henderson , Eric Blake , IS20 Avi Fishman Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: w0u4n1ffn+Pq +Eric / Richard for compiler optimizations. On 8/20/20 3:53 AM, Havard Skinnemoen wrote: > On Tue, Aug 11, 2020 at 8:26 PM Havard Skinnemoen > wrote: >> >> On Tue, Aug 11, 2020 at 1:48 AM Philippe Mathieu-Daudé wrote: >>> INTERRUPTED: Test interrupted by SIGTERM >>> Runner error occurred: Timeout reached >>> (240.45 s) >>> >>> Is that expected? >> >> I'm not sure why it only happens when running direct kernel boot with >> unoptimized qemu, but it seems a little happier if I enable a few more >> peripherals that I have queued up (sd, ehci, ohci and rng), though not >> enough. >> >> It still stalls for an awfully long time on "console: Run /init as >> init process" though. I'm not sure what it's doing there. With -O2 it >> only takes a couple of seconds to move on. > > So it turns out that the kernel gets _really_ sluggish when skipping > the clock initialization normally done by the boot loader. > > I changed the reset value of CLKSEL like this: > > diff --git a/hw/misc/npcm7xx_clk.c b/hw/misc/npcm7xx_clk.c > index 21ab4200d1..5e9849410f 100644 > --- a/hw/misc/npcm7xx_clk.c > +++ b/hw/misc/npcm7xx_clk.c > @@ -67,7 +67,7 @@ enum NPCM7xxCLKRegisters { > */ > static const uint32_t cold_reset_values[NPCM7XX_CLK_NR_REGS] = { > [NPCM7XX_CLK_CLKEN1] = 0xffffffff, > - [NPCM7XX_CLK_CLKSEL] = 0x004aaaaa, > + [NPCM7XX_CLK_CLKSEL] = 0x004aaba9, > [NPCM7XX_CLK_CLKDIV1] = 0x5413f855, > [NPCM7XX_CLK_PLLCON0] = 0x00222101 | PLLCON_LOKI, > [NPCM7XX_CLK_PLLCON1] = 0x00202101 | PLLCON_LOKI, > > which switches the CPU core and UART to run from PLL2 instead of > CLKREF (25 MHz). > > With this change, the test passes without optimization: > > (02/19) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_arm_quanta_gsj_initrd: > PASS (39.62 s) > > It doesn't look like this change hurts booting from the bootrom (IIUC > the nuvoton bootblock overwrites CLKSEL anyway), but it's not super > clean. > > Perhaps I should make it conditional on kernel_filename being set? Or > would it be better to provide a write_board_setup hook for this? QEMU prefers to avoid ifdef'ry at all cost. However I find this approach acceptable (anyway up to the maintainer): +static void npcm7xx_clk_cold_reset_fixup(NPCM7xxCLKState *s) +{ +#ifndef __OPTIMIZE__ + /* + * When built without optimization, ... + * so run CPU core and UART from PLL2 instead of CLKREF. + */ + s->regs[NPCM7XX_CLK_CLKSEL] |= 0x103, +#endif +} static void npcm7xx_clk_enter_reset(Object *obj, ResetType type) { NPCM7xxCLKState *s = NPCM7XX_CLK(obj); QEMU_BUILD_BUG_ON(sizeof(s->regs) != sizeof(cold_reset_values)); switch (type) { case RESET_TYPE_COLD: memcpy(s->regs, cold_reset_values, sizeof(cold_reset_values)); + npcm7xx_clk_cold_reset_fixup(s); s->ref_ns = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); return; } ... Regards, Phil.