From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B95F8C433E0 for ; Mon, 15 Mar 2021 03:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8EBE464E46 for ; Mon, 15 Mar 2021 03:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbhCODhX (ORCPT ); Sun, 14 Mar 2021 23:37:23 -0400 Received: from mga01.intel.com ([192.55.52.88]:57989 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229599AbhCODhK (ORCPT ); Sun, 14 Mar 2021 23:37:10 -0400 IronPort-SDR: e1r5JljvBOPGx4ajwvWAGHSN4QFUUiPzsOOpjvJ4s2FDYiBwDaPJWSHQ3FsMoxJJ+pfJqpOtbW TjGK9HhpZgOg== X-IronPort-AV: E=McAfee;i="6000,8403,9923"; a="208925243" X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="208925243" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2021 20:37:04 -0700 IronPort-SDR: Ua5HwDV6UApRMkS6GpJy7024IbgwWZvc1n8Z/1mrpqRZNPs1sKhl2ZRqge/8Z4VBlDlGrBCv8O T3kDvZ9X2FlQ== X-IronPort-AV: E=Sophos;i="5.81,249,1610438400"; d="scan'208";a="371499675" Received: from avaldezb-mobl.amr.corp.intel.com (HELO khuang2-desk.gar.corp.intel.com) ([10.255.229.198]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Mar 2021 20:36:59 -0700 Date: Mon, 15 Mar 2021 16:36:56 +1300 From: Kai Huang To: Sean Christopherson Cc: kvm@vger.kernel.org, linux-sgx@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, jarkko@kernel.org, luto@kernel.org, dave.hansen@intel.com, rick.p.edgecombe@intel.com, haitao.huang@intel.com, pbonzini@redhat.com, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Subject: Re: [PATCH v2 08/25] x86/sgx: Expose SGX architectural definitions to the kernel Message-Id: <20210315163656.df89c4f52573724e492cc11d@intel.com> In-Reply-To: References: X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 Mar 2021 13:58:40 -0800 Sean Christopherson wrote: > On Tue, Mar 09, 2021, Kai Huang wrote: > > From: Sean Christopherson > > > > Expose SGX architectural structures, as KVM will use many of the > > architectural constants and structs to virtualize SGX. > > > > Name the new header file as asm/sgx.h, rather than asm/sgx_arch.h, to > > have single header to provide SGX facilities to share with other kernel > > componments. > > > > Signed-off-by: Sean Christopherson > > Co-developed-by: Kai Huang > > Acked-by: Dave Hansen > > Same checkpatch warning. Probably doesn't matter. Will change order to make checkpatch happy for this whole series. Thanks for pointing out. > > > Signed-off-by: Kai Huang > > --- > > .../cpu/sgx/arch.h => include/asm/sgx.h} | 20 ++++++++++++++----- > > arch/x86/kernel/cpu/sgx/encl.c | 2 +- > > arch/x86/kernel/cpu/sgx/sgx.h | 2 +- > > tools/testing/selftests/sgx/defines.h | 2 +- > > 4 files changed, 18 insertions(+), 8 deletions(-) > > rename arch/x86/{kernel/cpu/sgx/arch.h => include/asm/sgx.h} (95%) > > > > diff --git a/arch/x86/kernel/cpu/sgx/arch.h b/arch/x86/include/asm/sgx.h > > similarity index 95% > > rename from arch/x86/kernel/cpu/sgx/arch.h > > rename to arch/x86/include/asm/sgx.h > > index abf99bb71fdc..d4ad35f6319a 100644 > > --- a/arch/x86/kernel/cpu/sgx/arch.h > > +++ b/arch/x86/include/asm/sgx.h > > @@ -2,15 +2,20 @@ > > /** > > * Copyright(c) 2016-20 Intel Corporation. > > * > > - * Contains data structures defined by the SGX architecture. Data structures > > - * defined by the Linux software stack should not be placed here. > > + * Intel Software Guard Extensions (SGX) support. > > */ > > -#ifndef _ASM_X86_SGX_ARCH_H > > -#define _ASM_X86_SGX_ARCH_H > > +#ifndef _ASM_X86_SGX_H > > +#define _ASM_X86_SGX_H > > > > #include > > #include > > > > +/* > > + * This file contains both data structures defined by SGX architecture and Linux > > + * defined software data structures and functions. The two should not be mixed > > + * together for better readibility. The architectural definitions come first. > > + */ > > + > > /* The SGX specific CPUID function. */ > > #define SGX_CPUID 0x12 > > /* EPC enumeration. */ > > @@ -337,4 +342,9 @@ struct sgx_sigstruct { > > > > #define SGX_LAUNCH_TOKEN_SIZE 304 > > > > -#endif /* _ASM_X86_SGX_ARCH_H */ > > +/* > > + * Do not put any hardware-defined SGX structure representations below this > > + * line! > > Heh, which line? Yep, it's Friday afternoon... Hmm.. I will change to below this comment. :)