Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1812587pxk; Fri, 2 Oct 2020 21:53:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxK41jf7zjcwNUxuA/6RmhSmMc3TSsbTrANnji16cBk2JOGRvNsOkHc2SEoBRr8/Rj2BA+I X-Received: by 2002:a05:6402:3105:: with SMTP id dc5mr6397737edb.105.1601700819464; Fri, 02 Oct 2020 21:53:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601700819; cv=none; d=google.com; s=arc-20160816; b=k+GFd6hHhqgmFwarPaQOonXmhutnVhvlKqWHbg0S9DEsLEj2AT//JiEic47dSRFwDK Elcn4oDbaRYu46mFAyC9QOvnI+fiAstkz7rzzdU5Kjwx2WRVGbqqLcilMwRy+RXdNe0H sUWYi78ss4w9OFirJWLswmmeDMwh2G6kZIQSD2bKyRmMRfDHjL00+W21WXh1HWsoT7iQ g2alnHFI6B1Fgd7uoiJYdk3/WdqkVFE5/Rn2ut3KkircnuEWKL9lW+77j4CDQ+QX10+l /IRiZC33zqvUXU0FDqqzzoHG8WtXUyqw9EkcqkRLe+U498nLiGMrDCBkz9CVqUyEyFQ7 MAaQ== 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=wWv446DqHWH73GIhyfdXXt1vc8CreyPhpw3ZKT5bMnw=; b=zCvHABq50kTxAANGPikCYL771Hs0MrU/aFOgXzefHfXdXLJ+OeFGwoO849casCkZ4X uBB7L/meKYwsZpYuG8PZBYO1aqBGfVni/qIaJc9PAKqwzeqdROQ5JYjwoJcbDxVD3p2m +0lVJCouLFFUUPDBFbQ9NCxobhYdst054G71xDoGnyFzrF6bykiwSIjXmyQTugM/J3A0 jbmfRXYgYIPXsl5jcSeLVyi2vQJx/ag7T4PU7ZGM5zpQcMi77/+Mb4VrtZ7llNi2q2Cq rLJNy4oP1Hm/F5XVsK/8Q/EMY22oF2Lg5b+0DOOhh2QoTd01crQtySVgHUBvXZ61b0c2 QQAQ== 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 d10si1959621edp.364.2020.10.02.21.53.17; Fri, 02 Oct 2020 21:53:39 -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 S1725843AbgJCEvW (ORCPT + 99 others); Sat, 3 Oct 2020 00:51:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:49704 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725791AbgJCEvU (ORCPT ); Sat, 3 Oct 2020 00:51:20 -0400 Received: from localhost (83-245-197-237.elisa-laajakaista.fi [83.245.197.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6F5322193E; Sat, 3 Oct 2020 04:51:19 +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 v39 07/24] x86/cpu/intel: Add nosgx kernel parameter Date: Sat, 3 Oct 2020 07:50:42 +0300 Message-Id: <20201003045059.665934-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201003045059.665934-1-jarkko.sakkinen@linux.intel.com> References: <20201003045059.665934-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. 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 115c50f4e927..7ff2b35a1b8e 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3356,6 +3356,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