Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3785270ybl; Mon, 26 Aug 2019 00:02:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzqep+uEMGiyLJTh3sUq96UegAYNaIjIg637yvrTixBDBppm/7L3ztPNPMr8H8pIs9rhSmq X-Received: by 2002:a65:4b8b:: with SMTP id t11mr15068186pgq.130.1566802934648; Mon, 26 Aug 2019 00:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566802934; cv=none; d=google.com; s=arc-20160816; b=uk1qvEQY3z7PN4xdW/X5uZ1VzsOin3yJesHvh36rmFO85MHAQbpDv4f+dp+tnqFSBz TqBHB3kHgHRgrRiMUGKpXXBaGP6e+7t5/LPz/jWvuoIBT4YbKELhdFrtqZ+bl7Z4DxQh tbWRew2abXhKBkZv84mcH2Wqrgmi8qs4GN1pnNGyTOXNAmE5Z9nsEuYZEOocgMQe9wip csYZ6fcY67F+pSjb9oQWhLdXD+uVx0vWz7fK11pNp4VcZ8HvjOzXimoaF5Ef7QHgp4O2 ZpbP1+7tp2FtI5ZYFqPpDy7OHDTaENXEIIuJNxtqnEYLFj+rDJqPCms1nIXsK7iSjX9b 4H/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=8j5mwu9pWK20Qk1oNaDurAISpRT0outYGtUkNA7dR4k=; b=UXL4SZEaUVMuFQ06pJa3vl1303Nm8hpdJz1L/ZGoE2g1Y0iwRMwINB5gnWme5kKPfX YFbY8Xyy3ND5RyMps7nD/FDuYFsA62GSDEKC4U/bnsrBvHocrVKyp3lSgzenqYKh7kbp 3ffG2dSvWkg8u12Wz0DSMwplLpuJwlxtjiI9z6B82t5FUGy+XlVgPdJgmXfoNaT4HNVc arVA0cmsP3fRu25R/WzmvKJOcZ0orwJLcYPgMn6FRbtBtmE6z3Fk7rU0CAog5DxuTL+z ICtPvyTfsCR0wH9e6yc/fRcNZmkIGfKlaBThU1TCYrUvR+IhoQ7G7i4ZEbEBwDLoHWY+ xQJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=BF2Wd3vW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t18si8572316pjr.102.2019.08.26.00.01.58; Mon, 26 Aug 2019 00:02:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=BF2Wd3vW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729824AbfHZG7g (ORCPT + 99 others); Mon, 26 Aug 2019 02:59:36 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:7685 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729487AbfHZG7g (ORCPT ); Mon, 26 Aug 2019 02:59:36 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 46H2tV36fcz9vBLK; Mon, 26 Aug 2019 08:59:30 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=BF2Wd3vW; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id opuO-a8eCCRS; Mon, 26 Aug 2019 08:59:30 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 46H2tV24bNz9vBLJ; Mon, 26 Aug 2019 08:59:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1566802770; bh=8j5mwu9pWK20Qk1oNaDurAISpRT0outYGtUkNA7dR4k=; h=From:Subject:To:Cc:Date:From; b=BF2Wd3vWQzhrPPDonMt+g0Q/G87ECs0Rhh7ErEOA6zVBImOOAzRhLkI5PN4fiQJWI zc6VTVvbVbdxsC24JX6UnyiHrm7l/jGcHALyAXr/Kr0mSSWQHcQVMuDILygvzOU/aa 9+KkaAHurSU5hykFmHu5ZSNNGO0hC6F79gQb/+8I= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id E464A8B7CE; Mon, 26 Aug 2019 08:59:34 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id mFg2us_BdCCW; Mon, 26 Aug 2019 08:59:34 +0200 (CEST) Received: from pc16032vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.230.103]) by messagerie.si.c-s.fr (Postfix) with ESMTP id CB6AF8B7B9; Mon, 26 Aug 2019 08:59:34 +0200 (CEST) Received: by pc16032vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 9DAB1672A8; Mon, 26 Aug 2019 06:59:34 +0000 (UTC) Message-Id: <55c267ac6e0cd289970accfafbf9dda11a324c2e.1566802736.git.christophe.leroy@c-s.fr> From: Christophe Leroy Subject: [PATCH] powerpc/time: use feature fixup in __USE_RTC() instead of cpu feature. To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Mon, 26 Aug 2019 06:59:34 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org sched_clock(), used by printk(), calls __USE_RTC() to know whether to use realtime clock or timebase. __USE_RTC() uses cpu_has_feature() which is initialised by machine_init(). Before machine_init(), __USE_RTC() returns true, leading to a program check exception on CPUs not having realtime clock. In order to be able to use printk() earlier, use feature fixup. Feature fixups are applies in early_init(), enabling the use of printk() earlier. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/time.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h index 54f4ec1f9fab..3455cb54c333 100644 --- a/arch/powerpc/include/asm/time.h +++ b/arch/powerpc/include/asm/time.h @@ -42,7 +42,14 @@ struct div_result { /* Accessor functions for the timebase (RTC on 601) registers. */ /* If one day CONFIG_POWER is added just define __USE_RTC as 1 */ #ifdef CONFIG_PPC_BOOK3S_32 -#define __USE_RTC() (cpu_has_feature(CPU_FTR_USE_RTC)) +static inline bool __USE_RTC(void) +{ + asm_volatile_goto(ASM_FTR_IFCLR("nop;", "b %1;", %0) :: + "i" (CPU_FTR_USE_RTC) :: l_use_rtc); + return false; +l_use_rtc: + return true; +} #else #define __USE_RTC() 0 #endif -- 2.13.3