Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2871988pxk; Tue, 15 Sep 2020 04:45:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcf6yWiaB1GJElI2PjRfUqNXcaMTTb4V720V1caWzfr7EQnZwrcBzbD+cHUpG0R5j1vsQQ X-Received: by 2002:aa7:de03:: with SMTP id h3mr22259372edv.232.1600170345549; Tue, 15 Sep 2020 04:45:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600170345; cv=none; d=google.com; s=arc-20160816; b=QwDxzySvba83YcLx7dZi+Hlo/f25hgfEoBbSQvQB/u4aCE5lCExGBaP20y0f+mILwU o/tds6NWvcLyo1thzWRk1+pJpUe9PlRWq/AabUU1Sdc1Vj0iqhlHtMzAsI/BZPer6J89 znamlayPLwUYMIa4zJGkIqC2U2kXCkyOA40SjRod8dey0oSDnwTKiq+HPYdj/VnErqTg vP4Ft07QRdyKnkKbofooMUGMIQd5Km6O6sFw12tzTN569mPLJ77LKYu7dHv4I5RGvmlS 7a4Wp7jX23eY6znKHqR3UV3E4xCQxdEyNP/NDYZ6noalRR/leixBOjEKbS/ao4OV+FsY gCtQ== 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 :dkim-signature; bh=6oVqFguTY88nx046qRZZUVk5BI6qMTS+nDtw4NJb1Rs=; b=gQG1QaLRhwuh6UXH9GZFXTXX5SXquj9jQb6eFldxAD7Eut9Mxz4lF4RbsQSDCpWN0E pUmdyoRltg4FH8ldlZy9DkrKeVUxy+uiOEokoXMkjSY9HoEduf5Y86vkMjqOQIDC1qh/ 85lt0qxSek81Qs8t6qzahjBGpXStpBtinlMKWxTnxS64/n8WgiRIrL8ePUcu4Wrfelil echvfYJQWm13FeRey6m5RYQhrdZXC+i1XxM/t6jH4zoe2HK3Kz3TxFi3qZ3s9eRoQ6Ac JF6uHZqOFs7hF8M3uFF1iR3P/zI1ivjFWLhMpFKUkCmE25e623orDGlk9dn+i7/wM9op O3MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=UGMezc4O; 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 p16si8915268edm.382.2020.09.15.04.45.23; Tue, 15 Sep 2020 04:45:45 -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; dkim=fail header.i=@kapsi.fi header.s=20161220 header.b=UGMezc4O; 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 S1726334AbgIOLjR (ORCPT + 99 others); Tue, 15 Sep 2020 07:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726280AbgIOLaZ (ORCPT ); Tue, 15 Sep 2020 07:30:25 -0400 Received: from mail.kapsi.fi (mail.kapsi.fi [IPv6:2001:67c:1be8::25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A33FC061788; Tue, 15 Sep 2020 04:28:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=6oVqFguTY88nx046qRZZUVk5BI6qMTS+nDtw4NJb1Rs=; b=UGMezc4ONMP7u/4T7NP6bzsL7R Fx47pH1Aao2z9nXcdvsFzQ4FEx1iUoOnPsoz9hBNGIE5jU9LmntiOULSybTSQuykHYRr0dWt2dwB0 GxliFHbpxshdTlt4RbsJOojxbLNmHGysklUgTJToj4umEmKZNbc4XsLmcgMu3Vgla6SRSxAeP7vNi XimC1KTAgfrMsGdZbEzRGxGH/B9uEHyOCL4zpdJKSadNPzOEgzbBUbgxuiqvQDs3QCDrvSdpXfRcW 5SWCVnnVkcQQxQcWuKCz29g6CN6nhBkhebCo4c4YNKBIFMZSe/HArw65PpAlQQsigT71VwQNyypwd h32KSNMA==; Received: from 83-245-197-237.elisa-laajakaista.fi ([83.245.197.237] helo=localhost) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1kI98i-0000ik-Je; Tue, 15 Sep 2020 14:28:48 +0300 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 v38 07/24] x86/cpu/intel: Add nosgx kernel parameter Date: Tue, 15 Sep 2020 14:28:25 +0300 Message-Id: <20200915112842.897265-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> References: <20200915112842.897265-1-jarkko.sakkinen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 83.245.197.237 X-SA-Exim-Mail-From: jjs@kapsi.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false 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