From patchwork Fri Mar 20 17:47:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11449975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 230DC913 for ; Fri, 20 Mar 2020 17:47:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 011BE2072C for ; Fri, 20 Mar 2020 17:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbgCTRr1 (ORCPT ); Fri, 20 Mar 2020 13:47:27 -0400 Received: from mga17.intel.com ([192.55.52.151]:24109 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726814AbgCTRr1 (ORCPT ); Fri, 20 Mar 2020 13:47:27 -0400 IronPort-SDR: vGJWeQXvfFpfQO9sAdruIKAP6PyZXjFecVY27vX1srrwuN6LvgDzv1aWJobW7kXcW3aMjEgI6+ uV1q1gsQAsiQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2020 10:47:27 -0700 IronPort-SDR: 4zVTUrEcukyRW++nT8A5RCusFyG5oFLmEBwhN7YZCQkLXZ25Q2a9Efx9adWFKf6NZK/ZQL0yk8 8XqvfSwKycDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,285,1580803200"; d="scan'208";a="356475247" Received: from aklimker-mobl1.ger.corp.intel.com (HELO localhost) ([10.255.197.99]) by fmsmga001.fm.intel.com with ESMTP; 20 Mar 2020 10:47:24 -0700 From: Jarkko Sakkinen To: linux-sgx@vger.kernel.org Cc: Jarkko Sakkinen Subject: [PATCH 1/2] Revert "selftests/x86: Recurse into subdirectories" Date: Fri, 20 Mar 2020 19:47:15 +0200 Message-Id: <20200320174716.27944-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org This reverts commit 565ceeb112045102d62493efb951e237d030e7e1. --- tools/testing/selftests/x86/Makefile | 44 ---------------------------- 1 file changed, 44 deletions(-) diff --git a/tools/testing/selftests/x86/Makefile b/tools/testing/selftests/x86/Makefile index dee6dadeba61..5d49bfec1e9a 100644 --- a/tools/testing/selftests/x86/Makefile +++ b/tools/testing/selftests/x86/Makefile @@ -10,8 +10,6 @@ CAN_BUILD_I386 := $(shell ./check_cc.sh $(CC) trivial_32bit_program.c -m32) CAN_BUILD_X86_64 := $(shell ./check_cc.sh $(CC) trivial_64bit_program.c) CAN_BUILD_WITH_NOPIE := $(shell ./check_cc.sh $(CC) trivial_program.c -no-pie) -SUBDIRS := sgx - TARGETS_C_BOTHBITS := single_step_syscall sysret_ss_attrs syscall_nt test_mremap_vdso \ check_initial_reg_state sigreturn iopl ioperm \ protection_keys test_vdso test_vsyscall mov_ss_trap \ @@ -61,48 +59,6 @@ endif ifeq ($(CAN_BUILD_X86_64),1) all: all_64 - @for DIR in $(SUBDIRS); do \ - BUILD_TARGET=$(OUTPUT)/$$DIR; \ - mkdir $$BUILD_TARGET -p; \ - make OUTPUT=$$BUILD_TARGET -C $$DIR $@; \ - done - -DEFAULT_RUN_TESTS := $(RUN_TESTS) -override define RUN_TESTS - $(DEFAULT_RUN_TESTS) - @for TARGET in $(SUBDIRS); do \ - BUILD_TARGET=$(OUTPUT)/$$TARGET; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET run_tests; \ - done; -endef - -DEFAULT_INSTALL_RULE := $(INSTALL_RULE) -override define INSTALL_RULE - $(DEFAULT_INSTALL_RULE) - @for TARGET in $(SUBDIRS); do \ - BUILD_TARGET=$(OUTPUT)/$$TARGET; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET install; \ - done; -endef - -DEFAULT_EMIT_TESTS := $(EMIT_TESTS) -override define EMIT_TESTS - $(DEFAULT_EMIT_TESTS) - @for TARGET in $(SUBDIRS); do \ - BUILD_TARGET=$(OUTPUT)/$$TARGET; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -s -C $$TARGET emit_tests; \ - done; -endef - -DEFAULT_CLEAN := $(CLEAN) -override define CLEAN - $(DEFAULT_CLEAN) - @for TARGET in $(SUBDIRS); do \ - BUILD_TARGET=$(OUTPUT)/$$TARGET; \ - $(MAKE) OUTPUT=$$BUILD_TARGET -C $$TARGET clean; \ - done; -endef - TEST_PROGS += $(BINARIES_64) EXTRA_CFLAGS += -DCAN_BUILD_64 $(foreach t,$(TARGETS_C_64BIT_ALL),$(eval $(call gen-target-rule-64,$(t)))) From patchwork Fri Mar 20 17:47:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarkko Sakkinen X-Patchwork-Id: 11449977 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78F37913 for ; Fri, 20 Mar 2020 17:47:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5A8452072C for ; Fri, 20 Mar 2020 17:47:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbgCTRrf (ORCPT ); Fri, 20 Mar 2020 13:47:35 -0400 Received: from mga09.intel.com ([134.134.136.24]:21595 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726847AbgCTRre (ORCPT ); Fri, 20 Mar 2020 13:47:34 -0400 IronPort-SDR: gC2qMM5tvmQ4bRhwvRgkTttNwt4fFKBOxUlJ6FlyNWSLTOmpaoBHuiMqDanqs2YyssUNGob26Z 7QTJ7e9iCkSQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2020 10:47:33 -0700 IronPort-SDR: j3dzngyOGG39U6Zh8r9Z7EUYqUJ22j6AF0FntRcwy2ahtmzygI/34NsnZIU/w6l4FL2/80tESe eu0WrCUWvzSQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,285,1580803200"; d="scan'208";a="239291166" Received: from aklimker-mobl1.ger.corp.intel.com (HELO localhost) ([10.255.197.99]) by orsmga008.jf.intel.com with ESMTP; 20 Mar 2020 10:47:30 -0700 From: Jarkko Sakkinen To: linux-sgx@vger.kernel.org Cc: Jarkko Sakkinen , Sean Christopherson Subject: [PATCH 2/2] selftests/x86/sgx: Move to selftests/sgx Date: Fri, 20 Mar 2020 19:47:16 +0200 Message-Id: <20200320174716.27944-2-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200320174716.27944-1-jarkko.sakkinen@linux.intel.com> References: <20200320174716.27944-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Sender: linux-sgx-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sgx@vger.kernel.org Move selftest under the top level selftests directory so that we don't need to clutter x86/Makefile. The changes made for x86/Makefile caused also issues with packaging the selftests. Finally, SGX assets need their own tailored compilation environment. With this change BuildRoot nicely packages both standard x86 selftests and our SGX test. Cc: Sean Christopherson Signed-off-by: Jarkko Sakkinen --- tools/testing/selftests/Makefile | 1 + tools/testing/selftests/{x86 => }/sgx/.gitignore | 0 tools/testing/selftests/{x86 => }/sgx/Makefile | 12 +++++++++--- tools/testing/selftests/{x86 => }/sgx/call.S | 0 tools/testing/selftests/{x86 => }/sgx/defines.h | 4 ++-- tools/testing/selftests/{x86 => }/sgx/encl.c | 0 tools/testing/selftests/{x86 => }/sgx/encl.lds | 0 .../testing/selftests/{x86 => }/sgx/encl_bootstrap.S | 0 tools/testing/selftests/{x86 => }/sgx/main.c | 0 tools/testing/selftests/{x86 => }/sgx/main.h | 0 tools/testing/selftests/{x86 => }/sgx/sign.c | 0 11 files changed, 12 insertions(+), 5 deletions(-) rename tools/testing/selftests/{x86 => }/sgx/.gitignore (100%) rename tools/testing/selftests/{x86 => }/sgx/Makefile (83%) rename tools/testing/selftests/{x86 => }/sgx/call.S (100%) rename tools/testing/selftests/{x86 => }/sgx/defines.h (71%) rename tools/testing/selftests/{x86 => }/sgx/encl.c (100%) rename tools/testing/selftests/{x86 => }/sgx/encl.lds (100%) rename tools/testing/selftests/{x86 => }/sgx/encl_bootstrap.S (100%) rename tools/testing/selftests/{x86 => }/sgx/main.c (100%) rename tools/testing/selftests/{x86 => }/sgx/main.h (100%) rename tools/testing/selftests/{x86 => }/sgx/sign.c (100%) diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile index 6ec503912bea..183a050b5bda 100644 --- a/tools/testing/selftests/Makefile +++ b/tools/testing/selftests/Makefile @@ -63,6 +63,7 @@ TARGETS += user TARGETS += vm TARGETS += x86 TARGETS += zram +TARGETS += sgx #Please keep the TARGETS list alphabetically sorted # Run "make quicktest=1 run_tests" or # "make quicktest=1 kselftest" from top level Makefile diff --git a/tools/testing/selftests/x86/sgx/.gitignore b/tools/testing/selftests/sgx/.gitignore similarity index 100% rename from tools/testing/selftests/x86/sgx/.gitignore rename to tools/testing/selftests/sgx/.gitignore diff --git a/tools/testing/selftests/x86/sgx/Makefile b/tools/testing/selftests/sgx/Makefile similarity index 83% rename from tools/testing/selftests/x86/sgx/Makefile rename to tools/testing/selftests/sgx/Makefile index 789ebbbfddcb..d9c3b3a1983b 100644 --- a/tools/testing/selftests/x86/sgx/Makefile +++ b/tools/testing/selftests/sgx/Makefile @@ -1,6 +1,11 @@ -top_srcdir = ../../../../.. +top_srcdir = ../../../.. -include ../../lib.mk +include ../lib.mk + +.PHONY: all clean + +CAN_BUILD_X86_64 := $(shell ../x86/check_cc.sh $(CC) \ + ../x86/trivial_64bit_program.c) ifndef OBJCOPY OBJCOPY := $(CROSS_COMPILE)objcopy @@ -13,7 +18,9 @@ ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \ TEST_CUSTOM_PROGS := $(OUTPUT)/test_sgx $(OUTPUT)/encl.bin +ifeq ($(CAN_BUILD_X86_64), 1) all: $(TEST_CUSTOM_PROGS) +endif $(OUTPUT)/test_sgx: $(OUTPUT)/main.o $(OUTPUT)/sign.o $(OUTPUT)/call.o $(CC) $(HOST_CFLAGS) -o $@ $^ -lcrypto @@ -40,4 +47,3 @@ EXTRA_CLEAN := \ $(OUTPUT)/test_sgx \ $(OUTPUT)/test_sgx.o \ -.PHONY: clean diff --git a/tools/testing/selftests/x86/sgx/call.S b/tools/testing/selftests/sgx/call.S similarity index 100% rename from tools/testing/selftests/x86/sgx/call.S rename to tools/testing/selftests/sgx/call.S diff --git a/tools/testing/selftests/x86/sgx/defines.h b/tools/testing/selftests/sgx/defines.h similarity index 71% rename from tools/testing/selftests/x86/sgx/defines.h rename to tools/testing/selftests/sgx/defines.h index 0f91175088f6..8f4d17cf8cee 100644 --- a/tools/testing/selftests/x86/sgx/defines.h +++ b/tools/testing/selftests/sgx/defines.h @@ -13,7 +13,7 @@ #define __aligned(x) __attribute__((__aligned__(x))) #define __packed __attribute__((packed)) -#include "../../../../../arch/x86/kernel/cpu/sgx/arch.h" -#include "../../../../../arch/x86/include/uapi/asm/sgx.h" +#include "../../../../arch/x86/kernel/cpu/sgx/arch.h" +#include "../../../../arch/x86/include/uapi/asm/sgx.h" #endif /* DEFINES_H */ diff --git a/tools/testing/selftests/x86/sgx/encl.c b/tools/testing/selftests/sgx/encl.c similarity index 100% rename from tools/testing/selftests/x86/sgx/encl.c rename to tools/testing/selftests/sgx/encl.c diff --git a/tools/testing/selftests/x86/sgx/encl.lds b/tools/testing/selftests/sgx/encl.lds similarity index 100% rename from tools/testing/selftests/x86/sgx/encl.lds rename to tools/testing/selftests/sgx/encl.lds diff --git a/tools/testing/selftests/x86/sgx/encl_bootstrap.S b/tools/testing/selftests/sgx/encl_bootstrap.S similarity index 100% rename from tools/testing/selftests/x86/sgx/encl_bootstrap.S rename to tools/testing/selftests/sgx/encl_bootstrap.S diff --git a/tools/testing/selftests/x86/sgx/main.c b/tools/testing/selftests/sgx/main.c similarity index 100% rename from tools/testing/selftests/x86/sgx/main.c rename to tools/testing/selftests/sgx/main.c diff --git a/tools/testing/selftests/x86/sgx/main.h b/tools/testing/selftests/sgx/main.h similarity index 100% rename from tools/testing/selftests/x86/sgx/main.h rename to tools/testing/selftests/sgx/main.h diff --git a/tools/testing/selftests/x86/sgx/sign.c b/tools/testing/selftests/sgx/sign.c similarity index 100% rename from tools/testing/selftests/x86/sgx/sign.c rename to tools/testing/selftests/sgx/sign.c