Make target_phys_addr_t 64 bits unconditionally
The hassle and compile time overhead of maintaining both 32-bit and 64-bit capable source isn't worth the tiny performance advantage which is seen on a minority of configurations. Switch to compiling libhw only once, with target_phys_addr_t unconditionally typedefed to uint64_t. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
e744c06fca
commit
4be403c815
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,6 +12,7 @@ trace-dtrace.dtrace
|
||||||
*-linux-user
|
*-linux-user
|
||||||
*-bsd-user
|
*-bsd-user
|
||||||
libdis*
|
libdis*
|
||||||
|
libhw
|
||||||
libhw32
|
libhw32
|
||||||
libhw64
|
libhw64
|
||||||
libuser
|
libuser
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -214,7 +214,7 @@ $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN)
|
||||||
|
|
||||||
qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y)
|
qemu-ga$(EXESUF): qemu-ga.o $(qga-obj-y) $(tools-obj-y) $(qapi-obj-y) $(qobject-obj-y) $(version-obj-y)
|
||||||
|
|
||||||
QEMULIBS=libhw32 libhw64 libuser libdis libdis-user
|
QEMULIBS=libhw libuser libdis libdis-user
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
# avoid old build problems by removing potentially incorrect old files
|
# avoid old build problems by removing potentially incorrect old files
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
include ../config-host.mak
|
include ../config-host.mak
|
||||||
include ../config-all-devices.mak
|
include ../config-all-devices.mak
|
||||||
include config.mak
|
|
||||||
include $(SRC_PATH)/rules.mak
|
include $(SRC_PATH)/rules.mak
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
|
|
|
@ -4,9 +4,6 @@ include ../config-host.mak
|
||||||
include config-devices.mak
|
include config-devices.mak
|
||||||
include config-target.mak
|
include config-target.mak
|
||||||
include $(SRC_PATH)/rules.mak
|
include $(SRC_PATH)/rules.mak
|
||||||
ifneq ($(HWDIR),)
|
|
||||||
include $(HWDIR)/config.mak
|
|
||||||
endif
|
|
||||||
|
|
||||||
$(call set-vpath, $(SRC_PATH))
|
$(call set-vpath, $(SRC_PATH))
|
||||||
ifdef CONFIG_LINUX
|
ifdef CONFIG_LINUX
|
||||||
|
|
34
configure
vendored
34
configure
vendored
|
@ -3694,7 +3694,6 @@ TARGET_ABI_DIR=""
|
||||||
|
|
||||||
case "$target_arch2" in
|
case "$target_arch2" in
|
||||||
i386)
|
i386)
|
||||||
target_phys_bits=64
|
|
||||||
;;
|
;;
|
||||||
x86_64)
|
x86_64)
|
||||||
TARGET_BASE_ARCH=i386
|
TARGET_BASE_ARCH=i386
|
||||||
|
@ -3702,7 +3701,6 @@ case "$target_arch2" in
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
;;
|
;;
|
||||||
alpha)
|
alpha)
|
||||||
target_phys_bits=64
|
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
;;
|
;;
|
||||||
|
@ -3711,22 +3709,18 @@ case "$target_arch2" in
|
||||||
bflt="yes"
|
bflt="yes"
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
|
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
|
||||||
target_phys_bits=64
|
|
||||||
target_llong_alignment=4
|
target_llong_alignment=4
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
cris)
|
cris)
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_phys_bits=32
|
|
||||||
;;
|
;;
|
||||||
lm32)
|
lm32)
|
||||||
target_phys_bits=32
|
|
||||||
target_libs_softmmu="$opengl_libs"
|
target_libs_softmmu="$opengl_libs"
|
||||||
;;
|
;;
|
||||||
m68k)
|
m68k)
|
||||||
bflt="yes"
|
bflt="yes"
|
||||||
gdb_xml_files="cf-core.xml cf-fp.xml"
|
gdb_xml_files="cf-core.xml cf-fp.xml"
|
||||||
target_phys_bits=32
|
|
||||||
target_int_alignment=2
|
target_int_alignment=2
|
||||||
target_long_alignment=2
|
target_long_alignment=2
|
||||||
target_llong_alignment=2
|
target_llong_alignment=2
|
||||||
|
@ -3735,36 +3729,30 @@ case "$target_arch2" in
|
||||||
TARGET_ARCH=microblaze
|
TARGET_ARCH=microblaze
|
||||||
bflt="yes"
|
bflt="yes"
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_phys_bits=32
|
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
mips|mipsel)
|
mips|mipsel)
|
||||||
TARGET_ARCH=mips
|
TARGET_ARCH=mips
|
||||||
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
|
echo "TARGET_ABI_MIPSO32=y" >> $config_target_mak
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_phys_bits=64
|
|
||||||
;;
|
;;
|
||||||
mipsn32|mipsn32el)
|
mipsn32|mipsn32el)
|
||||||
TARGET_ARCH=mipsn32
|
TARGET_ARCH=mipsn32
|
||||||
TARGET_BASE_ARCH=mips
|
TARGET_BASE_ARCH=mips
|
||||||
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
|
echo "TARGET_ABI_MIPSN32=y" >> $config_target_mak
|
||||||
target_phys_bits=64
|
|
||||||
;;
|
;;
|
||||||
mips64|mips64el)
|
mips64|mips64el)
|
||||||
TARGET_ARCH=mips64
|
TARGET_ARCH=mips64
|
||||||
TARGET_BASE_ARCH=mips
|
TARGET_BASE_ARCH=mips
|
||||||
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
|
echo "TARGET_ABI_MIPSN64=y" >> $config_target_mak
|
||||||
target_phys_bits=64
|
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
;;
|
;;
|
||||||
or32)
|
or32)
|
||||||
TARGET_ARCH=openrisc
|
TARGET_ARCH=openrisc
|
||||||
TARGET_BASE_ARCH=openrisc
|
TARGET_BASE_ARCH=openrisc
|
||||||
target_phys_bits=32
|
|
||||||
;;
|
;;
|
||||||
ppc)
|
ppc)
|
||||||
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||||
target_phys_bits=64
|
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
|
@ -3772,7 +3760,6 @@ case "$target_arch2" in
|
||||||
TARGET_BASE_ARCH=ppc
|
TARGET_BASE_ARCH=ppc
|
||||||
TARGET_ABI_DIR=ppc
|
TARGET_ABI_DIR=ppc
|
||||||
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
gdb_xml_files="power-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||||
target_phys_bits=64
|
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
|
@ -3780,7 +3767,6 @@ case "$target_arch2" in
|
||||||
TARGET_BASE_ARCH=ppc
|
TARGET_BASE_ARCH=ppc
|
||||||
TARGET_ABI_DIR=ppc
|
TARGET_ABI_DIR=ppc
|
||||||
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||||
target_phys_bits=64
|
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
|
@ -3790,21 +3776,17 @@ case "$target_arch2" in
|
||||||
TARGET_ABI_DIR=ppc
|
TARGET_ABI_DIR=ppc
|
||||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||||
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
gdb_xml_files="power64-core.xml power-fpu.xml power-altivec.xml power-spe.xml"
|
||||||
target_phys_bits=64
|
|
||||||
target_libs_softmmu="$fdt_libs"
|
target_libs_softmmu="$fdt_libs"
|
||||||
;;
|
;;
|
||||||
sh4|sh4eb)
|
sh4|sh4eb)
|
||||||
TARGET_ARCH=sh4
|
TARGET_ARCH=sh4
|
||||||
bflt="yes"
|
bflt="yes"
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_phys_bits=32
|
|
||||||
;;
|
;;
|
||||||
sparc)
|
sparc)
|
||||||
target_phys_bits=64
|
|
||||||
;;
|
;;
|
||||||
sparc64)
|
sparc64)
|
||||||
TARGET_BASE_ARCH=sparc
|
TARGET_BASE_ARCH=sparc
|
||||||
target_phys_bits=64
|
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
;;
|
;;
|
||||||
sparc32plus)
|
sparc32plus)
|
||||||
|
@ -3812,11 +3794,9 @@ case "$target_arch2" in
|
||||||
TARGET_BASE_ARCH=sparc
|
TARGET_BASE_ARCH=sparc
|
||||||
TARGET_ABI_DIR=sparc
|
TARGET_ABI_DIR=sparc
|
||||||
echo "TARGET_ABI32=y" >> $config_target_mak
|
echo "TARGET_ABI32=y" >> $config_target_mak
|
||||||
target_phys_bits=64
|
|
||||||
;;
|
;;
|
||||||
s390x)
|
s390x)
|
||||||
target_nptl="yes"
|
target_nptl="yes"
|
||||||
target_phys_bits=64
|
|
||||||
target_long_alignment=8
|
target_long_alignment=8
|
||||||
;;
|
;;
|
||||||
unicore32)
|
unicore32)
|
||||||
|
@ -3824,7 +3804,6 @@ case "$target_arch2" in
|
||||||
;;
|
;;
|
||||||
xtensa|xtensaeb)
|
xtensa|xtensaeb)
|
||||||
TARGET_ARCH=xtensa
|
TARGET_ARCH=xtensa
|
||||||
target_phys_bits=32
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unsupported target CPU"
|
echo "Unsupported target CPU"
|
||||||
|
@ -3859,7 +3838,6 @@ echo "TARGET_ABI_DIR=$TARGET_ABI_DIR" >> $config_target_mak
|
||||||
case "$target_arch2" in
|
case "$target_arch2" in
|
||||||
i386|x86_64)
|
i386|x86_64)
|
||||||
if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
|
if test "$xen" = "yes" -a "$target_softmmu" = "yes" ; then
|
||||||
target_phys_bits=64
|
|
||||||
echo "CONFIG_XEN=y" >> $config_target_mak
|
echo "CONFIG_XEN=y" >> $config_target_mak
|
||||||
if test "$xen_pci_passthrough" = yes; then
|
if test "$xen_pci_passthrough" = yes; then
|
||||||
echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
|
echo "CONFIG_XEN_PCI_PASSTHROUGH=y" >> "$config_target_mak"
|
||||||
|
@ -3899,11 +3877,10 @@ if test "$target_bigendian" = "yes" ; then
|
||||||
echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
|
echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak
|
||||||
fi
|
fi
|
||||||
if test "$target_softmmu" = "yes" ; then
|
if test "$target_softmmu" = "yes" ; then
|
||||||
echo "TARGET_PHYS_ADDR_BITS=$target_phys_bits" >> $config_target_mak
|
|
||||||
echo "CONFIG_SOFTMMU=y" >> $config_target_mak
|
echo "CONFIG_SOFTMMU=y" >> $config_target_mak
|
||||||
echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
|
echo "LIBS+=$libs_softmmu $target_libs_softmmu" >> $config_target_mak
|
||||||
echo "HWDIR=../libhw$target_phys_bits" >> $config_target_mak
|
echo "HWDIR=../libhw" >> $config_target_mak
|
||||||
echo "subdir-$target: subdir-libhw$target_phys_bits" >> $config_host_mak
|
echo "subdir-$target: subdir-libhw" >> $config_host_mak
|
||||||
if test "$smartcard_nss" = "yes" ; then
|
if test "$smartcard_nss" = "yes" ; then
|
||||||
echo "subdir-$target: subdir-libcacard" >> $config_host_mak
|
echo "subdir-$target: subdir-libcacard" >> $config_host_mak
|
||||||
fi
|
fi
|
||||||
|
@ -4145,11 +4122,8 @@ for rom in seabios vgabios ; do
|
||||||
echo "LD=$ld" >> $config_mak
|
echo "LD=$ld" >> $config_mak
|
||||||
done
|
done
|
||||||
|
|
||||||
for hwlib in 32 64; do
|
d=libhw
|
||||||
d=libhw$hwlib
|
symlink "$source_path/Makefile.hw" "$d/Makefile"
|
||||||
symlink "$source_path/Makefile.hw" "$d/Makefile"
|
|
||||||
echo "QEMU_CFLAGS+=-DTARGET_PHYS_ADDR_BITS=$hwlib" > $d/config.mak
|
|
||||||
done
|
|
||||||
|
|
||||||
d=libuser
|
d=libuser
|
||||||
symlink "$source_path/Makefile.user" "$d/Makefile"
|
symlink "$source_path/Makefile.user" "$d/Makefile"
|
||||||
|
|
|
@ -21,7 +21,7 @@ enum device_endian {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* address in the RAM (different from a physical address) */
|
/* address in the RAM (different from a physical address) */
|
||||||
#if defined(CONFIG_XEN_BACKEND) && TARGET_PHYS_ADDR_BITS == 64
|
#if defined(CONFIG_XEN_BACKEND)
|
||||||
typedef uint64_t ram_addr_t;
|
typedef uint64_t ram_addr_t;
|
||||||
# define RAM_ADDR_MAX UINT64_MAX
|
# define RAM_ADDR_MAX UINT64_MAX
|
||||||
# define RAM_ADDR_FMT "%" PRIx64
|
# define RAM_ADDR_FMT "%" PRIx64
|
||||||
|
|
2
dma.h
2
dma.h
|
@ -31,7 +31,7 @@ struct QEMUSGList {
|
||||||
DMAContext *dma;
|
DMAContext *dma;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(TARGET_PHYS_ADDR_BITS)
|
#ifndef CONFIG_USER_ONLY
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When an IOMMU is present, bus addresses become distinct from
|
* When an IOMMU is present, bus addresses become distinct from
|
||||||
|
|
2
hw/hw.h
2
hw/hw.h
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
|
||||||
#if defined(TARGET_PHYS_ADDR_BITS) && !defined(NEED_CPU_H)
|
#if !defined(CONFIG_USER_ONLY) && !defined(NEED_CPU_H)
|
||||||
#include "cpu-common.h"
|
#include "cpu-common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -210,13 +210,7 @@ static target_phys_addr_t intel_hda_addr(uint32_t lbase, uint32_t ubase)
|
||||||
{
|
{
|
||||||
target_phys_addr_t addr;
|
target_phys_addr_t addr;
|
||||||
|
|
||||||
#if TARGET_PHYS_ADDR_BITS == 32
|
addr = ((uint64_t)ubase << 32) | lbase;
|
||||||
addr = lbase;
|
|
||||||
#else
|
|
||||||
addr = ubase;
|
|
||||||
addr <<= 32;
|
|
||||||
addr |= lbase;
|
|
||||||
#endif
|
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -774,11 +774,7 @@ static void rtl8139_write_buffer(RTL8139State *s, const void *buf, int size)
|
||||||
#define MIN_BUF_SIZE 60
|
#define MIN_BUF_SIZE 60
|
||||||
static inline dma_addr_t rtl8139_addr64(uint32_t low, uint32_t high)
|
static inline dma_addr_t rtl8139_addr64(uint32_t low, uint32_t high)
|
||||||
{
|
{
|
||||||
#if TARGET_PHYS_ADDR_BITS > 32
|
return low | ((uint64_t)high << 32);
|
||||||
return low | ((target_phys_addr_t)high << 32);
|
|
||||||
#else
|
|
||||||
return low;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Workaround for buggy guest driver such as linux who allocates rx
|
/* Workaround for buggy guest driver such as linux who allocates rx
|
||||||
|
|
|
@ -3259,11 +3259,7 @@ static int64_t expr_unary(Monitor *mon)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#if TARGET_PHYS_ADDR_BITS > 32
|
|
||||||
n = strtoull(pch, &p, 0);
|
n = strtoull(pch, &p, 0);
|
||||||
#else
|
|
||||||
n = strtoul(pch, &p, 0);
|
|
||||||
#endif
|
|
||||||
if (errno == ERANGE) {
|
if (errno == ERANGE) {
|
||||||
expr_error(mon, "number too large");
|
expr_error(mon, "number too large");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1032,12 +1032,10 @@ static int ppcemb_tlb_check(CPUPPCState *env, ppcemb_tlb_t *tlb,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*raddrp = (tlb->RPN & mask) | (address & ~mask);
|
*raddrp = (tlb->RPN & mask) | (address & ~mask);
|
||||||
#if (TARGET_PHYS_ADDR_BITS >= 36)
|
|
||||||
if (ext) {
|
if (ext) {
|
||||||
/* Extend the physical address to 36 bits */
|
/* Extend the physical address to 36 bits */
|
||||||
*raddrp |= (target_phys_addr_t)(tlb->RPN & 0xF) << 32;
|
*raddrp |= (uint64_t)(tlb->RPN & 0xF) << 32;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
19
targphys.h
19
targphys.h
|
@ -3,25 +3,10 @@
|
||||||
#ifndef TARGPHYS_H
|
#ifndef TARGPHYS_H
|
||||||
#define TARGPHYS_H
|
#define TARGPHYS_H
|
||||||
|
|
||||||
#ifdef TARGET_PHYS_ADDR_BITS
|
#define TARGET_PHYS_ADDR_BITS 64
|
||||||
/* target_phys_addr_t is the type of a physical address (its size can
|
/* target_phys_addr_t is the type of a physical address (its size can
|
||||||
be different from 'target_ulong'). */
|
be different from 'target_ulong'). */
|
||||||
|
|
||||||
#if TARGET_PHYS_ADDR_BITS == 32
|
|
||||||
typedef uint32_t target_phys_addr_t;
|
|
||||||
#define TARGET_PHYS_ADDR_MAX UINT32_MAX
|
|
||||||
#define TARGET_FMT_plx "%08x"
|
|
||||||
/* Format strings for printing target_phys_addr_t types.
|
|
||||||
* These are recommended over the less flexible TARGET_FMT_plx,
|
|
||||||
* which is retained for the benefit of existing code.
|
|
||||||
*/
|
|
||||||
#define TARGET_PRIdPHYS PRId32
|
|
||||||
#define TARGET_PRIiPHYS PRIi32
|
|
||||||
#define TARGET_PRIoPHYS PRIo32
|
|
||||||
#define TARGET_PRIuPHYS PRIu32
|
|
||||||
#define TARGET_PRIxPHYS PRIx32
|
|
||||||
#define TARGET_PRIXPHYS PRIX32
|
|
||||||
#elif TARGET_PHYS_ADDR_BITS == 64
|
|
||||||
typedef uint64_t target_phys_addr_t;
|
typedef uint64_t target_phys_addr_t;
|
||||||
#define TARGET_PHYS_ADDR_MAX UINT64_MAX
|
#define TARGET_PHYS_ADDR_MAX UINT64_MAX
|
||||||
#define TARGET_FMT_plx "%016" PRIx64
|
#define TARGET_FMT_plx "%016" PRIx64
|
||||||
|
@ -31,7 +16,5 @@ typedef uint64_t target_phys_addr_t;
|
||||||
#define TARGET_PRIuPHYS PRIu64
|
#define TARGET_PRIuPHYS PRIu64
|
||||||
#define TARGET_PRIxPHYS PRIx64
|
#define TARGET_PRIxPHYS PRIx64
|
||||||
#define TARGET_PRIXPHYS PRIX64
|
#define TARGET_PRIXPHYS PRIX64
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue