On Thu, Feb 06, 2025 at 02:11:01PM +0000, Mark Rutland wrote: > The shared hyp switch header has a number of static functions which > might not be used by all files that include the header, and when unused > they will provoke compiler warnings, e.g. > > | In file included from arch/arm64/kvm/hyp/nvhe/hyp-main.c:8: > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:703:13: warning: 'kvm_hyp_handle_dabt_low' defined but not used [-Wunused-function] > | 703 | static bool kvm_hyp_handle_dabt_low(struct kvm_vcpu *vcpu, u64 *exit_code) > | | ^~~~~~~~~~~~~~~~~~~~~~~ > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:682:13: warning: 'kvm_hyp_handle_cp15_32' defined but not used [-Wunused-function] > | 682 | static bool kvm_hyp_handle_cp15_32(struct kvm_vcpu *vcpu, u64 *exit_code) > | | ^~~~~~~~~~~~~~~~~~~~~~ > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:662:13: warning: 'kvm_hyp_handle_sysreg' defined but not used [-Wunused-function] > | 662 | static bool kvm_hyp_handle_sysreg(struct kvm_vcpu *vcpu, u64 *exit_code) > | | ^~~~~~~~~~~~~~~~~~~~~ > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:458:13: warning: 'kvm_hyp_handle_fpsimd' defined but not used [-Wunused-function] > | 458 | static bool kvm_hyp_handle_fpsimd(struct kvm_vcpu *vcpu, u64 *exit_code) > | | ^~~~~~~~~~~~~~~~~~~~~ > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:329:13: warning: 'kvm_hyp_handle_mops' defined but not used [-Wunused-function] > | 329 | static bool kvm_hyp_handle_mops(struct kvm_vcpu *vcpu, u64 *exit_code) > | | ^~~~~~~~~~~~~~~~~~~ > > Mark these functions as 'inline' to suppress this warning. This > shouldn't result in any functional change. > > At the same time, avoid the use of __alias() in the header and alias > kvm_hyp_handle_iabt_low() and kvm_hyp_handle_watchpt_low() to > kvm_hyp_handle_memory_fault() using CPP, matching the style in the rest > of the kernel. For consistency, kvm_hyp_handle_memory_fault() is also > marked as 'inline'. > > Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx> > Reviewed-by: Mark Brown <broonie@xxxxxxxxxx> > Cc: Catalin Marinas <catalin.marinas@xxxxxxx> > Cc: Fuad Tabba <tabba@xxxxxxxxxx> > Cc: Marc Zyngier <maz@xxxxxxxxxx> > Cc: Mark Brown <broonie@xxxxxxxxxx> > Cc: Oliver Upton <oliver.upton@xxxxxxxxx> > Cc: Will Deacon <will@xxxxxxxxxx> > --- > arch/arm64/kvm/hyp/include/hyp/switch.h | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) Acked-by: Will Deacon <will@xxxxxxxxxx> Will