All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Vishal Annapurve <vannapurve@google.com>
Cc: pbonzini@redhat.com, dave.hansen@linux.intel.com,
	 rick.p.edgecombe@intel.com, dapeng1.mi@linux.intel.com,
	mizhang@google.com,  kai.huang@intel.com, jmattson@google.com,
	kvm@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] KVM: TDX: Set the has_protected_pmu flag for TDX VMs
Date: Thu, 7 May 2026 06:23:29 -0700	[thread overview]
Message-ID: <afySUVD06XrJD0m0@google.com> (raw)
In-Reply-To: <20260507003613.1784851-3-vannapurve@google.com>

On Thu, May 07, 2026, Vishal Annapurve wrote:
> TDX module virtualizes PMU for TDX VMs[1]. Host has following
> toggles to control the PMU functionality exposed to TDX VMs:
> 1) Configure TD_PARAMS to allow guests to use performance monitoring.
> 2) Restrict the TD to a subset of the PEBS counters if supported.
> 3) Limit the TD to setup a certain perfmon events using basic/enhanced
>    event filtering.
> 
> KVM will need to be enlightened to support these toggles.
> 
> Explicitly set the hast_protected_pmu flag to avoid KVM trying to manage
> PMU state for TDX VMs using existing PMU virtualization framework.
> 
> [1] Section 15.2: https://cdrdv2.intel.com/v1/dl/getContent/733575
> 
> Suggested-by: Sean Christopherson <seanjc@google.com>
> Signed-off-by: Vishal Annapurve <vannapurve@google.com>
> ---
>  arch/x86/kvm/vmx/tdx.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c
> index 1e47c194af53..eb4b4518e6f0 100644
> --- a/arch/x86/kvm/vmx/tdx.c
> +++ b/arch/x86/kvm/vmx/tdx.c
> @@ -638,6 +638,12 @@ int tdx_vm_init(struct kvm *kvm)
>  	kvm->arch.has_private_mem = true;
>  	kvm->arch.disabled_quirks |= KVM_X86_QUIRK_IGNORE_GUEST_PAT;
>  
> +	/*
> +	 * PMU support is provided by the TDX-Module (if enabled for the VM).
> +	 * From KVM's perspective, the VM doesn't have a virtual PMU.
> +	 */
> +	kvm->arch.has_protected_pmu = true;

Eh, squash this with patch 1.  It's not really possible to review patch 1 without
seeing the usage here.

> +
>  	/*
>  	 * Because guest TD is protected, VMM can't parse the instruction in TD.
>  	 * Instead, guest uses MMIO hypercall.  For unmodified device driver,
> -- 
> 2.54.0.563.g4f69b47b94-goog
> 

      reply	other threads:[~2026-05-07 13:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07  0:36 [PATCH v2 0/2] KVM: TDX: Disable PMU virtualization for TDX VMs Vishal Annapurve
2026-05-07  0:36 ` [PATCH v2 1/2] KVM: x86: Introduce arch specific has_protected_pmu state Vishal Annapurve
2026-05-07 13:15   ` Sean Christopherson
2026-05-07  0:36 ` [PATCH v2 2/2] KVM: TDX: Set the has_protected_pmu flag for TDX VMs Vishal Annapurve
2026-05-07 13:23   ` Sean Christopherson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=afySUVD06XrJD0m0@google.com \
    --to=seanjc@google.com \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=jmattson@google.com \
    --cc=kai.huang@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mizhang@google.com \
    --cc=pbonzini@redhat.com \
    --cc=rick.p.edgecombe@intel.com \
    --cc=vannapurve@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.