configure: Define target access alignment in configure
v4 cover configure: Define target access alignment in configure
Move the define of target access alignment earlier from target/foo/cpu.h to configure.
Suggested in Richard Henderson's reply to "[PATCH 1/4] tcg: TCGMemOp is now accelerator independent MemOp"
Analysed target/foo/cpu.h for more candidates to define earlier but did not spot any other straight forward predicates.
Possible future clean ups:
- TCG_GUEST_DEFAULT_MO and TCG_TARGET_DEFAULT_MO seems like duplicates
- TARGET_INSN_START_EXTRA_WORDS 1 seems redundant as ifndef value is 1
v2:
- split cosmetic changes into separate patch
- cc corresponding maintainers
v3:
- dropped cosmetic changes
- improved commit message
v4:
- further improved commit message
Tony Nguyen (1):
configure: Define TARGET_ALIGNED_ONLY in configure
configure | 10 +++++++++- include/exec/poison.h | 1 + include/qom/cpu.h | 2 +- target/alpha/cpu.h | 2 -- target/hppa/cpu.h | 1 - target/mips/cpu.h | 2 -- target/sh4/cpu.h | 2 -- target/sparc/cpu.h | 2 -- target/xtensa/cpu.h | 2 -- tcg/tcg.c | 2 +- tcg/tcg.h | 8 +++++--- 11 files changed, 17 insertions(+), 17 deletions(-)
Signature · 1 line
2.22.0
PATCH v4 1/1 configure: Define target access alignment in configure
Rename ALIGNED_ONLY to TARGET_ALIGNED_ONLY for clarity and move defines out of target/foo/cpu.h into configure, as we do with TARGET_WORDS_BIGENDIAN, so that it is always defined early.
Poison TARGET_ALIGNED_ONLY to prevent use in common code.
--- configure | 10 +++++++++- include/exec/poison.h | 1 + include/qom/cpu.h | 2 +- target/alpha/cpu.h | 2 -- target/hppa/cpu.h | 1 - target/mips/cpu.h | 2 -- target/sh4/cpu.h | 2 -- target/sparc/cpu.h | 2 -- target/xtensa/cpu.h | 2 -- tcg/tcg.c | 2 +- tcg/tcg.h | 8 +++++--- 11 files changed, 17 insertions(+), 17 deletions(-)
configure +9 -1
@@ -7431,8 +7431,13 @@ for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak target_name=$(echo $target | cut -d '-' -f 1) +target_aligned_only="no" +case "$target_name" in + alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) + target_aligned_only="yes" + ;; +esac target_bigendian="no" - case "$target_name" in armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes
@@ -7717,6 +7722,9 @@ fi if supported_whpx_target $target; then echo "CONFIG_WHPX=y" >> $config_target_mak fi +if test "$target_aligned_only" = "yes" ; then + echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak +fi if test "$target_bigendian" = "yes" ; then echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak fi
include/exec/poison.h +1 -0
@@ -35,6 +35,7 @@#pragma GCC poison TARGET_UNICORE32#pragma GCC poison TARGET_XTENSA +#pragma GCC poison TARGET_ALIGNED_ONLY#pragma GCC poison TARGET_HAS_BFLT#pragma GCC poison TARGET_NAME#pragma GCC poison TARGET_SUPPORTS_MTTCG
include/qom/cpu.h +1 -1
@@ -89,7 +89,7 @@ struct TranslationBlock;* @do_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) * @do_unaligned_access: Callback for unaligned access handling, if -* the target defines #ALIGNED_ONLY. +* the target defines #TARGET_ALIGNED_ONLY. * @do_transaction_failed: Callback for handling failed memory transactions * (ie bus faults or external aborts; not MMU faults) * @virtio_is_big_endian: Callback to return %true if a CPU which supports
target/alpha/cpu.h +0 -2
@@ -23,8 +23,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -/* Alpha processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
target/hppa/cpu.h +0 -1
@@ -30,7 +30,6 @@basis. It's probably easier to fall back to a strong memory model. */ #define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#define ALIGNED_ONLY #define MMU_KERNEL_IDX 0#define MMU_USER_IDX 3#define MMU_PHYS_IDX 4
target/mips/cpu.h +0 -2
@@ -1,8 +1,6 @@#ifndef MIPS_CPU_H #define MIPS_CPU_H -#define ALIGNED_ONLY -#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h"
target/sh4/cpu.h +0 -2
@@ -23,8 +23,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -/* CPU Subtypes */ #define SH_CPU_SH7750 (1 << 0)#define SH_CPU_SH7750S (1 << 1)
target/sparc/cpu.h +0 -2
@@ -5,8 +5,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -#if !defined(TARGET_SPARC64 )#define TARGET_DPREGS 16#else
target/xtensa/cpu.h +0 -2
@@ -32,8 +32,6 @@#include "exec/cpu-defs.h" #include "xtensa-isa.h" -#define ALIGNED_ONLY -/* Xtensa processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
tcg/tcg.c +1 -1
@@ -1926,7 +1926,7 @@ static const char * const ldst_name[] = };static const char *const alignment_name[(MO_AMASK >>MO_ASHIFT ) +1 ] = { -#ifdef ALIGNED_ONLY +#ifdef TARGET_ALIGNED_ONLY [MO_UNALN >>MO_ASHIFT ] ="un+" , [MO_ALIGN >>MO_ASHIFT ] ="" , #else
tcg/tcg.h +5 -3
@@ -333,10 +333,12 @@ typedef enum TCGMemOp { MO_TE = MO_LE,#endif -/* MO_UNALN accesses are never checked for alignment. +/* +* MO_UNALN accesses are never checked for alignment. * MO_ALIGN accesses will result in a call to the CPU's * do_unaligned_access hook if the guest address is not aligned. -* The default depends on whether the target CPU defines ALIGNED_ONLY. +* The default depends on whether the target CPU defines +* TARGET_ALIGNED_ONLY. * * Some architectures (e.g. ARMv8) need the address which is aligned * to a size more than the size of the memory access.
@@ -353,7 +355,7 @@ typedef enum TCGMemOp {*/ MO_ASHIFT = 4, MO_AMASK = 7 << MO_ASHIFT, -#ifdef ALIGNED_ONLY +#ifdef TARGET_ALIGNED_ONLY MO_ALIGN =0 , MO_UNALN = MO_AMASK, #else
Signature · 1 line
2.22.0
Quoted 7 lines
From: [email protected] <[email protected]>
Subject: [EXTERNAL][Qemu-devel] [PATCH v4 1/1] configure: Define target access alignment in configureRename
ALIGNED_ONLYtoTARGET_ALIGNED_ONLYfor clarity and move defines out oftarget/foo/cpu.hinto configure, as we do withTARGET_WORDS_BIGENDIAN, so that it is always defined early.
Quoted 6 lines
Poison
TARGET_ALIGNED_ONLYto prevent use in common code.Signed-off-by Tony Nguyen <[email protected]>Reviewed-by Philippe Mathieu-Daudé <[email protected]>Reviewed-by Richard Henderson <[email protected]>---
Advice: Try to always check and, if possible, improve commit messages prior to submissions. This doesn't take a lot of time, but improves the quality of one's contributions and increases overall submitter's reputation significantly.
PATCH v4 1/1 configure: Define target access alignment in configure
In reply to [email protected]Rename ALIGNED_ONLY to TARGET_ALIGNED_ONLY for clarity and move defines out of target/foo/cpu.h into configure, as we do with TARGET_WORDS_BIGENDIAN, so that it is always defined early.
Poison TARGET_ALIGNED_ONLY to prevent use in common code.
--- configure | 10 +++++++++- include/exec/poison.h | 1 + include/qom/cpu.h | 2 +- target/alpha/cpu.h | 2 -- target/hppa/cpu.h | 1 - target/mips/cpu.h | 2 -- target/sh4/cpu.h | 2 -- target/sparc/cpu.h | 2 -- target/xtensa/cpu.h | 2 -- tcg/tcg.c | 2 +- tcg/tcg.h | 8 +++++--- 11 files changed, 17 insertions(+), 17 deletions(-)
configure +9 -1
@@ -7431,8 +7431,13 @@ for target in $target_list; do target_dir="$target" config_target_mak=$target_dir/config-target.mak target_name=$(echo $target | cut -d '-' -f 1) +target_aligned_only="no" +case "$target_name" in + alpha|hppa|mips64el|mips64|mipsel|mips|mipsn32|mipsn32el|sh4|sh4eb|sparc|sparc64|sparc32plus|xtensa|xtensaeb) + target_aligned_only="yes" + ;; +esac target_bigendian="no" - case "$target_name" in armeb|aarch64_be|hppa|lm32|m68k|microblaze|mips|mipsn32|mips64|moxie|or1k|ppc|ppc64|ppc64abi32|s390x|sh4eb|sparc|sparc64|sparc32plus|xtensaeb) target_bigendian=yes
@@ -7717,6 +7722,9 @@ fi if supported_whpx_target $target; then echo "CONFIG_WHPX=y" >> $config_target_mak fi +if test "$target_aligned_only" = "yes" ; then + echo "TARGET_ALIGNED_ONLY=y" >> $config_target_mak +fi if test "$target_bigendian" = "yes" ; then echo "TARGET_WORDS_BIGENDIAN=y" >> $config_target_mak fi
include/exec/poison.h +1 -0
@@ -35,6 +35,7 @@#pragma GCC poison TARGET_UNICORE32#pragma GCC poison TARGET_XTENSA +#pragma GCC poison TARGET_ALIGNED_ONLY#pragma GCC poison TARGET_HAS_BFLT#pragma GCC poison TARGET_NAME#pragma GCC poison TARGET_SUPPORTS_MTTCG
include/qom/cpu.h +1 -1
@@ -89,7 +89,7 @@ struct TranslationBlock;* @do_unassigned_access: Callback for unassigned access handling. * (this is deprecated: new targets should use do_transaction_failed instead) * @do_unaligned_access: Callback for unaligned access handling, if -* the target defines #ALIGNED_ONLY. +* the target defines #TARGET_ALIGNED_ONLY. * @do_transaction_failed: Callback for handling failed memory transactions * (ie bus faults or external aborts; not MMU faults) * @virtio_is_big_endian: Callback to return %true if a CPU which supports
target/alpha/cpu.h +0 -2
@@ -23,8 +23,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -/* Alpha processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
target/hppa/cpu.h +0 -1
@@ -30,7 +30,6 @@basis. It's probably easier to fall back to a strong memory model. */ #define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#define ALIGNED_ONLY #define MMU_KERNEL_IDX 0#define MMU_USER_IDX 3#define MMU_PHYS_IDX 4
target/mips/cpu.h +0 -2
@@ -1,8 +1,6 @@#ifndef MIPS_CPU_H #define MIPS_CPU_H -#define ALIGNED_ONLY -#include "cpu-qom.h" #include "exec/cpu-defs.h" #include "fpu/softfloat.h"
target/sh4/cpu.h +0 -2
@@ -23,8 +23,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -/* CPU Subtypes */ #define SH_CPU_SH7750 (1 << 0)#define SH_CPU_SH7750S (1 << 1)
target/sparc/cpu.h +0 -2
@@ -5,8 +5,6 @@#include "cpu-qom.h" #include "exec/cpu-defs.h" -#define ALIGNED_ONLY -#if !defined(TARGET_SPARC64 )#define TARGET_DPREGS 16#else
target/xtensa/cpu.h +0 -2
@@ -32,8 +32,6 @@#include "exec/cpu-defs.h" #include "xtensa-isa.h" -#define ALIGNED_ONLY -/* Xtensa processors have a weak memory model */ #define TCG_GUEST_DEFAULT_MO (0)
tcg/tcg.c +1 -1
@@ -1926,7 +1926,7 @@ static const char * const ldst_name[] = };static const char *const alignment_name[(MO_AMASK >>MO_ASHIFT ) +1 ] = { -#ifdef ALIGNED_ONLY +#ifdef TARGET_ALIGNED_ONLY [MO_UNALN >>MO_ASHIFT ] ="un+" , [MO_ALIGN >>MO_ASHIFT ] ="" , #else
tcg/tcg.h +5 -3
@@ -333,10 +333,12 @@ typedef enum TCGMemOp { MO_TE = MO_LE,#endif -/* MO_UNALN accesses are never checked for alignment. +/* +* MO_UNALN accesses are never checked for alignment. * MO_ALIGN accesses will result in a call to the CPU's * do_unaligned_access hook if the guest address is not aligned. -* The default depends on whether the target CPU defines ALIGNED_ONLY. +* The default depends on whether the target CPU defines +* TARGET_ALIGNED_ONLY. * * Some architectures (e.g. ARMv8) need the address which is aligned * to a size more than the size of the memory access.
@@ -353,7 +355,7 @@ typedef enum TCGMemOp {*/ MO_ASHIFT = 4, MO_AMASK = 7 << MO_ASHIFT, -#ifdef ALIGNED_ONLY +#ifdef TARGET_ALIGNED_ONLY MO_ALIGN =0 , MO_UNALN = MO_AMASK, #else
Signature · 1 line
2.22.0
Quoted 11 lines · [email protected] writes:
Move the define of target access alignment earlier from
target/foo/cpu.hto configure.Suggested in Richard Henderson's reply to "[PATCH 1/4] tcg: TCGMemOp is now accelerator independent MemOp"
Analysed
target/foo/cpu.hfor more candidates to define earlier but did not spot any other straight forward predicates.Possible future clean ups:
-TCG_GUEST_DEFAULT_MOandTCG_TARGET_DEFAULT_MOseems like duplicates
These aren't duplicates. This is used to work out if the host memory order is compatible with running the guest under TCG with multiple threads (MTTCG). See check_tcg_memory_orders_compatible.
Quoted 16 lines
-
TARGET_INSN_START_EXTRA_WORDS1 seems redundant as ifndef value is 1v2:
- split cosmetic changes into separate patch
- cc corresponding maintainersv3:
- dropped cosmetic changes
- improved commit messagev4:
- further improved commit messageTony Nguyen (1):
configure: DefineTARGET_ALIGNED_ONLYin configure
Quoted 12 lines
configure | 10 +++++++++- include/exec/poison.h | 1 + include/qom/cpu.h | 2 +- target/alpha/cpu.h | 2 -- target/hppa/cpu.h | 1 - target/mips/cpu.h | 2 -- target/sh4/cpu.h | 2 -- target/sparc/cpu.h | 2 -- target/xtensa/cpu.h | 2 -- tcg/tcg.c | 2 +- tcg/tcg.h | 8 +++++--- 11 files changed, 17 insertions(+), 17 deletions(-)
--
Alex Bennée