public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.1/6.6] MIPS: mipsregs: Set proper ISA level for virt extensions
@ 2024-12-24  6:22 WangYuli
  2024-12-26  1:21 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: WangYuli @ 2024-12-24  6:22 UTC (permalink / raw)
  To: gregkh, sashal, stable
  Cc: jiaxun.yang, tsbogend, rdunlap, bhelgaas, linux-mips,
	linux-kernel, guanwentao, baimingcong, revy, WangYuli

From: Jiaxun Yang <jiaxun.yang@flygoat.com>

[ Upstream commit a640d6762a7d404644201ebf6d2a078e8dc84f97 ]

c994a3ec7ecc ("MIPS: set mips32r5 for virt extensions") setted
some instructions in virt extensions to ISA level mips32r5.

However TLB related vz instructions was leftover, also this
shouldn't be done to a R5 or R6 kernel buid.

Reorg macros to set ISA level as needed when _ASM_SET_VIRT
is called.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: WangYuli <wangyuli@uniontech.com>
---
 arch/mips/include/asm/mipsregs.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index 2d53704d9f24..e959a6b1a325 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -2078,7 +2078,14 @@ do {									\
 		_ASM_INSN_IF_MIPS(0x4200000c)				\
 		_ASM_INSN32_IF_MM(0x0000517c)
 #else	/* !TOOLCHAIN_SUPPORTS_VIRT */
-#define _ASM_SET_VIRT ".set\tvirt\n\t"
+#if MIPS_ISA_REV >= 5
+#define _ASM_SET_VIRT_ISA
+#elif defined(CONFIG_64BIT)
+#define _ASM_SET_VIRT_ISA ".set\tmips64r5\n\t"
+#else
+#define _ASM_SET_VIRT_ISA ".set\tmips32r5\n\t"
+#endif
+#define _ASM_SET_VIRT _ASM_SET_VIRT_ISA ".set\tvirt\n\t"
 #define _ASM_SET_MFGC0	_ASM_SET_VIRT
 #define _ASM_SET_DMFGC0	_ASM_SET_VIRT
 #define _ASM_SET_MTGC0	_ASM_SET_VIRT
@@ -2099,7 +2106,6 @@ do {									\
 ({ int __res;								\
 	__asm__ __volatile__(						\
 		".set\tpush\n\t"					\
-		".set\tmips32r5\n\t"					\
 		_ASM_SET_MFGC0						\
 		"mfgc0\t%0, " #source ", %1\n\t"			\
 		_ASM_UNSET_MFGC0					\
@@ -2113,7 +2119,6 @@ do {									\
 ({ unsigned long long __res;						\
 	__asm__ __volatile__(						\
 		".set\tpush\n\t"					\
-		".set\tmips64r5\n\t"					\
 		_ASM_SET_DMFGC0						\
 		"dmfgc0\t%0, " #source ", %1\n\t"			\
 		_ASM_UNSET_DMFGC0					\
@@ -2127,7 +2132,6 @@ do {									\
 do {									\
 	__asm__ __volatile__(						\
 		".set\tpush\n\t"					\
-		".set\tmips32r5\n\t"					\
 		_ASM_SET_MTGC0						\
 		"mtgc0\t%z0, " #register ", %1\n\t"			\
 		_ASM_UNSET_MTGC0					\
@@ -2140,7 +2144,6 @@ do {									\
 do {									\
 	__asm__ __volatile__(						\
 		".set\tpush\n\t"					\
-		".set\tmips64r5\n\t"					\
 		_ASM_SET_DMTGC0						\
 		"dmtgc0\t%z0, " #register ", %1\n\t"			\
 		_ASM_UNSET_DMTGC0					\
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6.1/6.6] MIPS: mipsregs: Set proper ISA level for virt extensions
  2024-12-24  6:22 [PATCH 6.1/6.6] MIPS: mipsregs: Set proper ISA level for virt extensions WangYuli
@ 2024-12-26  1:21 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2024-12-26  1:21 UTC (permalink / raw)
  To: stable; +Cc: WangYuli, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: a640d6762a7d404644201ebf6d2a078e8dc84f97

WARNING: Author mismatch between patch and upstream commit:
Backport author: WangYuli <wangyuli@uniontech.com>
Commit author: Jiaxun Yang <jiaxun.yang@flygoat.com>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Not found

Note: The patch differs from the upstream commit:
---
1:  a640d6762a7d ! 1:  b6d3079a55fb MIPS: mipsregs: Set proper ISA level for virt extensions
    @@ Metadata
      ## Commit message ##
         MIPS: mipsregs: Set proper ISA level for virt extensions
     
    +    [ Upstream commit a640d6762a7d404644201ebf6d2a078e8dc84f97 ]
    +
         c994a3ec7ecc ("MIPS: set mips32r5 for virt extensions") setted
         some instructions in virt extensions to ISA level mips32r5.
     
    @@ Commit message
     
         Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
         Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    +    Signed-off-by: WangYuli <wangyuli@uniontech.com>
     
      ## arch/mips/include/asm/mipsregs.h ##
     @@ arch/mips/include/asm/mipsregs.h: do {									\
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-12-26  1:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-24  6:22 [PATCH 6.1/6.6] MIPS: mipsregs: Set proper ISA level for virt extensions WangYuli
2024-12-26  1:21 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox