Skip to contentSkip to conversation

linux-user/mips: Select correct CPUs

PATCH In review Philippe Mathieu-Daudé 2 participants 10 messages Aug 14, 2024 – Aug 15, 2024

lore
Share & tools
lore
#0 lore raw

cover linux-user/mips: Select correct CPUs

Improve CPU type selection:
- Remove R5900
- Cover Octeon / R2 / Loongson*

Philippe Mathieu-Daudé (4):
linux-user/mips: Do not try to use removed R5900 CPU linux-user/mips: Select Octeon68XX CPU for Octeon binaries linux-user/mips: Select MIPS64R2-generic for Rel2 binaries linux-user/mips: Select Loongson CPU for Loongson binaries

 linux-user/mips/target_elf.h   |  3 ---
 linux-user/mips64/target_elf.h | 24 ++++++++++++++++++++----
 2 files changed, 20 insertions(+), 7 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH 1/4 linux-user/mips: Do not try to use removed R5900 CPU

R5900 emulation was removed in commit 823f2897bd.
Remove it from ELF parsing in order to avoid:

  $ qemu-mipsn32 ./test5900
  qemu-mipsn32: unable to find CPU model 'R5900'

This reverts commit 4d9e5a0eb7df6e98ac6cf5e16029f35dd05b9537.

Fixes 823f2897bd ("target/mips: Disable R5900 support")
---
 linux-user/mips/target_elf.h   | 3 ---
 linux-user/mips64/target_elf.h | 3 ---
 2 files changed, 6 deletions(-)
linux-user/mips/target_elf.h +0 -3
index b965e86b2b..71a32315a8 100644
@@ -12,9 +12,6 @@ static inline const char *cpu_get_model(uint32_t eflags)
     if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_32R6) {
         return "mips32r6-generic";
     }
-    if ((eflags & EF_MIPS_MACH) == EF_MIPS_MACH_5900) {
-        return "R5900";
-    }
     if (eflags & EF_MIPS_NAN2008) {
         return "P5600";
     }
linux-user/mips64/target_elf.h +0 -3
index 5f2f2df29f..ec55d8542a 100644
@@ -12,9 +12,6 @@ static inline const char *cpu_get_model(uint32_t eflags)
     if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) {
         return "I6400";
     }
-    if ((eflags & EF_MIPS_MACH) == EF_MIPS_MACH_5900) {
-        return "R5900";
-    }
     return "5KEf";
 }
 #endif
Signature · 1 line
2.45.2
Reviewed-by on v1 1/4
#2 lore raw

Re: [PATCH-for-9.1 1/4] linux-user/mips: Do not try to use removed R5900 CPU

Quoted 6 lines · Philippe Mathieu-Daudé

R5900 emulation was removed in commit 823f2897bd.
Remove it from ELF parsing in order to avoid:

   $ qemu-mipsn32 ./test5900
   qemu-mipsn32: unable to find CPU model 'R5900'
Quoted 8 lines

This reverts commit 4d9e5a0eb7df6e98ac6cf5e16029f35dd05b9537.

Fixes 823f2897bd ("target/mips: Disable R5900 support")
---
  linux-user/mips/target_elf.h   | 3 ---
  linux-user/mips64/target_elf.h | 3 ---
  2 files changed, 6 deletions(-)

r~

#3 lore raw

PATCH 2/4 linux-user/mips: Select Octeon68XX CPU for Octeon binaries

In reply to Philippe Mathieu-Daudé

The Octeon68XX CPU is available since commit 9a6046a655 ("target/mips: introduce Cavium Octeon CPU model").

Cc: Pavel Dovgalyuk <[email protected]>
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1722

---
 linux-user/mips64/target_elf.h | 8 ++++++++
 1 file changed, 8 insertions(+)
linux-user/mips64/target_elf.h +8 -0
index ec55d8542a..ce6fb6541e 100644
@@ -9,6 +9,14 @@
 #define MIPS64_TARGET_ELF_H
 static inline const char *cpu_get_model(uint32_t eflags)
 {
+    switch (eflags & EF_MIPS_MACH) {
+    case EF_MIPS_MACH_OCTEON:
+    case EF_MIPS_MACH_OCTEON2:
+    case EF_MIPS_MACH_OCTEON3:
+        return "Octeon68XX";
+    default:
+        break;
+    }
     if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) {
         return "I6400";
     }
Signature · 1 line
2.45.2
Reviewed-by on v1 2/4
#4 lore raw

Re: [PATCH-for-9.1 2/4] linux-user/mips: Select Octeon68XX CPU for Octeon binaries

Quoted 11 lines · Philippe Mathieu-Daudé

The Octeon68XX CPU is available since commit 9a6046a655 ("target/mips: introduce Cavium Octeon CPU model").

Cc: Pavel Dovgalyuk<[email protected]> Resolves:https://gitlab.com/qemu-project/qemu/-/issues/1722

---
  linux-user/mips64/target_elf.h | 8 ++++++++
  1 file changed, 8 insertions(+)

r~

#5 lore raw

PATCH 3/4 linux-user/mips: Select MIPS64R2-generic for Rel2 binaries

In reply to Philippe Mathieu-Daudé
---
 linux-user/mips64/target_elf.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
linux-user/mips64/target_elf.h +6 -1
index ce6fb6541e..a3a8b2e385 100644
@@ -17,8 +17,13 @@ static inline const char *cpu_get_model(uint32_t eflags)
     default:
         break;
     }
-    if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) {
+    switch (eflags & EF_MIPS_ARCH) {
+    case EF_MIPS_ARCH_64R6:
         return "I6400";
+    case EF_MIPS_ARCH_64R2:
+        return "MIPS64R2-generic";
+    default:
+        break;
     }
     return "5KEf";
 }
Signature · 1 line
2.45.2
#7 lore raw

PATCH 4/4 linux-user/mips: Select Loongson CPU for Loongson binaries

In reply to Philippe Mathieu-Daudé
---
 linux-user/mips64/target_elf.h | 6 ++++++
 1 file changed, 6 insertions(+)
linux-user/mips64/target_elf.h +6 -0
index a3a8b2e385..502af9d278 100644
@@ -14,6 +14,12 @@ static inline const char *cpu_get_model(uint32_t eflags)
     case EF_MIPS_MACH_OCTEON2:
     case EF_MIPS_MACH_OCTEON3:
         return "Octeon68XX";
+    case EF_MIPS_MACH_LS2E:
+        return "Loongson-2E";
+    case EF_MIPS_MACH_LS2F:
+        return "Loongson-2F";
+    case EF_MIPS_MACH_LS3A:
+        return "Loongson-3A1000";
     default:
         break;
     }
Signature · 1 line
2.45.2
#9 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 5 lines · Philippe Mathieu-Daudé

Philippe Mathieu-Daudé (4):
linux-user/mips: Do not try to use removed R5900 CPU linux-user/mips: Select Octeon68XX CPU for Octeon binaries linux-user/mips: Select MIPS64R2-generic for Rel2 binaries linux-user/mips: Select Loongson CPU for Loongson binaries

Series queued.