lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5112b3ba-d038-f622-c67f-e53695cbef37@redhat.com>
Date:   Tue, 9 Nov 2021 16:26:00 +0100
From:   Eric Auger <eauger@...hat.com>
To:     Gavin Shan <gshan@...hat.com>, kvmarm@...ts.cs.columbia.edu
Cc:     maz@...nel.org, linux-kernel@...r.kernel.org,
        Jonathan.Cameron@...wei.com, pbonzini@...hat.com, will@...nel.org
Subject: Re: [PATCH v4 01/21] KVM: arm64: Introduce template for inline
 functions

Hi Gavin,

On 8/15/21 2:13 AM, Gavin Shan wrote:
> The inline functions used to get the SMCCC parameters have same
> layout. It means these functions can be presented by a template,
> to make the code simplified. Besides, this adds more similar inline
> functions like smccc_get_arg{4,5,6,7,8}() to visit more SMCCC arguments,
> which are needed by SDEI virtualization support.
> 
> Signed-off-by: Gavin Shan <gshan@...hat.com>
> ---
>  include/kvm/arm_hypercalls.h | 34 +++++++++++++++-------------------
>  1 file changed, 15 insertions(+), 19 deletions(-)
> 
> diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
> index 0e2509d27910..ebecb6c68254 100644
> --- a/include/kvm/arm_hypercalls.h
> +++ b/include/kvm/arm_hypercalls.h
> @@ -6,27 +6,21 @@
>  
>  #include <asm/kvm_emulate.h>
>  
> -int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
> -
> -static inline u32 smccc_get_function(struct kvm_vcpu *vcpu)
> -{
> -	return vcpu_get_reg(vcpu, 0);
> +#define SMCCC_DECLARE_GET_FUNC(type, name, reg)			\
> +static inline type smccc_get_##name(struct kvm_vcpu *vcpu)	\
> +{								\
> +	return vcpu_get_reg(vcpu, reg);				\
>  }
>  
> -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);
> -}
> -
> -static inline unsigned long smccc_get_arg3(struct kvm_vcpu *vcpu)
> -{
> -	return vcpu_get_reg(vcpu, 3);
> -}
> +SMCCC_DECLARE_GET_FUNC(u32,           function, 0)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg1,     1)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg2,     2)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg3,     3)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg4,     4)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg5,     5)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg6,     6)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg7,     7)
> +SMCCC_DECLARE_GET_FUNC(unsigned long, arg8,     8)
I think I would keep smccc_get_function() and add macros to get the
64-bit args. SMCCC_DECLARE_GET_FUNC is an odd macro name for a function
fetching an arg. I would suggest:

> +#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 void smccc_set_retval(struct kvm_vcpu *vcpu,
>  				    unsigned long a0,
> @@ -40,4 +34,6 @@ static inline void smccc_set_retval(struct kvm_vcpu *vcpu,
>  	vcpu_set_reg(vcpu, 3, a3);
>  }
>  
> +int kvm_hvc_call_handler(struct kvm_vcpu *vcpu);
> +
spurious change?
>  #endif
> 
Thanks

Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ