Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1357221pxb; Wed, 4 Nov 2020 06:57:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn5zhWuXrt242DsGXXHmtWAPiq7GCtyTcKW2unUyJaL69vCswU4GxO3rTlIJgRH0GsZ/iN X-Received: by 2002:a17:906:1c0f:: with SMTP id k15mr24457779ejg.343.1604501867747; Wed, 04 Nov 2020 06:57:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604501867; cv=none; d=google.com; s=arc-20160816; b=va1vXOCgckfOlK6WPifWxe90P3Rc6DCpm/A2I0c8SfTZqb9Wmd1M9qgOkcwizEL8mR krTsM0WvMgJSqdo04rTjxVZrEyu6UquInX5x+pYbTh0I4CPhYg7urk+wML4sjWKc3Nry KujaYcHEmplL70imvHONAziB3Z84ZnpAFRuSZaucw2DH2XCFSx0i+1u6B2QbtpNR+uNr AArh/6/RaDdS6SSS82HkPb/V/RQk2+f3CwzeN9lVnF1+QIw70Uy+a95NTWmJBm+S374m GHsQTg2LqKif+0kX0qujrh2+v4WvQ+2VTaDkKCQAZ4TMqZqWf25ejTrwpiLpxrjBn8Pb 2oIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ClCQV/H8o+eyZH/lAxu2OxplvFjFcWvzbvAiBkdeN58=; b=IthqIJs1ND6e3xrM2ajsWpLizzrf+hBU1KHzRWlQPYuIb3bIpMlcO9YbSikGAJETAG /TRiKu4avzWKiKrcL3jWD7iDU9LzkfA4vbVNK3zNNA+NBP9+P82dpaE/GcK8EG8ca0pG znc1qdh7r3Iev+N4Ai3bq2z2NSSDBfGBCeas6JrC4Li/CkRVS1/MUWBbSnducij/QCvX IGWHKV2haeJUeSFbMvXYwmLb8HzOkG11x2i6FAmnyMLyyAqfUIfoVorppMKz2iFnBJd7 SI2M6uHvbokLxMFkZcCZ6as+yLB6CIlkrDRYPjAUohEoZzOqf3ZPJJZZMKK1jwdzMEew ehlA== 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 a14si1611196edn.216.2020.11.04.06.57.24; Wed, 04 Nov 2020 06:57:47 -0800 (PST) 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 S1730409AbgKDOza (ORCPT + 99 others); Wed, 4 Nov 2020 09:55:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:49230 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730399AbgKDOz2 (ORCPT ); Wed, 4 Nov 2020 09:55:28 -0500 Received: from suppilovahvero.lan (83-245-197-237.elisa-laajakaista.fi [83.245.197.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 46FB521527; Wed, 4 Nov 2020 14:55:22 +0000 (UTC) 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, 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, mikko.ylinen@intel.com Subject: [PATCH v40 08/24] x86/cpu/intel: Add nosgx kernel parameter Date: Wed, 4 Nov 2020 16:54:14 +0200 Message-Id: <20201104145430.300542-9-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201104145430.300542-1-jarkko.sakkinen@linux.intel.com> References: <20201104145430.300542-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add kernel parameter to disable Intel SGX kernel support, along with supporting Documentation. 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 bd1a5b87a5e2..4684611edf09 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3385,6 +3385,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 d38e97325018..3b1b01f2b248 100644 --- a/arch/x86/kernel/cpu/feat_ctl.c +++ b/arch/x86/kernel/cpu/feat_ctl.c @@ -99,6 +99,15 @@ static void clear_sgx_caps(void) setup_clear_cpu_cap(X86_FEATURE_SGX_LC); } +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.27.0