Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp1132328ybk; Sat, 16 May 2020 02:01:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwexPZCZHrdpXUynYzjEB3IXhkGi1Ezf4yx3T14GddLtZeQsWrj6cM5eKG6KeyGZYgUeWE9 X-Received: by 2002:a50:c94d:: with SMTP id p13mr6327630edh.240.1589619695075; Sat, 16 May 2020 02:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589619695; cv=none; d=google.com; s=arc-20160816; b=gFfYGYgg2bXj9fg3M0EpsSbOCuJsyKoIwuW0w13Qbz2hzGmOe9iP3J7p5HBYcx1rju Nfk7GfwuyeOwcjigZvUqRr7IOnBu4ad1WwQuzAtkgbHMMWISa8sAg8Rj1InE4r9IazVT jsvlUvZZvSaAYvYA/r1jOGyY0hRBfHgSXW7ojMoIM1NVSzb/ZG05mN8Op6KKU8GQT4Or Y/cys0ARNtrWS8qxcmIemx/HO42cI289LWbmMyLT94qBDsAeGZcZMDcHyqnkifF6zO02 5YlkgNv2fC/IGOHKdHu55e9pIX1KxIvqXZzpTuU9Cvt4NaJ+UozWg+tlEN/3FhpYu8tc SK5A== 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=fIHUJxHKCdo6ysroR1DLOhZzAoeKoFt2Df07HwTAbfE6P6MTKPFo+ZWkGXoyHAzS8I lvTqnEel+vvAqSPaSlZYYlaFd8eLy7JnEufVUL+bY+k8WtkADfCPPc9hqXWphqMr76pZ 9g1rGigW2EpLtcHdWQON8M/VmTOKuTP71AkG5hMm2D1zFsRhQUajV9jB7/V4ESUn7K0b TS458gKiG55eyKcnpCWRCdGvlSuuD8RylBb3R1QqyMHN9PelOdU2qr+vao5FLoiA8ZN2 V7X+Ylq4icDk1mkbdh6iZYN4ATkqhjeJi/goKTIbghSFawZv7bE7zd8yRd39zOQcg2BF 5zXQ== 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 z8si2756145edl.471.2020.05.16.02.01.10; Sat, 16 May 2020 02:01:35 -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 S1726833AbgEPI5v (ORCPT + 99 others); Sat, 16 May 2020 04:57:51 -0400 Received: from mga03.intel.com ([134.134.136.65]:28230 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725997AbgEPI5v (ORCPT ); Sat, 16 May 2020 04:57:51 -0400 IronPort-SDR: 1W4P9j6CfYWtrG/X+WJEjMhNtyq6Hw/h+vuSpehk3+fqTHtPS/6Th+B7QoxuWFp93zWwqmXq3w AemBOkvdr+GA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2020 01:57:48 -0700 IronPort-SDR: in0yoFGzJjUIkU1B28SpdR5XFmYKLgi2naD49dLDLaJ7AtWqlV/JOUmaXbA+44jObhP4JnZzpK eeRKqb2bLgPg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,398,1583222400"; d="scan'208";a="266860185" Received: from dbobocel-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.55.115]) by orsmga006.jf.intel.com with ESMTP; 16 May 2020 01:57:39 -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] x86/cpu/intel: Add nosgx kernel parameter Date: Sat, 16 May 2020 11:57:37 +0300 Message-Id: <20200516085737.10838-1-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200515004410.723949-1-jarkko.sakkinen@linux.intel.com> References: <20200515004410.723949-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