[PATCH 16/25] KVM: arm64: Rename __check_nv_sr_forward() to triage_sysreg_trap()
Joey Gouly
joey.gouly at arm.com
Wed Jan 24 08:57:20 PST 2024
On Mon, Jan 22, 2024 at 08:18:43PM +0000, Marc Zyngier wrote:
> __check_nv_sr_forward() is not specific to NV anymore, and does
> a lot more. Rename it to triage_sysreg_trap(), making it plain
> that its role is to handle where an exception is to be handled.
>
> Signed-off-by: Marc Zyngier <maz at kernel.org>
> ---
> arch/arm64/include/asm/kvm_nested.h | 1 -
> arch/arm64/kvm/emulate-nested.c | 2 +-
> arch/arm64/kvm/sys_regs.c | 2 +-
> arch/arm64/kvm/sys_regs.h | 2 ++
> 4 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kvm_nested.h b/arch/arm64/include/asm/kvm_nested.h
> index 68465f87d308..c77d795556e1 100644
> --- a/arch/arm64/include/asm/kvm_nested.h
> +++ b/arch/arm64/include/asm/kvm_nested.h
> @@ -60,7 +60,6 @@ static inline u64 translate_ttbr0_el2_to_ttbr0_el1(u64 ttbr0)
> return ttbr0 & ~GENMASK_ULL(63, 48);
> }
>
> -extern bool __check_nv_sr_forward(struct kvm_vcpu *vcpu, int *sr_idx);
>
> int kvm_init_nv_sysregs(struct kvm *kvm);
>
> diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
> index 54ab4d240fc6..b39ced4ea331 100644
> --- a/arch/arm64/kvm/emulate-nested.c
> +++ b/arch/arm64/kvm/emulate-nested.c
> @@ -2001,7 +2001,7 @@ static bool check_fgt_bit(struct kvm *kvm, bool is_read,
> return !(kvm_get_sysreg_res0(kvm, sr) & BIT(tc.bit));
> }
>
> -bool __check_nv_sr_forward(struct kvm_vcpu *vcpu, int *sr_index)
> +bool triage_sysreg_trap(struct kvm_vcpu *vcpu, int *sr_index)
> {
> union trap_config tc;
> enum trap_behaviour b;
> diff --git a/arch/arm64/kvm/sys_regs.c b/arch/arm64/kvm/sys_regs.c
> index 794d1f8c9bfe..c48bc2577162 100644
> --- a/arch/arm64/kvm/sys_regs.c
> +++ b/arch/arm64/kvm/sys_regs.c
> @@ -3484,7 +3484,7 @@ int kvm_handle_sys_reg(struct kvm_vcpu *vcpu)
>
> trace_kvm_handle_sys_reg(esr);
>
> - if (__check_nv_sr_forward(vcpu, &sr_idx))
> + if (triage_sysreg_trap(vcpu, &sr_idx))
> return 1;
>
> params = esr_sys64_to_params(esr);
> diff --git a/arch/arm64/kvm/sys_regs.h b/arch/arm64/kvm/sys_regs.h
> index c65c129b3500..997eea21ba2a 100644
> --- a/arch/arm64/kvm/sys_regs.h
> +++ b/arch/arm64/kvm/sys_regs.h
> @@ -233,6 +233,8 @@ int kvm_sys_reg_get_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
> int kvm_sys_reg_set_user(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg,
> const struct sys_reg_desc table[], unsigned int num);
>
> +bool triage_sysreg_trap(struct kvm_vcpu *vcpu, int *sr_index);
> +
> #define AA32(_x) .aarch32_map = AA32_##_x
> #define Op0(_x) .Op0 = _x
> #define Op1(_x) .Op1 = _x
It's strange having triage_sysreg_trap() in emulate-nested.c, but moving that
would be churn for little benefit. Maybe once NV is all in.
Reviewed-by: Joey Gouly <joey.gouly at arm.com>
Thanks,
Joey
More information about the linux-arm-kernel
mailing list