Received: by 2002:ac2:4841:0:0:0:0:0 with SMTP id 1csp1547651lfy; Thu, 20 Aug 2020 10:47:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz7tGvaZekXvT23JHXcjfdWLyf2uu0KgNDf80pk2djChVcwVYzsGw+w5+IAxFkU5yddZQUH X-Received: by 2002:a5b:602:: with SMTP id d2mr6588956ybq.451.1597945626820; Thu, 20 Aug 2020 10:47:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597945626; cv=none; d=google.com; s=arc-20160816; b=R783Jj4nhfFv6H+z6joh1ZRCr4lfAyucpxqmv9EPtPibvYX7VoJF5+regkQQ9cvYbD tiYJNyeOUuEQ82ASoZHjLskvf3WcZdcjU125sLclm6pHuTTk89MpxSWY85EF12M+9Yys ezgVFoxFfvInTQB09V5UmweFuRHTxhPgpW+fYEbH1mN/5d2tIAeg27vqxsA2Asgv0SSI XCZldmPoeB0L4DZ7CH5VECNDBcX5dVB5JeTwIJfcisu/MWDFfMKLVrfDsGGp6K634MAc UNOGPdfasVvnXp7tEI3i2sqDFAK0lc3ocy/DYfwTOmzpmWKj64G3Cps4jd3jr73QyAp3 Fmzw== 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=t9Dp645C08U5Ww6R62ktOgkmynXD/UDWfeGpGhS9brk=; b=GkwpFl1m9jIDe2UPBFup76W8YfOCdKG6szjloV0sQe3soCFd15g344SzmMgl1J78Ai 0u73hYlnSos6c3rX0TDnl2s4+opjFjMmutuntzQRS8EbyUqBWsHRrdD5m5qcBMkdngAT j+VVvWEBorr1/JtnsXKww91x+nhJtj7dPph/8uWq3YFTS8mJOaoBjAW5dnM/kzN8RXG/ 2evFpQajE9Psqb4cO9T2LrgkH4ZPsOu1hErIUogZfpmPt90Z9MUbP9ZKmKMh3wbpHjbf INY0mOzpVOKR6zlMPGBmoos7guqsLgfg8REG/i1CRGFOiuSPUiMZSN62vnXBhl12XzOM 3NLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=j7s8F4AQ; 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 f13si2835101ybh.9.2020.08.20.10.47.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Aug 2020 10:47:06 -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=j7s8F4AQ; 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]:50392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k8oeY-0008CL-4a for alex.bennee@linaro.org; Thu, 20 Aug 2020 13:47:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k8oeQ-0008C5-0l; Thu, 20 Aug 2020 13:46:58 -0400 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:37624) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k8oeO-0004AM-8T; Thu, 20 Aug 2020 13:46:57 -0400 Received: by mail-wm1-x342.google.com with SMTP id k8so2443526wma.2; Thu, 20 Aug 2020 10:46:54 -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=t9Dp645C08U5Ww6R62ktOgkmynXD/UDWfeGpGhS9brk=; b=j7s8F4AQMuSZag+cEj2nRJHDsPMhahzu4YK2Wkar1SInSdFsTSM67AQH18DGceQGIJ uE1+7oPASAAVUAtIV2es5QUcGcKdWRiJ6FLziCXbN6eZYfymuGrPuv/RUWKQahYfV0Su DcUux0V1//2YoEW9Z/i6nj7OYIm4qMIDGn9rgd2j7y8PacmZjzpT9IPBr2J9n8WWl6X/ vTCgcjXrUI0PtoTxHM0NqneiR4s49MQbaEWHIjceuJPE0UH3RHHJiFS/nOqaNXKDeBa1 7nUtmbaaDgfLm6vMP9aFgYYdz0gIjjN1CpjuogMBmDkTuNQtBBBrWSVOhDgfnFralLBx S1oA== 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=t9Dp645C08U5Ww6R62ktOgkmynXD/UDWfeGpGhS9brk=; b=Dunn8XgJbDFrN5B6DfyRF94Ql+fjIIlqIYla8JWTUhOGOV2d7BhR8C6KXQV7DTExse EtWpF2CZ6J77CDm6DWquGu62e5ejmrxVu7wAv+inI0/Tz+KvkEZ2Y3dzWql4497n73V+ 9W1r2aM2vlxgLOV3GouOa9I/goXootJciiA6rGfoLoJNgJEkoPvP86fmm92+y7OCUrNi cEObzjWh2d44CSM0fNI/8Z2nKEc0djeG97kULn5FzNwoVEK0FoHJ6nks0s2hkO0+l1ss +WiII0xfmSF07ZdSapvGcN3VKTOOsk7Y1IA322HmBOUy9J4Au9t4uspy62yd/oI3ihls DOCw== X-Gm-Message-State: AOAM533u+ubhbwWqq9OVAfU9qVvZTnnMFX/mpDj/qAqUG+JDLr/4EHvn w3Sm4H6A8vWh3FGvtyuKH0w= X-Received: by 2002:a7b:c084:: with SMTP id r4mr4477007wmh.20.1597945613708; Thu, 20 Aug 2020 10:46:53 -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 f16sm5415387wro.34.2020.08.20.10.46.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Aug 2020 10:46:53 -0700 (PDT) Subject: Re: [PATCH v7 13/13] tests/acceptance: console boot tests for quanta-gsj To: Havard Skinnemoen References: <20200811004607.2133149-1-hskinnemoen@google.com> <20200811004607.2133149-14-hskinnemoen@google.com> <64f8cd56-306e-4961-488b-36c666894a54@amsat.org> <28a30c64-7cc5-4b4f-2be2-b3d3af511cb1@amsat.org> From: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= Message-ID: <6a23375f-64ec-cfdd-10cf-272eef719dd6@amsat.org> Date: Thu, 20 Aug 2020 19:46:51 +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::342; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wm1-x342.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: "Edgar E. Iglesias" , Peter Maydell , Sai Pavan Boddu , Andrew Jeffery , QEMU Developers , Wainer dos Santos Moschetta , Joel Stanley , CS20 KFTing , qemu-arm , =?UTF-8?Q?C=c3=a9dric_Le_Goate?= =?UTF-8?Q?r?= , 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: oQ3Bn/EmyvNI On 8/20/20 6:24 PM, Havard Skinnemoen wrote: > On Wed, Aug 19, 2020 at 10:29 PM Philippe Mathieu-Daudé wrote: >> >> +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 >> +} > > I think this is actually a problem regardless of optimization level. > Turning optimization off amplifies the problem, but the problem is > still there with optimization on. OK, this reminds me few more details about the problem I had with the raspi3 when adding the ClockPowerResetManager block. Found the branch. A bit bitter/sad it was more than 1 year ago. So if ARM_FEATURE_GENERIC_TIMER is available, Linux polls the CNTFRQ_EL0 register. At that time this register were using a fixed frequency: #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ Xilinx' fork does it this way: https://github.com/Xilinx/qemu/commit/9e939b54e2d Now I see Andrew Jeffery fixed that in 96eec6b2b38 ("target/arm: Prepare generic timer for per-platform CNTFRQ") adding a 'cntfrq' property, which he then sets in the Aspeed machine in commit 058d095532d ("ast2600: Configure CNTFRQ at 1125MHz"). Maybe your SoC is simply missing this property? > > This does not affect booting a full flash image, as these fixups (and > more) are done by the boot loader in that case. > > Havard >