From: Mark Rutland <mark.rutland@arm.com>
To: Marc Zyngier <maz@kernel.org>
Cc: kernel-team@android.com, linux-arm-kernel@lists.infradead.org,
kvm@vger.kernel.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH 4/4] KVM: arm64: Check HCR_EL2 instead of shadow copy to swap PtrAuth registers
Date: Mon, 15 Jun 2020 11:25:29 +0100 [thread overview]
Message-ID: <20200615102529.GD773@C02TD0UTHF1T.local> (raw)
In-Reply-To: <20200615081954.6233-5-maz@kernel.org>
On Mon, Jun 15, 2020 at 09:19:54AM +0100, Marc Zyngier wrote:
> When save/restoring PtrAuth registers between host and guest, it is
> pretty useless to fetch the in-memory state, while we have the right
> state in the HCR_EL2 system register. Use that instead.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
It took me a while to spot that we switched the guest/host hcr_el2 value
in the __activate_traps() and __deactivate_traps() paths, but given that
this is only called in the __kvm_vcpu_run_*() paths called between
those, I agree this is sound. Given that:
Acked-by: Mark Rutland <mark.rutland@arm.com>
Mark.
> ---
> arch/arm64/include/asm/kvm_ptrauth.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_ptrauth.h b/arch/arm64/include/asm/kvm_ptrauth.h
> index 6301813dcace..f1830173fa9e 100644
> --- a/arch/arm64/include/asm/kvm_ptrauth.h
> +++ b/arch/arm64/include/asm/kvm_ptrauth.h
> @@ -74,7 +74,7 @@ alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
> b 1001f
> alternative_else_nop_endif
> 1000:
> - ldr \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
> + mrs \reg1, hcr_el2
> and \reg1, \reg1, #(HCR_API | HCR_APK)
> cbz \reg1, 1001f
> add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
> @@ -90,7 +90,7 @@ alternative_if_not ARM64_HAS_ADDRESS_AUTH_IMP_DEF
> b 2001f
> alternative_else_nop_endif
> 2000:
> - ldr \reg1, [\g_ctxt, #(VCPU_HCR_EL2 - VCPU_CONTEXT)]
> + mrs \reg1, hcr_el2
> and \reg1, \reg1, #(HCR_API | HCR_APK)
> cbz \reg1, 2001f
> add \reg1, \g_ctxt, #CPU_APIAKEYLO_EL1
> --
> 2.27.0
>
> _______________________________________________
> kvmarm mailing list
> kvmarm@lists.cs.columbia.edu
> https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-06-15 10:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-15 8:19 [PATCH 0/4] KVM/arm64: Enable PtrAuth on non-VHE KVM Marc Zyngier
2020-06-15 8:19 ` [PATCH 1/4] KVM: arm64: Enable Pointer Authentication at EL2 if available Marc Zyngier
2020-06-15 8:48 ` Andrew Scull
2020-06-15 10:45 ` Marc Zyngier
2020-06-15 10:03 ` Mark Rutland
2020-06-15 10:55 ` Marc Zyngier
2020-06-15 8:19 ` [PATCH 2/4] KVM: arm64: Allow ARM64_PTR_AUTH when ARM64_VHE=n Marc Zyngier
2020-06-15 8:58 ` Andrew Scull
2020-06-15 10:12 ` Mark Rutland
2020-06-15 8:19 ` [PATCH 3/4] KVM: arm64: Allow PtrAuth to be enabled from userspace on non-VHE systems Marc Zyngier
2020-06-15 9:09 ` Andrew Scull
2020-06-15 10:16 ` Mark Rutland
2020-06-15 8:19 ` [PATCH 4/4] KVM: arm64: Check HCR_EL2 instead of shadow copy to swap PtrAuth registers Marc Zyngier
2020-06-15 10:25 ` Mark Rutland [this message]
2020-06-15 12:59 ` [PATCH 0/4] KVM/arm64: Enable PtrAuth on non-VHE KVM Dave Martin
2020-06-15 13:22 ` Marc Zyngier
2020-06-15 14:17 ` Dave Martin
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=20200615102529.GD773@C02TD0UTHF1T.local \
--to=mark.rutland@arm.com \
--cc=kernel-team@android.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).