[PATCH v4 01/66] arm64: Add ARM64_HAS_NESTED_VIRT cpufeature

Zenghui Yu yuzenghui at huawei.com
Thu May 20 06:32:17 PDT 2021


On 2021/5/11 0:58, Marc Zyngier wrote:
> From: Jintack Lim <jintack.lim at linaro.org>
> 
> Add a new ARM64_HAS_NESTED_VIRT feature to indicate that the
> CPU has the ARMv8.3 nested virtualization capability.
> 
> This will be used to support nested virtualization in KVM.
> 
> Signed-off-by: Jintack Lim <jintack.lim at linaro.org>
> Signed-off-by: Andre Przywara <andre.przywara at arm.com>
> Signed-off-by: Christoffer Dall <christoffer.dall at arm.com>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
>  .../admin-guide/kernel-parameters.txt         |  4 +++
>  arch/arm64/include/asm/cpucaps.h              |  1 +
>  arch/arm64/kernel/cpufeature.c                | 25 +++++++++++++++++++
>  3 files changed, 30 insertions(+)

[...]

> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index efed2830d141..056de86d7f6f 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -1645,6 +1645,21 @@ static void cpu_copy_el2regs(const struct arm64_cpu_capabilities *__unused)
>  		write_sysreg(read_sysreg(tpidr_el1), tpidr_el2);
>  }
>  
> +static bool nested_param;
> +static bool has_nested_virt_support(const struct arm64_cpu_capabilities *cap,
> +				    int scope)
> +{
> +	return has_cpuid_feature(cap, scope) &&
> +		nested_param;
> +}

Nitpick:

How about putting them into a single line (they still perfectly
fit within the 80-colume limit)?

Zenghui



More information about the linux-arm-kernel mailing list