Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp826308ybt; Wed, 17 Jun 2020 15:13:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeaaSxSPi6ogcj99b1IjXZuYjpfl7WntsDNl85ub2a0fgYDCUYuLVjhhYU/yepMEWkFg0p X-Received: by 2002:a17:906:e247:: with SMTP id gq7mr1171155ejb.107.1592432008454; Wed, 17 Jun 2020 15:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592432008; cv=none; d=google.com; s=arc-20160816; b=p13RDXhThkbQMtf+Jxn4ZBg2enGLHm60eV3qa4kV3tzT8zm7Hm3A2tt6S/h7FM8lmv kyb1s7Vou16/1CH3KJU2pBLN8Drd8Ttx3hZRrwDCoSdz6EgXmSdtb6N2r6dhugy6FIQR pmneJJ9cyxlVoZKbl6WClEhnUhgaM3gOhOJQpilM1EK2H6eygKWJ4phTI/HhS4WIAz0A tECofiHJRNXCVfWYTcEJ1s7xgji8DaTIZPt6HY3r21rBJfKC8kZiDT7hH6OeQ1BuL9My ZtDetmX8mkQ7RF+rvoUEFiDxwVYrc5nuex07BdfyEhnVzYFMoOoxm3ydlZ8qCeDV0h2G Ubxg== 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=9Xg0HAoquqXVJFpeR7U04l0IcPNYodipy0F+bn8xL6w=; b=Uo0waFnyjgg1Q5IppV8uoDqBwy42F4Oe/TPuoWc8leHIGkzwMcGbbnPwV1wOX3+eVX PIKrWCNVfXKRqODJDBajbIGeXIMoPFazJlsoW5ukvG5UMYSSc9Wvfo+nQOjbtT5722QY 7Jnvpr7DNhgoWsHfkXtm8OA4UE/NsmS3ACMwON+J8O1tIrOU6wdUGp5M78zNWLCD6RR8 CdhsYX7YwB3yNLaSK7613rJFlwLCnkhFdLGnzmqyHXanHCx8MHVJoO724WdwddbeevA2 cWNsjWNmEqY8rIM6bsFyJU4kWHxQFPbnbRxT0nKwdP6JIp4cdbbha5eQspknTAm/HU3G 1lkA== 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 l8si623454ejb.670.2020.06.17.15.13.05; Wed, 17 Jun 2020 15:13:28 -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 S1727097AbgFQWKm (ORCPT + 99 others); Wed, 17 Jun 2020 18:10:42 -0400 Received: from mga09.intel.com ([134.134.136.24]:33246 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726758AbgFQWKl (ORCPT ); Wed, 17 Jun 2020 18:10:41 -0400 IronPort-SDR: Buum2IlzEtzhXNBi+k6yDT10Vor/HR/bBzzwd2fPm3nO3fFs5ey3sUzJBKBud9nunFTk4t5nvQ nClMNUphk+Mg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 15:10:40 -0700 IronPort-SDR: g9uek6hIXKXwvafpe+Q5NJE40d+e1c3WABk6CfyF5PnAy/f/9y/DnHYutDI/1OJiUAi4/sMev0 8EfMVJ0JHO5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,523,1583222400"; d="scan'208";a="421288163" Received: from ysharon1-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.49.131]) by orsmga004.jf.intel.com with ESMTP; 17 Jun 2020 15:10:28 -0700 From: Jarkko Sakkinen To: x86@kernel.org, linux-sgx@vger.kernel.org Cc: linux-kernel@vger.kernel.org, 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 v33 07/21] x86/cpu/intel: Add nosgx kernel parameter Date: Thu, 18 Jun 2020 01:08:29 +0300 Message-Id: <20200617220844.57423-8-jarkko.sakkinen@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200617220844.57423-1-jarkko.sakkinen@linux.intel.com> References: <20200617220844.57423-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 fb95fad81c79..e747bd9ca911 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -3314,6 +3314,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