Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp431894pxk; Fri, 11 Sep 2020 10:41:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPs5S5ViG+QN+KGI/bSP53DLsVj20R0AkDspM7RTZvXrNUAp9hCGSYML7iTuuj8nctmfvw X-Received: by 2002:a17:906:275b:: with SMTP id a27mr3246234ejd.190.1599846113115; Fri, 11 Sep 2020 10:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599846113; cv=none; d=google.com; s=arc-20160816; b=Var8kVLrkKeHgxvsT9M7IU0wByA+H2ikIuRPwNEcuKH1aMRktRSvcOjQk7gQPErvzA VJzOr7O/9UAn5K+tkVfEPC0swLJasDpweceFVTlPA7MrmZWbhkIXqs6zH871px/pIjNh lZRdJi5i5aEB9YHgYeYuTwODY7i5zy9KApejpnt2rezTvji+5MXrojMaQR68uXG9B2P3 NT8N47NPUHqCILVI7PZFnRh8RXoAqApvQxt8+G7RseOgFsaOljBvVi+uBiDAvYDcFBJU d88qfPVV/7UDI1dYR4tHxgChuKeyMcf4pw5czNgL0hYxzDna6ZU75ny97uVx8g0tOUFq 0q3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=6oVqFguTY88nx046qRZZUVk5BI6qMTS+nDtw4NJb1Rs=; b=nPjo5XCDRPsCeUsbNE8HjKS4HYTzWsHNbdK2y77C+9raQ/tkXm4hwE/Wkwuzm0QE5B i0eaHAoTnCYDVMyxdGqQSckT3kMPr3lpNEQl08KRd69typ6aNhdftAnKf58FLY73mh/L qff2VZA2jkK/gDBgCm/trc2AFeQIXKrLmWAiE/EqEZco+fd5dS39w/pSBoPVLieaCc5m ktqk9VTdoc0tRgQ0f56CfjcwID9A70t8VZBEaoJlcRdBcnMxmtnX7N9qsL1G50sU00Az 0z0ojYvC1DDDTYl+/Q79DVH88fxvbvt82LfWHG9adQx7g0xIhXWTUHe4+JRt22F07BF9 llvQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s8si1658482edt.374.2020.09.11.10.41.30; Fri, 11 Sep 2020 10:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726264AbgIKRk4 (ORCPT + 99 others); Fri, 11 Sep 2020 13:40:56 -0400 Received: from mga18.intel.com ([134.134.136.126]:6451 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725730AbgIKMmk (ORCPT ); Fri, 11 Sep 2020 08:42:40 -0400 IronPort-SDR: ShEHYmn+9aUyon7x6sMpxRHv6fKPa4KbGnY3WHWzl+11EJvQDmhMaXHhmU/5lAV7aJexdon2Wl bth+Lzo7yf7w== X-IronPort-AV: E=McAfee;i="6000,8403,9740"; a="146478501" X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="146478501" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 05:42:21 -0700 IronPort-SDR: M0BFc5qND/2V4JxJoC9vY6DzdKNuhbZjhvT8BtPBzwYPwM3it4RCrFqravgt5ZHG6B0X7QXKrM GptqHlzjssTA== X-IronPort-AV: E=Sophos;i="5.76,415,1592895600"; d="scan'208";a="305259134" Received: from amaksymi-mobl.ger.corp.intel.com (HELO localhost) ([10.252.60.247]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2020 05:42:09 -0700 From: Jarkko Sakkinen To: x86@kernel.org, linux-sgx@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jarkko Sakkinen , Sean Christopherson , Darren Kenny , akpm@linux-foundation.org, andriy.shevchenko@linux.intel.com, asapek@google.com, bp@alien8.de, cedric.xing@intel.com, chenalexchen@google.com, conradparker@google.com, cyhanish@google.com, dave.hansen@intel.com, haitao.huang@intel.com, josh@joshtriplett.org, kai.huang@intel.com, kai.svahn@intel.com, kmoy@google.com, ludloff@google.com, luto@kernel.org, nhorman@redhat.com, npmccallum@redhat.com, puiterwijk@redhat.com, rientjes@google.com, tglx@linutronix.de, yaozhangx@google.com Subject: [PATCH v37 07/24] x86/cpu/intel: Add nosgx kernel parameter Date: Fri, 11 Sep 2020 15:40:02 +0300 Message-Id: <20200911124019.42178-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200911124019.42178-1-jarkko.sakkinen@linux.intel.com> References: <20200911124019.42178-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add kernel parameter to disable Intel SGX kernel support. Tested-by: Sean Christopherson Reviewed-by: Sean Christopherson Reviewed-by: Darren Kenny Signed-off-by: Jarkko Sakkinen --- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/x86/kernel/cpu/feat_ctl.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a1068742a6df..e53448716567 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3339,6 +3339,8 @@ nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support. + nosgx [X86-64,SGX] Disables Intel SGX kernel support. + nosmp [SMP] Tells an SMP kernel to act as a UP kernel, and disable the IO APIC. legacy for "maxcpus=0". diff --git a/arch/x86/kernel/cpu/feat_ctl.c b/arch/x86/kernel/cpu/feat_ctl.c index c3afcd2e4342..1837df39527f 100644 --- a/arch/x86/kernel/cpu/feat_ctl.c +++ b/arch/x86/kernel/cpu/feat_ctl.c @@ -101,6 +101,15 @@ static void clear_sgx_caps(void) setup_clear_cpu_cap(X86_FEATURE_SGX2); } +static int __init nosgx(char *str) +{ + clear_sgx_caps(); + + return 0; +} + +early_param("nosgx", nosgx); + void init_ia32_feat_ctl(struct cpuinfo_x86 *c) { bool tboot = tboot_enabled(); -- 2.25.1