Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 107EDC4338F for ; Wed, 11 Aug 2021 09:01:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E89366101E for ; Wed, 11 Aug 2021 09:01:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236255AbhHKJCA (ORCPT ); Wed, 11 Aug 2021 05:02:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:58750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236270AbhHKJB7 (ORCPT ); Wed, 11 Aug 2021 05:01:59 -0400 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DE7060FE6; Wed, 11 Aug 2021 09:01:34 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mDk7A-004H2h-Iv; Wed, 11 Aug 2021 10:01:32 +0100 Date: Wed, 11 Aug 2021 10:01:32 +0100 Message-ID: <87wnos9wyb.wl-maz@kernel.org> From: Marc Zyngier To: Oliver Upton Cc: kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, Paolo Bonzini , Sean Christopherson , Peter Shier , Jim Mattson , David Matlack , Ricardo Koller , Jing Zhang , Raghavendra Rao Anata , James Morse , Alexandru Elisei , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, Andrew Jones , Will Deacon , Catalin Marinas Subject: Re: [PATCH v6 17/21] KVM: arm64: Allow userspace to configure a guest's counter-timer offset In-Reply-To: References: <20210804085819.846610-1-oupton@google.com> <20210804085819.846610-18-oupton@google.com> <87a6lpbmbb.wl-maz@kernel.org> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: oupton@google.com, kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu, pbonzini@redhat.com, seanjc@google.com, pshier@google.com, jmattson@google.com, dmatlack@google.com, ricarkol@google.com, jingzhangos@google.com, rananta@google.com, james.morse@arm.com, Alexandru.Elisei@arm.com, suzuki.poulose@arm.com, linux-arm-kernel@lists.infradead.org, drjones@redhat.com, will@kernel.org, catalin.marinas@arm.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, 10 Aug 2021 18:55:12 +0100, Oliver Upton wrote: > > On Tue, Aug 10, 2021 at 3:56 AM Marc Zyngier wrote: > > > > On Wed, 04 Aug 2021 09:58:15 +0100, > > Oliver Upton wrote: [...] > > > diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h > > > index 73c7139c866f..7252ffa3d675 100644 > > > --- a/include/clocksource/arm_arch_timer.h > > > +++ b/include/clocksource/arm_arch_timer.h > > > @@ -21,6 +21,7 @@ > > > #define CNTHCTL_EVNTEN (1 << 2) > > > #define CNTHCTL_EVNTDIR (1 << 3) > > > #define CNTHCTL_EVNTI (0xF << 4) > > > +#define CNTHCTL_ECV (1 << 12) > > > > > > enum arch_timer_reg { > > > ARCH_TIMER_REG_CTRL, > > > > You also want to document that SCR_EL3.ECVEn has to be set to 1 for > > this to work (see Documentation/arm64/booting.txt). And if it isn't, > > the firmware better handle the CNTPOFF_EL2 traps correctly... > > I'll grab the popcorn now ;-) Adding docs for this, good idea. > > > What firmware did you use for this? I think we need to update the boot > > wrapper, but that's something that can be done in parallel. > > I had actually just done a direct boot from ARM-TF -> Linux, nothing > else in between. Ah, right. I tend to use the boot-wrapper[1] to build a single binary that contains the 'boot loader', DT and kernel. Using ATF is probably more representative of the final thing, but the boot-wrapper is dead easy to hack on... Thanks, M. [1] git://git.kernel.org/pub/scm/linux/kernel/git/mark/boot-wrapper-aarch64.git -- Without deviation from the norm, progress is not possible.