From patchwork Wed May 24 06:16:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Gao X-Patchwork-Id: 9773 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2637886vqo; Tue, 23 May 2023 23:39:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Mg2CcBGYkGqztHvfEXdqnzbjegboOgrMnv5z6eSAXvNFxJFVdbuclOfc6o5Uk8mDyG0Pe X-Received: by 2002:a17:903:124e:b0:1ab:afd:903a with SMTP id u14-20020a170903124e00b001ab0afd903amr19122736plh.24.1684910377690; Tue, 23 May 2023 23:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684910377; cv=none; d=google.com; s=arc-20160816; b=Ik3mdoSpvaIU2bmiSWgt19+fVss+iIOafmgBaTst6bojWlAwhZ8JuudcKBEwvJ4Ro5 HGCAUVke64hpWEeRvUHN69FYXrEImA03rJ/mN5GR++moReHvXQNy6KI1gk8M6NGxdakQ Hnr7KNdWomz/LSa6bDwYG8AsdgB1uuQClv2Q5XhIf0wFGGHtDuAyyocZxkJLgNkFSiJX 1ZBcKJdt35Oqs4/45wFPuaQF8Cl9LK9+llIAl9+k1OczVrbisuawiWDlek9KL5Q23mQ/ zWllZ7lycpuHJKCQQ0mqJMolWw8RV09EZ5+X4AiGjc3qKtPGV6R8u0Ec0YK5psfXYDg+ IVdg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=lIWVElt4RVXc0NX36qIwBIrYKu7XnQe5ZTyK3lbsvU8=; b=OMcJCUjiby0e90g21UTPGeL1y9z1n5k15GNM7XC36CVnMs1f/MWb5ysSIL9D4AXOQo RfU8owAPpLnzw2I6g0SgrKMdHCDOtyX9dsvPTAKnr8BqjeF8y62fJczDsPbGzLToFhSb chmIIjRtkW3I+mPrb8rm+6QEy9kh+5c+2iUbnLZDOELK1719pTxMfiZN85DjFo8a0gSf 0OCkOBuYswm17pMODzGmIzSOtlc3cV6RV+1g1bAfcsuC1dxUp3qJW27EG6ty0tVw6TE5 Jrf1hnFauvZVvfOF7VjZCFYsTJ/MnDAjbUqeT2bfaoP/Ftun5MYdmuiFr54cYASnTSqd smCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=cy7BpqLa; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z7-20020a170903018700b001ac59bc1c20si2111612plg.47.2023.05.23.23.39.25; Tue, 23 May 2023 23:39:37 -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=cy7BpqLa; 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 S239404AbjEXGRA (ORCPT + 99 others); Wed, 24 May 2023 02:17:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238372AbjEXGQ7 (ORCPT ); Wed, 24 May 2023 02:16:59 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 634A6184; Tue, 23 May 2023 23:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684909016; x=1716445016; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=pmlnhEwlLJ82wU3OOOEr2W6zri3/mEqlLsG47OGicj0=; b=cy7BpqLam0SquWxxrRxyAX1T9fZTaaxOrG6bhHn6GNBngYiV0VxjwREw 55nJuQlIwBNX2yIIZQ+cBv8tWn45f6brxVbq3Dp47+Jw4nZ2TfzKi16F2 XIyQ0X80vESIZ/3W0ZIY2dHcbaV0Cvz+Zg9gJREhnjzREnFyhVYvJAEKX AKRpafnmLnSpCPt2n6BLpLCEMTuuQuLU2iJ6aEDr/xazy/PAubIr3gLbz HfAuBzKWVlmxMGN2Ef2cjlv4KY/6H9FRDBb6qG1ePNzsJffpDpkuZSX5C E225bPdfxcquiox+qMqyEzEuLrGhrzBh6PZqPD9iEgclD5QUYg2qfw3cG g==; X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="356695040" X-IronPort-AV: E=Sophos;i="6.00,188,1681196400"; d="scan'208";a="356695040" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 23:16:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10719"; a="704212331" X-IronPort-AV: E=Sophos;i="6.00,188,1681196400"; d="scan'208";a="704212331" Received: from spr.sh.intel.com ([10.239.53.106]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 May 2023 23:16:49 -0700 From: Chao Gao To: kvm@vger.kernel.org, x86@kernel.org Cc: xiaoyao.li@intel.com, Chao Gao , Alexandre Chartre , Ashok Raj , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Ingo Molnar , Juergen Gross , Kim Phillips , linux-kernel@vger.kernel.org, Paolo Bonzini , Pawan Gupta , Peter Zijlstra , Sean Christopherson , Thomas Gleixner Subject: [PATCH v2 0/3] MSR_IA32_ARCH_CAPABILITIES cleanups Date: Wed, 24 May 2023 14:16:30 +0800 Message-Id: <20230524061634.54141-1-chao.gao@intel.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 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, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766756584106233689?= X-GMAIL-MSGID: =?utf-8?q?1766756584106233689?= Do some cleanups about MSR_IA32_ARCH_CAPABILITIES in KVM e.g, fix stale comments, elimite open-coded MSR reads, track features that can be exposed to guests to avoid computing them runtime. They are found when reading the code. No functional change intented. Changes from v1 -> v2: 1. toggle ARCH_CAP_SKIP_VMENTRY_L1DFLUSH bit when l1tf mitigation state is changed by module param. [Xiaoyao, Sean] 2. add more cleanups (patch 2/3) Chao Gao (3): KVM: x86: Track supported ARCH_CAPABILITIES in kvm_caps KVM: x86: Correct the name for skipping VMENTER l1d flush x86/cpu, KVM: Use helper function to read MSR_IA32_ARCH_CAPABILITIES arch/x86/kernel/cpu/common.c | 1 + arch/x86/kvm/vmx/vmx.c | 44 +++++++++++++++++++++++------------- arch/x86/kvm/x86.c | 16 +++++-------- arch/x86/kvm/x86.h | 1 + 4 files changed, 36 insertions(+), 26 deletions(-) base-commit: b9846a698c9aff4eb2214a06ac83638ad098f33f