Skip to contentSkip to conversation

xen/arm: Rename psr_mode_is_32bit to regs_mode_is_32bit

PATCH Superseded Michal Orzel 3 participants 6 messages Feb 21, 2022 – Feb 22, 2022

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: Rename psr_mode_is_32bit to regs_mode_is_32bit

Following a discussion [1] it seems like that renaming work has been forgotten. Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

[1] https://marc.info/?l=xen-devel&m=156457538423787&w=2

---
 xen/arch/arm/include/asm/regs.h |  2 +-
 xen/arch/arm/traps.c            | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)
xen/arch/arm/include/asm/regs.h +1 -1
index ec091a28a2..04e821138a 100644
@@ -13,7 +13,7 @@
 
 #define psr_mode(psr,m) (((psr) & PSR_MODE_MASK) == m)
 
-static inline bool psr_mode_is_32bit(const struct cpu_user_regs *regs)
+static inline bool regs_mode_is_32bit(const struct cpu_user_regs *regs)
 {
 #ifdef CONFIG_ARM_32
     return true;
xen/arch/arm/traps.c +15 -15
index 9339d12f58..0db8e42d65 100644
@@ -896,7 +896,7 @@ static void _show_registers(const struct cpu_user_regs *regs,
 
     if ( guest_mode )
     {
-        if ( psr_mode_is_32bit(regs) )
+        if ( regs_mode_is_32bit(regs) )
             show_registers_32(regs, ctxt, guest_mode, v);
 #ifdef CONFIG_ARM_64
         else
@@ -1631,7 +1631,7 @@ int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr)
     {
         unsigned long it;
 
-        BUG_ON( !psr_mode_is_32bit(regs) || !(cpsr & PSR_THUMB) );
+        BUG_ON( !regs_mode_is_32bit(regs) || !(cpsr & PSR_THUMB) );
 
         it = ( (cpsr >> (10-2)) & 0xfc) | ((cpsr >> 25) & 0x3 );
 
@@ -1656,7 +1656,7 @@ int check_conditional_instr(struct cpu_user_regs *regs, const union hsr hsr)
 void advance_pc(struct cpu_user_regs *regs, const union hsr hsr)
 {
     register_t itbits, cond, cpsr = regs->cpsr;
-    bool is_thumb = psr_mode_is_32bit(regs) && (cpsr & PSR_THUMB);
+    bool is_thumb = regs_mode_is_32bit(regs) && (cpsr & PSR_THUMB);
 
     if ( is_thumb && (cpsr & PSR_IT_MASK) )
     {
@@ -2098,37 +2098,37 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
         advance_pc(regs, hsr);
         break;
     case HSR_EC_CP15_32:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp15_32);
         do_cp15_32(regs, hsr);
         break;
     case HSR_EC_CP15_64:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp15_64);
         do_cp15_64(regs, hsr);
         break;
     case HSR_EC_CP14_32:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp14_32);
         do_cp14_32(regs, hsr);
         break;
     case HSR_EC_CP14_64:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp14_64);
         do_cp14_64(regs, hsr);
         break;
     case HSR_EC_CP14_DBG:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp14_dbg);
         do_cp14_dbg(regs, hsr);
         break;
     case HSR_EC_CP10:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp10);
         do_cp10(regs, hsr);
         break;
     case HSR_EC_CP:
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_cp);
         do_cp(regs, hsr);
         break;
@@ -2139,7 +2139,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
          * ARMv7 (DDI 0406C.b): B1.14.8
          * ARMv8 (DDI 0487A.d): D1-1501 Table D1-44
          */
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_smc32);
         do_trap_smc(regs, hsr);
         break;
@@ -2147,7 +2147,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
     {
         register_t nr;
 
-        GUEST_BUG_ON(!psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(!regs_mode_is_32bit(regs));
         perfc_incr(trap_hvc32);
 #ifndef NDEBUG
         if ( (hsr.iss & 0xff00) == 0xff00 )
@@ -2162,7 +2162,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
     }
 #ifdef CONFIG_ARM_64
     case HSR_EC_HVC64:
-        GUEST_BUG_ON(psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(regs_mode_is_32bit(regs));
         perfc_incr(trap_hvc64);
 #ifndef NDEBUG
         if ( (hsr.iss & 0xff00) == 0xff00 )
@@ -2178,12 +2178,12 @@ void do_trap_guest_sync(struct cpu_user_regs *regs)
          *
          * ARMv8 (DDI 0487A.d): D1-1501 Table D1-44
          */
-        GUEST_BUG_ON(psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(regs_mode_is_32bit(regs));
         perfc_incr(trap_smc64);
         do_trap_smc(regs, hsr);
         break;
     case HSR_EC_SYSREG:
-        GUEST_BUG_ON(psr_mode_is_32bit(regs));
+        GUEST_BUG_ON(regs_mode_is_32bit(regs));
         perfc_incr(trap_sysreg);
         do_sysreg(regs, hsr);
         break;
Signature · 1 line
2.29.0
#1 lore raw

Hi Michal,

Quoted 2 lines · Michal Orzel

Following a discussion [1] it seems like that renaming work has been forgotten.

This is in my todo list of clean-up I need to do for Xen. But I haven't yet had a chance to look at it. Thank you for taking a look!

Quoted 2 lines

Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

If we modify psr_mode_is_32bit(), then we should also modify psr_mode_is_user() because they have the same prototype and we should keep the naming consistent.

Quoted 2 lines

[1] https://marc.info/?l=xen-devel&m=156457538423787&w=2

NIT: The first sentence and this link adds value for the review on the mailing list (we know where the request came from) but doesn't add any after the commit message (there are no extra information in them).

So I would move this information after ---. This will get dropped on commit.

Cheers,

Signature · 1 line
Julien Grall
#2 lore raw

Hi Julien,

Quoted 6 lines · Julien Grall

Hi Michal,

Quoted 2 lines · Michal Orzel

Following a discussion [1] it seems like that renaming work has been forgotten.

Quoted 7 lines

This is in my todo list of clean-up I need to do for Xen. But I haven't yet had a chance to look at it. Thank you for taking a look!

Quoted 2 lines

Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

If we modify psr_mode_is_32bit(), then we should also modify psr_mode_is_user() because they have the same prototype and we should keep the naming consistent.

Ok, I agree. Do you think this should be done in a separate patch?
FWICS, psr_mode_is_user is used in traps.c, vcpreg.c ,vtimer.c and vsysreg.c whereas psr_mode_is_32bit - only in traps.c.

Quoted 7 lines
Quoted 2 lines

[1] https://marc.info/?l=xen-devel&m=156457538423787&w=2

NIT: The first sentence and this link adds value for the review on the mailing list (we know where the request came from) but doesn't add any after the commit message (there are no extra information in them).

So I would move this information after ---. This will get dropped on commit.

Ok.

Quoted 2 lines

Cheers,

Cheers,
Michal

#3 lore raw

Hi Michal,

Quoted 13 lines · Michal Orzel

Hi Julien,

Quoted 8 lines · Julien Grall

Hi Michal,

Quoted 2 lines · Michal Orzel

Following a discussion [1] it seems like that renaming work has been forgotten.

This is in my todo list of clean-up I need to do for Xen. But I haven't yet had a chance to look at it. Thank you for taking a look!

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

If we modify psr_mode_is_32bit(), then we should also modify psr_mode_is_user() because they have the same prototype and we should keep the naming consistent.

Ok, I agree. Do you think this should be done in a separate patch?
FWICS, psr_mode_is_user is used in traps.c, vcpreg.c ,vtimer.c and vsysreg.c whereas psr_mode_is_32bit - only in traps.c.

I think it can be done in a separate patch.

Cheers
Bertrand

Quoted 15 lines
Quoted 8 lines
Quoted 3 lines

[1] https://marc.info/?l=xen-devel&m=156457538423787&w=2

NIT: The first sentence and this link adds value for the review on the mailing list (we know where the request came from) but doesn't add any after the commit message (there are no extra information in them).

So I would move this information after ---. This will get dropped on commit.

Ok.

Quoted 2 lines

Cheers,

Cheers,
Michal

#4 lore raw

Hi Bertrand,

Quoted 18 lines · Bertrand Marquis

Hi Michal,

Quoted 16 lines · Michal Orzel

Hi Julien,

Quoted 11 lines · Julien Grall

Hi Michal,

Quoted 2 lines · Michal Orzel

Following a discussion [1] it seems like that renaming work has been forgotten.

This is in my todo list of clean-up I need to do for Xen. But I haven't yet had a chance to look at it. Thank you for taking a look!

Quoted 2 lines

Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

If we modify psr_mode_is_32bit(), then we should also modify psr_mode_is_user() because they have the same prototype and we should keep the naming consistent.

Ok, I agree. Do you think this should be done in a separate patch?
FWICS, psr_mode_is_user is used in traps.c, vcpreg.c ,vtimer.c and vsysreg.c whereas psr_mode_is_32bit - only in traps.c.

I think it can be done in a separate patch.

Ok, so I will push a patch series consisting of two patches.

Quoted 19 lines

Cheers
Bertrand

Quoted 15 lines
Quoted 8 lines
Quoted 3 lines

[1] https://marc.info/?l=xen-devel&m=156457538423787&w=2

NIT: The first sentence and this link adds value for the review on the mailing list (we know where the request came from) but doesn't add any after the commit message (there are no extra information in them).

So I would move this information after ---. This will get dropped on commit.

Ok.

Quoted 2 lines

Cheers,

Cheers,
Michal

Cheers,
Michal

#5 lore raw
In reply to Michal Orzel
Quoted 1 line · Michal Orzel

Hi Julien,

Hi Michal,

Quoted 7 lines · Julien Grall
Quoted 6 lines

Hi Michal,

Quoted 2 lines · Michal Orzel

Following a discussion [1] it seems like that renaming work has been forgotten.

Quoted 8 lines
Quoted 7 lines

This is in my todo list of clean-up I need to do for Xen. But I haven't yet had a chance to look at it. Thank you for taking a look!

Quoted 2 lines

Perform renaming of psr_mode_is_32bit to regs_mode_is_32bit as the function no longer takes psr parameter.

If we modify psr_mode_is_32bit(), then we should also modify psr_mode_is_user() because they have the same prototype and we should keep the naming consistent.

Ok, I agree. Do you think this should be done in a separate patch?

I am fine either way so long the two changes are committed together.

Cheers,

Signature · 1 line
Julien Grall