All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@kernel.org>
To: qemu-devel@nongnu.org
Cc: "Laurent Vivier" <laurent@vivier.eu>,
	"Aleksandar Rikalo" <arikalo@gmail.com>,
	"Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>,
	"Helge Deller" <deller@gmx.de>,
	"Jiaxun Yang" <jiaxun.yang@flygoat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>
Subject: [PULL 5/5] linux-user/mips: pick Loongson-3A4000 if a pre-r6 mips64 binary needs nan2008
Date: Sun,  4 Oct 2026 13:43:10 +0200	[thread overview]
Message-ID: <20261004114311.3874-6-deller@kernel.org> (raw)
In-Reply-To: <20261004114311.3874-1-deller@kernel.org>

From: Alex Rønne Petersen <alex@alexrp.com>

Before this patch, we'd pick MIPS64R2-generic which does not have 2008 mode, so
the binary would just fail to run without an explicit -cpu flag. Now it'll just
work as in the pre-r6 mips32 case.

Signed-off-by: Alex Rønne Petersen <alex@alexrp.com>
Signed-off-by: Helge Deller <deller@gmx.de>
---
 linux-user/mips/elfload.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/linux-user/mips/elfload.c b/linux-user/mips/elfload.c
index 1d62ae0a4d..19850f4835 100644
--- a/linux-user/mips/elfload.c
+++ b/linux-user/mips/elfload.c
@@ -20,17 +20,19 @@ const char *get_elf_cpu_model(uint32_t eflags)
     case EF_MIPS_MACH_LS2F:
         return "Loongson-2F";
     case EF_MIPS_MACH_LS3A:
-        return "Loongson-3A1000";
+        return (eflags & EF_MIPS_NAN2008) ? "Loongson-3A4000"
+                                          : "Loongson-3A1000";
     default:
         break;
     }
-    switch (eflags & EF_MIPS_ARCH) {
-    case EF_MIPS_ARCH_64R6:
+    if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R6) {
         return "I6400";
-    case EF_MIPS_ARCH_64R2:
+    }
+    if (eflags & EF_MIPS_NAN2008) {
+        return "Loongson-3A4000";
+    }
+    if ((eflags & EF_MIPS_ARCH) == EF_MIPS_ARCH_64R2) {
         return "MIPS64R2-generic";
-    default:
-        break;
     }
     return "5KEf";
 #else
-- 
2.54.0



  parent reply	other threads:[~2026-10-04 11:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 11:43 [PULL 0/5] Linux user next patches Helge Deller
2026-10-04 11:43 ` [PULL 1/5] linux-user: add elf_core_eflags() hook for core dump e_flags Helge Deller
2026-10-04 11:43 ` [PULL 2/5] linux-user/mips64: set EF_MIPS_ABI2 in mipsn32 core dumps Helge Deller
2026-10-04 11:43 ` [PULL 3/5] linux-user/riscv: copy the executable's e_flags into " Helge Deller
2026-10-04 11:43 ` [PULL 4/5] target/mips: fix Loongson-3A4000 definition to have abs2008 and nan2008 Helge Deller
2026-10-04 11:43 ` Helge Deller [this message]
2026-10-06  9:24 ` [PULL 0/5] Linux user next patches Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261004114311.3874-6-deller@kernel.org \
    --to=deller@kernel.org \
    --cc=arikalo@gmail.com \
    --cc=aurelien@aurel32.net \
    --cc=deller@gmx.de \
    --cc=jiaxun.yang@flygoat.com \
    --cc=laurent@vivier.eu \
    --cc=philmd@oss.qualcomm.com \
    --cc=pierrick.bouvier@oss.qualcomm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.