Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp695834pxb; Thu, 12 Nov 2020 14:05:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJwd6fBPb+1eJhAnDvS2u+MUSC4V9qCQoNyNzzCw0LLnnDwvzoq4VLdIFdI+FFstRa0LrbYQ X-Received: by 2002:a17:906:3547:: with SMTP id s7mr1441418eja.70.1605218702332; Thu, 12 Nov 2020 14:05:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605218702; cv=none; d=google.com; s=arc-20160816; b=nzXOBzdbwjzrBAi81w93ApxxAse5lPf9VKUycCKNzgvHMi9ToFS0Re3NZiwCp8d5vb SSf9pao77Z8cTV4q+fT8XgJqaKNyRZ+AOuJhRcHGiRHAaRK23TArPIZ0iaFNrznpc3z8 0Ii7TtMo6PUW3kaZVHcH+FaKToneR4lqqipAUNmBQPE7YtLt8YRT68OJE3692VZf6aj9 ldwACw3xg4vrkjm6vm3KzhxBogKILkDTXdRg4HBYMcbS5AaBI9LkWV8kxvJ5Dj1gdX5l Vi/9PiLTPW6pGQlfHjqwjgJh+yPWCwJnvzIqEUM3g8ZDCWqXpS2/ikX+tqceMFIvqsMF Nr0w== 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 :dkim-signature; bh=HSpvtptq91rNBB4iP+fkaNICKiu834c/ofZxDLomNyo=; b=uWoLfgQioQJ5hozEPULBm+zevka28s4RLpa+G8FSRWt94rRsfkEdTye0WN0VSsHXUp UUgPkB4L8WFCACyvWO+fhRA/dlrgEsZhCPp/NNxaPBUyHZ2tVaRVJntBkipE0aWPhknW 7Zmdl3S0NfIC/3kIRN8VcH7VjOc1jI/Tdc2g+QDSTAvqSlyM1OsziCNnX5d8ZgQDPVkN sJnfu7XpF9JKzvTWM3JbCfM2GbsVFgbGAANKJivpKscqak6oq0OTZJGNAnjw0wcsV0sY RxpOpPTX/rfzo58FrT4BuGpIkgzvcr8A88B1xg+wwspcj4/fQkAFrtlbiTLdH8Vktuv2 K1rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=QzBBBZE5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y12si4899440eds.22.2020.11.12.14.04.39; Thu, 12 Nov 2020 14:05:02 -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; dkim=pass header.i=@kernel.org header.s=default header.b=QzBBBZE5; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727626AbgKLWCp (ORCPT + 99 others); Thu, 12 Nov 2020 17:02:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:50252 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727553AbgKLWCk (ORCPT ); Thu, 12 Nov 2020 17:02:40 -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 E106B22201; Thu, 12 Nov 2020 22:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605218559; bh=zJx4e7mNcNnTToB29aO9Ny/o14a9p3GCHActo+yKdJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QzBBBZE5WwOMsI7lDNwxIeQKUQHqDig/c1IxAbBptENai206PDp3BkkGNIMQSYzbQ K5jip7VPxFJsOz2jIujMkHc0e1gIWT90to8Pv7luEmWFtuouP/wDMN1nR3H+7cKyTK i5g/KdolDM8fhPClZSSiItXA8Ebftzuh7+scRbpQ= From: Jarkko Sakkinen To: x86@kernel.org, linux-sgx@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jarkko Sakkinen , Jethro Beekman , 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, sean.j.christopherson@intel.com, tglx@linutronix.de, yaozhangx@google.com, mikko.ylinen@intel.com Subject: [PATCH v41 08/24] x86/cpu/intel: Add nosgx kernel parameter Date: Fri, 13 Nov 2020 00:01:19 +0200 Message-Id: <20201112220135.165028-9-jarkko@kernel.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201112220135.165028-1-jarkko@kernel.org> References: <20201112220135.165028-1-jarkko@kernel.org> 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. Acked-by: Jethro Beekman # v40 # 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 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