From: Christoffer Dall <christoffer.dall@linaro.org>
To: Shanker Donthineni <shankerd@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
Vikram Sethi <vikrams@codeaurora.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
kvmarm <kvmarm@lists.cs.columbia.edu>
Subject: Re: [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE
Date: Thu, 22 Feb 2018 09:42:31 +0100 [thread overview]
Message-ID: <20180222084231.GA29376@cbox> (raw)
In-Reply-To: <1519054687-14405-1-git-send-email-shankerd@codeaurora.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 <shankerd@codeaurora.org>
> ---
> 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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE
Date: Thu, 22 Feb 2018 09:42:31 +0100 [thread overview]
Message-ID: <20180222084231.GA29376@cbox> (raw)
In-Reply-To: <1519054687-14405-1-git-send-email-shankerd@codeaurora.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 <shankerd@codeaurora.org>
> ---
> 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
WARNING: multiple messages have this Message-ID (diff)
From: Christoffer Dall <christoffer.dall@linaro.org>
To: Shanker Donthineni <shankerd@codeaurora.org>
Cc: Marc Zyngier <marc.zyngier@arm.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
kvmarm <kvmarm@lists.cs.columbia.edu>,
Vikram Sethi <vikrams@codeaurora.org>
Subject: Re: [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE
Date: Thu, 22 Feb 2018 09:42:31 +0100 [thread overview]
Message-ID: <20180222084231.GA29376@cbox> (raw)
In-Reply-To: <1519054687-14405-1-git-send-email-shankerd@codeaurora.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 <shankerd@codeaurora.org>
> ---
> 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
next prev parent reply other threads:[~2018-02-22 8:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 15:38 [PATCH] KVM: arm/arm64: No need to zero CNTVOFF in kvm_timer_vcpu_put() for VHE Shanker Donthineni
2018-02-19 15:38 ` Shanker Donthineni
2018-02-19 15:38 ` Shanker Donthineni
2018-02-22 8:42 ` Christoffer Dall [this message]
2018-02-22 8:42 ` Christoffer Dall
2018-02-22 8:42 ` Christoffer Dall
2018-02-22 8:58 ` Marc Zyngier
2018-02-22 8:58 ` Marc Zyngier
2018-02-22 8:58 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180222084231.GA29376@cbox \
--to=christoffer.dall@linaro.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=shankerd@codeaurora.org \
--cc=vikrams@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.