Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp283215ybg; Mon, 1 Jun 2020 00:56:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGzu70BbhvrxrioyqZTJWFwrMJhTm04zRRmZRU/UFoRQ2Z2MYahWdrmpxekQ8oWPts2TWo X-Received: by 2002:a17:906:2b04:: with SMTP id a4mr18902080ejg.98.1590998174023; Mon, 01 Jun 2020 00:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590998174; cv=none; d=google.com; s=arc-20160816; b=iv4n3ohtWpQeZzWbo+mZzb+sYHEqLh7vRqTnXWCYC+nK/3Y+96lp6pgNJhcxAyccJI cU3D+PrKxUl8T5Q6yzw1mB6dclxMFrWpDZyG2xKrMhOiHCitu0DfkhklXjA4ZZbpeG07 pfC4pYLBJ6oeC7nYHhH6zuVCpQ/RqHBA+H6Bvrqm23lk5zcnPVv+4jxfxKunEP3X6HTL b7Y7LKbtM2S2Nw6sqYWF1jESzeR7hJKFXQa4mn58wqFy61hfd53mU84wTOqGdsaWd8/U XlVFKekX7o/YzY7wf86JAkMxBcq5GCTubJnoZO+WOSdoXC/mutUP5d74/FlJs0/ycu67 a3dg== 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=qioDiIDwXsaQ0H69spPlmJ24x3qOEMk2XF2yo18lKej3wkWGoCF1w9xEJ4Ppjv6CHE +ghah0i54cTNjg/HIzZLc8f4/M8EdTtEGuNnPxRHIQ2bHx1YQIRKfKYNjYfK4vwUERDL 2BQgSLEMO/WK8ssIZByvuRWpn37st22tKkdkX/Q6XqRnzOPi8fGAGk1UG6CXHm6A4vsI O1thqgXOBIGLKqmxCwU5maPMXPVndZAXUfgGMpmE0YqYb7dfaolgie71PI4fleWlWMvq SIbV0UxstysQv/wQnVRYWIm9lbCiu8HQ3WV2/zSNBFGFezxPuEGSDQWT19hyRv/roGrY 6YzA== 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 y10si10868401edp.3.2020.06.01.00.55.51; Mon, 01 Jun 2020 00:56:14 -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 S1728289AbgFAHxQ (ORCPT + 99 others); Mon, 1 Jun 2020 03:53:16 -0400 Received: from mga03.intel.com ([134.134.136.65]:18186 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbgFAHxQ (ORCPT ); Mon, 1 Jun 2020 03:53:16 -0400 IronPort-SDR: NBXu+W4QNESf8Y8Bj3tApc8+wK3ntUwFc/YQG9LZADB9q1ZN/UZcyXc1kga2liaa+yMEXmrvE6 QkBSqMVS6mPw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jun 2020 00:53:16 -0700 IronPort-SDR: PtTTqghyPNi5ol6U3rUdS7wgwi+UMXQYkXM5ECw3C8MpknElsdi3+kZa0zK+BCqLi+OpwZA/rg 9rasj/zodpvA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,460,1583222400"; d="scan'208";a="311879578" Received: from yhanin-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.43.17]) by FMSMGA003.fm.intel.com with ESMTP; 01 Jun 2020 00:53:10 -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 v32 07/21] x86/cpu/intel: Add nosgx kernel parameter Date: Mon, 1 Jun 2020 10:52:04 +0300 Message-Id: <20200601075218.65618-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200601075218.65618-1-jarkko.sakkinen@linux.intel.com> References: <20200601075218.65618-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