diff mbox

[v2,2/3] target-arm: Make pamax an argument to check_s2_startlevel

Message ID 1453375108-25229-3-git-send-email-edgar.iglesias@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Edgar E. Iglesias Jan. 21, 2016, 11:18 a.m. UTC
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>

Make pamax an argument to check_s2_startlevel in preparation
for future reuse.

No functional change.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 target-arm/helper.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alex Bennée Jan. 21, 2016, 3:54 p.m. UTC | #1
Edgar E. Iglesias <edgar.iglesias@gmail.com> writes:

> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Make pamax an argument to check_s2_startlevel in preparation
> for future reuse.
>
> No functional change.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  target-arm/helper.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 8aedce9..4abeb4d 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -6579,7 +6579,8 @@ typedef enum {
>   * Returns true if the suggested starting level is OK and false otherwise.
>   */
>  static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
> -                                int inputsize, int stride)
> +                                int inputsize, int stride,
> +                                unsigned int pamax)
>  {

If you fix the docstring above you can have my:

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>


>      const int grainsize = stride + 3;
>      int startsizecheck;
> @@ -6595,8 +6596,6 @@ static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
>      }
>
>      if (is_aa64) {
> -        unsigned int pamax = arm_pamax(cpu);
> -
>          switch (stride) {
>          case 13: /* 64KB Pages.  */
>              if (level == 0 || (level == 1 && pamax <= 42)) {
> @@ -6808,6 +6807,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>           * VTCR_EL2.SL0 field (whose interpretation depends on the page size)
>           */
>          int startlevel = extract32(tcr->raw_tcr, 6, 2);
> +        unsigned int pamax = arm_pamax(cpu);
>          bool ok;
>
>          if (va_size == 32 || stride == 9) {
> @@ -6820,7 +6820,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
>
>          /* Check that the starting level is valid. */
>          ok = check_s2_startlevel(cpu, va_size == 64, level,
> -                                 inputsize, stride);
> +                                 inputsize, stride, pamax);
>          if (!ok) {
>              /* AArch64 reports these as level 0 faults.
>               * AArch32 reports these as level 1 faults.


--
Alex Bennée
Edgar E. Iglesias Jan. 21, 2016, 4:07 p.m. UTC | #2
On Thu, Jan 21, 2016 at 03:54:54PM +0000, Alex Bennée wrote:
> 
> Edgar E. Iglesias <edgar.iglesias@gmail.com> writes:
> 
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Make pamax an argument to check_s2_startlevel in preparation
> > for future reuse.
> >
> > No functional change.
> >
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> >  target-arm/helper.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/target-arm/helper.c b/target-arm/helper.c
> > index 8aedce9..4abeb4d 100644
> > --- a/target-arm/helper.c
> > +++ b/target-arm/helper.c
> > @@ -6579,7 +6579,8 @@ typedef enum {
> >   * Returns true if the suggested starting level is OK and false otherwise.
> >   */
> >  static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
> > -                                int inputsize, int stride)
> > +                                int inputsize, int stride,
> > +                                unsigned int pamax)
> >  {
> 
> If you fix the docstring above you can have my:
> 
> Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

I've fixed the comment for v3.

Thanks,
Edgar

> 
> 
> >      const int grainsize = stride + 3;
> >      int startsizecheck;
> > @@ -6595,8 +6596,6 @@ static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
> >      }
> >
> >      if (is_aa64) {
> > -        unsigned int pamax = arm_pamax(cpu);
> > -
> >          switch (stride) {
> >          case 13: /* 64KB Pages.  */
> >              if (level == 0 || (level == 1 && pamax <= 42)) {
> > @@ -6808,6 +6807,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
> >           * VTCR_EL2.SL0 field (whose interpretation depends on the page size)
> >           */
> >          int startlevel = extract32(tcr->raw_tcr, 6, 2);
> > +        unsigned int pamax = arm_pamax(cpu);
> >          bool ok;
> >
> >          if (va_size == 32 || stride == 9) {
> > @@ -6820,7 +6820,7 @@ static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
> >
> >          /* Check that the starting level is valid. */
> >          ok = check_s2_startlevel(cpu, va_size == 64, level,
> > -                                 inputsize, stride);
> > +                                 inputsize, stride, pamax);
> >          if (!ok) {
> >              /* AArch64 reports these as level 0 faults.
> >               * AArch32 reports these as level 1 faults.
> 
> 
> --
> Alex Bennée
diff mbox

Patch

diff --git a/target-arm/helper.c b/target-arm/helper.c
index 8aedce9..4abeb4d 100644
--- a/target-arm/helper.c
+++ b/target-arm/helper.c
@@ -6579,7 +6579,8 @@  typedef enum {
  * Returns true if the suggested starting level is OK and false otherwise.
  */
 static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
-                                int inputsize, int stride)
+                                int inputsize, int stride,
+                                unsigned int pamax)
 {
     const int grainsize = stride + 3;
     int startsizecheck;
@@ -6595,8 +6596,6 @@  static bool check_s2_startlevel(ARMCPU *cpu, bool is_aa64, int level,
     }
 
     if (is_aa64) {
-        unsigned int pamax = arm_pamax(cpu);
-
         switch (stride) {
         case 13: /* 64KB Pages.  */
             if (level == 0 || (level == 1 && pamax <= 42)) {
@@ -6808,6 +6807,7 @@  static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
          * VTCR_EL2.SL0 field (whose interpretation depends on the page size)
          */
         int startlevel = extract32(tcr->raw_tcr, 6, 2);
+        unsigned int pamax = arm_pamax(cpu);
         bool ok;
 
         if (va_size == 32 || stride == 9) {
@@ -6820,7 +6820,7 @@  static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
 
         /* Check that the starting level is valid. */
         ok = check_s2_startlevel(cpu, va_size == 64, level,
-                                 inputsize, stride);
+                                 inputsize, stride, pamax);
         if (!ok) {
             /* AArch64 reports these as level 0 faults.
              * AArch32 reports these as level 1 faults.