diff mbox series

[XEN,v7,15/20] xen/arm: move regpair_to_uint64() and uint64_to_regpair() to regs.h

Message ID ee6ebe4d22c3aecf35b7a4813ca95b2978eed534.1677079672.git.jens.wiklander@linaro.org (mailing list archive)
State Superseded
Headers show
Series Xen FF-A mediator | expand

Commit Message

Jens Wiklander Feb. 22, 2023, 3:33 p.m. UTC
Moves the two helper functions regpair_to_uint64() and
uint64_to_regpair() from xen/arch/arm/tee/optee.c to the common arm
specific regs.h. This enables reuse of these functions in the FF-A
mediator in a subsequent patch.

Reviewed-by: Michal Orzel <michal.orzel@amd.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
---
 xen/arch/arm/include/asm/regs.h | 12 ++++++++++++
 xen/arch/arm/tee/optee.c        | 11 -----------
 2 files changed, 12 insertions(+), 11 deletions(-)

Comments

Bertrand Marquis March 3, 2023, 10:51 a.m. UTC | #1
Hi Jens,

> On 22 Feb 2023, at 16:33, Jens Wiklander <jens.wiklander@linaro.org> wrote:
> 
> Moves the two helper functions regpair_to_uint64() and
> uint64_to_regpair() from xen/arch/arm/tee/optee.c to the common arm
> specific regs.h. This enables reuse of these functions in the FF-A
> mediator in a subsequent patch.
> 
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>

Please move Michal R-B after your signed off.

With that fixed:
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Cheers
Bertrand

> ---
> xen/arch/arm/include/asm/regs.h | 12 ++++++++++++
> xen/arch/arm/tee/optee.c        | 11 -----------
> 2 files changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h
> index 0693a681315f..aa39e83ee5f4 100644
> --- a/xen/arch/arm/include/asm/regs.h
> +++ b/xen/arch/arm/include/asm/regs.h
> @@ -60,6 +60,18 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
> register_t get_user_reg(struct cpu_user_regs *regs, int reg);
> void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
> 
> +static inline uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
> +{
> +    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
> +}
> +
> +static inline void uint64_to_regpair(register_t *reg0, register_t *reg1,
> +                                     uint64_t val)
> +{
> +    *reg0 = val >> 32;
> +    *reg1 = (uint32_t)val;
> +}
> +
> #endif
> 
> #endif /* __ARM_REGS_H__ */
> diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
> index 9cb9f16d43cb..47027ecef47c 100644
> --- a/xen/arch/arm/tee/optee.c
> +++ b/xen/arch/arm/tee/optee.c
> @@ -268,17 +268,6 @@ static int optee_domain_init(struct domain *d)
>     return 0;
> }
> 
> -static uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
> -{
> -    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
> -}
> -
> -static void uint64_to_regpair(register_t *reg0, register_t *reg1, uint64_t val)
> -{
> -    *reg0 = val >> 32;
> -    *reg1 = (uint32_t)val;
> -}
> -
> static struct page_info *get_domain_ram_page(gfn_t gfn)
> {
>     struct page_info *page;
> -- 
> 2.34.1
>
Jens Wiklander March 3, 2023, 1:18 p.m. UTC | #2
On Fri, Mar 3, 2023 at 11:51 AM Bertrand Marquis
<Bertrand.Marquis@arm.com> wrote:
>
> Hi Jens,
>
> > On 22 Feb 2023, at 16:33, Jens Wiklander <jens.wiklander@linaro.org> wrote:
> >
> > Moves the two helper functions regpair_to_uint64() and
> > uint64_to_regpair() from xen/arch/arm/tee/optee.c to the common arm
> > specific regs.h. This enables reuse of these functions in the FF-A
> > mediator in a subsequent patch.
> >
> > Reviewed-by: Michal Orzel <michal.orzel@amd.com>
> > Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
>
> Please move Michal R-B after your signed off.

OK

>
> With that fixed:
> Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>

Thanks,
Jens

>
> Cheers
> Bertrand
>
> > ---
> > xen/arch/arm/include/asm/regs.h | 12 ++++++++++++
> > xen/arch/arm/tee/optee.c        | 11 -----------
> > 2 files changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h
> > index 0693a681315f..aa39e83ee5f4 100644
> > --- a/xen/arch/arm/include/asm/regs.h
> > +++ b/xen/arch/arm/include/asm/regs.h
> > @@ -60,6 +60,18 @@ static inline bool guest_mode(const struct cpu_user_regs *r)
> > register_t get_user_reg(struct cpu_user_regs *regs, int reg);
> > void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
> >
> > +static inline uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
> > +{
> > +    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
> > +}
> > +
> > +static inline void uint64_to_regpair(register_t *reg0, register_t *reg1,
> > +                                     uint64_t val)
> > +{
> > +    *reg0 = val >> 32;
> > +    *reg1 = (uint32_t)val;
> > +}
> > +
> > #endif
> >
> > #endif /* __ARM_REGS_H__ */
> > diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
> > index 9cb9f16d43cb..47027ecef47c 100644
> > --- a/xen/arch/arm/tee/optee.c
> > +++ b/xen/arch/arm/tee/optee.c
> > @@ -268,17 +268,6 @@ static int optee_domain_init(struct domain *d)
> >     return 0;
> > }
> >
> > -static uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
> > -{
> > -    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
> > -}
> > -
> > -static void uint64_to_regpair(register_t *reg0, register_t *reg1, uint64_t val)
> > -{
> > -    *reg0 = val >> 32;
> > -    *reg1 = (uint32_t)val;
> > -}
> > -
> > static struct page_info *get_domain_ram_page(gfn_t gfn)
> > {
> >     struct page_info *page;
> > --
> > 2.34.1
> >
>
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/regs.h b/xen/arch/arm/include/asm/regs.h
index 0693a681315f..aa39e83ee5f4 100644
--- a/xen/arch/arm/include/asm/regs.h
+++ b/xen/arch/arm/include/asm/regs.h
@@ -60,6 +60,18 @@  static inline bool guest_mode(const struct cpu_user_regs *r)
 register_t get_user_reg(struct cpu_user_regs *regs, int reg);
 void set_user_reg(struct cpu_user_regs *regs, int reg, register_t val);
 
+static inline uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
+{
+    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
+}
+
+static inline void uint64_to_regpair(register_t *reg0, register_t *reg1,
+                                     uint64_t val)
+{
+    *reg0 = val >> 32;
+    *reg1 = (uint32_t)val;
+}
+
 #endif
 
 #endif /* __ARM_REGS_H__ */
diff --git a/xen/arch/arm/tee/optee.c b/xen/arch/arm/tee/optee.c
index 9cb9f16d43cb..47027ecef47c 100644
--- a/xen/arch/arm/tee/optee.c
+++ b/xen/arch/arm/tee/optee.c
@@ -268,17 +268,6 @@  static int optee_domain_init(struct domain *d)
     return 0;
 }
 
-static uint64_t regpair_to_uint64(register_t reg0, register_t reg1)
-{
-    return ((uint64_t)reg0 << 32) | (uint32_t)reg1;
-}
-
-static void uint64_to_regpair(register_t *reg0, register_t *reg1, uint64_t val)
-{
-    *reg0 = val >> 32;
-    *reg1 = (uint32_t)val;
-}
-
 static struct page_info *get_domain_ram_page(gfn_t gfn)
 {
     struct page_info *page;