From patchwork Fri Dec 20 22:54:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11306511 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 859A514B7 for ; Fri, 20 Dec 2019 22:55:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 63BC82146E for ; Fri, 20 Dec 2019 22:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726799AbfLTWzE (ORCPT ); Fri, 20 Dec 2019 17:55:04 -0500 Received: from mga03.intel.com ([134.134.136.65]:34039 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbfLTWzE (ORCPT ); Fri, 20 Dec 2019 17:55:04 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2019 14:55:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,337,1571727600"; d="scan'208";a="366508439" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2019 14:55:02 -0800 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org Subject: [PATCH for_v25 1/4] selftests/x86: Fix INCLUDES definition in SGX Makefile Date: Fri, 20 Dec 2019 14:54:58 -0800 Message-Id: <20191220225501.23476-2-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191220225501.23476-1-sean.j.christopherson@intel.com> References: <20191220225501.23476-1-sean.j.christopherson@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 Define INCLUDES to reference the top-level tools/include when building SGX selftests in preparation of adding a missing linux/bits.h include in sgx/arch.h. Signed-off-by: Sean Christopherson --- tools/testing/selftests/x86/sgx/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/x86/sgx/Makefile b/tools/testing/selftests/x86/sgx/Makefile index a09ef5f965dc..f838700029e2 100644 --- a/tools/testing/selftests/x86/sgx/Makefile +++ b/tools/testing/selftests/x86/sgx/Makefile @@ -6,6 +6,7 @@ ifndef OBJCOPY OBJCOPY := $(CROSS_COMPILE)objcopy endif +INCLUDES := -I$(top_srcdir)/tools/include HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC -z noexecstack ENCL_CFLAGS := -Wall -Werror -static -nostdlib -nostartfiles -fPIC \ -fno-stack-protector -mrdrnd $(INCLUDES) @@ -33,7 +34,7 @@ $(OUTPUT)/encl.ss: $(OUTPUT)/encl.bin $(OUTPUT)/sgxsign signing_key.pem $(OUTPUT)/encl.bin $(OUTPUT)/encl.ss $(OUTPUT)/sgxsign: sgxsign.c - $(CC) -o $@ $< -lcrypto + $(CC) $(INCLUDES) -o $@ $< -lcrypto EXTRA_CLEAN := \ $(OUTPUT)/encl.bin \ From patchwork Fri Dec 20 22:54:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11306505 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 032AD139A for ; Fri, 20 Dec 2019 22:55:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D5E642146E for ; Fri, 20 Dec 2019 22:55:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726786AbfLTWzD (ORCPT ); Fri, 20 Dec 2019 17:55:03 -0500 Received: from mga03.intel.com ([134.134.136.65]:34039 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbfLTWzD (ORCPT ); Fri, 20 Dec 2019 17:55:03 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2019 14:55:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,337,1571727600"; d="scan'208";a="366508440" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2019 14:55:02 -0800 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org Subject: [PATCH for_v25 2/4] x86/sgx: Add missing linux/bits.h include in sgx/arch.h Date: Fri, 20 Dec 2019 14:54:59 -0800 Message-Id: <20191220225501.23476-3-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191220225501.23476-1-sean.j.christopherson@intel.com> References: <20191220225501.23476-1-sean.j.christopherson@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 Include linux/bits.h for its defitions of BIT() and GENMASK*(). Signed-off-by: Sean Christopherson --- arch/x86/kernel/cpu/sgx/arch.h | 1 + tools/testing/selftests/x86/sgx/defines.h | 22 ---------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/arch/x86/kernel/cpu/sgx/arch.h b/arch/x86/kernel/cpu/sgx/arch.h index 7a5d24b4d1bb..dbd652be9b53 100644 --- a/arch/x86/kernel/cpu/sgx/arch.h +++ b/arch/x86/kernel/cpu/sgx/arch.h @@ -8,6 +8,7 @@ #ifndef _ASM_X86_SGX_ARCH_H #define _ASM_X86_SGX_ARCH_H +#include #include #define SGX_CPUID 0x12 diff --git a/tools/testing/selftests/x86/sgx/defines.h b/tools/testing/selftests/x86/sgx/defines.h index 1e67f2f29f42..87264f85cb9f 100644 --- a/tools/testing/selftests/x86/sgx/defines.h +++ b/tools/testing/selftests/x86/sgx/defines.h @@ -8,31 +8,9 @@ #include -typedef uint8_t u8; -typedef uint16_t u16; -typedef uint32_t u32; -typedef uint64_t u64; - #define __aligned(x) __attribute__((__aligned__(x))) #define __packed __attribute__((packed)) -/* Derived from asm-generic/bitsperlong.h. */ -#if __x86_64__ -#define BITS_PER_LONG 64 -#else -#define BITS_PER_LONG 32 -#endif -#define BITS_PER_LONG_LONG 64 - -/* Taken from linux/bits.h. */ -#define BIT(nr) (1UL << (nr)) -#define BIT_ULL(nr) (1ULL << (nr)) -#define GENMASK(h, l) \ - (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) -#define GENMASK_ULL(h, l) \ - (((~0ULL) - (1ULL << (l)) + 1) & \ - (~0ULL >> (BITS_PER_LONG_LONG - 1 - (h)))) - #include "../../../../../arch/x86/kernel/cpu/sgx/arch.h" #include "../../../../../arch/x86/include/uapi/asm/sgx.h" From patchwork Fri Dec 20 22:55:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11306513 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 1EDD114E3 for ; Fri, 20 Dec 2019 22:55:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06D682146E for ; Fri, 20 Dec 2019 22:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726539AbfLTWzE (ORCPT ); Fri, 20 Dec 2019 17:55:04 -0500 Received: from mga03.intel.com ([134.134.136.65]:34039 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726030AbfLTWzE (ORCPT ); Fri, 20 Dec 2019 17:55:04 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2019 14:55:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,337,1571727600"; d="scan'208";a="366508443" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2019 14:55:02 -0800 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org Subject: [PATCH for_v25 3/4] selftests/x86: Add .gitignore for SGX selftest Date: Fri, 20 Dec 2019 14:55:00 -0800 Message-Id: <20191220225501.23476-4-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191220225501.23476-1-sean.j.christopherson@intel.com> References: <20191220225501.23476-1-sean.j.christopherson@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 Add a .gitignore for SGX to ignore its build output. Signed-off-by: Sean Christopherson --- tools/testing/selftests/x86/sgx/.gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 tools/testing/selftests/x86/sgx/.gitignore diff --git a/tools/testing/selftests/x86/sgx/.gitignore b/tools/testing/selftests/x86/sgx/.gitignore new file mode 100644 index 000000000000..98eb2d439606 --- /dev/null +++ b/tools/testing/selftests/x86/sgx/.gitignore @@ -0,0 +1,3 @@ +encl.ss +sgxsign +test_sgx From patchwork Fri Dec 20 22:55:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 11306507 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 2432414E3 for ; Fri, 20 Dec 2019 22:55:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0CA8221655 for ; Fri, 20 Dec 2019 22:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726787AbfLTWzD (ORCPT ); Fri, 20 Dec 2019 17:55:03 -0500 Received: from mga03.intel.com ([134.134.136.65]:34039 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbfLTWzD (ORCPT ); Fri, 20 Dec 2019 17:55:03 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2019 14:55:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,337,1571727600"; d="scan'208";a="366508445" Received: from sjchrist-coffee.jf.intel.com ([10.54.74.202]) by orsmga004.jf.intel.com with ESMTP; 20 Dec 2019 14:55:02 -0800 From: Sean Christopherson To: Jarkko Sakkinen Cc: linux-sgx@vger.kernel.org Subject: [PATCH for_v25 4/4] selftests/x86: Remove redundant kernel include Date: Fri, 20 Dec 2019 14:55:01 -0800 Message-Id: <20191220225501.23476-5-sean.j.christopherson@intel.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191220225501.23476-1-sean.j.christopherson@intel.com> References: <20191220225501.23476-1-sean.j.christopherson@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 The SGX selftests incorporate any and all necessary kernel includes in defines.h, remove redundant includes from main.c so that the obnoxiously long paths don't need to be updated if the kernel files are renamed. Signed-off-by: Sean Christopherson --- tools/testing/selftests/x86/sgx/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tools/testing/selftests/x86/sgx/main.c b/tools/testing/selftests/x86/sgx/main.c index a94ba894b020..d97cc3cf0093 100644 --- a/tools/testing/selftests/x86/sgx/main.c +++ b/tools/testing/selftests/x86/sgx/main.c @@ -16,8 +16,6 @@ #include #include #include "defines.h" -#include "../../../../../arch/x86/kernel/cpu/sgx/arch.h" -#include "../../../../../arch/x86/include/uapi/asm/sgx.h" #include "sgx_call.h" #define PAGE_SIZE 4096