[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC for 2.8 1/3] configure: check CPU width and disabl
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [RFC for 2.8 1/3] configure: check CPU width and disable larger guests |
Date: |
Tue, 9 Aug 2016 17:13:28 +0100 |
On 9 August 2016 at 16:55, Alex Bennée <address@hidden> wrote:
> Emulating 64 bit guests on a 32 bit host is either impossible with KVM
> or needs a lot of special casing for TCG targets. As 64 bit hosts are
> fairly normal nowadays and there can't be many people trying this
> combination lets disable it completely.
>
> Signed-off-by: Alex Bennée <address@hidden>
> ---
> configure | 34 +++++++++++++++++++++++++++++++++-
> 1 file changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index f57fcc6..7b779c1 100755
> --- a/configure
> +++ b/configure
> @@ -478,6 +478,7 @@ elif check_define __x86_64__ ; then
> cpu="x32"
> else
> cpu="x86_64"
> + cpu_width=64
> fi
> elif check_define __sparc__ ; then
> if check_define __arch64__ ; then
> @@ -515,26 +516,36 @@ ARCH=
> # Normalise host CPU name and set ARCH.
> # Note that this case should only have supported host CPUs, not guests.
> case "$cpu" in
> - ia64|ppc|ppc64|s390|s390x|sparc64|x32)
> + ppc|s390|x32)
> cpu="$cpu"
> + cpu_width=32
> + ;;
> + ia64|ppc64|s390x|sparc64)
> + cpu="$cpu"
> + cpu_width=64
We can detect the host pointer width generically at configure time,
in a similar way to how we detect its endianness:
cat > $TMPC << EOF
#include <inttypes.h>
uintptr_t be[] = { (uintptr_t)0x4c6f4e674c6f4e67ULL };
uintptr_t le[] = { (uintptr_t)0x674e6f4c674e6f4cULL };
extern int foo(uintptr_t *a, uintptr_t *b);
int main(void) {
return foo(le, be);
}
EOF
if compile_object; then
if grep -q LoNgLoNg $TMPO; then
hostwidth=64
elif grep -q LoNg $TMPO; then
hostwidth=32
else
error_exit "Host pointer width detection failed"
fi
else
error_exit "Host pointer width detection failed"
fi
(I've tested the C code here but not the shell-scriptery.)
> ##########################################
> +# host address width checks
> +too_wide_targets=""
> +
> +if test "$cpu_width" = "32"; then
> + for target in $target_list; do
> + target_name=$(echo $target | cut -d '-' -f 1)
> + case "$target_name" in
> + aarch64|mips64|ppc64|s390x|sparc64)
We should find a way to avoid having to specify the guest
CPU's pointer width twice (once here and once by setting
TARGET_LONG_BITS in its cpu.h). Otherwise people are going
to forget to update this list for new CPUs.
> + too_wide_targets="$too_wide_targets $target"
> + ;;
> + esac
> + done
> +fi
> +
> +if test ! -z "$too_wide_targets" ; then
> + error_exit "Support for the following targets can't be built on 32 bit
> systems:\n\t$too_wide_targets"
> +fi
Won't this break running configure on a 32-bit host with
no target-list specified at all?
thanks
-- PMM