[PATCH 2/3] KVM: arm64: Generate final CTR_EL0 value when running in Protected mode
Quentin Perret
qperret at google.com
Tue Mar 23 09:47:08 GMT 2021
Hi Marc,
On Monday 22 Mar 2021 at 18:37:14 (+0000), Marc Zyngier wrote:
> Can't say I'm keen on the yucky bit, but here's an alternative (ha!)
> for you:
>
> diff --git a/arch/arm64/include/asm/assembler.h b/arch/arm64/include/asm/assembler.h
> index 1a4cee7eb3c9..7582c3bd2f05 100644
> --- a/arch/arm64/include/asm/assembler.h
> +++ b/arch/arm64/include/asm/assembler.h
> @@ -278,6 +278,9 @@ alternative_else
> ldr_l \reg, arm64_ftr_reg_ctrel0 + ARM64_FTR_SYSVAL
> alternative_endif
> #else
> +alternative_if_not ARM64_KVM_PROTECTED_MODE
> + ASM_BUG()
> +alternative_else_nop_endif
> alternative_cb kvm_compute_final_ctr_el0
> movz \reg, #0
> movk \reg, #0, lsl #16
>
> Yes, it is one more instruction, but it is cleaner and allows us to
> from the first patch of the series.
>
> What do you think?
Yes, I think having the ASM_BUG() in this macro is bit nicer and I doubt
the additional nop will make any difference, so this is looking good to
me!
Thanks,
Quentin
More information about the linux-arm-kernel
mailing list