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

target/mips: Style improvements in cp0_timer.c

Fixes mostly errors and warnings reported by 'checkpatch.pl -f'.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <1566216496-17375-7-git-send-email-aleksandar.markovic@rt-rk.com>

+23 -19
+23 -19
target/mips/cp0_timer.c
··· 30 30 #define TIMER_PERIOD 10 /* 10 ns period for 100 Mhz frequency */ 31 31 32 32 /* XXX: do not use a global */ 33 - uint32_t cpu_mips_get_random (CPUMIPSState *env) 33 + uint32_t cpu_mips_get_random(CPUMIPSState *env) 34 34 { 35 35 static uint32_t seed = 1; 36 36 static uint32_t prev_idx = 0; ··· 43 43 44 44 /* Don't return same value twice, so get another value */ 45 45 do { 46 - /* Use a simple algorithm of Linear Congruential Generator 47 - * from ISO/IEC 9899 standard. */ 46 + /* 47 + * Use a simple algorithm of Linear Congruential Generator 48 + * from ISO/IEC 9899 standard. 49 + */ 48 50 seed = 1103515245 * seed + 12345; 49 51 idx = (seed >> 16) % nb_rand_tlb + env->CP0_Wired; 50 52 } while (idx == prev_idx); ··· 74 76 qemu_irq_raise(env->irq[(env->CP0_IntCtl >> CP0IntCtl_IPTI) & 0x7]); 75 77 } 76 78 77 - uint32_t cpu_mips_get_count (CPUMIPSState *env) 79 + uint32_t cpu_mips_get_count(CPUMIPSState *env) 78 80 { 79 81 if (env->CP0_Cause & (1 << CP0Ca_DC)) { 80 82 return env->CP0_Count; ··· 92 94 } 93 95 } 94 96 95 - void cpu_mips_store_count (CPUMIPSState *env, uint32_t count) 97 + void cpu_mips_store_count(CPUMIPSState *env, uint32_t count) 96 98 { 97 99 /* 98 100 * This gets called from cpu_state_reset(), potentially before timer init. 99 101 * So env->timer may be NULL, which is also the case with KVM enabled so 100 102 * treat timer as disabled in that case. 101 103 */ 102 - if (env->CP0_Cause & (1 << CP0Ca_DC) || !env->timer) 104 + if (env->CP0_Cause & (1 << CP0Ca_DC) || !env->timer) { 103 105 env->CP0_Count = count; 104 - else { 106 + } else { 105 107 /* Store new count register */ 106 108 env->CP0_Count = count - 107 109 (uint32_t)(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) / TIMER_PERIOD); ··· 110 112 } 111 113 } 112 114 113 - void cpu_mips_store_compare (CPUMIPSState *env, uint32_t value) 115 + void cpu_mips_store_compare(CPUMIPSState *env, uint32_t value) 114 116 { 115 117 env->CP0_Compare = value; 116 - if (!(env->CP0_Cause & (1 << CP0Ca_DC))) 118 + if (!(env->CP0_Cause & (1 << CP0Ca_DC))) { 117 119 cpu_mips_timer_update(env); 118 - if (env->insn_flags & ISA_MIPS32R2) 120 + } 121 + if (env->insn_flags & ISA_MIPS32R2) { 119 122 env->CP0_Cause &= ~(1 << CP0Ca_TI); 123 + } 120 124 qemu_irq_lower(env->irq[(env->CP0_IntCtl >> CP0IntCtl_IPTI) & 0x7]); 121 125 } 122 126 ··· 132 136 TIMER_PERIOD); 133 137 } 134 138 135 - static void mips_timer_cb (void *opaque) 139 + static void mips_timer_cb(void *opaque) 136 140 { 137 141 CPUMIPSState *env; 138 142 139 143 env = opaque; 140 - #if 0 141 - qemu_log("%s\n", __func__); 142 - #endif 143 144 144 - if (env->CP0_Cause & (1 << CP0Ca_DC)) 145 + if (env->CP0_Cause & (1 << CP0Ca_DC)) { 145 146 return; 147 + } 146 148 147 - /* ??? This callback should occur when the counter is exactly equal to 148 - the comparator value. Offset the count by one to avoid immediately 149 - retriggering the callback before any virtual time has passed. */ 149 + /* 150 + * ??? This callback should occur when the counter is exactly equal to 151 + * the comparator value. Offset the count by one to avoid immediately 152 + * retriggering the callback before any virtual time has passed. 153 + */ 150 154 env->CP0_Count++; 151 155 cpu_mips_timer_expire(env); 152 156 env->CP0_Count--; 153 157 } 154 158 155 - void cpu_mips_clock_init (MIPSCPU *cpu) 159 + void cpu_mips_clock_init(MIPSCPU *cpu) 156 160 { 157 161 CPUMIPSState *env = &cpu->env; 158 162