lkml.org 
[lkml]   [2022]   [Mar]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 01/22] KVM: arm64: Introduce template for inline functions
    Date
    The inline functions used to get the SMCCC parameters have same
    layout. It means these functions can be presented by an unified
    template, to make the code simplified. Besides, this adds more
    similar inline functions like smccc_get_arg{4,5,6,7,8}() to get
    more SMCCC arguments, which are needed by SDEI virtualization
    support.

    Signed-off-by: Gavin Shan <gshan@redhat.com>
    ---
    include/kvm/arm_hypercalls.h | 24 ++++++++++++------------
    1 file changed, 12 insertions(+), 12 deletions(-)

    diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
    index 0e2509d27910..d5144c852fe4 100644
    --- a/include/kvm/arm_hypercalls.h
    +++ b/include/kvm/arm_hypercalls.h
    @@ -13,20 +13,20 @@ static inline u32 smccc_get_function(struct kvm_vcpu *vcpu)
    return vcpu_get_reg(vcpu, 0);
    }

    -static inline unsigned long smccc_get_arg1(struct kvm_vcpu *vcpu)
    -{
    - return vcpu_get_reg(vcpu, 1);
    -}
    -
    -static inline unsigned long smccc_get_arg2(struct kvm_vcpu *vcpu)
    -{
    - return vcpu_get_reg(vcpu, 2);
    +#define SMCCC_DECLARE_GET_ARG(reg) \
    +static inline unsigned long smccc_get_arg##reg(struct kvm_vcpu *vcpu) \
    +{ \
    + return vcpu_get_reg(vcpu, reg); \
    }

    -static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu)
    -{
    - return vcpu_get_reg(vcpu, 3);
    -}
    +SMCCC_DECLARE_GET_ARG(1)
    +SMCCC_DECLARE_GET_ARG(2)
    +SMCCC_DECLARE_GET_ARG(3)
    +SMCCC_DECLARE_GET_ARG(4)
    +SMCCC_DECLARE_GET_ARG(5)
    +SMCCC_DECLARE_GET_ARG(6)
    +SMCCC_DECLARE_GET_ARG(7)
    +SMCCC_DECLARE_GET_ARG(8)

    static inline void smccc_set_retval(struct kvm_vcpu *vcpu,
    unsigned long a0,
    --
    2.23.0
    \
     
     \ /
      Last update: 2022-03-22 09:09    [W:4.131 / U:0.352 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site