linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
cover linux-user: Select default CPUs for MicroMIPS and MIPS16e ASEs
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(+)
Signature · 1 line
2.49.0
PATCH 1/3 elf: Add EF_MIPS_ARCH_ASE definitions
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
--- include/elf.h | 7 +++++++ 1 file changed, 7 insertions(+)
include/elf.h +7 -0
@@ -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. */
Signature · 1 line
2.49.0
PATCH 2/3 linux-user/mips: Select 74Kf CPU to run MIPS16e binaries
In reply to Philippe Mathieu-DaudéThe 74Kf is our latest CPU supporting MIPS16e ASE.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3054
--- linux-user/mips/target_elf.h | 3 +++ 1 file changed, 3 insertions(+)
linux-user/mips/target_elf.h +3 -0
@@ -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" ; }
Signature · 1 line
2.49.0
PATCH 3/3 linux-user/mips: Select M14Kc CPU to run microMIPS binaries
In reply to Philippe Mathieu-DaudéThe M14Kc is our latest CPU supporting the microMIPS ASE.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/3054
--- linux-user/mips/target_elf.h | 3 +++ 1 file changed, 3 insertions(+)
linux-user/mips/target_elf.h +3 -0
@@ -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" ; }
Signature · 1 line
2.49.0
Quoted 12 lines · Philippe Mathieu-Daudé
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.
Quoted 9 lines
Philippe Mathieu-Daudé (3):
elf: AddEF_MIPS_ARCH_ASEdefinitions linux-user/mips: Select 74Kf CPU to run MIPS16e binaries linux-user/mips: Select M14Kc CPU to run microMIPS binariesinclude/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,
r~
Quoted 18 lines · Richard Henderson
Quoted 17 lines · Philippe Mathieu-Daudé
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: AddEF_MIPS_ARCH_ASEdefinitions linux-user/mips: Select 74Kf CPU to run MIPS16e binaries linux-user/mips: Select M14Kc CPU to run microMIPS binaries
Quoted 6 lines
Quoted 4 lines
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).
Quoted 1 line
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."
Quoted 2 lines
Otherwise,
Reviewed-by Richard Henderson <[email protected]>
Thanks!
Quoted 8 lines · Philippe Mathieu-Daudé
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
Quoted 7 lines · Philippe Mathieu-Daudé
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
Quoted 18 lines
Regards,
Phil.
Philippe Mathieu-Daudé (3):
elf: AddEF_MIPS_ARCH_ASEdefinitions linux-user/mips: Select 74Kf CPU to run MIPS16e binaries linux-user/mips: Select M14Kc CPU to run microMIPS binariesinclude/elf.h | 7 +++++++ linux-user/mips/target_elf.h | 6 ++++++ 2 files changed, 13 insertions(+)Signature · 1 line
2.49.0
Quoted 8 lines · Philippe Mathieu-Daudé
We weren't parsing MIPS ASE in the ELF header, so couldn't automatically pick an appropriate CPU.
Philippe Mathieu-Daudé (3):
elf: AddEF_MIPS_ARCH_ASEdefinitions linux-user/mips: Select 74Kf CPU to run MIPS16e binaries linux-user/mips: Select M14Kc CPU to run microMIPS binaries
Series now queued, thanks.
Quoted 7 lines · Philippe Mathieu-Daudé
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
Quoted 4 lines · Michael Tokarev
Quoted 3 lines · Philippe Mathieu-Daudé
We weren't parsing MIPS ASE in the ELF header, so couldn't automatically pick an appropriate CPU.
Quoted 8 lines
Quoted 4 lines
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.
Quoted 7 lines
(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.
Quoted 2 lines
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 :)