Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2159227iof; Tue, 7 Jun 2022 21:43:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl4mn0UG70f7vBzF3J0aMau43GinauG+rMKK+BBB21cr2/j1An0NRGCL+nELC52ZYLhPJv X-Received: by 2002:a63:fb4b:0:b0:3fc:d245:9a4e with SMTP id w11-20020a63fb4b000000b003fcd2459a4emr28786249pgj.451.1654663431248; Tue, 07 Jun 2022 21:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663431; cv=none; d=google.com; s=arc-20160816; b=Ddp973yfObWB+0SU1g5xNWN5FbIxk8ti5LG0cMQ0sE6L7NULHJR/jCMzUfXjpZ1gVP r3HE2UaoIjYhCKkIjV8l3Dm1z6V5zxP4ETH9v8NABBjWP18bUjLl2pZPXtXOOZaBaytj LFuIisSQtMdTDqVv/gc1YLUFxxFFRURgwg70xqrTFdCpjIv9FkQ8MiubeAhZTB2WViWw UWtklXWt8u6jmMVMHeOdOwhEczscXeqIdrCDYg/u0q2bur1gSivpp79sSYAPB/8Gu4PA /ckf7G7FbA6ZEqQs629xzIraO+dEZx3XWIfFhOwbLLPqv0X7BzHQdvRkaiyVich7b/wO Xm4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=LqQ09zwxFhnNlDdoJ4/gqEVuIeZ+5DWg9VnySWDOtPw=; b=kM8PBHgGbuq0EkElb2ycs6ayx3IQX4gCq3pPcI2NvSDpnHQpjLGqTuupqaQ6yhAtHP n4bbMoSuwzIE3vmDvMk6AiRHA9+IFamqK6pl3EpApp55zEDjz6r//vbMEakk0HluJdGJ K+YIjnQ6cQ5TTuy/XYoolbc7XZf3sog37PpR2rrh+2MqaJpjT6M1IXT+MC5SbX5hG8+s ZluEg8otQjjN9IOhkxp+bvdTxhiAII5+jWYfj3CurnCiwWjYUyrXdLnm0XdU/uWKLmSP V7BeZqi5gL4kSZ2S524MVe3Ca7phS10VEqMrPkv0U6SljdIVzYGket5z/mc0xO8i8/p9 zPPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j9Y24Keq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q30-20020a638c5e000000b003faaa30cadesi26442361pgn.125.2022.06.07.21.43.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:43:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j9Y24Keq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD7A11E303B; Tue, 7 Jun 2022 21:13:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346596AbiFGR1N (ORCPT + 99 others); Tue, 7 Jun 2022 13:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346272AbiFGRXk (ORCPT ); Tue, 7 Jun 2022 13:23:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 759991091A5; Tue, 7 Jun 2022 10:21:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0513560906; Tue, 7 Jun 2022 17:21:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B7ABC385A5; Tue, 7 Jun 2022 17:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654622497; bh=WWXwnluIknTI8FY8VAf+fD5iMRaR7CaezF5xqnWvTIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j9Y24Keq46y2gDIUz74bAhAFHxUYMNaIEZ8bGK/t9BA2Mrwt9QqNPxAagqbuGKBYH aoqfIhb0ULHWRCH1n3DyCZYYtFW8zbxVQ6QTwDVV6iR/ziMUh8hfd+sT4wQ/CiEhhW 93U2Ga2oya4e1cJqnA2ERvMefVAU2PjvF34adNlU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Arnd Bergmann , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Guenter Roeck , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.10 081/452] openrisc: start CPU timer early in boot Date: Tue, 7 Jun 2022 18:58:58 +0200 Message-Id: <20220607164910.966827865@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jason A. Donenfeld [ Upstream commit 516dd4aacd67a0f27da94f3fe63fe0f4dbab6e2b ] In order to measure the boot process, the timer should be switched on as early in boot as possible. As well, the commit defines the get_cycles macro, like the previous patches in this series, so that generic code is aware that it's implemented by the platform, as is done on other archs. Cc: Thomas Gleixner Cc: Arnd Bergmann Cc: Jonas Bonn Cc: Stefan Kristiansson Acked-by: Stafford Horne Reported-by: Guenter Roeck Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin --- arch/openrisc/include/asm/timex.h | 1 + arch/openrisc/kernel/head.S | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/arch/openrisc/include/asm/timex.h b/arch/openrisc/include/asm/timex.h index d52b4e536e3f..5487fa93dd9b 100644 --- a/arch/openrisc/include/asm/timex.h +++ b/arch/openrisc/include/asm/timex.h @@ -23,6 +23,7 @@ static inline cycles_t get_cycles(void) { return mfspr(SPR_TTCR); } +#define get_cycles get_cycles /* This isn't really used any more */ #define CLOCK_TICK_RATE 1000 diff --git a/arch/openrisc/kernel/head.S b/arch/openrisc/kernel/head.S index af355e3f4619..459b0a1e4eb2 100644 --- a/arch/openrisc/kernel/head.S +++ b/arch/openrisc/kernel/head.S @@ -521,6 +521,15 @@ _start: l.ori r3,r0,0x1 l.mtspr r0,r3,SPR_SR + /* + * Start the TTCR as early as possible, so that the RNG can make use of + * measurements of boot time from the earliest opportunity. Especially + * important is that the TTCR does not return zero by the time we reach + * rand_initialize(). + */ + l.movhi r3,hi(SPR_TTMR_CR) + l.mtspr r0,r3,SPR_TTMR + CLEAR_GPR(r1) CLEAR_GPR(r2) CLEAR_GPR(r3) -- 2.35.1