mbox series

[0/3] arm64: KVM: Kiss hyp_alternate_select() goodbye

Message ID 20190901211237.11673-1-maz@kernel.org (mailing list archive)
Headers show
Series arm64: KVM: Kiss hyp_alternate_select() goodbye | expand

Message

Marc Zyngier Sept. 1, 2019, 9:12 p.m. UTC
hyp_alternate_select() is a leftover from the my second attempt at
supporting VHE (the first one was never merged, thankfully), and is
now an irrelevant relic. It was a way to patch function pointers
without having to dereference memory, a bit like static keys for
function calls.

Lovely idea, but since Christoffer mostly separated the VHE and !VHE
hypervisor paths, most of the uses of hyp_alternate_select() are
gone. What is left is two instances that are better replaced by
already existing static keys. One of the instances becomes
cpus_have_const_cap(), and the rest is a light sprinkling of
has_vhe().

So off it goes.

Marc Zyngier (3):
  arm64: KVM: Drop hyp_alternate_select for checking for
    ARM64_WORKAROUND_834220
  arm64: KVM: Replace hyp_alternate_select with has_vhe()
  arm64: KVM: Kill hyp_alternate_select()

 arch/arm64/include/asm/kvm_hyp.h | 24 ---------------------
 arch/arm64/kvm/hyp/switch.c      | 17 ++-------------
 arch/arm64/kvm/hyp/tlb.c         | 36 +++++++++++++++++++-------------
 3 files changed, 24 insertions(+), 53 deletions(-)

Comments

Christoffer Dall Sept. 2, 2019, 8 a.m. UTC | #1
On Sun, Sep 01, 2019 at 10:12:34PM +0100, Marc Zyngier wrote:
> hyp_alternate_select() is a leftover from the my second attempt at
> supporting VHE (the first one was never merged, thankfully), and is
> now an irrelevant relic. It was a way to patch function pointers
> without having to dereference memory, a bit like static keys for
> function calls.
> 
> Lovely idea, but since Christoffer mostly separated the VHE and !VHE
> hypervisor paths, most of the uses of hyp_alternate_select() are
> gone. What is left is two instances that are better replaced by
> already existing static keys. One of the instances becomes
> cpus_have_const_cap(), and the rest is a light sprinkling of
> has_vhe().
> 
> So off it goes.

I'm not sure I want to kiss hyp_alternate_select() at all, but away it
must go!

Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Andrew Jones Sept. 2, 2019, 8:34 a.m. UTC | #2
On Sun, Sep 01, 2019 at 10:12:34PM +0100, Marc Zyngier wrote:
> hyp_alternate_select() is a leftover from the my second attempt at
> supporting VHE (the first one was never merged, thankfully), and is
> now an irrelevant relic. It was a way to patch function pointers
> without having to dereference memory, a bit like static keys for
> function calls.
> 
> Lovely idea, but since Christoffer mostly separated the VHE and !VHE
> hypervisor paths, most of the uses of hyp_alternate_select() are
> gone. What is left is two instances that are better replaced by
> already existing static keys. One of the instances becomes
> cpus_have_const_cap(), and the rest is a light sprinkling of
> has_vhe().
> 
> So off it goes.
> 
> Marc Zyngier (3):
>   arm64: KVM: Drop hyp_alternate_select for checking for
>     ARM64_WORKAROUND_834220
>   arm64: KVM: Replace hyp_alternate_select with has_vhe()
>   arm64: KVM: Kill hyp_alternate_select()
> 
>  arch/arm64/include/asm/kvm_hyp.h | 24 ---------------------
>  arch/arm64/kvm/hyp/switch.c      | 17 ++-------------
>  arch/arm64/kvm/hyp/tlb.c         | 36 +++++++++++++++++++-------------
>  3 files changed, 24 insertions(+), 53 deletions(-)
> 
> -- 
> 2.20.1
>

Yay! The 'func()(...)' stuff always gave me cross-eyes.

Reviewed-by: Andrew Jones <drjones@redhat.com>