Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4392006rwd; Tue, 30 May 2023 05:01:07 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5N+5oCXs59yXyxnXoDPOpvDidZtj13DqSXUndb7kUtY7ZyLo9n54zvrINR8tOhOBJGjZsE X-Received: by 2002:a05:6a21:339a:b0:100:5851:d4ba with SMTP id yy26-20020a056a21339a00b001005851d4bamr2473807pzb.54.1685448066189; Tue, 30 May 2023 05:01:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685448066; cv=none; d=google.com; s=arc-20160816; b=oyEHv54FswYBROrrR9TfDiPw8rNDQsmD2xgIJSDB0YcOgvY0kPzIm0WmQSxq/0+81x grM+967dwPmYXqV2qELizoiIqopypa6eH8/15VxmZKQCn/l+Hvliku84JQuhTzyi/RSO Jsa7WMB+W6XZPMybCtqSa3+DG9FTGg68dq6FS7PNlXfRiKddB22STshgrenAFRdAgo+S 1vaIh6jvcsoat0eWQpk3KZwelOR9CXWJ1ARF5V6zHRBlTUIR576XV4FCMEA80lTbpIl3 2jbRsalR7Cn6q/XUokaKngXy517qq3x0r4ac6vlfz2sWYaVSwnbygzGLI4cONVA9Pxof QFPw== 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:to:from :dkim-signature; bh=M6xAa6Sh4n/H6ozx9jGb1/0kNkmL9jZ/ihnYL2Ot710=; b=CdrdEC0TS+xCFaXnaU4tRElm/+uKU3i/SLErc0GOrQkVgqKJWf699NVLiNXrQdcYPF UiXwufIb6r3jDlT6ymiQppl6KZi7Gqf/zIESTvfQyPm9ZYctmt5Ublh4N4w40nCeoGAq qGWrMWhn1dSUil7CsPhblEmHJDAyK1fImPIzRJnU/gut7rcKONOyOCuyDBUukGBLDkrc bAjCL5UGgEey2zYvsvneN8ZDQ1ERuohotTnND9yP+ODOuc+G7K3aLjxzVGl6m+KWE0MC fyf8jwOxvM8CXKe/3dj0m8rKOf1y1w4QVcHlJWmCFt2LZrznol5KtykCAC8Cj4zc4C97 AJcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UXf9oN4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a632704000000b005346b8dae84si8065946pgn.787.2023.05.30.05.00.51; Tue, 30 May 2023 05:01:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UXf9oN4T; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232022AbjE3LoD (ORCPT + 99 others); Tue, 30 May 2023 07:44:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232031AbjE3Lnj (ORCPT ); Tue, 30 May 2023 07:43:39 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109F7184 for ; Tue, 30 May 2023 04:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685447002; x=1716983002; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=YeT6YYfsU+EDG4nhTRFaSzhnjKPDKCvTrH+jCnce9So=; b=UXf9oN4T/HFIde4YRlzQ82sM9+UVRn1yuXoeennLgaassDgVPfMF8kuw wbU/bkmEZ7/CtFQfMz65nqrQplfpr5GvedD+JGJVTCuHWKGPD3F5Oy+Yz aYzbCDfSpXcUclm5FlQclysXK3TxqRhQKoOpmpmk73g35zLaduqDBeQIU wE8dUDU8ueY/tl828F2thNS3WcnV2l+pqWqZDHd1MS5OvjgfA5SxdMxl0 SpYchDMHvVcwYxa32LmdjFP9BnnosAXqv6GNQKo6OVdOsOKsneXply+nb L6dns5ZZJOi020WL+0EvMYh3wG7osbczDJsISL/ImD3jSDBPLc+PhOjmM A==; X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="383145355" X-IronPort-AV: E=Sophos;i="6.00,204,1681196400"; d="scan'208";a="383145355" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 May 2023 04:43:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10725"; a="700588706" X-IronPort-AV: E=Sophos;i="6.00,204,1681196400"; d="scan'208";a="700588706" Received: from black.fi.intel.com (HELO black.fi.intel.com.) ([10.237.72.28]) by orsmga007.jf.intel.com with ESMTP; 30 May 2023 04:43:05 -0700 From: Alexander Shishkin To: linux-kernel@vger.kernel.org, x86@kernel.org, Andy Lutomirski , Dave Hansen , Ravi Shankar , Tony Luck , Sohil Mehta , Paul Lai Subject: [PATCH v2 04/12] x86/cpu: Enable LASS during CPU initialization Date: Tue, 30 May 2023 14:42:39 +0300 Message-Id: <20230530114247.21821-5-alexander.shishkin@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230530114247.21821-1-alexander.shishkin@linux.intel.com> References: <20230530114247.21821-1-alexander.shishkin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sohil Mehta Being a security feature, enable LASS by default if the platform supports it. Signed-off-by: Sohil Mehta --- arch/x86/kernel/cpu/common.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index 80710a68ef7d..315cc67ba93a 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c @@ -413,6 +413,12 @@ static __always_inline void setup_umip(struct cpuinfo_x86 *c) cr4_clear_bits(X86_CR4_UMIP); } +static __always_inline void setup_lass(struct cpuinfo_x86 *c) +{ + if (cpu_feature_enabled(X86_FEATURE_LASS)) + cr4_set_bits(X86_CR4_LASS); +} + /* These bits should not change their value after CPU init is finished. */ static const unsigned long cr4_pinned_mask = X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_UMIP | @@ -1859,6 +1865,7 @@ static void identify_cpu(struct cpuinfo_x86 *c) setup_smep(c); setup_smap(c); setup_umip(c); + setup_lass(c); /* Enable FSGSBASE instructions if available. */ if (cpu_has(c, X86_FEATURE_FSGSBASE)) { -- 2.39.2