From patchwork Thu May 18 09:13:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binbin Wu X-Patchwork-Id: 13246315 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AF25C7EE23 for ; Thu, 18 May 2023 09:13:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbjERJN6 (ORCPT ); Thu, 18 May 2023 05:13:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjERJNz (ORCPT ); Thu, 18 May 2023 05:13:55 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15A3D2113 for ; Thu, 18 May 2023 02:13:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684401226; x=1715937226; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pw8l4n2mOVVmegt6txD7DS91TNvz1PTS1w9ewy4nGuo=; b=NsU1tIgpONhBwyd6trVnBhx/AlOcC9yQNltSU2kCoPFufOwBh6Ww5Ogj wjPrz3e2rjpQDBgmYfmAk6wAS0gSp7lqT+/8F4+EauX/2QTruIjLQ2wF0 T+5gFDNXB96Y/D+1DF49GXx98+RcGd5gLIe/3Unoj3or/sWaMkzpOMp8G s7qrHF3Czr1p26UQvoH2XxHsGdzSUwq73o4kZLBc3LCaz1H4zWyV3GM3+ NYWFhRPgjp7UvlLC9m7nkor0YeObzWcQv7QBRm3UX1elhX/MwO3gWdbyk IdKIakn8jK99dBq2s4CoHBw5sqGrZLhov0bBofzq3ZUR/qi0dQCrXjxEr w==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="332383004" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="332383004" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="735006637" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="735006637" Received: from binbinwu-mobl.ccr.corp.intel.com ([10.254.208.101]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:44 -0700 From: Binbin Wu To: kvm@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, binbin.wu@linux.intel.com Subject: [PATCH v2 1/3] KVM: Fix comment for KVM_ENABLE_CAP Date: Thu, 18 May 2023 17:13:37 +0800 Message-Id: <20230518091339.1102-2-binbin.wu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518091339.1102-1-binbin.wu@linux.intel.com> References: <20230518091339.1102-1-binbin.wu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Fix comment for vcpu ioctl version of KVM_ENABLE_CAP. KVM provides ioctl KVM_ENABLE_CAP to allow userspace to enable an extension which is not enabled by default. For vcpu ioctl version, it is available with the capability KVM_CAP_ENABLE_CAP. For vm ioctl version, it is available with the capability KVM_CAP_ENABLE_CAP_VM. Signed-off-by: Binbin Wu --- include/uapi/linux/kvm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index 737318b1c1d9..bddf2871db8f 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1613,7 +1613,7 @@ struct kvm_s390_ucas_mapping { #define KVM_GET_DEBUGREGS _IOR(KVMIO, 0xa1, struct kvm_debugregs) #define KVM_SET_DEBUGREGS _IOW(KVMIO, 0xa2, struct kvm_debugregs) /* - * vcpu version available with KVM_ENABLE_CAP + * vcpu version available with KVM_CAP_ENABLE_CAP * vm version available with KVM_CAP_ENABLE_CAP_VM */ #define KVM_ENABLE_CAP _IOW(KVMIO, 0xa3, struct kvm_enable_cap) From patchwork Thu May 18 09:13:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binbin Wu X-Patchwork-Id: 13246316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AEFAC77B7A for ; Thu, 18 May 2023 09:14:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230100AbjERJN7 (ORCPT ); Thu, 18 May 2023 05:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230042AbjERJN4 (ORCPT ); Thu, 18 May 2023 05:13:56 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3F92119 for ; Thu, 18 May 2023 02:13:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684401227; x=1715937227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=01jGKo92XpUcST3U5voHLk83zefoHPKE0hNVgwqQhcw=; b=SDVrkaYhvb5YQilQzlgO1UjtWpixPNkrccVIcH6JxWEFvzrOWrcm23Q1 H2neo6HO4XPheJD0kYDhHMxysn1g/Uj0kROTbDQj7jyJMKoATP1vCYL06 9JW99n3Hu6jcpZMSEFYmbQ1U/4LJIrRSeeb+JGR37v5P8DCgCzucy5DW8 CJRjfbJaklDboESk4J/erT1WOJpHxbIqphaNHr0l0vTzwvYOtb3QDoTYU 3QwUkOt/r939gpQDNGir0GUE9tKxU/pBx5si8L3UN7UTs23gadi7s2s6l UjE0xMrOGhsXSf+7fn7+7EYnb/PfHJojmV3X6ZNvDsqRrE6s1L3KvTWPJ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="332383010" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="332383010" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="735006642" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="735006642" Received: from binbinwu-mobl.ccr.corp.intel.com ([10.254.208.101]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:46 -0700 From: Binbin Wu To: kvm@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, binbin.wu@linux.intel.com Subject: [PATCH v2 2/3] KVM: x86: Fix comments that refer to the out-dated msrs_to_save_all Date: Thu, 18 May 2023 17:13:38 +0800 Message-Id: <20230518091339.1102-3-binbin.wu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518091339.1102-1-binbin.wu@linux.intel.com> References: <20230518091339.1102-1-binbin.wu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org msrs_to_save_all is out-dated after commit 2374b7310b66 (KVM: x86/pmu: Use separate array for defining "PMU MSRs to save"). Update the comments to msrs_to_save_base. Signed-off-by: Binbin Wu Reported-by: Binbin Wu Signed-off-by: Sean Christopherson --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ceb7c5e9cf9e..ca7cff5252ae 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1432,7 +1432,7 @@ EXPORT_SYMBOL_GPL(kvm_emulate_rdpmc); * * The three MSR lists(msrs_to_save, emulated_msrs, msr_based_features) * extract the supported MSRs from the related const lists. - * msrs_to_save is selected from the msrs_to_save_all to reflect the + * msrs_to_save is selected from the msrs_to_save_base to reflect the * capabilities of the host cpu. This capabilities test skips MSRs that are * kvm-specific. Those are put in emulated_msrs_all; filtering of emulated_msrs * may depend on host virtualization features rather than host cpu features. @@ -1535,7 +1535,7 @@ static const u32 emulated_msrs_all[] = { * by arch/x86/kvm/vmx/nested.c based on CPUID or other MSRs. * We always support the "true" VMX control MSRs, even if the host * processor does not, so I am putting these registers here rather - * than in msrs_to_save_all. + * than in msrs_to_save_base. */ MSR_IA32_VMX_BASIC, MSR_IA32_VMX_TRUE_PINBASED_CTLS, From patchwork Thu May 18 09:13:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Binbin Wu X-Patchwork-Id: 13246317 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C095BC77B7A for ; Thu, 18 May 2023 09:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230114AbjERJOE (ORCPT ); Thu, 18 May 2023 05:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjERJOB (ORCPT ); Thu, 18 May 2023 05:14:01 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B15F1FFD for ; Thu, 18 May 2023 02:13:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1684401234; x=1715937234; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z+Itf9S6ADeHAGEtG8lpYUrE4BYHeW5u+qbQ92HBlGY=; b=OJEc73ShpYOEImC+B2qoGfF3VIYeWTvA6+lVh0c3KCiKzepCxqAvlWVO NuKs9aZRKOU3VKCEwMAv1ejMHiNyAAqRQVefr9Ngw39RdOKLllBzXfI2f hZ6D4F29DUvh8x+CH7XLvv9plTQruGELAiEmbg3gMz2g49qT9yVxx1w3L Qr6JVBznEK9bPl+aXLSodPV/uU/OE/7tZW12oo44DwRzK6ZRO/TIxekHX XRkB/hqHYBZEEpqtzgxLLM06UuHjB+MrmkyZlP9ii5MKU7KgtFNk/PCD6 PNkiJPJbgcO8ZYB4EzjOfYhd+oPKX6PIP0lNBhWy2ZdQpKkJmT9eEBQQ3 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="332383019" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="332383019" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10713"; a="735006647" X-IronPort-AV: E=Sophos;i="5.99,284,1677571200"; d="scan'208";a="735006647" Received: from binbinwu-mobl.ccr.corp.intel.com ([10.254.208.101]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 May 2023 02:13:47 -0700 From: Binbin Wu To: kvm@vger.kernel.org Cc: seanjc@google.com, pbonzini@redhat.com, binbin.wu@linux.intel.com Subject: [PATCH v2 3/3] KVM: Documentation: Fix a typo in Documentation/virt/kvm/x86/mmu.rst Date: Thu, 18 May 2023 17:13:39 +0800 Message-Id: <20230518091339.1102-4-binbin.wu@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230518091339.1102-1-binbin.wu@linux.intel.com> References: <20230518091339.1102-1-binbin.wu@linux.intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org L1 CR4.LA57 should be '0' instead of '1' when shadowing 5-level NPT for 4-level NPT L1 guest. Signed-off-by: Binbin Wu --- Documentation/virt/kvm/x86/mmu.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/x86/mmu.rst b/Documentation/virt/kvm/x86/mmu.rst index 8364afa228ec..26f62034b6f3 100644 --- a/Documentation/virt/kvm/x86/mmu.rst +++ b/Documentation/virt/kvm/x86/mmu.rst @@ -205,7 +205,7 @@ Shadow pages contain the following information: role.passthrough: The page is not backed by a guest page table, but its first entry points to one. This is set if NPT uses 5-level page tables (host - CR4.LA57=1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=1). + CR4.LA57=1) and is shadowing L1's 4-level NPT (L1 CR4.LA57=0). gfn: Either the guest page table containing the translations shadowed by this page, or the base page frame for linear translations. See role.direct.