Skip to contentSkip to conversation

target-mips queue

GIT PULL Applied Yongbok Kim 3 participants 10 messages Sep 21, 2017

lore
Share & tools
lore
#0 lore raw

Hi,

The patch 1 and 2 contain checkpatch.pl errors but patch 1 is relocating a file and patch 2 has false positive warnings.

Regards,
Yongbok

The following changes since commit ff5667ed53c544c4dc88dcd7cb23cc509c9a55e0:

Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging (2017-09-21 10:56:09 +0100)

are available in the git repository at:

git://github.com/yongbok/upstream-qemu.git tags/mips-20170921

for you to fetch changes up to 2a2be359c4335607c7f746cf27c412c08ab89aff:

mips: Improve macro parenthesization (2017-09-21 13:25:41 +0100)

----------------------------------------------------------------
MIPS patches 2017-09-21

Changes:
QOMify MIPS cpu
Improve macro parenthesization

----------------------------------------------------------------

Eric Blake (1):
mips: Improve macro parenthesization

Igor Mammedov (2):
mips: MIPSCPU model subclasses
mips: replace cpu_mips_init() with cpu_generic_init()

Philippe Mathieu-Daudé (4):
mips: move hw/mips/cputimer.c to target/mips/
mips: introduce internal.h and cleanup cpu.h
mips: split cpu_mips_realize_env() out of cpu_mips_init()
mips: call cpu_mips_realize_env() from mips_cpu_realizefn()

 hw/mips/Makefile.objs        |   2 +-
 hw/mips/cps.c                |   2 +-
 hw/mips/cputimer.c           | 165 -----------------
 hw/mips/mips_fulong2e.c      |   2 +-
 hw/mips/mips_jazz.c          |   2 +-
 hw/mips/mips_malta.c         |   2 +-
 hw/mips/mips_mipssim.c       |   2 +-
 hw/mips/mips_r4k.c           |   2 +-
 target/mips/Makefile.objs    |   2 +-
 target/mips/cp0_timer.c      | 165 +++++++++++++++++
 target/mips/cpu-qom.h        |   1 +
 target/mips/cpu.c            |  54 +++++-
 target/mips/cpu.h            | 357 +-----------------------------------
 target/mips/dsp_helper.c     |  56 +++---
 target/mips/gdbstub.c        |   1 +
 target/mips/helper.c         |   1 +
 target/mips/internal.h       | 422 +++++++++++++++++++++++++++++++++++++++++++
 target/mips/kvm.c            |   1 +
 target/mips/machine.c        |   1 +
 target/mips/msa_helper.c     |   1 +
 target/mips/op_helper.c      |   1 +
 target/mips/translate.c      |  23 +--
 target/mips/translate_init.c |  58 +-----
 23 files changed, 692 insertions(+), 631 deletions(-)
 delete mode 100644 hw/mips/cputimer.c
 create mode 100644 target/mips/cp0_timer.c
 create mode 100644 target/mips/internal.h
Signature · 1 line
2.7.4
#1 lore raw

[Qemu-devel] [PULL 5/7] mips: MIPSCPU model subclasses

From: Igor Mammedov <[email protected]>

Register separate QOM types for each mips cpu model, so it would be possible to reuse generic CPU creation routines.

[PMD: use internal.h, use void* to hold cpu_def in MIPSCPUClass,
mark MIPSCPU abstract, address Eduardo Habkost review]

---
 target/mips/cpu-qom.h        |  1 +
 target/mips/cpu.c            | 50 ++++++++++++++++++++++++++++++++++++-
 target/mips/internal.h       | 59 ++++++++++++++++++++++++++++++++++++++++++++
 target/mips/translate.c      | 13 +++++-----
 target/mips/translate_init.c | 58 ++-----------------------------------------
 5 files changed, 117 insertions(+), 64 deletions(-)
target/mips/cpu-qom.h +1 -0
index 3f5bf23..ee58606 100644
@@ -49,6 +49,7 @@ typedef struct MIPSCPUClass {
 
     DeviceRealize parent_realize;
     void (*parent_reset)(CPUState *cpu);
+    const struct mips_def_t *cpu_def;
 } MIPSCPUClass;
 
 typedef struct MIPSCPU MIPSCPU;
target/mips/cpu.c +49 -1

83 lines not on this page · raw message

target/mips/internal.h +59 -0

65 lines not on this page · raw message

target/mips/translate.c +6 -7
index 94c38e8..f7128bc 100644
@@ -20525,16 +20525,15 @@ void cpu_mips_realize_env(CPUMIPSState *env)
 
 MIPSCPU *cpu_mips_init(const char *cpu_model)
 {
+    ObjectClass *oc;
     MIPSCPU *cpu;
-    CPUMIPSState *env;
-    const mips_def_t *def;
 
-    def = cpu_mips_find_by_name(cpu_model);
-    if (!def)
+    oc = cpu_class_by_name(TYPE_MIPS_CPU, cpu_model);
+    if (oc == NULL) {
         return NULL;
-    cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
-    env = &cpu->env;
-    env->cpu_model = def;
+    }
+
+    cpu = MIPS_CPU(object_new(object_class_get_name(oc)));
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
target/mips/translate_init.c +2 -56

72 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 2/7] mips: introduce internal.h and cleanup cpu.h

In reply to Yongbok Kim

From: Philippe Mathieu-Daudé <[email protected]>

no logical change, only code movement (and fix a comment typo).

---
 target/mips/cp0_timer.c  |   1 +
 target/mips/cpu.c        |   1 +
 target/mips/cpu.h        | 354 +--------------------------------------------
 target/mips/gdbstub.c    |   1 +
 target/mips/helper.c     |   1 +
 target/mips/internal.h   | 362 +++++++++++++++++++++++++++++++++++++++++++++++
 target/mips/kvm.c        |   1 +
 target/mips/machine.c    |   1 +
 target/mips/msa_helper.c |   1 +
 target/mips/op_helper.c  |   1 +
 target/mips/translate.c  |   1 +
 11 files changed, 372 insertions(+), 353 deletions(-)
 create mode 100644 target/mips/internal.h
target/mips/cp0_timer.c +1 -0
index a9a58c5..f471639 100644
@@ -24,6 +24,7 @@
 #include "hw/mips/cpudevs.h"
 #include "qemu/timer.h"
 #include "sysemu/kvm.h"
+#include "internal.h"
 
 #define TIMER_PERIOD 10 /* 10 ns period for 100 Mhz frequency */
 
target/mips/cpu.c +1 -0
index 1bb66b7..68bf423 100644
@@ -21,6 +21,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "cpu.h"
+#include "internal.h"
 #include "kvm_mips.h"
 #include "qemu-common.h"
 #include "sysemu/kvm.h"
target/mips/cpu.h +1 -353

417 lines not on this page · raw message

target/mips/gdbstub.c +1 -0
index 7c68228..6d1fb70 100644
@@ -20,6 +20,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "internal.h"
 #include "exec/gdbstub.h"
 
 int mips_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
target/mips/helper.c +1 -0
index ca39aca..ea07626 100644
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 
 #include "cpu.h"
+#include "internal.h"
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 #include "exec/log.h"
target/mips/internal.h new file +362 -0

362 lines not on this page · raw message

target/mips/kvm.c +1 -0
index 3b7b1d9..8e72850 100644
@@ -16,6 +16,7 @@
 
 #include "qemu-common.h"
 #include "cpu.h"
+#include "internal.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
 #include "sysemu/sysemu.h"
target/mips/machine.c +1 -0
index 898825d..20100d5 100644
@@ -1,6 +1,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "cpu.h"
+#include "internal.h"
 #include "hw/hw.h"
 #include "migration/cpu.h"
 
target/mips/msa_helper.c +1 -0
index 1fdb0d9..f167a42 100644
@@ -19,6 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "internal.h"
 #include "exec/exec-all.h"
 #include "exec/helper-proto.h"
 
target/mips/op_helper.c +1 -0
index 320f2b0..e537a8b 100644
@@ -19,6 +19,7 @@
 #include "qemu/osdep.h"
 #include "qemu/main-loop.h"
 #include "cpu.h"
+#include "internal.h"
 #include "qemu/host-utils.h"
 #include "exec/helper-proto.h"
 #include "exec/exec-all.h"
target/mips/translate.c +1 -0
index c78d272..f0febaf 100644
@@ -23,6 +23,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "internal.h"
 #include "disas/disas.h"
 #include "exec/exec-all.h"
 #include "tcg-op.h"
Signature · 1 line
2.7.4
#3 lore raw

[Qemu-devel] [PULL 3/7] mips: split cpu_mips_realize_env() out of cpu_mips_init()

In reply to Yongbok Kim

From: Philippe Mathieu-Daudé <[email protected]>

so it can be used in mips_cpu_realizefn() in the next commit

---
 target/mips/internal.h  |  1 +
 target/mips/translate.c | 19 ++++++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)
target/mips/internal.h +1 -0
index 91c2df4..cf4c9db 100644
@@ -132,6 +132,7 @@ void mips_tcg_init(void);
 
 /* TODO QOM'ify CPU reset and remove */
 void cpu_state_reset(CPUMIPSState *s);
+void cpu_mips_realize_env(CPUMIPSState *env);
 
 /* cp0_timer.c */
 uint32_t cpu_mips_get_random(CPUMIPSState *env);
target/mips/translate.c +12 -7
index f0febaf..5fc7979 100644
@@ -20512,6 +20512,17 @@ void mips_tcg_init(void)
 
 #include "translate_init.c"
 
+void cpu_mips_realize_env(CPUMIPSState *env)
+{
+    env->exception_base = (int32_t)0xBFC00000;
+
+#ifndef CONFIG_USER_ONLY
+    mmu_init(env, env->cpu_model);
+#endif
+    fpu_init(env, env->cpu_model);
+    mvp_init(env, env->cpu_model);
+}
+
 MIPSCPU *cpu_mips_init(const char *cpu_model)
 {
     MIPSCPU *cpu;
@@ -20524,13 +20535,7 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
     cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
     env = &cpu->env;
     env->cpu_model = def;
-    env->exception_base = (int32_t)0xBFC00000;
-
-#ifndef CONFIG_USER_ONLY
-    mmu_init(env, def);
-#endif
-    fpu_init(env, def);
-    mvp_init(env, def);
+    cpu_mips_realize_env(env);
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
Signature · 1 line
2.7.4
#4 lore raw

[Qemu-devel] [PULL 6/7] mips: replace cpu_mips_init() with cpu_generic_init()

In reply to Yongbok Kim

From: Igor Mammedov <[email protected]>

now cpu_mips_init() reimplements subset of cpu_generic_init() tasks, so just drop it and use cpu_generic_init() directly.

---
 hw/mips/cps.c           |  2 +-
 hw/mips/mips_fulong2e.c |  2 +-
 hw/mips/mips_jazz.c     |  2 +-
 hw/mips/mips_malta.c    |  2 +-
 hw/mips/mips_mipssim.c  |  2 +-
 hw/mips/mips_r4k.c      |  2 +-
 target/mips/cpu.h       |  3 +--
 target/mips/translate.c | 17 -----------------
 8 files changed, 7 insertions(+), 25 deletions(-)
hw/mips/cps.c +1 -1
index 79d4c5e..fe5c630 100644
@@ -71,7 +71,7 @@ static void mips_cps_realize(DeviceState *dev, Error **errp)
     bool itu_present = false;
 
     for (i = 0; i < s->num_vp; i++) {
-        cpu = cpu_mips_init(s->cpu_model);
+        cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, s->cpu_model));
 
         /* Init internal devices */
         cpu_mips_irq_init_cpu(cpu);
hw/mips/mips_fulong2e.c +1 -1
index 439a3d7..7531868 100644
@@ -280,7 +280,7 @@ static void mips_fulong2e_init(MachineState *machine)
     if (cpu_model == NULL) {
         cpu_model = "Loongson-2E";
     }
-    cpu = cpu_mips_init(cpu_model);
+    cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model));
     env = &cpu->env;
 
     qemu_register_reset(main_cpu_reset, cpu);
hw/mips/mips_jazz.c +1 -1
index ae10670..7e6626d 100644
@@ -151,7 +151,7 @@ static void mips_jazz_init(MachineState *machine,
     if (cpu_model == NULL) {
         cpu_model = "R4000";
     }
-    cpu = cpu_mips_init(cpu_model);
+    cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model));
     env = &cpu->env;
     qemu_register_reset(main_cpu_reset, cpu);
 
hw/mips/mips_malta.c +1 -1
index e87cd32..2adb9bc 100644
@@ -931,7 +931,7 @@ static void create_cpu_without_cps(const char *cpu_model,
     int i;
 
     for (i = 0; i < smp_cpus; i++) {
-        cpu = cpu_mips_init(cpu_model);
+        cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model));
 
         /* Init internal devices */
         cpu_mips_irq_init_cpu(cpu);
hw/mips/mips_mipssim.c +1 -1
index 49cd38d..a092072 100644
@@ -163,7 +163,7 @@ mips_mipssim_init(MachineState *machine)
         cpu_model = "24Kf";
 #endif
     }
-    cpu = cpu_mips_init(cpu_model);
+    cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model));
     env = &cpu->env;
 
     reset_info = g_malloc0(sizeof(ResetData));
hw/mips/mips_r4k.c +1 -1
index 7efee94..1272d4e 100644
@@ -193,7 +193,7 @@ void mips_r4k_init(MachineState *machine)
         cpu_model = "24Kf";
 #endif
     }
-    cpu = cpu_mips_init(cpu_model);
+    cpu = MIPS_CPU(cpu_generic_init(TYPE_MIPS_CPU, cpu_model));
     env = &cpu->env;
 
     reset_info = g_malloc0(sizeof(ResetData));
target/mips/cpu.h +1 -2
index 2f81e0f..66265e4 100644
@@ -737,10 +737,9 @@ enum {
  */
 #define CPU_INTERRUPT_WAKE CPU_INTERRUPT_TGT_INT_0
 
-MIPSCPU *cpu_mips_init(const char *cpu_model);
 int cpu_mips_signal_handler(int host_signum, void *pinfo, void *puc);
 
-#define cpu_init(cpu_model) CPU(cpu_mips_init(cpu_model))
+#define cpu_init(cpu_model) cpu_generic_init(TYPE_MIPS_CPU, cpu_model)
 bool cpu_supports_cps_smp(const char *cpu_model);
 bool cpu_supports_isa(const char *cpu_model, unsigned int isa);
 void cpu_set_exception_base(int vp_index, target_ulong address);
target/mips/translate.c +0 -17
index f7128bc..d16d879 100644
@@ -20523,23 +20523,6 @@ void cpu_mips_realize_env(CPUMIPSState *env)
     mvp_init(env, env->cpu_model);
 }
 
-MIPSCPU *cpu_mips_init(const char *cpu_model)
-{
-    ObjectClass *oc;
-    MIPSCPU *cpu;
-
-    oc = cpu_class_by_name(TYPE_MIPS_CPU, cpu_model);
-    if (oc == NULL) {
-        return NULL;
-    }
-
-    cpu = MIPS_CPU(object_new(object_class_get_name(oc)));
-
-    object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
-
-    return cpu;
-}
-
 bool cpu_supports_cps_smp(const char *cpu_model)
 {
     const mips_def_t *def = cpu_mips_find_by_name(cpu_model);
Signature · 1 line
2.7.4
#5 lore raw

[Qemu-devel] [PULL 7/7] mips: Improve macro parenthesization

In reply to Yongbok Kim

From: Eric Blake <[email protected]>

Although none of the existing macro call-sites were broken, it's always better to write macros that properly parenthesize arguments that can be complex expressions, so that the intended order of operations is not broken.

---
 target/mips/dsp_helper.c | 56 ++++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)
target/mips/dsp_helper.c +28 -28
index dc70793..f152fea 100644
@@ -45,9 +45,9 @@ typedef union {
 } DSP64Value;
 
 /*** MIPS DSP internal functions begin ***/
-#define MIPSDSP_ABS(x) (((x) >= 0) ? x : -x)
-#define MIPSDSP_OVERFLOW_ADD(a, b, c, d) (~(a ^ b) & (a ^ c) & d)
-#define MIPSDSP_OVERFLOW_SUB(a, b, c, d) ((a ^ b) & (a ^ c) & d)
+#define MIPSDSP_ABS(x) (((x) >= 0) ? (x) : -(x))
+#define MIPSDSP_OVERFLOW_ADD(a, b, c, d) (~((a) ^ (b)) & ((a) ^ (c)) & (d))
+#define MIPSDSP_OVERFLOW_SUB(a, b, c, d) (((a) ^ (b)) & ((a) ^ (c)) & (d))
 
 static inline void set_DSPControl_overflow_flag(uint32_t flag, int position,
                                                 CPUMIPSState *env)
@@ -1047,47 +1047,47 @@ static inline int32_t mipsdsp_cmpu_lt(uint32_t a, uint32_t b)
 
 #define MIPSDSP_SPLIT32_8(num, a, b, c, d)  \
     do {                                    \
-        a = (num >> 24) & MIPSDSP_Q0;       \
-        b = (num >> 16) & MIPSDSP_Q0;       \
-        c = (num >> 8) & MIPSDSP_Q0;        \
-        d = num & MIPSDSP_Q0;               \
+        a = ((num) >> 24) & MIPSDSP_Q0;     \
+        b = ((num) >> 16) & MIPSDSP_Q0;     \
+        c = ((num) >> 8) & MIPSDSP_Q0;      \
+        d = (num) & MIPSDSP_Q0;             \
     } while (0)
 
 #define MIPSDSP_SPLIT32_16(num, a, b)       \
     do {                                    \
-        a = (num >> 16) & MIPSDSP_LO;       \
-        b = num & MIPSDSP_LO;               \
+        a = ((num) >> 16) & MIPSDSP_LO;     \
+        b = (num) & MIPSDSP_LO;             \
     } while (0)
 
-#define MIPSDSP_RETURN32_8(a, b, c, d)  ((target_long)(int32_t) \
-                                         (((uint32_t)a << 24) | \
-                                         (((uint32_t)b << 16) | \
-                                         (((uint32_t)c << 8) |  \
-                                          ((uint32_t)d & 0xFF)))))
-#define MIPSDSP_RETURN32_16(a, b)       ((target_long)(int32_t) \
-                                         (((uint32_t)a << 16) | \
-                                          ((uint32_t)b & 0xFFFF)))
+#define MIPSDSP_RETURN32_8(a, b, c, d)  ((target_long)(int32_t)         \
+                                         (((uint32_t)(a) << 24) |       \
+                                          ((uint32_t)(b) << 16) |       \
+                                          ((uint32_t)(c) << 8) |        \
+                                          ((uint32_t)(d) & 0xFF)))
+#define MIPSDSP_RETURN32_16(a, b)       ((target_long)(int32_t)         \
+                                         (((uint32_t)(a) << 16) |       \
+                                          ((uint32_t)(b) & 0xFFFF)))
 
 #ifdef TARGET_MIPS64
 #define MIPSDSP_SPLIT64_16(num, a, b, c, d)  \
     do {                                     \
-        a = (num >> 48) & MIPSDSP_LO;        \
-        b = (num >> 32) & MIPSDSP_LO;        \
-        c = (num >> 16) & MIPSDSP_LO;        \
-        d = num & MIPSDSP_LO;                \
+        a = ((num) >> 48) & MIPSDSP_LO;      \
+        b = ((num) >> 32) & MIPSDSP_LO;      \
+        c = ((num) >> 16) & MIPSDSP_LO;      \
+        d = (num) & MIPSDSP_LO;              \
     } while (0)
 
 #define MIPSDSP_SPLIT64_32(num, a, b)       \
     do {                                    \
-        a = (num >> 32) & MIPSDSP_LLO;      \
-        b = num & MIPSDSP_LLO;              \
+        a = ((num) >> 32) & MIPSDSP_LLO;    \
+        b = (num) & MIPSDSP_LLO;            \
     } while (0)
 
-#define MIPSDSP_RETURN64_16(a, b, c, d) (((uint64_t)a << 48) | \
-                                         ((uint64_t)b << 32) | \
-                                         ((uint64_t)c << 16) | \
-                                         (uint64_t)d)
-#define MIPSDSP_RETURN64_32(a, b)       (((uint64_t)a << 32) | (uint64_t)b)
+#define MIPSDSP_RETURN64_16(a, b, c, d) (((uint64_t)(a) << 48) |        \
+                                         ((uint64_t)(b) << 32) |        \
+                                         ((uint64_t)(c) << 16) |        \
+                                         (uint64_t)(d))
+#define MIPSDSP_RETURN64_32(a, b)       (((uint64_t)(a) << 32) | (uint64_t)(b))
 #endif
 
 /** DSP Arithmetic Sub-class insns **/
Signature · 1 line
2.7.4
#6 lore raw

[Qemu-devel] [PULL 1/7] mips: move hw/mips/cputimer.c to target/mips/

In reply to Yongbok Kim

From: Philippe Mathieu-Daudé <[email protected]>

This timer is a required part of the MIPS32/MIPS64 System Control coprocessor (CP0). Moving it with the other architecture related files will allow an opaque use of CPUMIPSState* in the next commit (introduce "internal.h").

also remove it from 'user' targets, remove an unnecessary include.

---
 hw/mips/Makefile.objs     |   2 +-
 hw/mips/cputimer.c        | 165 ----------------------------------------------
 target/mips/Makefile.objs |   2 +-
 target/mips/cp0_timer.c   | 164 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 166 insertions(+), 167 deletions(-)
 delete mode 100644 hw/mips/cputimer.c
 create mode 100644 target/mips/cp0_timer.c
hw/mips/Makefile.objs +1 -1
index 48cd2ef..17a311a 100644
@@ -1,5 +1,5 @@
 obj-y += mips_r4k.o mips_malta.o mips_mipssim.o
-obj-y += addr.o cputimer.o mips_int.o
+obj-y += addr.o mips_int.o
 obj-$(CONFIG_JAZZ) += mips_jazz.o
 obj-$(CONFIG_FULONG) += mips_fulong2e.o
 obj-y += gt64xxx_pci.o
hw/mips/cputimer.c deleted +0 -165

165 lines not on this page · raw message

target/mips/Makefile.objs +1 -1
index bc5ed85..651f36f 100644
@@ -1,4 +1,4 @@
 obj-y += translate.o dsp_helper.o op_helper.o lmi_helper.o helper.o cpu.o
 obj-y += gdbstub.o msa_helper.o mips-semi.o
-obj-$(CONFIG_SOFTMMU) += machine.o
+obj-$(CONFIG_SOFTMMU) += machine.o cp0_timer.o
 obj-$(CONFIG_KVM) += kvm.o
target/mips/cp0_timer.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
2.7.4
#7 lore raw

[Qemu-devel] [PULL 4/7] mips: call cpu_mips_realize_env() from mips_cpu_realizefn()

In reply to Yongbok Kim

From: Philippe Mathieu-Daudé <[email protected]>

This changes the order between cpu_mips_realize_env() and cpu_exec_initfn(), but cpu_exec_initfn() don't have anything that depends on cpu_mips_realize_env() being called first.

---
 target/mips/cpu.c       | 3 +++
 target/mips/translate.c | 1 -
 2 files changed, 3 insertions(+), 1 deletion(-)
target/mips/cpu.c +3 -0
index 68bf423..e3ef835 100644
@@ -123,6 +123,7 @@ static void mips_cpu_disas_set_info(CPUState *s, disassemble_info *info) {
 static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
 {
     CPUState *cs = CPU(dev);
+    MIPSCPU *cpu = MIPS_CPU(dev);
     MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(dev);
     Error *local_err = NULL;
 
@@ -132,6 +133,8 @@ static void mips_cpu_realizefn(DeviceState *dev, Error **errp)
         return;
     }
 
+    cpu_mips_realize_env(&cpu->env);
+
     cpu_reset(cs);
     qemu_init_vcpu(cs);
 
target/mips/translate.c +0 -1
index 5fc7979..94c38e8 100644
@@ -20535,7 +20535,6 @@ MIPSCPU *cpu_mips_init(const char *cpu_model)
     cpu = MIPS_CPU(object_new(TYPE_MIPS_CPU));
     env = &cpu->env;
     env->cpu_model = def;
-    cpu_mips_realize_env(env);
 
     object_property_set_bool(OBJECT(cpu), true, "realized", NULL);
 
Signature · 1 line
2.7.4
#8 lore raw
In reply to Yongbok Kim
This series seems to have some coding style problems. See output below for more information:

Hi,

This series seems to have some coding style problems. See output below for more information:

Subject: [Qemu-devel] [PULL 0/7] target-mips queue
Message-id: [email protected]
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash

BASE=base
n=1
total=$(git log --oneline $BASE.. | wc -l)
failed=0

git config --local diff.renamelimit 0
git config --local diff.renames True

commits="$(git log --format=%H --reverse $BASE..)" for c in $commits; do

    echo "Checking PATCH $n/$total: $(git log -n 1 --format=%s $c)..."
    if ! git show $c --format=email | ./scripts/checkpatch.pl --mailback -; then
        failed=1
        echo
    fi
    n=$((n+1))

done

exit $failed
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
116019051c mips: Improve macro parenthesization
acd068893a mips: replace cpu_mips_init() with cpu_generic_init() 39800b8ba2 mips: MIPSCPU model subclasses
9b397529e6 mips: call cpu_mips_realize_env() from mips_cpu_realizefn() 91d8418edd mips: split cpu_mips_realize_env() out of cpu_mips_init() 925c58e3ac mips: introduce internal.h and cleanup cpu.h 3b898a7dc8 mips: move hw/mips/cputimer.c to target/mips/

=== OUTPUT BEGIN ===
Checking PATCH 1/7: mips: move hw/mips/cputimer.c to target/mips/... Checking PATCH 2/7: mips: introduce internal.h and cleanup cpu.h...
ERROR: space prohibited after that '&' (ctx:WxW)
#729: FILE: target/mips/internal.h:230:

+    if ((env->CP0_VPControl >> CP0VPCtl_DIS) & 1) {
                                              ^

ERROR: space prohibited after that '&' (ctx:WxW)
#737: FILE: target/mips/internal.h:238:

+            ((other_cpu->env.CP0_VPControl >> CP0VPCtl_DIS) & 1)) {
                                                             ^

ERROR: space prohibited after that '&' (ctx:WxW)
#757: FILE: target/mips/internal.h:258:

+        env->hflags |= (env->CP0_Status >> CP0St_KSU) & MIPS_HFLAG_KSU;
                                                       ^

total: 3 errors, 0 warnings, 842 lines checked

Your patch has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

Checking PATCH 3/7: mips: split cpu_mips_realize_env() out of cpu_mips_init()... Checking PATCH 4/7: mips: call cpu_mips_realize_env() from mips_cpu_realizefn()... Checking PATCH 5/7: mips: MIPSCPU model subclasses...
Checking PATCH 6/7: mips: replace cpu_mips_init() with cpu_generic_init()... Checking PATCH 7/7: mips: Improve macro parenthesization...
=== OUTPUT END ===

Test command exited with code: 1

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#9 lore raw
In reply to Yongbok Kim
Quoted 18 lines · Yongbok Kim

Hi,

The patch 1 and 2 contain checkpatch.pl errors but patch 1 is relocating a file and patch 2 has false positive warnings.

Regards,
Yongbok

The following changes since commit ff5667ed53c544c4dc88dcd7cb23cc509c9a55e0:

Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-signed' into staging (2017-09-21 10:56:09 +0100)

are available in the git repository at:

git://github.com/yongbok/upstream-qemu.git tags/mips-20170921

for you to fetch changes up to 2a2be359c4335607c7f746cf27c412c08ab89aff:

Quoted 9 lines

mips: Improve macro parenthesization (2017-09-21 13:25:41 +0100)

----------------------------------------------------------------
MIPS patches 2017-09-21

Changes:
QOMify MIPS cpu
Improve macro parenthesization

Applied, thanks.

-- PMM