From: Christoffer Dall <christoffer.dall@linaro.org>
To: Julien Thierry <julien.thierry@arm.com>
Cc: linux-arm-kernel@lists.infradead.org,
kvmarm@lists.cs.columbia.edu, Marc Zyngier <marc.zyngier@arm.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu
Date: Thu, 7 Dec 2017 10:35:31 +0100 [thread overview]
Message-ID: <20171207093531.GO32397@cbox> (raw)
In-Reply-To: <1512580189-5921-1-git-send-email-julien.thierry@arm.com>
On Wed, Dec 06, 2017 at 05:09:49PM +0000, Julien Thierry wrote:
> When VHE is not present, KVM needs to save and restores PMSCR_EL1 when
> possible. If SPE is used by the host, value of PMSCR_EL1 cannot be saved
> for the guest.
> If the host starts using SPE between two save+restore on the same vcpu,
> restore will write the value of PMSCR_EL1 read during the first save.
>
> Make sure __debug_save_spe_nvhe clears the value of the saved PMSCR_EL1
> when the guest cannot use SPE.
>
> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: <stable@vger.kernel.org>
> ---
> arch/arm64/kvm/hyp/debug-sr.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/debug-sr.c b/arch/arm64/kvm/hyp/debug-sr.c
> index 321c9c0..f4363d4 100644
> --- a/arch/arm64/kvm/hyp/debug-sr.c
> +++ b/arch/arm64/kvm/hyp/debug-sr.c
> @@ -74,6 +74,9 @@ static void __hyp_text __debug_save_spe_nvhe(u64 *pmscr_el1)
> {
> u64 reg;
>
> + /* Clear pmscr in case of early return */
> + *pmscr_el1 = 0;
> +
> /* SPE present on this CPU? */
> if (!cpuid_feature_extract_unsigned_field(read_sysreg(id_aa64dfr0_el1),
> ID_AA64DFR0_PMSVER_SHIFT))
> --
> 1.9.1
Applied, thanks.
-Christoffer
WARNING: multiple messages have this Message-ID (diff)
From: christoffer.dall@linaro.org (Christoffer Dall)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu
Date: Thu, 7 Dec 2017 10:35:31 +0100 [thread overview]
Message-ID: <20171207093531.GO32397@cbox> (raw)
In-Reply-To: <1512580189-5921-1-git-send-email-julien.thierry@arm.com>
On Wed, Dec 06, 2017 at 05:09:49PM +0000, Julien Thierry wrote:
> When VHE is not present, KVM needs to save and restores PMSCR_EL1 when
> possible. If SPE is used by the host, value of PMSCR_EL1 cannot be saved
> for the guest.
> If the host starts using SPE between two save+restore on the same vcpu,
> restore will write the value of PMSCR_EL1 read during the first save.
>
> Make sure __debug_save_spe_nvhe clears the value of the saved PMSCR_EL1
> when the guest cannot use SPE.
>
> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
> Cc: Christoffer Dall <christoffer.dall@linaro.org>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: <stable@vger.kernel.org>
> ---
> arch/arm64/kvm/hyp/debug-sr.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/arch/arm64/kvm/hyp/debug-sr.c b/arch/arm64/kvm/hyp/debug-sr.c
> index 321c9c0..f4363d4 100644
> --- a/arch/arm64/kvm/hyp/debug-sr.c
> +++ b/arch/arm64/kvm/hyp/debug-sr.c
> @@ -74,6 +74,9 @@ static void __hyp_text __debug_save_spe_nvhe(u64 *pmscr_el1)
> {
> u64 reg;
>
> + /* Clear pmscr in case of early return */
> + *pmscr_el1 = 0;
> +
> /* SPE present on this CPU? */
> if (!cpuid_feature_extract_unsigned_field(read_sysreg(id_aa64dfr0_el1),
> ID_AA64DFR0_PMSVER_SHIFT))
> --
> 1.9.1
Applied, thanks.
-Christoffer
next prev parent reply other threads:[~2017-12-07 9:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 17:09 [PATCH] arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu Julien Thierry
2017-12-06 17:09 ` Julien Thierry
2017-12-06 17:09 ` Julien Thierry
2017-12-06 17:25 ` Will Deacon
2017-12-06 17:25 ` Will Deacon
2017-12-06 17:25 ` Will Deacon
2017-12-07 9:35 ` Christoffer Dall [this message]
2017-12-07 9:35 ` Christoffer Dall
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=20171207093531.GO32397@cbox \
--to=christoffer.dall@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=julien.thierry@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=marc.zyngier@arm.com \
--cc=stable@vger.kernel.org \
--cc=will.deacon@arm.com \
/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.