qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

target/*/cpu.h: remove softfloat.h

As cpu.h is another typically widely included file which doesn't need
full access to the softfloat API we can remove the includes from here
as well. Where they do need types it's typically for float_status and
the rounding modes so we move that to softfloat-types.h as well.

As a result of not having softfloat in every cpu.h call we now need to
add it to various helpers that do need the full softfloat.h
definitions.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
[For PPC parts]
Acked-by: David Gibson <david@gibson.dropbear.id.au>

+93 -79
+64
include/fpu/softfloat-types.h
··· 80 80 #ifndef SOFTFLOAT_TYPES_H 81 81 #define SOFTFLOAT_TYPES_H 82 82 83 + /* This 'flag' type must be able to hold at least 0 and 1. It should 84 + * probably be replaced with 'bool' but the uses would need to be audited 85 + * to check that they weren't accidentally relying on it being a larger type. 86 + */ 87 + typedef uint8_t flag; 88 + 83 89 /* 84 90 * Software IEC/IEEE floating-point types. 85 91 */ ··· 111 117 } float128; 112 118 #define make_float128(high_, low_) ((float128) { .high = high_, .low = low_ }) 113 119 #define make_float128_init(high_, low_) { .high = high_, .low = low_ } 120 + 121 + /* 122 + * Software IEC/IEEE floating-point underflow tininess-detection mode. 123 + */ 124 + 125 + enum { 126 + float_tininess_after_rounding = 0, 127 + float_tininess_before_rounding = 1 128 + }; 129 + 130 + /* 131 + *Software IEC/IEEE floating-point rounding mode. 132 + */ 133 + 134 + enum { 135 + float_round_nearest_even = 0, 136 + float_round_down = 1, 137 + float_round_up = 2, 138 + float_round_to_zero = 3, 139 + float_round_ties_away = 4, 140 + /* Not an IEEE rounding mode: round to the closest odd mantissa value */ 141 + float_round_to_odd = 5, 142 + }; 143 + 144 + /* 145 + * Software IEC/IEEE floating-point exception flags. 146 + */ 147 + 148 + enum { 149 + float_flag_invalid = 1, 150 + float_flag_divbyzero = 4, 151 + float_flag_overflow = 8, 152 + float_flag_underflow = 16, 153 + float_flag_inexact = 32, 154 + float_flag_input_denormal = 64, 155 + float_flag_output_denormal = 128 156 + }; 157 + 158 + 159 + /* 160 + * Floating Point Status. Individual architectures may maintain 161 + * several versions of float_status for different functions. The 162 + * correct status for the operation is then passed by reference to 163 + * most of the softfloat functions. 164 + */ 165 + 166 + typedef struct float_status { 167 + signed char float_detect_tininess; 168 + signed char float_rounding_mode; 169 + uint8_t float_exception_flags; 170 + signed char floatx80_rounding_precision; 171 + /* should denormalised results go to zero and set the inexact flag? */ 172 + flag flush_to_zero; 173 + /* should denormalised inputs go to zero and set the input_denormal flag? */ 174 + flag flush_inputs_to_zero; 175 + flag default_nan_mode; 176 + flag snan_bit_is_one; 177 + } float_status; 114 178 115 179 #endif /* SOFTFLOAT_TYPES_H */
-53
include/fpu/softfloat.h
··· 82 82 #ifndef SOFTFLOAT_H 83 83 #define SOFTFLOAT_H 84 84 85 - /* This 'flag' type must be able to hold at least 0 and 1. It should 86 - * probably be replaced with 'bool' but the uses would need to be audited 87 - * to check that they weren't accidentally relying on it being a larger type. 88 - */ 89 - typedef uint8_t flag; 90 - 91 85 #define LIT64( a ) a##LL 92 86 93 87 /*---------------------------------------------------------------------------- ··· 101 95 }; 102 96 103 97 #include "fpu/softfloat-types.h" 104 - 105 - /*---------------------------------------------------------------------------- 106 - | Software IEC/IEEE floating-point underflow tininess-detection mode. 107 - *----------------------------------------------------------------------------*/ 108 - enum { 109 - float_tininess_after_rounding = 0, 110 - float_tininess_before_rounding = 1 111 - }; 112 - 113 - /*---------------------------------------------------------------------------- 114 - | Software IEC/IEEE floating-point rounding mode. 115 - *----------------------------------------------------------------------------*/ 116 - enum { 117 - float_round_nearest_even = 0, 118 - float_round_down = 1, 119 - float_round_up = 2, 120 - float_round_to_zero = 3, 121 - float_round_ties_away = 4, 122 - /* Not an IEEE rounding mode: round to the closest odd mantissa value */ 123 - float_round_to_odd = 5, 124 - }; 125 - 126 - /*---------------------------------------------------------------------------- 127 - | Software IEC/IEEE floating-point exception flags. 128 - *----------------------------------------------------------------------------*/ 129 - enum { 130 - float_flag_invalid = 1, 131 - float_flag_divbyzero = 4, 132 - float_flag_overflow = 8, 133 - float_flag_underflow = 16, 134 - float_flag_inexact = 32, 135 - float_flag_input_denormal = 64, 136 - float_flag_output_denormal = 128 137 - }; 138 - 139 - typedef struct float_status { 140 - signed char float_detect_tininess; 141 - signed char float_rounding_mode; 142 - uint8_t float_exception_flags; 143 - signed char floatx80_rounding_precision; 144 - /* should denormalised results go to zero and set the inexact flag? */ 145 - flag flush_to_zero; 146 - /* should denormalised inputs go to zero and set the input_denormal flag? */ 147 - flag flush_inputs_to_zero; 148 - flag default_nan_mode; 149 - flag snan_bit_is_one; 150 - } float_status; 151 98 152 99 static inline void set_float_detect_tininess(int val, float_status *status) 153 100 {
-2
target/alpha/cpu.h
··· 33 33 34 34 #include "exec/cpu-defs.h" 35 35 36 - #include "fpu/softfloat.h" 37 - 38 36 #define ICACHE_LINE_SIZE 32 39 37 #define DCACHE_LINE_SIZE 32 40 38
+1
target/arm/cpu.c
··· 34 34 #include "sysemu/hw_accel.h" 35 35 #include "kvm_arm.h" 36 36 #include "disas/capstone.h" 37 + #include "fpu/softfloat.h" 37 38 38 39 static void arm_cpu_set_pc(CPUState *cs, vaddr value) 39 40 {
-2
target/arm/cpu.h
··· 39 39 #include "cpu-qom.h" 40 40 #include "exec/cpu-defs.h" 41 41 42 - #include "fpu/softfloat.h" 43 - 44 42 #define EXCP_UDEF 1 /* undefined instruction */ 45 43 #define EXCP_SWI 2 /* software interrupt */ 46 44 #define EXCP_PREFETCH_ABORT 3
+1
target/arm/helper-a64.c
··· 31 31 #include "exec/cpu_ldst.h" 32 32 #include "qemu/int128.h" 33 33 #include "tcg.h" 34 + #include "fpu/softfloat.h" 34 35 #include <zlib.h> /* For crc32 */ 35 36 36 37 /* C2.4.7 Multiply and divide */
+1
target/arm/helper.c
··· 15 15 #include <zlib.h> /* For crc32 */ 16 16 #include "exec/semihost.h" 17 17 #include "sysemu/kvm.h" 18 + #include "fpu/softfloat.h" 18 19 19 20 #define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */ 20 21
+1
target/arm/neon_helper.c
··· 11 11 #include "cpu.h" 12 12 #include "exec/exec-all.h" 13 13 #include "exec/helper-proto.h" 14 + #include "fpu/softfloat.h" 14 15 15 16 #define SIGNBIT (uint32_t)0x80000000 16 17 #define SIGNBIT64 ((uint64_t)1 << 63)
+1
target/hppa/cpu.c
··· 23 23 #include "cpu.h" 24 24 #include "qemu-common.h" 25 25 #include "exec/exec-all.h" 26 + #include "fpu/softfloat.h" 26 27 27 28 28 29 static void hppa_cpu_set_pc(CPUState *cs, vaddr value)
-1
target/hppa/cpu.h
··· 51 51 #define CPUArchState struct CPUHPPAState 52 52 53 53 #include "exec/cpu-defs.h" 54 - #include "fpu/softfloat.h" 55 54 56 55 #define TARGET_PAGE_BITS 12 57 56
+1 -1
target/hppa/op_helper.c
··· 24 24 #include "exec/cpu_ldst.h" 25 25 #include "sysemu/sysemu.h" 26 26 #include "qemu/timer.h" 27 - 27 + #include "fpu/softfloat.h" 28 28 29 29 void QEMU_NORETURN HELPER(excp)(CPUHPPAState *env, int excp) 30 30 {
-4
target/i386/cpu.h
··· 52 52 53 53 #define CPUArchState struct CPUX86State 54 54 55 - #ifdef CONFIG_TCG 56 - #include "fpu/softfloat.h" 57 - #endif 58 - 59 55 enum { 60 56 R_EAX = 0, 61 57 R_ECX = 1,
+1
target/i386/fpu_helper.c
··· 24 24 #include "qemu/host-utils.h" 25 25 #include "exec/exec-all.h" 26 26 #include "exec/cpu_ldst.h" 27 + #include "fpu/softfloat.h" 27 28 28 29 #define FPU_RC_MASK 0xc00 29 30 #define FPU_RC_NEAR 0x000
+1 -1
target/m68k/cpu.c
··· 24 24 #include "qemu-common.h" 25 25 #include "migration/vmstate.h" 26 26 #include "exec/exec-all.h" 27 - 27 + #include "fpu/softfloat.h" 28 28 29 29 static void m68k_cpu_set_pc(CPUState *cs, vaddr value) 30 30 {
-1
target/m68k/cpu.h
··· 28 28 #include "qemu-common.h" 29 29 #include "exec/cpu-defs.h" 30 30 #include "cpu-qom.h" 31 - #include "fpu/softfloat.h" 32 31 33 32 #define OS_BYTE 0 34 33 #define OS_WORD 1
+1
target/m68k/fpu_helper.c
··· 23 23 #include "exec/helper-proto.h" 24 24 #include "exec/exec-all.h" 25 25 #include "exec/cpu_ldst.h" 26 + #include "fpu/softfloat.h" 26 27 27 28 /* Undefined offsets may be different on various FPU. 28 29 * On 68040 they return 0.0 (floatx80_zero)
+1
target/m68k/helper.c
··· 24 24 #include "exec/gdbstub.h" 25 25 26 26 #include "exec/helper-proto.h" 27 + #include "fpu/softfloat.h" 27 28 28 29 #define SIGNBIT (1u << 31) 29 30
+2
target/m68k/translate.c
··· 32 32 33 33 #include "trace-tcg.h" 34 34 #include "exec/log.h" 35 + #include "fpu/softfloat.h" 36 + 35 37 36 38 //#define DEBUG_DISPATCH 1 37 39
+1
target/microblaze/cpu.c
··· 28 28 #include "hw/qdev-properties.h" 29 29 #include "migration/vmstate.h" 30 30 #include "exec/exec-all.h" 31 + #include "fpu/softfloat.h" 31 32 32 33 static const struct { 33 34 const char *name;
+1 -1
target/microblaze/cpu.h
··· 28 28 #define CPUArchState struct CPUMBState 29 29 30 30 #include "exec/cpu-defs.h" 31 - #include "fpu/softfloat.h" 31 + #include "fpu/softfloat-types.h" 32 32 struct CPUMBState; 33 33 typedef struct CPUMBState CPUMBState; 34 34 #if !defined(CONFIG_USER_ONLY)
+1
target/microblaze/op_helper.c
··· 24 24 #include "qemu/host-utils.h" 25 25 #include "exec/exec-all.h" 26 26 #include "exec/cpu_ldst.h" 27 + #include "fpu/softfloat.h" 27 28 28 29 #define D(x) 29 30
-1
target/moxie/cpu.h
··· 34 34 #define MOXIE_EX_BREAK 16 35 35 36 36 #include "exec/cpu-defs.h" 37 - #include "fpu/softfloat.h" 38 37 39 38 #define TARGET_PAGE_BITS 12 /* 4k */ 40 39
-1
target/nios2/cpu.h
··· 27 27 #define CPUArchState struct CPUNios2State 28 28 29 29 #include "exec/cpu-defs.h" 30 - #include "fpu/softfloat.h" 31 30 #include "qom/cpu.h" 32 31 struct CPUNios2State; 33 32 typedef struct CPUNios2State CPUNios2State;
-1
target/openrisc/cpu.h
··· 29 29 30 30 #include "qemu-common.h" 31 31 #include "exec/cpu-defs.h" 32 - #include "fpu/softfloat.h" 33 32 #include "qom/cpu.h" 34 33 35 34 #define TYPE_OPENRISC_CPU "or1k-cpu"
+1
target/openrisc/fpu_helper.c
··· 22 22 #include "cpu.h" 23 23 #include "exec/helper-proto.h" 24 24 #include "exception.h" 25 + #include "fpu/softfloat.h" 25 26 26 27 static inline uint32_t ieee_ex_to_openrisc(OpenRISCCPU *cpu, int fexcp) 27 28 {
-1
target/ppc/cpu.h
··· 79 79 80 80 #include "exec/cpu-defs.h" 81 81 #include "cpu-qom.h" 82 - #include "fpu/softfloat.h" 83 82 84 83 #if defined (TARGET_PPC64) 85 84 #define PPC_ELF_MACHINE EM_PPC64
+1
target/ppc/fpu_helper.c
··· 21 21 #include "exec/helper-proto.h" 22 22 #include "exec/exec-all.h" 23 23 #include "internal.h" 24 + #include "fpu/softfloat.h" 24 25 25 26 static inline float128 float128_snan_to_qnan(float128 x) 26 27 {
+1
target/ppc/int_helper.c
··· 23 23 #include "qemu/host-utils.h" 24 24 #include "exec/helper-proto.h" 25 25 #include "crypto/aes.h" 26 + #include "fpu/softfloat.h" 26 27 27 28 #include "helper_regs.h" 28 29 /*****************************************************************************/
+1
target/ppc/translate_init.c
··· 38 38 #include "sysemu/qtest.h" 39 39 #include "qemu/cutils.h" 40 40 #include "disas/capstone.h" 41 + #include "fpu/softfloat.h" 41 42 42 43 //#define PPC_DUMP_CPU 43 44 //#define PPC_DEBUG_SPR
+1
target/s390x/cpu.c
··· 42 42 #include "sysemu/arch_init.h" 43 43 #include "sysemu/sysemu.h" 44 44 #endif 45 + #include "fpu/softfloat.h" 45 46 46 47 #define CR0_RESET 0xE0UL 47 48 #define CR14_RESET 0xC2000000UL;
-2
target/s390x/cpu.h
··· 41 41 42 42 #include "exec/cpu-all.h" 43 43 44 - #include "fpu/softfloat.h" 45 - 46 44 #define NB_MMU_MODES 4 47 45 #define TARGET_INSN_START_EXTRA_WORDS 1 48 46
+1
target/s390x/fpu_helper.c
··· 24 24 #include "exec/exec-all.h" 25 25 #include "exec/cpu_ldst.h" 26 26 #include "exec/helper-proto.h" 27 + #include "fpu/softfloat.h" 27 28 28 29 /* #define DEBUG_HELPER */ 29 30 #ifdef DEBUG_HELPER
+1
target/sh4/cpu.c
··· 25 25 #include "qemu-common.h" 26 26 #include "migration/vmstate.h" 27 27 #include "exec/exec-all.h" 28 + #include "fpu/softfloat.h" 28 29 29 30 30 31 static void superh_cpu_set_pc(CPUState *cs, vaddr value)
-2
target/sh4/cpu.h
··· 40 40 41 41 #include "exec/cpu-defs.h" 42 42 43 - #include "fpu/softfloat.h" 44 - 45 43 #define TARGET_PAGE_BITS 12 /* 4k XXXXX */ 46 44 47 45 #define TARGET_PHYS_ADDR_SPACE_BITS 32
+1
target/sh4/op_helper.c
··· 21 21 #include "exec/helper-proto.h" 22 22 #include "exec/exec-all.h" 23 23 #include "exec/cpu_ldst.h" 24 + #include "fpu/softfloat.h" 24 25 25 26 #ifndef CONFIG_USER_ONLY 26 27
-2
target/sparc/cpu.h
··· 29 29 30 30 #include "exec/cpu-defs.h" 31 31 32 - #include "fpu/softfloat.h" 33 - 34 32 /*#define EXCP_INTERRUPT 0x100*/ 35 33 36 34 /* trap definitions */
+1
target/sparc/fop_helper.c
··· 21 21 #include "cpu.h" 22 22 #include "exec/exec-all.h" 23 23 #include "exec/helper-proto.h" 24 + #include "fpu/softfloat.h" 24 25 25 26 #define QT0 (env->qt0) 26 27 #define QT1 (env->qt1)
-1
target/tricore/cpu.h
··· 24 24 #include "qemu-common.h" 25 25 #include "cpu-qom.h" 26 26 #include "exec/cpu-defs.h" 27 - #include "fpu/softfloat.h" 28 27 29 28 #define CPUArchState struct CPUTriCoreState 30 29
+1
target/tricore/fpu_helper.c
··· 20 20 #include "qemu/osdep.h" 21 21 #include "cpu.h" 22 22 #include "exec/helper-proto.h" 23 + #include "fpu/softfloat.h" 23 24 24 25 #define QUIET_NAN 0x7fc00000 25 26 #define ADD_NAN 0x7fc00001
+1
target/tricore/helper.c
··· 19 19 20 20 #include "cpu.h" 21 21 #include "exec/exec-all.h" 22 + #include "fpu/softfloat.h" 22 23 23 24 enum { 24 25 TLBRET_DIRTY = -4,
+1
target/unicore32/cpu.c
··· 18 18 #include "qemu-common.h" 19 19 #include "migration/vmstate.h" 20 20 #include "exec/exec-all.h" 21 + #include "fpu/softfloat.h" 21 22 22 23 static void uc32_cpu_set_pc(CPUState *cs, vaddr value) 23 24 {
-1
target/unicore32/cpu.h
··· 23 23 #include "qemu-common.h" 24 24 #include "cpu-qom.h" 25 25 #include "exec/cpu-defs.h" 26 - #include "fpu/softfloat.h" 27 26 28 27 #define NB_MMU_MODES 2 29 28
+1
target/unicore32/ucf64_helper.c
··· 11 11 #include "qemu/osdep.h" 12 12 #include "cpu.h" 13 13 #include "exec/helper-proto.h" 14 + #include "fpu/softfloat.h" 14 15 15 16 /* 16 17 * The convention used for UniCore-F64 instructions:
-1
target/xtensa/cpu.h
··· 36 36 #include "qemu-common.h" 37 37 #include "cpu-qom.h" 38 38 #include "exec/cpu-defs.h" 39 - #include "fpu/softfloat.h" 40 39 #include "xtensa-isa.h" 41 40 42 41 #define NB_MMU_MODES 4
+1
target/xtensa/op_helper.c
··· 34 34 #include "exec/cpu_ldst.h" 35 35 #include "exec/address-spaces.h" 36 36 #include "qemu/timer.h" 37 + #include "fpu/softfloat.h" 37 38 38 39 void xtensa_cpu_do_unaligned_access(CPUState *cs, 39 40 vaddr addr, MMUAccessType access_type,