ACK/CMNT: [PATCH 2/3] KVM: arm/arm64: Introduce vcpu_el1_is_32bit
Tyler Hicks
tyhicks at canonical.com
Wed Feb 20 09:12:59 UTC 2019
On 2019-02-19 14:02:34, Paolo Pisati wrote:
> From: Christoffer Dall <christoffer.dall at linaro.org>
>
> We have numerous checks around that checks if the HCR_EL2 has the RW bit
> set to figure out if we're running an AArch64 or AArch32 VM. In some
> cases, directly checking the RW bit (given its unintuitive name), is a
> bit confusing, and that's not going to improve as we move logic around
> for the following patches that optimize KVM on AArch64 hosts with VHE.
>
> Therefore, introduce a helper, vcpu_el1_is_32bit, and replace existing
> direct checks of HCR_EL2.RW with the helper.
>
> Reviewed-by: Julien Grall <julien.grall at arm.com>
> Reviewed-by: Julien Thierry <julien.thierry at arm.com>
> Acked-by: Marc Zyngier <marc.zyngier at arm.com>
> Reviewed-by: Andrew Jones <drjones at redhat.com>
> Signed-off-by: Christoffer Dall <christoffer.dall at linaro.org>
> Signed-off-by: Marc Zyngier <marc.zyngier at arm.com>
Needs the associated CVE id listed here in the commit message:
CVE-2018-18021
This can be done by whoever applies the patch.
> (partially cherry picked from commit e72341c5126a70072a10585c45923dd55050ca79)
> Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
Acked-by: Tyler Hicks <tyhicks at canonical.com>
Tyler
> ---
> arch/arm64/include/asm/kvm_emulate.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> index 413dc82..00da772 100644
> --- a/arch/arm64/include/asm/kvm_emulate.h
> +++ b/arch/arm64/include/asm/kvm_emulate.h
> @@ -45,6 +45,11 @@ void kvm_inject_undef32(struct kvm_vcpu *vcpu);
> void kvm_inject_dabt32(struct kvm_vcpu *vcpu, unsigned long addr);
> void kvm_inject_pabt32(struct kvm_vcpu *vcpu, unsigned long addr);
>
> +static inline bool vcpu_el1_is_32bit(struct kvm_vcpu *vcpu)
> +{
> + return !(vcpu->arch.hcr_el2 & HCR_RW);
> +}
> +
> static inline void vcpu_reset_hcr(struct kvm_vcpu *vcpu)
> {
> vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS;
> --
> 2.7.4
>
>
> --
> kernel-team mailing list
> kernel-team at lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
More information about the kernel-team
mailing list