Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2150109iof; Tue, 7 Jun 2022 21:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwogG2kkWoBNIHJs2wpoyWLDJ/j9JLo+zH3JrEZo9yfFsuaV5Yqkzx8FWosK6ZholmlcqC0 X-Received: by 2002:a17:902:bf07:b0:167:6daa:f49c with SMTP id bi7-20020a170902bf0700b001676daaf49cmr17804490plb.9.1654662317557; Tue, 07 Jun 2022 21:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654662317; cv=none; d=google.com; s=arc-20160816; b=taBJpWk7swdavw73Y/wewgtwhzOaRBa0UvfRAHsMVS8Rot2HDQU7WGx8oYlUiydt2Q V3ZOjn4Im4ZYy7sF9bjs/HmDnmBi2TYuF/MdHL+k6Wa1GZVYRrUNrA+YZBHOzvt63eCi ehWZNvm+OmRIIT25R/zfom0/ZuYZB5JOFBQHZ6bKypWgufe4eNmV6ZvpxAIx/zj/Nu15 s2jcLXyjB2RJSg0xxX0b4QpVm6XlGjwCQI+fgcMfavBfCIAzOiZQvYEqbU8dHlmmzAuT y87T3V0R0jKO6TP1NY7eRFL2LkKIkrwMuASYH/No9kBbct+WBwNnE37ludBWxsHGTx7t sU2w== 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=CwLfZ/48W8fo1KGZ4Gq3b0GCpda2Dd3IXioA7Hic0bA=; b=hSCbZCdfwIVy/zrM96Cm+0eZBt1fvGhdLII8BK1bibSotVRtidkmaN0IuAmttTEJGj UoJd7apAOke1iguoZHsZlN1tX1Pr1nT9JVRelYykaRAmhdK2HQ9Wf6+7dctZUR6FifrH q+EiB/RZ015bqaBznArBfKa7yE4BnumiavR7n2JSfbU8BzVghLPUKqyPTx5h1TU2GeAp kOoC/r6N6KX+fOEtpsn+AkZXv8y+5hf2i5aS0AQIFRkHNhBmKnpbvJpSqzh2GdrmWlmK gcn0RAjs5xeXWirf/Z6eJl6/LoSPbeLe26p+urIRs4bO38g8OpfPLNVjDZHavvREB3KQ cN0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Suoh2DyT; 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 189-20020a6302c6000000b003fd206c9d53si19134028pgc.40.2022.06.07.21.25.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:25:17 -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=Suoh2DyT; 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 DFA26226CC6; Tue, 7 Jun 2022 21:10:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385004AbiFGWRJ (ORCPT + 99 others); Tue, 7 Jun 2022 18:17:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380207AbiFGVLl (ORCPT ); Tue, 7 Jun 2022 17:11:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BB4A218AA1; Tue, 7 Jun 2022 11:53:32 -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 07FCD6176D; Tue, 7 Jun 2022 18:53:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1682CC385A2; Tue, 7 Jun 2022 18:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628011; bh=HfOrDTLhdUzR7V2uVaro7XE7vKpON/b5Tcu5bw6pI6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Suoh2DyTcAmYQwcdDFTOah0GP7uRCWIJ4CS6h/szG3AEiVA6hk58BnxdOmxpOolcv LLS/NoMXWH7vNkgLt9Y/3+dymhWa5fyqZSsIqV0CzLlhp36ondDATrAWLFDvqkEHy4 zUMH77aMHpGj3E6Mt2oCaFwJnHA75/66yOPyU15w= 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.18 174/879] openrisc: start CPU timer early in boot Date: Tue, 7 Jun 2022 18:54:52 +0200 Message-Id: <20220607165007.891629583@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 15f1b38dfe03..871f4c858859 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