powerpc: Fix tst-set_ppr.c on 32-bit POWER7

Message ID 20180302203931.30149-1-tuliom@linux.vnet.ibm.com
State Changes Requested, archived
Headers

Commit Message

Tulio Magno Quites Machado Filho March 2, 2018, 8:39 p.m. UTC
  Instruction mfppr32 is categorized as phased-in in the POWER ISA 2.06,
which means that servers do not implement it.
It started to be available in POWER ISA 2.07.

2018-03-02  Tulio Magno Quites Machado Filho  <tuliom@linux.vnet.ibm.com>

	* sysdeps/powerpc/tst-set_ppr.c (do_test): Test for
	PPC_FEATURE2_ARCH_2_07 before trying to read the PPR32 on a
	POWER7 system.

Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
---
 sysdeps/powerpc/tst-set_ppr.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
  

Comments

Rajalakshmi S March 5, 2018, 4:54 p.m. UTC | #1
On 03/03/2018 02:09 AM, Tulio Magno Quites Machado Filho wrote:
> Instruction mfppr32 is categorized as phased-in in the POWER ISA 2.06,
> which means that servers do not implement it.
> It started to be available in POWER ISA 2.07.
> 
> 2018-03-02  Tulio Magno Quites Machado Filho<tuliom@linux.vnet.ibm.com>
> 
> 	* sysdeps/powerpc/tst-set_ppr.c (do_test): Test for
> 	PPC_FEATURE2_ARCH_2_07 before trying to read the PPR32 on a
> 	POWER7 system.
> 
> Signed-off-by: Tulio Magno Quites Machado Filho<tuliom@linux.vnet.ibm.com>

LGTM.
  

Patch

diff --git a/sysdeps/powerpc/tst-set_ppr.c b/sysdeps/powerpc/tst-set_ppr.c
index c4f8096..da8c4cd 100644
--- a/sysdeps/powerpc/tst-set_ppr.c
+++ b/sysdeps/powerpc/tst-set_ppr.c
@@ -73,13 +73,21 @@  static int
 do_test (void)
 {
   /* Check for the minimum required Power ISA to run these tests.  */
+#ifdef __powerpc64__
   if ((getauxval (AT_HWCAP) & PPC_FEATURE_ARCH_2_06) == 0)
     {
       printf ("Requires an environment that implements the Power ISA version"
               " 2.06 or greater.\n");
       return EXIT_UNSUPPORTED;
     }
-
+#else
+  if ((getauxval (AT_HWCAP2) & PPC_FEATURE2_ARCH_2_07) == 0)
+    {
+      printf ("Requires an environment that implements the Power ISA version"
+              " 2.07 or greater.\n");
+      return EXIT_UNSUPPORTED;
+    }
+#endif
   uint8_t rc = 0;
 
 #ifdef _ARCH_PWR8