diff mbox series

[2/2] cpuid/ptrace07: Only compile on x86_64

Message ID 20221024103836.6394-2-rpalethorpe@suse.com
State Accepted
Headers show
Series [1/2] Revert "ptrace07: Fix compilation when not on x86" | expand

Commit Message

Richard Palethorpe Oct. 24, 2022, 10:38 a.m. UTC
Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no
need to compile any part of the test or cpuid.h

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Suggested-by: Martin Doucha <martin.doucha@suse.com>
---
 include/lapi/cpuid.h                        |  4 ++++
 testcases/kernel/syscalls/ptrace/ptrace07.c | 11 ++++++++---
 2 files changed, 12 insertions(+), 3 deletions(-)

Comments

Jan Stancek Oct. 24, 2022, 10:44 a.m. UTC | #1
On Mon, Oct 24, 2022 at 12:39 PM Richard Palethorpe via ltp
<ltp@lists.linux.it> wrote:
>
> Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no
> need to compile any part of the test or cpuid.h
>
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> Suggested-by: Martin Doucha <martin.doucha@suse.com>

Acked-by: Jan Stancek <jstancek@redhat.com>
Martin Doucha Oct. 24, 2022, 1:41 p.m. UTC | #2
On 24. 10. 22 12:38, Richard Palethorpe wrote:
> Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no
> need to compile any part of the test or cpuid.h
> 
> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
> Suggested-by: Martin Doucha <martin.doucha@suse.com>

Hi,
for both patches:

Acked-by: Martin Doucha <martin.doucha@suse.com>
Richard Palethorpe Oct. 24, 2022, 2:25 p.m. UTC | #3
Hello,

Martin Doucha <mdoucha@suse.cz> writes:

> On 24. 10. 22 12:38, Richard Palethorpe wrote:
>> Both cpuid.h and ptrace07 contain inline ASM for x86(_64). There is no
>> need to compile any part of the test or cpuid.h
>> Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
>> Suggested-by: Martin Doucha <martin.doucha@suse.com>
>
> Hi,
> for both patches:
>
> Acked-by: Martin Doucha <martin.doucha@suse.com>

Merged, Thanks!
diff mbox series

Patch

diff --git a/include/lapi/cpuid.h b/include/lapi/cpuid.h
index cd0567f92..7ec785ecf 100644
--- a/include/lapi/cpuid.h
+++ b/include/lapi/cpuid.h
@@ -1,5 +1,9 @@ 
 // SPDX-License-Identifier: GPL-2.0-or-later
 
+#if !(defined(__i386__) || defined(__x86_64__))
+#  error "cpuid.h should only be included on x86"
+#endif
+
 #ifdef HAVE_CPUID_H
 #  include <cpuid.h>
 #endif
diff --git a/testcases/kernel/syscalls/ptrace/ptrace07.c b/testcases/kernel/syscalls/ptrace/ptrace07.c
index d1e68cbc6..362cee543 100644
--- a/testcases/kernel/syscalls/ptrace/ptrace07.c
+++ b/testcases/kernel/syscalls/ptrace/ptrace07.c
@@ -24,6 +24,10 @@ 
  * know about the architecture-dependent FPU state.
  */
 
+#include "tst_test.h"
+
+#ifdef __x86_64__
+
 #include <errno.h>
 #include <inttypes.h>
 #include <sched.h>
@@ -34,7 +38,6 @@ 
 
 #include "config.h"
 #include "ptrace.h"
-#include "tst_test.h"
 #include "tst_safe_macros.h"
 #include "lapi/cpuid.h"
 
@@ -60,7 +63,6 @@  static void check_regs_loop(uint32_t initval)
 	uint32_t xmm0[4] = { initval, initval, initval, initval };
 	int status = 1;
 
-#ifdef __x86_64__
 	asm volatile("   movdqu %0, %%xmm0\n"
 		     "   mov %0, %%rbx\n"
 		     "1: dec %2\n"
@@ -74,7 +76,6 @@  static void check_regs_loop(uint32_t initval)
 		     "3:\n"
 		     : "+m" (xmm0), "+r" (status)
 		     : "r" (num_iters) : "rax", "rbx", "xmm0");
-#endif
 
 	if (status) {
 		tst_res(TFAIL,
@@ -212,3 +213,7 @@  static struct tst_test test = {
 	}
 
 };
+
+#else
+TST_TEST_TCONF("Tests an x86_64 feature");
+#endif	/* if x86 */