Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp7309519rwl; Mon, 9 Jan 2023 22:04:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXsKZqycmujQja0k9QZvUi0YeJqoE8TGlYQmuHHpliky3qeQuj3zP3tDdp6VMIQ7phHHFG+/ X-Received: by 2002:a17:90a:640f:b0:226:7e28:8627 with SMTP id g15-20020a17090a640f00b002267e288627mr27504729pjj.8.1673330680359; Mon, 09 Jan 2023 22:04:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673330680; cv=none; d=google.com; s=arc-20160816; b=ZMaQcVQv90g5d9YBvB4mETz3iSYoKqUZ7aUDp6oubhVeKGEenTs7MlP1ZFKTMAEZmB +6YFyM9CxFn8i3uk4JNt02J1tyE5W0b/h/OsRCnh4epbWn0sIsjtIEjdcWPau1nbgTRW 4V6QQnbiiSn9pBBwr630EqyC0iApNBIaANacHC/0OiCuLsW49vaKZBsXKqTEfvA3q4HD KhO99uyVmZjPvTzLntf/8aCWgqmFKIQdBDjUkpxD5T61OfCOuP2N11T53xsS6z1LHdTK 5fzxgXMTYwz8PXCJ/Bb8pu8xLVoV6b1tg8ZZE+//hjk1Drn6Z6WXyqZZIJ6t5jQBXT3P hHkw== 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=bhkQ/x6xg+m+YmStRmnyWDoQW2qtVMCXW8Rp2Os2r8Y=; b=zxYIgmINmgWKdOTvnR3VIaqgsjGrtwFkI0KTachGDKIb4Pe47cPCgrnOUzAVJEAP4U VNexiUPPHNbVF2yl4SmpeXX3NxSMuuNx6l+ZAeW+AOaUewN87/0rD5uDgvgDRKI8zsXb AmENKAuz9OTz/iS2q5ozTVu3K3W9zI6Re+TW5udtMPOsCB5nXcuJ2hVRHl5l/YSGuy3J KQKWWPeppNHoiehkj5OXBu7PxS//68rMm2uZQNoM8j7cFVIpDeC0FkhzeHxbSV25N9zd HP6ubo5U5EfKm5VcDfVojfQFYBXy41vjlurn+To3RXrmWyFi0r8RPbJFLnVdTeWouYHD Xs8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L15N3eRS; 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 kb16-20020a17090ae7d000b00223facc5d2csi12143376pjb.162.2023.01.09.22.04.20; Mon, 09 Jan 2023 22:04:40 -0800 (PST) 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=L15N3eRS; 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 S231547AbjAJF5v (ORCPT + 53 others); Tue, 10 Jan 2023 00:57:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235352AbjAJF4a (ORCPT ); Tue, 10 Jan 2023 00:56:30 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25A3A8FC7 for ; Mon, 9 Jan 2023 21:55:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673330157; x=1704866157; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=DmevG4XQSgqRzdAJ2vm+aeGRW8v5LCwWogDmX0SU+vA=; b=L15N3eRSP5w5d6D1GU5JDsei4lL7QZKuY5+NhzFARCZ5DDKyCy2kTda0 6M7wGL5cM6VRIUJCruIUL3Cux+LJOAR3Y0x1B/8+yYBy7t2+as52ncpct FSBpuwdd4Y7w8ZjcuA11E9K4Vy+hBTH9E1rT9+Xsb2ggRUUexnvCYCjBP Xx1YjthaN34HJ1K73vP6Ld63NzwftB1MQeHHEuo0DKTi9Uvkb44F+XAdt vSKY3Re/EozpbdG159Xmpx9Qzb3oM31DvEJUdERGRS+cQao7wVtF1ClLz 3ROblJbMOMSBzolXq00AurSlxVnfxHTlwyg4BfylDRkdneGIp/fdq0NLo Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="350289976" X-IronPort-AV: E=Sophos;i="5.96,314,1665471600"; d="scan'208";a="350289976" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 21:55:41 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10585"; a="634483759" X-IronPort-AV: E=Sophos;i="5.96,314,1665471600"; d="scan'208";a="634483759" Received: from oux.sc.intel.com ([10.3.52.57]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jan 2023 21:55:41 -0800 From: Yian Chen To: linux-kernel@vger.kernel.org, x86@kernel.org, Andy Lutomirski , Dave Hansen , Ravi Shankar , Tony Luck , Sohil Mehta , Paul Lai , Yian Chen Subject: [PATCH 7/7] x86/kvm: Expose LASS feature to VM guest Date: Mon, 9 Jan 2023 21:52:04 -0800 Message-Id: <20230110055204.3227669-8-yian.chen@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110055204.3227669-1-yian.chen@intel.com> References: <20230110055204.3227669-1-yian.chen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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: Paul Lai Expose LASS feature which is defined in the CPUID.7.1.EAX bit and enabled via the CR4 bit for VM guest. Signed-off-by: Paul Lai Signed-off-by: Yian Chen Reviewed-by: Tony Luck --- arch/x86/include/asm/kvm_host.h | 3 ++- arch/x86/kvm/cpuid.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index f35f1ff4427b..bd39f45e9b5a 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -125,7 +125,8 @@ | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR | X86_CR4_PCIDE \ | X86_CR4_OSXSAVE | X86_CR4_SMEP | X86_CR4_FSGSBASE \ | X86_CR4_OSXMMEXCPT | X86_CR4_LA57 | X86_CR4_VMXE \ - | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP)) + | X86_CR4_SMAP | X86_CR4_PKE | X86_CR4_UMIP \ + | X86_CR4_LASS)) #define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index b14653b61470..e0f53f85f5ae 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -664,7 +664,7 @@ void kvm_set_cpu_caps(void) kvm_cpu_cap_mask(CPUID_7_1_EAX, F(AVX_VNNI) | F(AVX512_BF16) | F(CMPCCXADD) | F(AMX_FP16) | - F(AVX_IFMA) + F(AVX_IFMA) | F(LASS) ); kvm_cpu_cap_init_kvm_defined(CPUID_7_1_EDX, -- 2.34.1