Skip to contentSkip to conversation

hw/sparc: Kconfig fixes to build with/without the leon3 machine

PATCH Superseded Philippe Mathieu-Daudé 4 participants 9 messages Apr 27, 2021 – Apr 28, 2021 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover hw/sparc: Kconfig fixes to build with/without the leon3 machine

This series fixes link failure when building either the leon3 machine or the sun4m ones.

The problem is we have hardware specific code in the architectural translation code. Move this code to hw/sparc/.

The link failures can be reproduced doing:

  $ echo CONFIG_LEON3=y > default-configs/devices/sparc-softmmu.mak
  $ configure --without-default-devices
  $ ninja qemu-system-sparc
  $ ./qemu-system-sparc -M leon3 -S

or:

  $ echo CONFIG_SUN4M=y > default-configs/devices/sparc-softmmu.mak

Philippe Mathieu-Daudé (2):
hw/sparc: Allow building the leon3 machine stand-alone hw/sparc: Allow building without the leon3 machine

 target/sparc/cpu.h          |  6 ----
 hw/sparc/irq.c              | 61 +++++++++++++++++++++++++++++++++++++
 hw/sparc/leon3.c            | 37 +++++++++++++++++++++-
 hw/sparc/sun4m.c            | 32 -------------------
 target/sparc/int32_helper.c | 37 ----------------------
 hw/sparc/meson.build        |  1 +
 hw/sparc/trace-events       |  2 ++
 target/sparc/trace-events   |  4 ---
 8 files changed, 100 insertions(+), 80 deletions(-)
 create mode 100644 hw/sparc/irq.c
Signature · 1 line
2.26.3
#1 lore raw

PATCH 1/2 hw/sparc: Allow building the leon3 machine stand-alone

When building only the leon3 machine, we get this link failure:

/usr/bin/ld: target_sparc_win_helper.c.o: in function `cpu_put_psr':
target/sparc/win_helper.c:91: undefined reference to `cpu_check_irqs'

This is because cpu_check_irqs() is defined in hw/sparc/sun4m.c, which is only built if the base sun4m machines are built (with the CONFIG_SUN4M selector).

Fix by moving cpu_check_irqs() out of hw/sparc/sun4m.c and build it unconditionally.

---
 hw/sparc/irq.c       | 61 ++++++++++++++++++++++++++++++++++++++++++++
 hw/sparc/sun4m.c     | 32 -----------------------
 hw/sparc/meson.build |  1 +
 3 files changed, 62 insertions(+), 32 deletions(-)
 create mode 100644 hw/sparc/irq.c
hw/sparc/irq.c new file +61 -0
new file mode 100644
index 00000000000..e34639f266e
@@ -0,0 +1,61 @@
+/*
+ * QEMU Sun4m & Sun4d & Sun4c IRQ handling
+ *
+ * Copyright (c) 2003-2005 Fabrice Bellard
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
+#include "hw/irq.h"
+#include "cpu.h"
+#include "trace.h"
+
+void cpu_check_irqs(CPUSPARCState *env)
+{
+    CPUState *cs;
+
+    /* We should be holding the BQL before we mess with IRQs */
+    g_assert(qemu_mutex_iothread_locked());
+
+    if (env->pil_in && (env->interrupt_index == 0 ||
+                        (env->interrupt_index & ~15) == TT_EXTINT)) {
+        unsigned int i;
+
+        for (i = 15; i > 0; i--) {
+            if (env->pil_in & (1 << i)) {
+                int old_interrupt = env->interrupt_index;
+
+                env->interrupt_index = TT_EXTINT | i;
+                if (old_interrupt != env->interrupt_index) {
+                    cs = env_cpu(env);
+                    trace_sun4m_cpu_interrupt(i);
+                    cpu_interrupt(cs, CPU_INTERRUPT_HARD);
+                }
+                break;
+            }
+        }
+    } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
+        cs = env_cpu(env);
+        trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15);
+        env->interrupt_index = 0;
+        cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
+    }
+}
hw/sparc/sun4m.c +0 -32
index 1a00816d9a8..2edf913d945 100644
@@ -159,38 +159,6 @@ static void nvram_init(Nvram *nvram, uint8_t *macaddr,
     }
 }
 
-void cpu_check_irqs(CPUSPARCState *env)
-{
-    CPUState *cs;
-
-    /* We should be holding the BQL before we mess with IRQs */
-    g_assert(qemu_mutex_iothread_locked());
-
-    if (env->pil_in && (env->interrupt_index == 0 ||
-                        (env->interrupt_index & ~15) == TT_EXTINT)) {
-        unsigned int i;
-
-        for (i = 15; i > 0; i--) {
-            if (env->pil_in & (1 << i)) {
-                int old_interrupt = env->interrupt_index;
-
-                env->interrupt_index = TT_EXTINT | i;
-                if (old_interrupt != env->interrupt_index) {
-                    cs = env_cpu(env);
-                    trace_sun4m_cpu_interrupt(i);
-                    cpu_interrupt(cs, CPU_INTERRUPT_HARD);
-                }
-                break;
-            }
-        }
-    } else if (!env->pil_in && (env->interrupt_index & ~15) == TT_EXTINT) {
-        cs = env_cpu(env);
-        trace_sun4m_cpu_reset_interrupt(env->interrupt_index & 15);
-        env->interrupt_index = 0;
-        cpu_reset_interrupt(cs, CPU_INTERRUPT_HARD);
-    }
-}
-
 static void cpu_kick_irq(SPARCCPU *cpu)
 {
     CPUSPARCState *env = &cpu->env;
hw/sparc/meson.build +1 -0
index 19c442c90d9..470159ff659 100644
@@ -1,4 +1,5 @@
 sparc_ss = ss.source_set()
+sparc_ss.add(files('irq.c'))
 sparc_ss.add(when: 'CONFIG_LEON3', if_true: files('leon3.c'))
 sparc_ss.add(when: 'CONFIG_SUN4M', if_true: files('sun4m.c'))
 sparc_ss.add(when: 'CONFIG_SUN4M', if_true: files('sun4m_iommu.c'))
Signature · 1 line
2.26.3
#2 lore raw

Re: [PATCH 1/2] hw/sparc: Allow building the leon3 machine stand-alone

Quoted 12 lines · Philippe Mathieu-Daudé

When building only the leon3 machine, we get this link failure:

/usr/bin/ld: target_sparc_win_helper.c.o: in function `cpu_put_psr':
target/sparc/win_helper.c:91: undefined reference to `cpu_check_irqs'

This is because cpu_check_irqs() is defined in hw/sparc/sun4m.c, which is only built if the base sun4m machines are built (with the CONFIG_SUN4M selector).

Fix by moving cpu_check_irqs() out of hw/sparc/sun4m.c and build it unconditionally.

Quoted 7 lines
---
  hw/sparc/irq.c       | 61 ++++++++++++++++++++++++++++++++++++++++++++
  hw/sparc/sun4m.c     | 32 -----------------------
  hw/sparc/meson.build |  1 +
  3 files changed, 62 insertions(+), 32 deletions(-)

create mode 100644 hw/sparc/irq.c

I think this code should be in target/sparc/. There doesn't seem to be any reference to anything outside CPUSPARCState.

r~

#3 lore raw

Re: [PATCH 1/2] hw/sparc: Allow building the leon3 machine stand-alone

Quoted 21 lines · Richard Henderson
Quoted 12 lines · Philippe Mathieu-Daudé

When building only the leon3 machine, we get this link failure:

   /usr/bin/ld: target_sparc_win_helper.c.o: in function `cpu_put_psr':
   target/sparc/win_helper.c:91: undefined reference to `cpu_check_irqs'

This is because cpu_check_irqs() is defined in hw/sparc/sun4m.c, which is only built if the base sun4m machines are built (with the CONFIG_SUN4M selector).

Fix by moving cpu_check_irqs() out of hw/sparc/sun4m.c and build it unconditionally.

Quoted 7 lines

---
  hw/sparc/irq.c       | 61 ++++++++++++++++++++++++++++++++++++++++++++ hw/sparc/sun4m.c     | 32 ----------------------- hw/sparc/meson.build |  1 +

  3 files changed, 62 insertions(+), 32 deletions(-)

  create mode 100644 hw/sparc/irq.c

Quoted 1 line

I think this code should be in target/sparc/.  There doesn't seem to be any reference to anything outside CPUSPARCState.

I suspect that this is based upon the existing precedent set by SPARC64 where the IRQ routines are stored in hw/sparc64/sparc64.c. I'd lean towards the current approach for now so that both 32-bit and 64-bit could be moved into target/sparc as a separate exercise for consistency.

ATB,

Mark.

#4 lore raw

RFC PATCH 2/2 hw/sparc: Allow building without the leon3 machine

In reply to Philippe Mathieu-Daudé

When building without the leon3 machine, we get this link failure:

/usr/bin/ld: target_sparc_int32_helper.c.o: in function `leon3_irq_manager':
target/sparc/int32_helper.c:172: undefined reference to `leon3_irq_ack'

This is because the leon3_irq_ack() is declared in hw/sparc/leon3.c, which is only build when CONFIG_LEON3 is selected.

Fix by moving the leon3_cache_control_int() / leon3_irq_manager() (which are specific to the leon3 machine) to hw/sparc/leon3.c. Move the trace events along (but don't rename them).

leon3_irq_ack() is now locally used, declare it static to reduce its scope.

---
RFC: The problem is we have hardware specific code in the architectural translation code. I wish there was a better alternative rather than moving this code to hw/sparc/.

---
 target/sparc/cpu.h          |  6 ------
 hw/sparc/leon3.c            | 37 ++++++++++++++++++++++++++++++++++++-
 target/sparc/int32_helper.c | 37 -------------------------------------
 hw/sparc/trace-events       |  2 ++
 target/sparc/trace-events   |  4 ----
 5 files changed, 38 insertions(+), 48 deletions(-)
target/sparc/cpu.h +0 -6
index 4b2290650be..ff8ae73002a 100644
@@ -615,15 +615,9 @@ int cpu_cwp_inc(CPUSPARCState *env1, int cwp);
 int cpu_cwp_dec(CPUSPARCState *env1, int cwp);
 void cpu_set_cwp(CPUSPARCState *env1, int new_cwp);
 
-/* int_helper.c */
-void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno);
-
 /* sun4m.c, sun4u.c */
 void cpu_check_irqs(CPUSPARCState *env);
 
-/* leon3.c */
-void leon3_irq_ack(void *irq_manager, int intno);
-
 #if defined (TARGET_SPARC64)
 
 static inline int compare_masked(uint64_t x, uint64_t y, uint64_t mask)
hw/sparc/leon3.c +36 -1
index 7e16eea9e67..98e3789cf84 100644
@@ -137,7 +137,36 @@ static void main_cpu_reset(void *opaque)
     env->regbase[6] = s->sp;
 }
 
-void leon3_irq_ack(void *irq_manager, int intno)
+static void leon3_cache_control_int(CPUSPARCState *env)
+{
+    uint32_t state = 0;
+
+    if (env->cache_control & CACHE_CTRL_IF) {
+        /* Instruction cache state */
+        state = env->cache_control & CACHE_STATE_MASK;
+        if (state == CACHE_ENABLED) {
+            state = CACHE_FROZEN;
+            trace_int_helper_icache_freeze();
+        }
+
+        env->cache_control &= ~CACHE_STATE_MASK;
+        env->cache_control |= state;
+    }
+
+    if (env->cache_control & CACHE_CTRL_DF) {
+        /* Data cache state */
+        state = (env->cache_control >> 2) & CACHE_STATE_MASK;
+        if (state == CACHE_ENABLED) {
+            state = CACHE_FROZEN;
+            trace_int_helper_dcache_freeze();
+        }
+
+        env->cache_control &= ~(CACHE_STATE_MASK << 2);
+        env->cache_control |= (state << 2);
+    }
+}
+
+static void leon3_irq_ack(void *irq_manager, int intno)
 {
     grlib_irqmp_ack((DeviceState *)irq_manager, intno);
 }
@@ -181,6 +210,12 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
     }
 }
 
+static void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno)
+{
+    leon3_irq_ack(irq_manager, intno);
+    leon3_cache_control_int(env);
+}
+
 static void leon3_generic_hw_init(MachineState *machine)
 {
     ram_addr_t ram_size = machine->ram_size;
target/sparc/int32_helper.c +0 -37
index 817a463a179..d008dbdb65c 100644
@@ -136,40 +136,3 @@ void sparc_cpu_do_interrupt(CPUState *cs)
     }
 #endif
 }
-
-#if !defined(CONFIG_USER_ONLY)
-static void leon3_cache_control_int(CPUSPARCState *env)
-{
-    uint32_t state = 0;
-
-    if (env->cache_control & CACHE_CTRL_IF) {
-        /* Instruction cache state */
-        state = env->cache_control & CACHE_STATE_MASK;
-        if (state == CACHE_ENABLED) {
-            state = CACHE_FROZEN;
-            trace_int_helper_icache_freeze();
-        }
-
-        env->cache_control &= ~CACHE_STATE_MASK;
-        env->cache_control |= state;
-    }
-
-    if (env->cache_control & CACHE_CTRL_DF) {
-        /* Data cache state */
-        state = (env->cache_control >> 2) & CACHE_STATE_MASK;
-        if (state == CACHE_ENABLED) {
-            state = CACHE_FROZEN;
-            trace_int_helper_dcache_freeze();
-        }
-
-        env->cache_control &= ~(CACHE_STATE_MASK << 2);
-        env->cache_control |= (state << 2);
-    }
-}
-
-void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno)
-{
-    leon3_irq_ack(irq_manager, intno);
-    leon3_cache_control_int(env);
-}
-#endif
hw/sparc/trace-events +2 -0
index 355b07ae057..dfb53dc1a24 100644
@@ -19,3 +19,5 @@ sun4m_iommu_bad_addr(uint64_t addr) "bad addr 0x%"PRIx64
 # leon3.c
 leon3_set_irq(int intno) "Set CPU IRQ %d"
 leon3_reset_irq(int intno) "Reset CPU IRQ %d"
+int_helper_icache_freeze(void) "Instruction cache: freeze"
+int_helper_dcache_freeze(void) "Data cache: freeze"
target/sparc/trace-events +0 -4
index 6a064e23275..e925ddd1cc0 100644
@@ -15,10 +15,6 @@ int_helper_set_softint(uint32_t softint) "new 0x%08x"
 int_helper_clear_softint(uint32_t softint) "new 0x%08x"
 int_helper_write_softint(uint32_t softint) "new 0x%08x"
 
-# int32_helper.c
-int_helper_icache_freeze(void) "Instruction cache: freeze"
-int_helper_dcache_freeze(void) "Data cache: freeze"
-
 # win_helper.c
 win_helper_gregset_error(uint32_t pstate) "ERROR in get_gregset: active pstate bits=0x%x"
 win_helper_switch_pstate(uint32_t pstate_regs, uint32_t new_pstate_regs) "change_pstate: switching regs old=0x%x new=0x%x"
Signature · 1 line
2.26.3
Reviewed-by on v1 2/2
#5 lore raw

Re: [RFC PATCH 2/2] hw/sparc: Allow building without the leon3 machine

Quoted 15 lines · Philippe Mathieu-Daudé

When building without the leon3 machine, we get this link failure:

/usr/bin/ld: target_sparc_int32_helper.c.o: in function `leon3_irq_manager':
target/sparc/int32_helper.c:172: undefined reference to `leon3_irq_ack'

This is because the leon3_irq_ack() is declared in hw/sparc/leon3.c, which is only build when CONFIG_LEON3 is selected.

Fix by moving the leon3_cache_control_int() / leon3_irq_manager() (which are specific to the leon3 machine) to hw/sparc/leon3.c. Move the trace events along (but don't rename them).

leon3_irq_ack() is now locally used, declare it static to reduce its scope.

Quoted 6 lines

---
RFC: The problem is we have hardware specific code in the architectural translation code. I wish there was a better alternative rather than moving this code to hw/sparc/.
---

This one seems dead obvious. I think this code should have been in hw/sparc/leon3.c to begin with.

r~

Reviewed-by KONRAD Frederic Tested-by KONRAD Frederic on v1 2/2
#6 lore raw

Re: [RFC PATCH 2/2] hw/sparc: Allow building without the leon3 machine

In reply to Philippe Mathieu-Daudé

Hi Philippe,

Le 4/27/21 à 9:26 PM, Philippe Mathieu-Daudé a écrit :

Quoted 8 lines

When building without the leon3 machine, we get this link failure:

/usr/bin/ld: target_sparc_int32_helper.c.o: in function `leon3_irq_manager':
target/sparc/int32_helper.c:172: undefined reference to `leon3_irq_ack'

This is because the leon3_irq_ack() is declared in hw/sparc/leon3.c, which is only build when CONFIG_LEON3 is selected.

Quoted 8 lines

Fix by moving the leon3_cache_control_int() / leon3_irq_manager() (which are specific to the leon3 machine) to hw/sparc/leon3.c. Move the trace events along (but don't rename them).

leon3_irq_ack() is now locally used, declare it static to reduce its scope.

Thanks for the fix!

Quoted 158 lines

---
RFC: The problem is we have hardware specific code in the architectural translation code. I wish there was a better alternative rather than moving this code to hw/sparc/.

---
  target/sparc/cpu.h          |  6 ------
  hw/sparc/leon3.c            | 37 ++++++++++++++++++++++++++++++++++++-
  target/sparc/int32_helper.c | 37 -------------------------------------
  hw/sparc/trace-events       |  2 ++
  target/sparc/trace-events   |  4 ----
  5 files changed, 38 insertions(+), 48 deletions(-)
target/sparc/cpu.h +0 -6
index 4b2290650be..ff8ae73002a 100644
@@ -615,15 +615,9 @@ int cpu_cwp_inc(CPUSPARCState *env1, int cwp);
  int cpu_cwp_dec(CPUSPARCState *env1, int cwp);
  void cpu_set_cwp(CPUSPARCState *env1, int new_cwp);
 
-/* int_helper.c */
-void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno);
-
  /* sun4m.c, sun4u.c */
  void cpu_check_irqs(CPUSPARCState *env);
 
-/* leon3.c */
-void leon3_irq_ack(void *irq_manager, int intno);
-
  #if defined (TARGET_SPARC64)
 
  static inline int compare_masked(uint64_t x, uint64_t y, uint64_t mask)
hw/sparc/leon3.c +36 -1
index 7e16eea9e67..98e3789cf84 100644
@@ -137,7 +137,36 @@ static void main_cpu_reset(void *opaque)
      env->regbase[6] = s->sp;
  }
 
-void leon3_irq_ack(void *irq_manager, int intno)
+static void leon3_cache_control_int(CPUSPARCState *env)
+{
+    uint32_t state = 0;
+
+    if (env->cache_control & CACHE_CTRL_IF) {
+        /* Instruction cache state */
+        state = env->cache_control & CACHE_STATE_MASK;
+        if (state == CACHE_ENABLED) {
+            state = CACHE_FROZEN;
+            trace_int_helper_icache_freeze();
+        }
+
+        env->cache_control &= ~CACHE_STATE_MASK;
+        env->cache_control |= state;
+    }
+
+    if (env->cache_control & CACHE_CTRL_DF) {
+        /* Data cache state */
+        state = (env->cache_control >> 2) & CACHE_STATE_MASK;
+        if (state == CACHE_ENABLED) {
+            state = CACHE_FROZEN;
+            trace_int_helper_dcache_freeze();
+        }
+
+        env->cache_control &= ~(CACHE_STATE_MASK << 2);
+        env->cache_control |= (state << 2);
+    }
+}
+
+static void leon3_irq_ack(void *irq_manager, int intno)
  {
      grlib_irqmp_ack((DeviceState *)irq_manager, intno);
  }
@@ -181,6 +210,12 @@ static void leon3_set_pil_in(void *opaque, int n, int level)
      }
  }
 
+static void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno)
+{
+    leon3_irq_ack(irq_manager, intno);
+    leon3_cache_control_int(env);
+}
+
  static void leon3_generic_hw_init(MachineState *machine)
  {
      ram_addr_t ram_size = machine->ram_size;
target/sparc/int32_helper.c +0 -37
index 817a463a179..d008dbdb65c 100644
@@ -136,40 +136,3 @@ void sparc_cpu_do_interrupt(CPUState *cs)
      }
  #endif
  }
-
-#if !defined(CONFIG_USER_ONLY)
-static void leon3_cache_control_int(CPUSPARCState *env)
-{
-    uint32_t state = 0;
-
-    if (env->cache_control & CACHE_CTRL_IF) {
-        /* Instruction cache state */
-        state = env->cache_control & CACHE_STATE_MASK;
-        if (state == CACHE_ENABLED) {
-            state = CACHE_FROZEN;
-            trace_int_helper_icache_freeze();
-        }
-
-        env->cache_control &= ~CACHE_STATE_MASK;
-        env->cache_control |= state;
-    }
-
-    if (env->cache_control & CACHE_CTRL_DF) {
-        /* Data cache state */
-        state = (env->cache_control >> 2) & CACHE_STATE_MASK;
-        if (state == CACHE_ENABLED) {
-            state = CACHE_FROZEN;
-            trace_int_helper_dcache_freeze();
-        }
-
-        env->cache_control &= ~(CACHE_STATE_MASK << 2);
-        env->cache_control |= (state << 2);
-    }
-}
-
-void leon3_irq_manager(CPUSPARCState *env, void *irq_manager, int intno)
-{
-    leon3_irq_ack(irq_manager, intno);
-    leon3_cache_control_int(env);
-}
-#endif
hw/sparc/trace-events +2 -0
index 355b07ae057..dfb53dc1a24 100644
@@ -19,3 +19,5 @@ sun4m_iommu_bad_addr(uint64_t addr) "bad addr 0x%"PRIx64
  # leon3.c
  leon3_set_irq(int intno) "Set CPU IRQ %d"
  leon3_reset_irq(int intno) "Reset CPU IRQ %d"
+int_helper_icache_freeze(void) "Instruction cache: freeze"
+int_helper_dcache_freeze(void) "Data cache: freeze"
target/sparc/trace-events +0 -4
index 6a064e23275..e925ddd1cc0 100644
@@ -15,10 +15,6 @@ int_helper_set_softint(uint32_t softint) "new 0x%08x"
  int_helper_clear_softint(uint32_t softint) "new 0x%08x"
  int_helper_write_softint(uint32_t softint) "new 0x%08x"
 
-# int32_helper.c
-int_helper_icache_freeze(void) "Instruction cache: freeze"
-int_helper_dcache_freeze(void) "Data cache: freeze"
-
  # win_helper.c
  win_helper_gregset_error(uint32_t pstate) "ERROR in get_gregset: active pstate bits=0x%x"
  win_helper_switch_pstate(uint32_t pstate_regs, uint32_t new_pstate_regs) "change_pstate: switching regs old=0x%x new=0x%x"
#7 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 30 lines · Philippe Mathieu-Daudé

This series fixes link failure when building either the leon3 machine or the sun4m ones.

The problem is we have hardware specific code in the architectural translation code. Move this code to hw/sparc/.

The link failures can be reproduced doing:

   $ echo CONFIG_LEON3=y > default-configs/devices/sparc-softmmu.mak
   $ configure --without-default-devices
   $ ninja qemu-system-sparc
   $ ./qemu-system-sparc -M leon3 -S

or:

   $ echo CONFIG_SUN4M=y > default-configs/devices/sparc-softmmu.mak

Philippe Mathieu-Daudé (2):
hw/sparc: Allow building the leon3 machine stand-alone hw/sparc: Allow building without the leon3 machine

  target/sparc/cpu.h          |  6 ----
  hw/sparc/irq.c              | 61 +++++++++++++++++++++++++++++++++++++
  hw/sparc/leon3.c            | 37 +++++++++++++++++++++-
  hw/sparc/sun4m.c            | 32 -------------------
  target/sparc/int32_helper.c | 37 ----------------------
  hw/sparc/meson.build        |  1 +
  hw/sparc/trace-events       |  2 ++
  target/sparc/trace-events   |  4 ---
  8 files changed, 100 insertions(+), 80 deletions(-)
Quoted 1 line

create mode 100644 hw/sparc/irq.c

Just one comment from me but other than that seems fine: if Frederic and/or Fabien could give a R-B tag then I'm happy to queue it via qemu-sparc.

ATB,

Mark.

#8 lore raw
In reply to Philippe Mathieu-Daudé

Le 4/27/21 à 9:26 PM, Philippe Mathieu-Daudé a écrit :

Quoted 11 lines

This series fixes link failure when building either the leon3 machine or the sun4m ones.

The problem is we have hardware specific code in the architectural translation code. Move this code to hw/sparc/.

The link failures can be reproduced doing:

   $ echo CONFIG_LEON3=y > default-configs/devices/sparc-softmmu.mak
   $ configure --without-default-devices
   $ ninja qemu-system-sparc

Indeed:

libqemu-sparc-softmmu.fa.p/target_sparc_win_helper.c.o: \
In function `cpu_put_psr':
xxx/qemu/build/../target/sparc/win_helper.c:91: \
undefined reference to `cpu_check_irqs'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Quoted 21 lines
   $ ./qemu-system-sparc -M leon3 -S

or:

   $ echo CONFIG_SUN4M=y > default-configs/devices/sparc-softmmu.mak

Philippe Mathieu-Daudé (2):
hw/sparc: Allow building the leon3 machine stand-alone hw/sparc: Allow building without the leon3 machine

  target/sparc/cpu.h          |  6 ----
  hw/sparc/irq.c              | 61 +++++++++++++++++++++++++++++++++++++
  hw/sparc/leon3.c            | 37 +++++++++++++++++++++-
  hw/sparc/sun4m.c            | 32 -------------------
  target/sparc/int32_helper.c | 37 ----------------------
  hw/sparc/meson.build        |  1 +
  hw/sparc/trace-events       |  2 ++
  target/sparc/trace-events   |  4 ---
  8 files changed, 100 insertions(+), 80 deletions(-)

create mode 100644 hw/sparc/irq.c