* [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
@ 2025-08-14 7:06 Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 1/3] elf: Add EF_MIPS_ARCH_ASE definitions Philippe Mathieu-Daudé
` (7 more replies)
0 siblings, 8 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-14 7:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Laurent Vivier, Jiaxun Yang
We weren't parsing MIPS ASE in the ELF header, so couldn't
automatically pick an appropriate CPU.
Since we'll have a rc4, I propose these sensible patches
for 10.1, but both ASEs are available since 15 years in QEMU,
so this isn't something broken since the latest release, and
I don't mind holding it for 10.2.
Regards,
Phil.
Philippe Mathieu-Daudé (3):
elf: Add EF_MIPS_ARCH_ASE definitions
linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
linux-user/mips: Select M14Kc CPU to run microMIPS binaries
include/elf.h | 7 +++++++
linux-user/mips/target_elf.h | 6 ++++++
2 files changed, 13 insertions(+)
--
2.49.0
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH-for-10.1? 1/3] elf: Add EF_MIPS_ARCH_ASE definitions
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
@ 2025-08-14 7:06 ` Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 2/3] linux-user/mips: Select 74Kf CPU to run MIPS16e binaries Philippe Mathieu-Daudé
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-14 7:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Laurent Vivier, Jiaxun Yang
Include MIPS ASE ELF definitions from binutils:
https://sourceware.org/git/?p=binutils-gdb.git;a=blob;f=include/elf/mips.h;h=4fc190f404d828ded84e621bfcece5fa9f9c23c8;hb=HEAD#l210
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/elf.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index e7259ec366f..bbfac055de4 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -56,6 +56,13 @@ typedef int64_t Elf64_Sxword;
#define EF_MIPS_ARCH_32R6 0x90000000 /* MIPS32r6 code. */
#define EF_MIPS_ARCH_64R6 0xa0000000 /* MIPS64r6 code. */
+/* MIPS Architectural Extensions. */
+#define EF_MIPS_ARCH_ASE 0x0f000000
+
+#define EF_MIPS_ARCH_ASE_MICROMIPS 0x02000000
+#define EF_MIPS_ARCH_ASE_M16 0x04000000
+#define EF_MIPS_ARCH_ASE_MDMX 0x08000000
+
/* The ABI of a file. */
#define EF_MIPS_ABI_O32 0x00001000 /* O32 ABI. */
#define EF_MIPS_ABI_O64 0x00002000 /* O32 extended for 64 bit. */
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH-for-10.1? 2/3] linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 1/3] elf: Add EF_MIPS_ARCH_ASE definitions Philippe Mathieu-Daudé
@ 2025-08-14 7:06 ` Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 3/3] linux-user/mips: Select M14Kc CPU to run microMIPS binaries Philippe Mathieu-Daudé
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-14 7:06 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Laurent Vivier, Jiaxun Yang,
qemu-stable, Justin Applegate
The 74Kf is our latest CPU supporting MIPS16e ASE.
Cc: qemu-stable@nongnu.org
Fixes: 6ea219d0196..d19954f46df ("target-mips: MIPS16 support")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3054
Reported-by: Justin Applegate <justink.applegate@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/mips/target_elf.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h
index 71a32315a85..cd8622ce283 100644
--- a/linux-user/mips/target_elf.h
+++ b/linux-user/mips/target_elf.h
@@ -12,6 +12,9 @@ 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_ARCH_ASE) == EF_MIPS_ARCH_ASE_M16) {
+ return "74Kf";
+ }
if (eflags & EF_MIPS_NAN2008) {
return "P5600";
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH-for-10.1? 3/3] linux-user/mips: Select M14Kc CPU to run microMIPS binaries
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 1/3] elf: Add EF_MIPS_ARCH_ASE definitions Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 2/3] linux-user/mips: Select 74Kf CPU to run MIPS16e binaries Philippe Mathieu-Daudé
@ 2025-08-14 7:06 ` Philippe Mathieu-Daudé
2025-08-14 9:57 ` [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Richard Henderson
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-14 7:06 UTC (permalink / raw)
To: qemu-devel
Cc: Philippe Mathieu-Daudé, Laurent Vivier, Jiaxun Yang,
qemu-stable, Justin Applegate
The M14Kc is our latest CPU supporting the microMIPS ASE.
Cc: qemu-stable@nongnu.org
Fixes: 3c824109da0 ("target-mips: microMIPS ASE support")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3054
Reported-by: Justin Applegate <justink.applegate@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
linux-user/mips/target_elf.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/linux-user/mips/target_elf.h b/linux-user/mips/target_elf.h
index cd8622ce283..d20c6080cc8 100644
--- a/linux-user/mips/target_elf.h
+++ b/linux-user/mips/target_elf.h
@@ -12,6 +12,9 @@ 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_ARCH_ASE) == EF_MIPS_ARCH_ASE_MICROMIPS) {
+ return "M14Kc";
+ }
if ((eflags & EF_MIPS_ARCH_ASE) == EF_MIPS_ARCH_ASE_M16) {
return "74Kf";
}
--
2.49.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2025-08-14 7:06 ` [PATCH-for-10.1? 3/3] linux-user/mips: Select M14Kc CPU to run microMIPS binaries Philippe Mathieu-Daudé
@ 2025-08-14 9:57 ` Richard Henderson
2025-08-14 10:22 ` Philippe Mathieu-Daudé
2025-08-14 13:42 ` Peter Maydell
` (3 subsequent siblings)
7 siblings, 1 reply; 11+ messages in thread
From: Richard Henderson @ 2025-08-14 9:57 UTC (permalink / raw)
To: qemu-devel
On 8/14/25 17:06, Philippe Mathieu-Daudé wrote:
> We weren't parsing MIPS ASE in the ELF header, so couldn't
> automatically pick an appropriate CPU.
>
> Since we'll have a rc4, I propose these sensible patches
> for 10.1, but both ASEs are available since 15 years in QEMU,
> so this isn't something broken since the latest release, and
> I don't mind holding it for 10.2.
>
> Regards,
>
> Phil.
>
> Philippe Mathieu-Daudé (3):
> elf: Add EF_MIPS_ARCH_ASE definitions
> linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
> linux-user/mips: Select M14Kc CPU to run microMIPS binaries
>
> include/elf.h | 7 +++++++
> linux-user/mips/target_elf.h | 6 ++++++
> 2 files changed, 13 insertions(+)
>
Does mips16 or micromips apply to mips64 as well?
If so, we're missing changes to linux-user/mips64/target_elf.h.
Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 9:57 ` [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Richard Henderson
@ 2025-08-14 10:22 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-08-14 10:22 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
On 14/8/25 11:57, Richard Henderson wrote:
> On 8/14/25 17:06, Philippe Mathieu-Daudé wrote:
>> We weren't parsing MIPS ASE in the ELF header, so couldn't
>> automatically pick an appropriate CPU.
>>
>> Since we'll have a rc4, I propose these sensible patches
>> for 10.1, but both ASEs are available since 15 years in QEMU,
>> so this isn't something broken since the latest release, and
>> I don't mind holding it for 10.2.
>>
>> Regards,
>>
>> Phil.
>>
>> Philippe Mathieu-Daudé (3):
>> elf: Add EF_MIPS_ARCH_ASE definitions
>> linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
>> linux-user/mips: Select M14Kc CPU to run microMIPS binaries
>>
>> include/elf.h | 7 +++++++
>> linux-user/mips/target_elf.h | 6 ++++++
>> 2 files changed, 13 insertions(+)
>>
>
> Does mips16 or micromips apply to mips64 as well?
Yes (both).
> If so, we're missing changes to linux-user/mips64/target_elf.h.
Unfortunately no 64-bit CPU we implement support these ASEs.
I'll add to patch 2 & 3 descriptions:
"Note, currently QEMU doesn't have 64-bit CPU supporting $FOO ASE."
> Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Thanks!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2025-08-14 9:57 ` [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Richard Henderson
@ 2025-08-14 13:42 ` Peter Maydell
2025-08-17 13:31 ` Stefan Hajnoczi
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2025-08-14 13:42 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Laurent Vivier, Jiaxun Yang
On Thu, 14 Aug 2025 at 08:07, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> We weren't parsing MIPS ASE in the ELF header, so couldn't
> automatically pick an appropriate CPU.
>
> Since we'll have a rc4, I propose these sensible patches
> for 10.1, but both ASEs are available since 15 years in QEMU,
> so this isn't something broken since the latest release, and
> I don't mind holding it for 10.2.
If this is a long-standing bug then I think it's best
held for 10.2.
thanks
-- PMM
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2025-08-14 13:42 ` Peter Maydell
@ 2025-08-17 13:31 ` Stefan Hajnoczi
2025-09-02 10:59 ` Philippe Mathieu-Daudé
2025-09-04 20:15 ` Michael Tokarev
7 siblings, 0 replies; 11+ messages in thread
From: Stefan Hajnoczi @ 2025-08-17 13:31 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Laurent Vivier, Jiaxun Yang
[-- Attachment #1: Type: text/plain, Size: 1036 bytes --]
On Thu, Aug 14, 2025 at 09:06:47AM +0200, Philippe Mathieu-Daudé wrote:
> We weren't parsing MIPS ASE in the ELF header, so couldn't
> automatically pick an appropriate CPU.
>
> Since we'll have a rc4, I propose these sensible patches
> for 10.1, but both ASEs are available since 15 years in QEMU,
> so this isn't something broken since the latest release, and
> I don't mind holding it for 10.2.
Starting from -rc3 onwards I prefer to merge only release blockers.
Other bug fixes should wait for the next release because non-essential
fixes might introduce issues that cause the release schedule to slip.
Thanks,
Stefan
>
> Regards,
>
> Phil.
>
> Philippe Mathieu-Daudé (3):
> elf: Add EF_MIPS_ARCH_ASE definitions
> linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
> linux-user/mips: Select M14Kc CPU to run microMIPS binaries
>
> include/elf.h | 7 +++++++
> linux-user/mips/target_elf.h | 6 ++++++
> 2 files changed, 13 insertions(+)
>
> --
> 2.49.0
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2025-08-17 13:31 ` Stefan Hajnoczi
@ 2025-09-02 10:59 ` Philippe Mathieu-Daudé
2025-09-04 20:15 ` Michael Tokarev
7 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-02 10:59 UTC (permalink / raw)
To: qemu-devel; +Cc: Laurent Vivier, Jiaxun Yang
On 14/8/25 09:06, Philippe Mathieu-Daudé wrote:
> We weren't parsing MIPS ASE in the ELF header, so couldn't
> automatically pick an appropriate CPU.
> Philippe Mathieu-Daudé (3):
> elf: Add EF_MIPS_ARCH_ASE definitions
> linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
> linux-user/mips: Select M14Kc CPU to run microMIPS binaries
Series now queued, thanks.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2025-09-02 10:59 ` Philippe Mathieu-Daudé
@ 2025-09-04 20:15 ` Michael Tokarev
2025-09-22 6:59 ` Philippe Mathieu-Daudé
7 siblings, 1 reply; 11+ messages in thread
From: Michael Tokarev @ 2025-09-04 20:15 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Laurent Vivier, Jiaxun Yang, qemu-stable
On 14.08.2025 10:06, Philippe Mathieu-Daudé wrote:
> We weren't parsing MIPS ASE in the ELF header, so couldn't
> automatically pick an appropriate CPU.
>
> Since we'll have a rc4, I propose these sensible patches
> for 10.1, but both ASEs are available since 15 years in QEMU,
> so this isn't something broken since the latest release, and
> I don't mind holding it for 10.2.
Now I wonder what should I do with this wrt qemu-stable series.
Since no one complained (?) for so many years.. is it worth
to add this to previous stable releases?
(fwiw, all 3 patches are needed, obviously. Also, for 7.2,
the following 2 patches can also be picked up:
f7e3d7521b4 "linux-user/mips: Use P5600 as default CPU to run NaN2008
ELF binaries"
3e8130da7c9 "linux-user/mips: Do not try to use removed R5900 CPU")
What do you think?
I picked all 3 up for 7.2, 10.0 and 10.1 series for now.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
2025-09-04 20:15 ` Michael Tokarev
@ 2025-09-22 6:59 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2025-09-22 6:59 UTC (permalink / raw)
To: Michael Tokarev, qemu-devel; +Cc: Laurent Vivier, Jiaxun Yang, qemu-stable
On 4/9/25 22:15, Michael Tokarev wrote:
> On 14.08.2025 10:06, Philippe Mathieu-Daudé wrote:
>> We weren't parsing MIPS ASE in the ELF header, so couldn't
>> automatically pick an appropriate CPU.
>>
>> Since we'll have a rc4, I propose these sensible patches
>> for 10.1, but both ASEs are available since 15 years in QEMU,
>> so this isn't something broken since the latest release, and
>> I don't mind holding it for 10.2.
>
> Now I wonder what should I do with this wrt qemu-stable series.
> Since no one complained (?) for so many years.. is it worth
> to add this to previous stable releases?
I fixed these for correctness, but indeed nobody cares.
>
> (fwiw, all 3 patches are needed, obviously. Also, for 7.2,
> the following 2 patches can also be picked up:
> f7e3d7521b4 "linux-user/mips: Use P5600 as default CPU to run NaN2008
> ELF binaries"
> 3e8130da7c9 "linux-user/mips: Do not try to use removed R5900 CPU")
>
> What do you think?
Ditto. If this is too much burden for you to carry them,
don't worry dropping them.
>
> I picked all 3 up for 7.2, 10.0 and 10.1 series for now.
Thanks for your careful work with the stable tree :)
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2025-09-22 6:59 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-14 7:06 [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 1/3] elf: Add EF_MIPS_ARCH_ASE definitions Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 2/3] linux-user/mips: Select 74Kf CPU to run MIPS16e binaries Philippe Mathieu-Daudé
2025-08-14 7:06 ` [PATCH-for-10.1? 3/3] linux-user/mips: Select M14Kc CPU to run microMIPS binaries Philippe Mathieu-Daudé
2025-08-14 9:57 ` [PATCH-for-10.1? 0/3] linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs Richard Henderson
2025-08-14 10:22 ` Philippe Mathieu-Daudé
2025-08-14 13:42 ` Peter Maydell
2025-08-17 13:31 ` Stefan Hajnoczi
2025-09-02 10:59 ` Philippe Mathieu-Daudé
2025-09-04 20:15 ` Michael Tokarev
2025-09-22 6:59 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).