From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f201.google.com (mail-pl1-f201.google.com [209.85.214.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8A4753F54B2 for ; Thu, 7 May 2026 13:23:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778160214; cv=none; b=bOCwDClGScGqu5wV2HQ+X6w44jXyHPWSoUmCcXeW39JfZQsJdilOAJCXQVNaFrCDjOzme4+vnzy2Qqr1dgjCOWGe1Rjvro0bhjeNUCbw6xMa/sUslt8OA58Z+PZWGKrQYqSw0DVo2o+AnWQfLoaZCIW9mMweMUwh1Cds15vOcn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778160214; c=relaxed/simple; bh=QSvNn7mVCoqpDWRpLEwzsQYXhphwXaDFMVb19cMkdys=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=TofOzL7oz1BDZpcRWFJNFA4a3Bdst1xfk5y7X0u/wOn239K8PdyVUv2nhw58K6S4VOigT2gPytre0UbHqvqE9lUCIu2fHIFBlK1OSZ0pZJw4AjBM+A1zb7zJe76M6CyKz//lzuJPMb5KzF2T12LUBLQ6gvRL6G2uCkQZSSINXUE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=hRrp8JNh; arc=none smtp.client-ip=209.85.214.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hRrp8JNh" Received: by mail-pl1-f201.google.com with SMTP id d9443c01a7336-2b4530a90fdso20935045ad.1 for ; Thu, 07 May 2026 06:23:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1778160211; x=1778765011; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Q2p7v66esSqoBYICxVl1Y8jghKc3MBnhyUfxMzYF7Ws=; b=hRrp8JNh8g4bUYn3uiR2GvW1Qgu9c8d+uvk+Nmlxyie9df+nhitsnX81tj//GMO2dz ayG6jpp8/o9tafl8bTrDaQidZrjwqPO2PICII5JezUbNy2lXWt3Dnmksns6lfEM4XW4J uX3qFRiCuCPZg0qUBsS1mdlbQ0NtglZOm2NTFFXQETD68YmCKZtTf8+f/j6sghVLmQmh RLcXBmEz1YtgIKdMGpbcmEynzvVpYaLGHOYWugi4lqz1LWdtC4TqszS/q5k9/9d4mubx qt8Mw845D6JPStQ3li6NLZ+ZgGuhZJymuKjzY85T4sm3vpS4bVFjvGDrYDieytFJxBG4 0vAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778160211; x=1778765011; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Q2p7v66esSqoBYICxVl1Y8jghKc3MBnhyUfxMzYF7Ws=; b=fwlkeXAP35ySn1grNXV3wm88TIUmhcO4C+rj78BQRINFr5fXyTPY1E3vJefwJl/8++ f4oRt8w2UEWR+x4iB+x1L5pnyBfaC2ZdU2BGAjv/I1TP6C+R3q6Iw4gM2g7a1n5pYRXZ 2mWr1uXccRaUgv6TmWPJ1VxzelU/5diWj4ATF4xU9vc7g6Bi+Ewtkn2X/aB1FC/o9qvW CHOXduyLVLh6uFB1mDFbLYDTZ0b2WSoaDAzmSN7764fbsRx2s9wrY/tCc4k7NvNrQIed qI10JViSgNwT7knyJJDIpPD2KaqrSsK6BLscChvV3TCT+19YWlv07FW5rHDnYPGa2E3d X9JQ== X-Forwarded-Encrypted: i=1; AFNElJ8SI/1gwyvanpb8g84+odN/mo7KH71s5D6Q98mLfLqnnuYsJaAaiD+W9puxcFlXR0bgL5NYCgMVvkEMni0=@vger.kernel.org X-Gm-Message-State: AOJu0YzPAQl+ru0DFCr5npGKW5N5tod0krQSs5sOFRlMw7sRq4Silh6g fr6o98uO3JpKe8a5ZgVDhKwOVqfpYTcUwNIxoNlcT9wxxDhyik1i0IYen0gVMPGuEB4qX0swnov 0yc50hA== X-Received: from plbmj16.prod.google.com ([2002:a17:903:2b90:b0:2ba:e27:debe]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:ebc9:b0:2b2:5840:80c5 with SMTP id d9443c01a7336-2ba7a35a6eamr91003805ad.37.1778160210966; Thu, 07 May 2026 06:23:30 -0700 (PDT) Date: Thu, 7 May 2026 06:23:29 -0700 In-Reply-To: <20260507003613.1784851-3-vannapurve@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260507003613.1784851-1-vannapurve@google.com> <20260507003613.1784851-3-vannapurve@google.com> Message-ID: Subject: Re: [PATCH v2 2/2] KVM: TDX: Set the has_protected_pmu flag for TDX VMs From: Sean Christopherson To: Vishal Annapurve 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 Content-Type: text/plain; charset="us-ascii" 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 > Signed-off-by: Vishal Annapurve > --- > 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 >