From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752023AbdAYRh1 (ORCPT ); Wed, 25 Jan 2017 12:37:27 -0500 Received: from foss.arm.com ([217.140.101.70]:41854 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751591AbdAYRhX (ORCPT ); Wed, 25 Jan 2017 12:37:23 -0500 Date: Wed, 25 Jan 2017 17:36:11 +0000 From: Mark Rutland To: Christopher Covington Cc: Fu Wei , "Rafael J. Wysocki" , Len Brown , Daniel Lezcano , Thomas Gleixner , Marc Zyngier , Lorenzo Pieralisi , Sudeep Holla , Hanjun Guo , linux-arm-kernel@lists.infradead.org, Linaro ACPI Mailman List , Linux Kernel Mailing List , ACPI Devel Maling List , rruigrok@codeaurora.org, "Abdulhamid, Harb" , Timur Tabi , G Gregory , Al Stone , Jon Masters , Wei Huang , Arnd Bergmann , Catalin Marinas , Will Deacon , Suravee Suthikulpanit , Leo Duran , Wim Van Sebroeck , Guenter Roeck , linux-watchdog@vger.kernel.org, Tomasz Nowicki , Christoffer Dall , Julien Grall Subject: Re: [PATCH v20 08/17] clocksource/drivers/arm_arch_timer: Rework counter frequency detection. Message-ID: <20170125173516.GA25470@leverpostej> References: <20170118132541.8989-1-fu.wei@linaro.org> <20170118132541.8989-9-fu.wei@linaro.org> <20170124172400.GG7572@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 25, 2017 at 10:38:01AM -0500, Christopher Covington wrote: > On 01/25/2017 01:46 AM, Fu Wei wrote: > > On 25 January 2017 at 01:24, Mark Rutland wrote: > >> On Wed, Jan 18, 2017 at 09:25:32PM +0800, fu.wei@linaro.org wrote: > >>> From: Fu Wei > > And for CNTFRQ(in CNTCTLBase and CNTBaseN) , we can NOT access it in > > Linux kernel (EL1), > > Because ARMv8 ARM says: > > In a system that implements both Secure and Non-secure states, this > > register is only accessible by Secure accesses. > > That means we still need to get the frequency of the system counter > > from CNTFRQ_EL0 in MMIO timer code. > > This have been proved when I tested this driver on foundation model, I > > got "0" when I access CNTFRQ from Linux kernel (Non-secure EL1) > > That sounds like a firmware problem. Firmware in EL3 is supposed to write > the value into CNTFRQ. Definitely. FW *should* program the CNTFRQ_EL0 CPU registers and any MMIO CNTFRQ registers. > If you're not currently using any firmware, I'd > recommend the bootwrapper on models/simulators/emulators. > > http://git.kernel.org/cgit/linux/kernel/git/mark/boot-wrapper-aarch64.git/tree/arch/aarch64/boot.S#n48 Unfortunately, the boot-wrapper only programs the CNTFRQ_EL0 CPU system registers, and does not program any MMIO CNTFRQ registers. IIRC the models it was originally written for didn't have any (and we had no DT binding until far later...). Luckily the model DTs do not expose any MMIO timer addresses to the kernel currently. Thanks, Mark.