Received: by 10.223.185.116 with SMTP id b49csp1665417wrg; Thu, 22 Feb 2018 00:43:28 -0800 (PST) X-Google-Smtp-Source: AH8x2270rMi3Ir6wDSG7bVcxbpKaCmlCuyQEQtGBd2uvmdVKmNgRmyjOUnf57Fak9qtXF0m4cQqr X-Received: by 2002:a17:902:9a98:: with SMTP id w24-v6mr5726780plp.188.1519289008283; Thu, 22 Feb 2018 00:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519289008; cv=none; d=google.com; s=arc-20160816; b=O01xkhaD9SMi4uPhP8j9pjeoAcV2G0gcqr/Ufq2W7b58qvGm+bI2w9m6OV7yrN4iT0 Nfh//XkyZMDqlrGSRdvwNDuUYu8rhS2HOIcmZwBYw7INO2LBFha4lvij45e88y2p9dKy Ei3L1aEyNeWKtA/LZ4XeBeNpnq2HxCea4C+CUAMTF4SzeLQt7WEoQNL1/+JQo5gAG9ue SUAQSrX0GXlf9L/qYYyo21w6b/LF973YHd5Vj78a2HPaxp3nvWG8oobi/d9FGcQ2auqv bnukNcmqTShwgIKSJLLIYr4zAfPIDPd7fJn9N96wSvF1vv4IET9vKt/HfjevGVA4TL8j YOrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=n5EXFE3ApgEZY9kK2yxNGPmbsnfaN9SIanP0nPEiJmQ=; b=TEZ2+fVfm29M43WVpBWIT39T6xGzNClKCYFkeUp4yuOsQA3qXqSTeN6PYLqK+UNTkE XGQLfhiCbtcwqn1cljl1D2r/H74EeIfyY5q/YEQaO2zQsaKZ34W/7T+RAXV1OpSUnQs9 ZPvoVpUJTJpQ5Ff21XiNz6GbUsu+U/7jt/cKztEJQIuNFb/ICoptdBP7ISm5D6ITQJeZ y9OFNjrEjgj2WB2q5b665gYRRy4MWAIVc3QyeT9+yFNfaZdnknr6gKiBPgRrz1ka0C5o 9rDPknTURL7Y2vI6DJnhzyJWU47Uvy5CmIwaXGZPeZr1RkGMTsSQxvT/i/sxaZ88YFJ8 0apQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Ux/k/LRy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21-v6si1281408plo.46.2018.02.22.00.43.13; Thu, 22 Feb 2018 00:43:28 -0800 (PST) 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=@linaro.org header.s=google header.b=Ux/k/LRy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752847AbeBVImg (ORCPT + 99 others); Thu, 22 Feb 2018 03:42:36 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:35387 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752765AbeBVIme (ORCPT ); Thu, 22 Feb 2018 03:42:34 -0500 Received: by mail-wm0-f66.google.com with SMTP id x21so2155495wmh.0 for ; Thu, 22 Feb 2018 00:42:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=n5EXFE3ApgEZY9kK2yxNGPmbsnfaN9SIanP0nPEiJmQ=; b=Ux/k/LRyl/V+GlZgBrAR2qu/YPRnpO49tbjKjPsZTWuOQ3zIlkFIiiZ0ny8CURJZnh vOV1XHnNhWvD0AhqWE0ykf/KDI/U3RSGYeqOd7M+QZHM+i3aKSfBx+y/hI62HWQlnQVI LNZdt5xpCqP+y2FyDTJk2LNSX79u1zrWmSGwM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=n5EXFE3ApgEZY9kK2yxNGPmbsnfaN9SIanP0nPEiJmQ=; b=mMJFPnBGj/L+aI9gfCKYeLj8nPfCnK9ipCyPEnlEWsXQSUQ8fNY4Vpq0EDOFu7KRid MAoNo8gUIyrvxDJ8a/j46qdDffk4/Zt1mykBNwG6RECx5NIQMWm5w56gmFr2NXtT896p zaDoTRlIC52EiuOeRDs2UrqxVu/8P4qOlVbQAzyjFEnREq3xnx4m/DauYDz1WhDoTWsu 8an6KYUfFtmL0s+K3nOyAIx4kSmwS4yeIjoSGasGd+Ev3Xzl7eVGISNexiuu9nmKjZrz zYSOL2bOrOkyxTanwaFTBMOSu/1OjwdQhsNZPt10tmr/bvLecc20jUjDtDLm9TAP5aj6 /fQQ== X-Gm-Message-State: APf1xPAVQhehkTZIOtAZ4hw+ph3/BJysgGnK/sQL/Nsn7QyrMzh9C3zV RoURbTHkxn26X+OY1KlnzK88bg== X-Received: by 10.80.169.230 with SMTP id n93mr8335086edc.202.1519288953500; Thu, 22 Feb 2018 00:42:33 -0800 (PST) Received: from localhost (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id t19sm5759812edh.22.2018.02.22.00.42.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Feb 2018 00:42:32 -0800 (PST) Date: Thu, 22 Feb 2018 09:42:31 +0100 From: Christoffer Dall To: Shanker Donthineni Cc: Marc Zyngier , linux-kernel , linux-arm-kernel , kvmarm , Vikram Sethi Subject: Re: [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE Message-ID: <20180222084231.GA29376@cbox> References: <1519054687-14405-1-git-send-email-shankerd@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1519054687-14405-1-git-send-email-shankerd@codeaurora.org> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Shanker, On Mon, Feb 19, 2018 at 09:38:07AM -0600, Shanker Donthineni wrote: > In AArch64/AArch32, the virtual counter uses a fixed virtual offset > of zero in the following situations as per ARMv8 specifications: > > 1) HCR_EL2.E2H is 1, and CNTVCT_EL0/CNTVCT are read from EL2. > 2) HCR_EL2.{E2H, TGE} is {1, 1}, and either: > — CNTVCT_EL0 is read from Non-secure EL0 or EL2. > — CNTVCT is read from Non-secure EL0. > > So, no need to zero CNTVOFF_EL2/CNTVOFF for VHE case. > > Signed-off-by: Shanker Donthineni > --- > virt/kvm/arm/arch_timer.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c > index 70268c0..86eca324 100644 > --- a/virt/kvm/arm/arch_timer.c > +++ b/virt/kvm/arm/arch_timer.c > @@ -541,9 +541,11 @@ void kvm_timer_vcpu_put(struct kvm_vcpu *vcpu) > * The kernel may decide to run userspace after calling vcpu_put, so > * we reset cntvoff to 0 to ensure a consistent read between user > * accesses to the virtual counter and kernel access to the physical > - * counter. > + * counter of non-VHE case. For VHE, the virtual counter uses a fixed > + * virtual offset of zero, so no need to zero CNTVOFF_EL2 register. > */ > - set_cntvoff(0); > + if (!has_vhe()) > + set_cntvoff(0); > } > > /* I'm okay with this change. I don't think there's a huge gain here though. Marc, any thoughts or concerns? Thanks, -Christoffer