On Thu, Feb 06, 2025 at 02:11:00PM +0000, Mark Rutland wrote: > The hyp exit handling logic is largely shared between VHE and nVHE/hVHE, > with common logic in arch/arm64/kvm/hyp/include/hyp/switch.h. The code > in the header depends on function definitions provided by > arch/arm64/kvm/hyp/vhe/switch.c and arch/arm64/kvm/hyp/nvhe/switch.c > when they include the header. > > This is an unusual header dependency, and prevents the use of > arch/arm64/kvm/hyp/include/hyp/switch.h in other files as this would > result in compiler warnings regarding missing definitions, e.g. > > | In file included from arch/arm64/kvm/hyp/nvhe/hyp-main.c:8: > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:733:31: warning: 'kvm_get_exit_handler_array' used but never defined > | 733 | static const exit_handler_fn *kvm_get_exit_handler_array(struct kvm_vcpu *vcpu); > | | ^~~~~~~~~~~~~~~~~~~~~~~~~~ > | ./arch/arm64/kvm/hyp/include/hyp/switch.h:735:13: warning: 'early_exit_filter' used but never defined > | 735 | static void early_exit_filter(struct kvm_vcpu *vcpu, u64 *exit_code); > | | ^~~~~~~~~~~~~~~~~ > > Refactor the logic such that the header doesn't depend on anything from > the C files. There should be no functional change as a result of this > patch. > > Signed-off-by: Mark Rutland <mark.rutland@xxxxxxx> > 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 | 30 +++++-------------------- > arch/arm64/kvm/hyp/nvhe/switch.c | 30 ++++++++++++++----------- > arch/arm64/kvm/hyp/vhe/switch.c | 9 ++++---- > 3 files changed, 27 insertions(+), 42 deletions(-) Acked-by: Will Deacon <will@xxxxxxxxxx> Will