Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp104851ybg; Sun, 31 May 2020 18:23:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMw5+9BtofR/1c4+UOGB1UziV5G0GzC6pGBrLC4eo1Y3FivSx8tdNhN18v0/0qE0+7HLJ4 X-Received: by 2002:a17:906:2e1a:: with SMTP id n26mr16937954eji.425.1590974585509; Sun, 31 May 2020 18:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590974585; cv=none; d=google.com; s=arc-20160816; b=rah5KBSa/8hr3vTpdblgUH/mWAb3c8QSI7UxNxrdb0Z0eQp4SKCNeeVxscjkPA37Cj EeQed+KjCHEqNh2falwOyINVpCqU96GZyCQLOQcLUMxUm8UJuKaXeVWnN0S75gh0jcUs iQU77i71UqzJSQkYTljIhHc1OWS+hTbNDMWzhiTXpaCbcLxKPHP8jHKeXImofCJ517Qs Cahl92wDggKpScBsdiRe9np2V4eQcn5eEL//5lj+HtEY8xDV6s5G1y7rsNr95YDhNzWF K04x8dHwrbttlp2/4dDvGjDkp41ncsyXaEWNJc5m8JMrCSHiZEJ9vN2Nfm4KdEoKIDYd STyQ== 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=tYNhXUefDgnBvVXZSNzg9qqL1DlXlGkSDt1LHgq6GDw=; b=iLG7PS4Xo4ZH+aOVjrgezOkgThdi4mdclMuICdXdGun7waJUu8Ix0o76wUg2jnVUHs bAwBYJLchjP5wrg7f5JlxaWR/xQ0Pjzbgnc+Len66YBl+JOR9/baEnttgJ9HXGh83rMu 5jR9QZSOyJ3s40vVmauFJlOKGnDjBWztfdWr+3tS5n8kgRkSP3/dxCjl68kO8UpwlQqj fqnxt5dGTU1n+GK/L/Q0Z5teC/PnoJrZEPow5hpoF8Wr2Ze/RpxKsodCqaRmxn5UWWw8 bClkK1hfBw+K25ClkNyrOvF9PkyOuhXhk5z+AgzzX4RFEsfH4JfkodYVXQ2UlRkK82P/ vZbg== 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 d11si274117edx.237.2020.05.31.18.22.43; Sun, 31 May 2020 18:23:05 -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 S1728080AbgFABS3 (ORCPT + 99 others); Sun, 31 May 2020 21:18:29 -0400 Received: from mga06.intel.com ([134.134.136.31]:40595 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726860AbgFABS3 (ORCPT ); Sun, 31 May 2020 21:18:29 -0400 IronPort-SDR: 2mG5zWZnoHt7sfHdaNNQCc5ysCinXi6CqmPZFAhTe4ne6EccwWl63U0aYZQ7gJjWNT4YtFhAFP a8lRH8Zb0RwQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 May 2020 18:18:28 -0700 IronPort-SDR: LJPCw34jOsfGxdLjQvZY+CRl1j5zpk2/iGNcxqdXn+P8Cpv6oyr1hTnavrvDTtLwfVG+ZIDQOz JQbxZ6OBHq1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,459,1583222400"; d="scan'208";a="268157061" Received: from hbetts-mobl.ger.corp.intel.com (HELO localhost) ([10.252.59.178]) by orsmga003.jf.intel.com with ESMTP; 31 May 2020 18:18:18 -0700 From: Jarkko Sakkinen To: linux-kernel@vger.kernel.org, x86@kernel.org, linux-sgx@vger.kernel.org Cc: Jarkko Sakkinen , Sean Christopherson , 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 v31 07/21] x86/cpu/intel: Add nosgx kernel parameter Date: Mon, 1 Jun 2020 04:16:31 +0300 Message-Id: <20200601011645.794040-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601011645.794040-1-jarkko.sakkinen@linux.intel.com> References: <20200601011645.794040-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 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 7bc83f3d9bdf..9f7202a54db6 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3268,6 +3268,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