From patchwork Wed Dec 26 16:45:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 10743207 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 681ED13A4 for ; Wed, 26 Dec 2018 16:45:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 479CA285FB for ; Wed, 26 Dec 2018 16:45:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 363F72874B; Wed, 26 Dec 2018 16:45:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AC49B285FB for ; Wed, 26 Dec 2018 16:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YlcUKi6EkyPiRqh5166K1sFBACu/4OusV8SpV+PcGXk=; b=OZys85lGl7cdLb nZMQVY/H+aipvkbwt5HkJchPNtcpEkgJL2+Jn6APFc4NrwKJbV0dITxyclA3Z3HDSoSbFryM/wINK Fu1u/COtDevX6UiDzjPDUENTdVsCfFEAQCWVF0HSXlCfh6IKJBFaeSN2si68XcdrRplO8kWoqpRjJ +zJwiSeEQG4ibiXsfeTggAp29Dw57aPGpG8gsR8mcuQgzWxNBXvnFHLJgJSgxSWHVoHv8EUaEKD8z QrJdVT9sWhZ8Z/MxWlUB6LW48M6fQ1QG5AC/lN88qoihQTQQLf4TZWFnDzxGf0BeyW1bqZRYycy/O K/A5ZAtFhTbJcNd0yNeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJD-00045j-Jr; Wed, 26 Dec 2018 16:45:27 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJA-00043H-G4 for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2018 16:45:26 +0000 Received: by mail-qk1-x743.google.com with SMTP id n12so9560964qkh.11 for ; Wed, 26 Dec 2018 08:45:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=InwYWFVcgsNeL+HQcZ5vgHtIv1cvzFUFvu3UrzzVaBw=; b=n2yeI7h8aHMbPfRTciWj/doMgM6b2hrPX6d2Nj/RJqxw4rXomNTuaPW2Erzqdxudqj HNe4J7qjWuhAu+sr6kO2Cn9ZtG7nf3kjP2aoJHXeK3lK8Ps5PHigegMsS8th/kDj44RG 2mFff9fAxK5Lhg7TT1GJ+S/ZVllpWgq26/9WsY+UpSgrZQxiaowZwLsfbGehuZbieptq +RKEDVN2NxOqxiU239+RxtiFJNFjTvJ5TDIv3+q7DUFMpMkha/70/Hj3FnN3EjHRMLai KTeD5ntD/a2Gl56CwuVqAuhsRChHnrdJGl+4yHROJecu0iOZFh265NPi+4ktGHw06pxr 3qOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=InwYWFVcgsNeL+HQcZ5vgHtIv1cvzFUFvu3UrzzVaBw=; b=HcT042ypwcnATg2a1dH4fH+P6NqOm1XXjIt4sUItcofzxo6T8WUk0F9/2e5+OjIjVZ hxMmV+36obwJZEJTK6mnvi4Velx5LGccy6+2yGHuZtX17q72hzJpwhm4e3xtOI9wTvqZ 4/6VsjzYl8Gd7et5DYvclDymxpqcfLEMgeoZ3SizKma+W0zc8KxDY2Oo5gwCz3Jq72jh LCHMgWKMGVP+N60QvtQLfCoVmvQA6zz4faONJnpCWKGvEyAOXHzvzusTIP2mvGGUU23V REmPVtcbKfWEDvb6YqfbhpekpfdpjmmKAdZMpffwiLNm7fpO4mxVKqx7dXt3Eu67jTWt VrhA== X-Gm-Message-State: AJcUuke1nIb3BRXX0UFW1ChqkhsnIhIsw8bAEswGZaXn6rBAsiLz8ULG 0aA5UG0WT/v4M0mXPME6IX7kjQ== X-Google-Smtp-Source: ALg8bN5hCYw0xiCyKIk/UBSJ8upSjDurDY60a3X/min2YuOsLsTeTR9K8nj0IoPeS3sKp4NPKWn6TQ== X-Received: by 2002:ae9:ec02:: with SMTP id h2mr18855149qkg.84.1545842713028; Wed, 26 Dec 2018 08:45:13 -0800 (PST) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id m41sm17874920qtc.58.2018.12.26.08.45.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Dec 2018 08:45:12 -0800 (PST) From: Pavel Tatashin To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, rppt@linux.vnet.ibm.com, mhocko@suse.com, ard.biesheuvel@linaro.org, andrew.murray@arm.com, james.morse@arm.com, marc.zyngier@arm.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com Subject: [PATCH v3 1/3] arm_arch_timer: add macro for timer nbits Date: Wed, 26 Dec 2018 11:45:07 -0500 Message-Id: <20181226164509.22916-2-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181226164509.22916-1-pasha.tatashin@soleen.com> References: <20181226164509.22916-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181226_084524_577422_A72CC6B1 X-CRM114-Status: GOOD ( 12.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The minimum value of bits arm defines for timer value is 56bits, add a new macro ARCH_TIMER_NBITS to use it in code instead of hardcoding 56. Signed-off-by: Pavel Tatashin --- drivers/clocksource/arm_arch_timer.c | 8 ++++---- include/clocksource/arm_arch_timer.h | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/arm_arch_timer.c b/drivers/clocksource/arm_arch_timer.c index 9a7d4dc00b6e..e4843ad48bd3 100644 --- a/drivers/clocksource/arm_arch_timer.c +++ b/drivers/clocksource/arm_arch_timer.c @@ -175,13 +175,13 @@ static struct clocksource clocksource_counter = { .name = "arch_sys_counter", .rating = 400, .read = arch_counter_read, - .mask = CLOCKSOURCE_MASK(56), + .mask = CLOCKSOURCE_MASK(ARCH_TIMER_NBITS), .flags = CLOCK_SOURCE_IS_CONTINUOUS, }; static struct cyclecounter cyclecounter __ro_after_init = { .read = arch_counter_read_cc, - .mask = CLOCKSOURCE_MASK(56), + .mask = CLOCKSOURCE_MASK(ARCH_TIMER_NBITS), }; struct ate_acpi_oem_info { @@ -963,8 +963,8 @@ static void __init arch_counter_register(unsigned type) timecounter_init(&arch_timer_kvm_info.timecounter, &cyclecounter, start_count); - /* 56 bits minimum, so we assume worst case rollover */ - sched_clock_register(arch_timer_read_counter, 56, arch_timer_rate); + sched_clock_register(arch_timer_read_counter, ARCH_TIMER_NBITS, + arch_timer_rate); } static void arch_timer_stop(struct clock_event_device *clk) diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h index 349e5957c949..c485512e1d01 100644 --- a/include/clocksource/arm_arch_timer.h +++ b/include/clocksource/arm_arch_timer.h @@ -71,6 +71,9 @@ enum arch_timer_spi_nr { #define ARCH_TIMER_EVT_STREAM_FREQ \ (USEC_PER_SEC / ARCH_TIMER_EVT_STREAM_PERIOD_US) +/* 56 bits minimum, so we assume worst case rollover */ +#define ARCH_TIMER_NBITS 56 + struct arch_timer_kvm_info { struct timecounter timecounter; int virtual_irq; From patchwork Wed Dec 26 16:45:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 10743211 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A79313A4 for ; Wed, 26 Dec 2018 16:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBDEC285FB for ; Wed, 26 Dec 2018 16:46:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF6892874B; Wed, 26 Dec 2018 16:46:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D88BD285FB for ; Wed, 26 Dec 2018 16:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9JOAGGozSO6jlcZ0xJO4Kpoyhzo7clsTno6KZnRelAs=; b=MSuBEk+SovNjU3 z2btuASPno8QNf0UNaA8mSqS0p6AU/r3e7sayzOan+HJDLjYdiCx7sgPZXBylUp4Ug1Gi00IpmCue z88iPY4UgJow8XAQc21WDjjgKrHIrqyeGDAfvrJbSCshyA+QfEZhSsNTM5lT0zlJCXtdyrY6yCTtj 9oPWwQzc/m5xaxFw4td0ZUbNejif38I98eQPBr/YZwojoHS6y/9WrfP4ni1lHClFh4jx5mLV4jMgV 3TzEMHQ5l+50DTwVGFgTt8VXIfToBQD7QC8DIorKkTM1dmk77sTJBv6m2tLw2Fo1aG12pMjycf89M tIxupRhHh28H2z7AtPCg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJj-0004Yb-O1; Wed, 26 Dec 2018 16:45:59 +0000 Received: from mail-qk1-x743.google.com ([2607:f8b0:4864:20::743]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJA-00043O-G3 for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2018 16:45:27 +0000 Received: by mail-qk1-x743.google.com with SMTP id q8so9595130qke.1 for ; Wed, 26 Dec 2018 08:45:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=a/LUwAP4xu+zNakjYJJ48vD4f9YrE1P+QIINyrItNIo=; b=GNmZUn9K6Tn2ODocJgkuyy3A7xgsDN0hL4FWSQLm3kh8j6g4isGWpG8o93hWu4pigN u0Gg8w5h3DBG2DLFiiKh8KGIGUzjNI0EmCf4h/43KOF0FXXNBMMP9gQpZNglJ+let7P7 8h22Skam697IhbSbUnwIUNGVP3GW/Q6xe4zJZQpLVKhRL8rwn+m+vGU1sbDx7SON17ro Y3tMCC/6zNvLK3OJvStI4DSD/4wJr2R9nSP7eLVlUAw6nbbzrlW4QrMOMxfk79RFF1rU YPTwgAplTcLDg/WN065zarbvVwKKjiM7/iwde0SzAU3EONCFmWlU2CpDTl2K25Ue52Uq VqNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a/LUwAP4xu+zNakjYJJ48vD4f9YrE1P+QIINyrItNIo=; b=aXBTmIIWMRCY/Yq4MVLzlnZMXP1guxD03J5SlqTSkDFnyrD4eSiydQMqhfvNm/3r72 W4Ut08KUqgDLgN2H4vPbuG/rX19PmdDPwwv3LIQTEaxuLY9JIm29beIoyEXweENLcMDy N495MDAqYsrCfcXlvDVZmIwOOE76kD7sm4sysyFG8gWnOBMQHFva10x2pYtiuOLu5Jzu DPAJoq1+jXfHB5ExNSVA3kyKkgTOPTv5P0CJgD+RMeabN9rfrq2RiUxvBg8cI3fWk5FA KUoTks2z0eU0xNVpyFWIte1Ne9CRLVTT4Zp6tQxM12GA1/zWWqRzZE2E/pTQQ0bEFG8x itww== X-Gm-Message-State: AJcUukcSuyNzQFTZBIQI0omOlw4zOOIF0regVYgPoahmMhtWm0QEv3j4 xUdY5tcb66Bf44vAveE5C4X1fA== X-Google-Smtp-Source: ALg8bN4qDJrXi30Gm/7gnRxTo2mkmliB5xWpXzK1jd9T94cUilZmTTKyrqwSwz39ZYtoAFTRG4GcUA== X-Received: by 2002:a37:7b01:: with SMTP id w1mr18816380qkc.122.1545842714264; Wed, 26 Dec 2018 08:45:14 -0800 (PST) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id m41sm17874920qtc.58.2018.12.26.08.45.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Dec 2018 08:45:13 -0800 (PST) From: Pavel Tatashin To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, rppt@linux.vnet.ibm.com, mhocko@suse.com, ard.biesheuvel@linaro.org, andrew.murray@arm.com, james.morse@arm.com, marc.zyngier@arm.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com Subject: [PATCH v3 2/3] arm64: vdso: Use ARCH_TIMER_NBITS to calculate mask Date: Wed, 26 Dec 2018 11:45:08 -0500 Message-Id: <20181226164509.22916-3-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181226164509.22916-1-pasha.tatashin@soleen.com> References: <20181226164509.22916-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181226_084524_576047_4BA1A10C X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP get_clock_shifted_nsec macro in vdso/gettimeofday.S has another place where the size of clocksource precision is hardcoded. Use ARCH_TIMER_NBITS to generate mask value. Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/asm-offsets.c | 1 + arch/arm64/kernel/vdso/gettimeofday.S | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/asm-offsets.c b/arch/arm64/kernel/asm-offsets.c index 65b8afc84466..32e1b935dd6c 100644 --- a/arch/arm64/kernel/asm-offsets.c +++ b/arch/arm64/kernel/asm-offsets.c @@ -107,6 +107,7 @@ int main(void) DEFINE(CLOCK_MONOTONIC_COARSE,CLOCK_MONOTONIC_COARSE); DEFINE(CLOCK_COARSE_RES, LOW_RES_NSEC); DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); + DEFINE(CLOCKSOURCE_MASK, CLOCKSOURCE_MASK(ARCH_TIMER_NBITS)); BLANK(); DEFINE(VDSO_CS_CYCLE_LAST, offsetof(struct vdso_data, cs_cycle_last)); DEFINE(VDSO_RAW_TIME_SEC, offsetof(struct vdso_data, raw_time_sec)); diff --git a/arch/arm64/kernel/vdso/gettimeofday.S b/arch/arm64/kernel/vdso/gettimeofday.S index c39872a7b03c..5a7580d0118e 100644 --- a/arch/arm64/kernel/vdso/gettimeofday.S +++ b/arch/arm64/kernel/vdso/gettimeofday.S @@ -69,8 +69,7 @@ x_tmp .req x8 mrs x_tmp, cntvct_el0 /* Calculate cycle delta and convert to ns. */ sub \res, x_tmp, \cycle_last - /* We can only guarantee 56 bits of precision. */ - movn x_tmp, #0xff00, lsl #48 + mov x_tmp, #CLOCKSOURCE_MASK and \res, x_tmp, \res mul \res, \res, \mult .endm From patchwork Wed Dec 26 16:45:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pasha Tatashin X-Patchwork-Id: 10743213 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4EDC213A4 for ; Wed, 26 Dec 2018 16:46:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C90E285FB for ; Wed, 26 Dec 2018 16:46:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2E0422874B; Wed, 26 Dec 2018 16:46:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C4F70285FB for ; Wed, 26 Dec 2018 16:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=48m+OBft/BwNCEw817cg1TIwOlGDXowdiOWUUne3hjQ=; b=hGHRxpDEu2acOG rRysnzbh0fMRJD4+DwDmyQre50jaBj6jh81SlBAjN4Fdne7yQR9dDzvARqSLWEURtp1U+qMltgb+G DAC1K8gpfvzjDivMBV5qqXn8Ve/IMQ0mfXrnACBVtZ29Q79v7zI3RBBAeb8up21XX7B5UGEfDigio emQbhbUTtPU8fNaxnN+iQpsgl4m0nOxaVYtVzJ5dhB/TfRLMInCxycQAXWdoKvRMFg3cbOXia7oF4 X+dtT6823oqXWhKyI50dFTA2H/ueRXXIvb3DQuj6eFVCEBTIMhisyTnZcxseNgP9NYR7rVNivqUIO YoDCEE/iCGOfmFmO/riQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJt-0004hf-8C; Wed, 26 Dec 2018 16:46:09 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gcCJE-00043P-IU for linux-arm-kernel@lists.infradead.org; Wed, 26 Dec 2018 16:45:30 +0000 Received: by mail-qt1-x842.google.com with SMTP id i7so17732015qtj.10 for ; Wed, 26 Dec 2018 08:45:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=w3KbIJQiIOy8N3UGEAqIqz0OpXOEfKfCNsBPN7OzZGI=; b=pG90tigs07wpuGuq2rTMB/CcCulJi9YnbL+1kJRO1c6yL0SozoJNJTn7jUq2uv0wfU 0t8g37/BhzyS5UiZ/lO0fY4Az2oXeysv2dZptLDNkM4mRTK/8FYY3LhHTMEkGkb3v32N SVSYeo1dEevLcJ9SdKFKxKjFLqX3IXZqoR6hOWErdd3Nu0u5JfXJbwsoLfv4WFS00pfO u85TqDKnr3pWyZ2yQLRIMDXHPtgS7LCCd9JXQykXLSNvS+jC55DvgB7tybectCRo+8Iz oroQK2w5UCz95qLK0A8ngmXfAv6VDcEeAqWQi62l2CTxVIdr09LvDVFBNjWaiGvlQ6qu WT2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w3KbIJQiIOy8N3UGEAqIqz0OpXOEfKfCNsBPN7OzZGI=; b=QsGU8J9fbN2sw8Kx8bP2pphAcz1TJazxUGXu7io3CzmHcFDRokM2Pn2ytBKWqPWs6k CXiWEm4ClYhPZRTGGEiq0rU41o8QKZu5MP/R/Z/P+HwO2NFTWenwfGZdu14pB4OvLEup IS+3Wrmg78ZvQ4364Rny4X/YzKqkBiKrqtrYKAaDEM4vnOdaDJ8+TDPLoSTeg433zuvL Y+dCPiPbX4euc9wn1y18kBbTEv6nvxbb/PQbqg8Dh3cqirUgSRU8DjchPzJQZuYv8hcB I9G4fAVXISGVQU0F3YQoZ9VKo18TC9kSTFGIib+rtMiNQ3Jll/CvlIH/re4HHcfzDpmu LEMg== X-Gm-Message-State: AJcUukcpq1Nus4TH6z+uc+Z8rbnRN1BEuHshDHQlUZONaEXOxKPeO5/J ++wsR7IUeVvGdeoMrKliT5C6JQ== X-Google-Smtp-Source: AFSGD/UIqZDh/l43NNC/5cSPHlmqbsSACc21s6yjEK3DUaREi7HP/Ds2QeOZzJnO1QuQ+Lnr3yYz3A== X-Received: by 2002:ac8:2a06:: with SMTP id k6mr19372341qtk.245.1545842715640; Wed, 26 Dec 2018 08:45:15 -0800 (PST) Received: from localhost.localdomain (c-73-69-118-222.hsd1.nh.comcast.net. [73.69.118.222]) by smtp.gmail.com with ESMTPSA id m41sm17874920qtc.58.2018.12.26.08.45.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Dec 2018 08:45:15 -0800 (PST) From: Pavel Tatashin To: catalin.marinas@arm.com, will.deacon@arm.com, akpm@linux-foundation.org, rppt@linux.vnet.ibm.com, mhocko@suse.com, ard.biesheuvel@linaro.org, andrew.murray@arm.com, james.morse@arm.com, marc.zyngier@arm.com, sboyd@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, pasha.tatashin@soleen.com Subject: [PATCH v3 3/3] arm64: Early boot time stamps Date: Wed, 26 Dec 2018 11:45:09 -0500 Message-Id: <20181226164509.22916-4-pasha.tatashin@soleen.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181226164509.22916-1-pasha.tatashin@soleen.com> References: <20181226164509.22916-1-pasha.tatashin@soleen.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181226_084528_891447_4457AA96 X-CRM114-Status: GOOD ( 11.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Allow printk time stamps/sched_clock() to be available from the early boot. Signed-off-by: Pavel Tatashin --- arch/arm64/kernel/setup.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 4b0e1231625c..28126facc4ed 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -279,8 +280,32 @@ arch_initcall(reserve_memblock_reserved_regions); u64 __cpu_logical_map[NR_CPUS] = { [0 ... NR_CPUS-1] = INVALID_HWID }; +/* + * Get time stamps available early in boot, useful to identify boot time issues + * from the early boot. + */ +static __init void sched_clock_early_init(void) +{ + u64 (*read_time)(void) = arch_counter_get_cntvct; + u64 freq = arch_timer_get_cntfrq(); + + /* + * The arm64 boot protocol mandates that CNTFRQ_EL0 reflects + * the timer frequency. To avoid breakage on misconfigured + * systems, do not register the early sched_clock if the + * programmed value if zero. Other random values will just + * result in random output. + */ + if (!freq) + return; + + sched_clock_register(read_time, ARCH_TIMER_NBITS, freq); +} + void __init setup_arch(char **cmdline_p) { + sched_clock_early_init(); + init_mm.start_code = (unsigned long) _text; init_mm.end_code = (unsigned long) _etext; init_mm.end_data = (unsigned long) _edata;