On Thu, Oct 7, 2021 at 5:24 PM Paolo Bonzini <pbonz...@redhat.com> wrote:

> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
>

lgtm
Reviewed-by: Marc-André Lureau <marcandre.lur...@redhat.com>


> ---
>  configure   | 91 -----------------------------------------------------
>  meson.build | 45 ++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+), 91 deletions(-)
>
> diff --git a/configure b/configure
> index 2091844ad6..33d330dcc9 100755
> --- a/configure
> +++ b/configure
> @@ -3108,19 +3108,6 @@ elif test "$tpm" = "yes"; then
>    fi
>  fi
>
> -##########################################
> -# iovec probe
> -cat > $TMPC <<EOF
> -#include <sys/types.h>
> -#include <sys/uio.h>
> -#include <unistd.h>
> -int main(void) { return sizeof(struct iovec); }
> -EOF
> -iovec=no
> -if compile_prog "" "" ; then
> -  iovec=yes
> -fi
> -
>  ##########################################
>  # fdt probe
>
> @@ -3562,42 +3549,6 @@ EOF
>    fi
>  fi
>
> -#########################################
> -# See if 64-bit atomic operations are supported.
> -# Note that without __atomic builtins, we can only
> -# assume atomic loads/stores max at pointer size.
> -
> -cat > $TMPC << EOF
> -#include <stdint.h>
> -int main(void)
> -{
> -  uint64_t x = 0, y = 0;
> -  y = __atomic_load_n(&x, __ATOMIC_RELAXED);
> -  __atomic_store_n(&x, y, __ATOMIC_RELAXED);
> -  __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED,
> __ATOMIC_RELAXED);
> -  __atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
> -  __atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
> -  return 0;
> -}
> -EOF
> -if compile_prog "" "" ; then
> -  atomic64=yes
> -fi
> -
> -########################################
> -# check if getauxval is available.
> -
> -getauxval=no
> -cat > $TMPC << EOF
> -#include <sys/auxv.h>
> -int main(void) {
> -  return getauxval(AT_HWCAP) == 0;
> -}
> -EOF
> -if compile_prog "" "" ; then
> -    getauxval=yes
> -fi
> -
>  ########################################
>  # check if ccache is interfering with
>  # semantic analysis of macros
> @@ -3671,33 +3622,6 @@ else
>      membarrier=no
>  fi
>
> -##########################################
> -# check for usable AF_VSOCK environment
> -have_af_vsock=no
> -cat > $TMPC << EOF
> -#include <errno.h>
> -#include <sys/types.h>
> -#include <sys/socket.h>
> -#if !defined(AF_VSOCK)
> -# error missing AF_VSOCK flag
> -#endif
> -#include <linux/vm_sockets.h>
> -int main(void) {
> -    int sock, ret;
> -    struct sockaddr_vm svm;
> -    socklen_t len = sizeof(svm);
> -    sock = socket(AF_VSOCK, SOCK_STREAM, 0);
> -    ret = getpeername(sock, (struct sockaddr *)&svm, &len);
> -    if ((ret == -1) && (errno == ENOTCONN)) {
> -        return 0;
> -    }
> -    return -1;
> -}
> -EOF
> -if compile_prog "" "" ; then
> -    have_af_vsock=yes
> -fi
> -
>  ##########################################
>  # check for usable AF_ALG environment
>  have_afalg=no
> @@ -4173,9 +4097,6 @@ fi
>  if test "$vhost_user_fs" = "yes" ; then
>    echo "CONFIG_VHOST_USER_FS=y" >> $config_host_mak
>  fi
> -if test "$iovec" = "yes" ; then
> -  echo "CONFIG_IOVEC=y" >> $config_host_mak
> -fi
>  if test "$membarrier" = "yes" ; then
>    echo "CONFIG_MEMBARRIER=y" >> $config_host_mak
>  fi
> @@ -4245,14 +4166,6 @@ if test "$cmpxchg128" = "yes" ; then
>    echo "CONFIG_CMPXCHG128=y" >> $config_host_mak
>  fi
>
> -if test "$atomic64" = "yes" ; then
> -  echo "CONFIG_ATOMIC64=y" >> $config_host_mak
> -fi
> -
> -if test "$getauxval" = "yes" ; then
> -  echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
> -fi
> -
>  if test "$libssh" = "yes" ; then
>    echo "CONFIG_LIBSSH=y" >> $config_host_mak
>    echo "LIBSSH_CFLAGS=$libssh_cflags" >> $config_host_mak
> @@ -4280,10 +4193,6 @@ if test "$replication" = "yes" ; then
>    echo "CONFIG_REPLICATION=y" >> $config_host_mak
>  fi
>
> -if test "$have_af_vsock" = "yes" ; then
> -  echo "CONFIG_AF_VSOCK=y" >> $config_host_mak
> -fi
> -
>  if test "$debug_mutex" = "yes" ; then
>    echo "CONFIG_DEBUG_MUTEX=y" >> $config_host_mak
>  fi
> diff --git a/meson.build b/meson.build
> index 0721309ed1..f08f364c90 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -1552,6 +1552,8 @@ config_host_data.set('CONFIG_INOTIFY',
>                       cc.has_header_symbol('sys/inotify.h',
> 'inotify_init'))
>  config_host_data.set('CONFIG_INOTIFY1',
>                       cc.has_header_symbol('sys/inotify.h',
> 'inotify_init1'))
> +config_host_data.set('CONFIG_IOVEC',
> +                     cc.has_header_symbol('sys/uio.h', 'struct iovec'))
>  config_host_data.set('CONFIG_MACHINE_BSWAP_H',
>                       cc.has_header_symbol('machine/bswap.h', 'bswap32',
>                                            prefix: '''#include
> <sys/endian.h>
> @@ -1700,6 +1702,49 @@ config_host_data.set('HAVE_BROKEN_SIZE_MAX', not
> cc.compiles('''
>          return printf("%zu", SIZE_MAX);
>      }''', args: ['-Werror']))
>
> +# See if 64-bit atomic operations are supported.
> +# Note that without __atomic builtins, we can only
> +# assume atomic loads/stores max at pointer size.
> +config_host_data.set('CONFIG_ATOMIC64', cc.links('''
> +  cat > $TMPC << EOF
> +  #include <stdint.h>
> +  int main(void)
> +  {
> +    uint64_t x = 0, y = 0;
> +    y = __atomic_load_n(&x, __ATOMIC_RELAXED);
> +    __atomic_store_n(&x, y, __ATOMIC_RELAXED);
> +    __atomic_compare_exchange_n(&x, &y, x, 0, __ATOMIC_RELAXED,
> __ATOMIC_RELAXED);
> +    __atomic_exchange_n(&x, y, __ATOMIC_RELAXED);
> +    __atomic_fetch_add(&x, y, __ATOMIC_RELAXED);
> +    return 0;
> +  }'''))
> +
> +config_host_data.set('CONFIG_GETAUXVAL', cc.links(gnu_source_prefix + '''
> +  #include <sys/auxv.h>
> +  int main(void) {
> +    return getauxval(AT_HWCAP) == 0;
> +  }'''))
> +
> +config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix +
> '''
> +  #include <errno.h>
> +  #include <sys/types.h>
> +  #include <sys/socket.h>
> +  #if !defined(AF_VSOCK)
> +  # error missing AF_VSOCK flag
> +  #endif
> +  #include <linux/vm_sockets.h>
> +  int main(void) {
> +    int sock, ret;
> +    struct sockaddr_vm svm;
> +    socklen_t len = sizeof(svm);
> +    sock = socket(AF_VSOCK, SOCK_STREAM, 0);
> +    ret = getpeername(sock, (struct sockaddr *)&svm, &len);
> +    if ((ret == -1) && (errno == ENOTCONN)) {
> +        return 0;
> +    }
> +    return -1;
> +  }'''))
> +
>  ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
>      'HAVE_GDB_BIN']
>  arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
> --
> 2.31.1
>
>
>
>

-- 
Marc-André Lureau

Reply via email to