[PATCH v2 12/13] KVM: arm64: Expose ID_AA64MMFR4_EL1 to guests

Suzuki K Poulose suzuki.poulose at arm.com
Wed Nov 22 10:01:24 PST 2023


On 20/11/2023 12:37, Marc Zyngier wrote:
> We can now expose ID_AA64MMFR4_EL1 to guests, and let NV guests
> understand that they cannot really switch HCR_EL2.E2H to 0 on
> some platforms.
> 
> Signed-off-by: Marc Zyngier <maz at kernel.org>

Reviewed-by: Suzuki K Poulose <suzuki.poulose at arm.com>


> ---
>   arch/arm64/kvm/nested.c   | 4 ++++
>   arch/arm64/kvm/sys_regs.c | 2 +-
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
> index 042695a210ce..3885f1c93979 100644
> --- a/arch/arm64/kvm/nested.c
> +++ b/arch/arm64/kvm/nested.c
> @@ -137,6 +137,10 @@ void access_nested_id_reg(struct kvm_vcpu *v, struct sys_reg_params *p,
>   		val |= FIELD_PREP(NV_FTR(MMFR2, TTL), 0b0001);
>   		break;
>   
> +	case SYS_ID_AA64MMFR4_EL1:
> +		val &= NV_FTR(MMFR4, E2H0);
> +		break;
> +
>   	case SYS_ID_AA64DFR0_EL1:
>   		/* Only limited support for PMU, Debug, BPs and WPs */
>   		val &= (NV_FTR(DFR0, PMUVer)	|
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 9f76f24b96f8..ff2e66f0bda1 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -2197,7 +2197,7 @@ static const struct sys_reg_desc sys_reg_descs[] = {
>   					ID_AA64MMFR2_EL1_NV |
>   					ID_AA64MMFR2_EL1_CCIDX)),
>   	ID_SANITISED(ID_AA64MMFR3_EL1),
> -	ID_UNALLOCATED(7,4),
> +	ID_SANITISED(ID_AA64MMFR4_EL1),
>   	ID_UNALLOCATED(7,5),
>   	ID_UNALLOCATED(7,6),
>   	ID_UNALLOCATED(7,7),




More information about the linux-arm-kernel mailing list