All of lore.kernel.org
 help / color / mirror / Atom feed
From: Manali Shukla <manali.shukla@amd.com>
To: Jim Mattson <jmattson@google.com>
Cc: <seanjc@google.com>, <pbonzini@redhat.com>, <mingo@redhat.com>,
	<bp@alien8.de>, <kvm@vger.kernel.org>, <x86@kernel.org>,
	<santosh.shukla@amd.com>, <nikunj.dadhania@amd.com>,
	<Naveen.Rao@amd.com>, <dapeng1.mi@linux.intel.com>,
	<ravi.bangoria@amd.com>, <peterz@infradead.org>,
	<Sandipan.Das@amd.com>, Yosry Ahmed <yosry@kernel.org>
Subject: Re: [PATCH v3 3/9] KVM: x86/cpuid: Add a KVM-only leaf for IBS capabilities
Date: Thu, 22 Oct 2026 15:46:56 +0530	[thread overview]
Message-ID: <100c5a35-e7e7-4bb0-9931-80cd078af7c6@amd.com> (raw)
In-Reply-To: <20261008174424.717033-1-jmattson@google.com>

Hi Jim,

Thank you for reviewing this series.

On 10/8/2026 11:14 PM, Jim Mattson wrote:
> On Tue, Mar 10, 2026 at 06:00:15AM +0000, Manali Shukla wrote:
>> Add a KVM-only leaf for AMD's Instruction Based Sampling capabilities.
>> Multiple IBS related capabilities are added to KVM-only leaf, so that KVM
>> can set these capabilities for the guest, when IBS feature bit is
>> enabled on the guest.
>>
>> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>> ---
>>  arch/x86/include/asm/kvm_host.h |  1 +
>>  arch/x86/kvm/reverse_cpuid.h    | 16 ++++++++++++++++
>>  2 files changed, 17 insertions(+)
>>
>> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
>> index 32dd2d55e6f0..01abdf7f112b 100644
>> --- a/arch/x86/include/asm/kvm_host.h
>> +++ b/arch/x86/include/asm/kvm_host.h
>> @@ -782,6 +782,7 @@ enum kvm_only_cpuid_leafs {
>>  	CPUID_12_EAX	 = NCAPINTS,
>>  	CPUID_7_1_EDX,
>>  	CPUID_8000_0007_EDX,
>> +	CPUID_8000_001B_EAX,
>>  	CPUID_8000_0022_EAX,
>>  	CPUID_7_2_EDX,
>>  	CPUID_24_0_EBX,
> 
> The other KVM-only leaves are in the order in which they were added, and
> reverse_cpuid[] uses the same order. This patch puts the new leaf in the
> middle of the enum, but near the end of reverse_cpuid[].  Please add it at
> the end of the enum, after the last existing leaf, and in the same place in
> reverse_cpuid[].

Sure. I will move CPUID_8000_001B_EAX in V4.

> 
>> diff --git a/arch/x86/kvm/reverse_cpuid.h b/arch/x86/kvm/reverse_cpuid.h
>> index 657f5f743ed9..22cfdb331e9e 100644
>> --- a/arch/x86/kvm/reverse_cpuid.h
>> +++ b/arch/x86/kvm/reverse_cpuid.h
>> @@ -76,6 +76,21 @@
>>  #define KVM_X86_FEATURE_TSA_SQ_NO	KVM_X86_FEATURE(CPUID_8000_0021_ECX, 1)
>>  #define KVM_X86_FEATURE_TSA_L1_NO	KVM_X86_FEATURE(CPUID_8000_0021_ECX, 2)
>>
>> +/* AMD defined Instruction-base Sampling capabilities. CPUID level 0x8000001B (EAX). */
> 
> Nit: "Instruction-base" should be "Instruction-Based."

Ack.

> 
>> +#define X86_FEATURE_IBS_AVAIL			KVM_X86_FEATURE(CPUID_8000_001B_EAX, 0)
>> +#define X86_FEATURE_IBS_FETCHSAM		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 1)
>> +#define X86_FEATURE_IBS_OPSAM			KVM_X86_FEATURE(CPUID_8000_001B_EAX, 2)
>> +#define X86_FEATURE_IBS_RDWROPCNT		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 3)
>> +#define X86_FEATURE_IBS_OPCNT			KVM_X86_FEATURE(CPUID_8000_001B_EAX, 4)
>> +#define X86_FEATURE_IBS_BRNTRGT			KVM_X86_FEATURE(CPUID_8000_001B_EAX, 5)
>> +#define X86_FEATURE_IBS_OPCNTEXT		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 6)
>> +#define X86_FEATURE_IBS_RIPINVALIDCHK		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 7)
>> +#define X86_FEATURE_IBS_OPBRNFUSE		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 8)
>> +#define X86_FEATURE_IBS_FETCHCTLEXTD		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 9)
>> +#define X86_FEATURE_IBS_ZEN4_EXT		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 11)
>> +#define X86_FEATURE_IBS_LOADLATFIL		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 12)
>> +#define X86_FEATURE_IBS_ZEN4_DTLBSTAT		KVM_X86_FEATURE(CPUID_8000_001B_EAX, 19)
> 
> Bit 10 (IBS_CAPS_OPDATA4 in asm/perf_event.h) is not defined here or later
> in the series. Is that an oversight?
> 

No, it was left out on purpose. CPUID Fn8000_001B_EAX[10] (IbsOpData4)
is not set on any platform that supports IBS virtualization, so there
is nothing for KVM to advertise that to the guest.

> Three of these names are different from the IBS_CAPS_* names for the same
> bits in asm/perf_event.h: ZEN4_EXT (IBS_CAPS_ZEN4), LOADLATFIL
> (IBS_CAPS_OPLDLAT), and ZEN4_DTLBSTAT (IBS_CAPS_OPDTLBPGSIZE). Please
> standardize on the existing names.
> 

Agreed. I will rename them to existing name in V4.

>> +
>>  struct cpuid_reg {
>>  	u32 function;
>>  	u32 index;
>> @@ -105,6 +120,7 @@ static const struct cpuid_reg reverse_cpuid[] = {
>>  	[CPUID_8000_0022_EAX] = {0x80000022, 0, CPUID_EAX},
>>  	[CPUID_7_2_EDX]       = {         7, 2, CPUID_EDX},
>>  	[CPUID_24_0_EBX]      = {      0x24, 0, CPUID_EBX},
>> +	[CPUID_8000_001B_EAX] = {0x8000001b, 0, CPUID_EAX},
>>  	[CPUID_8000_0021_ECX] = {0x80000021, 0, CPUID_ECX},
>>  	[CPUID_7_1_ECX]       = {         7, 1, CPUID_ECX},
>>  	[CPUID_1E_1_EAX]      = {      0x1e, 1, CPUID_EAX},

-Manali

  reply	other threads:[~2026-10-22 10:17 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-10  6:00 [PATCH v3 0/9] Implement support for IBS virtualization Manali Shukla
2026-03-10  6:00 ` [PATCH v3 1/9] perf/amd/ibs: Fix race condition in IBS Manali Shukla
2026-10-08 17:19   ` Jim Mattson
2026-03-10  6:00 ` [PATCH v3 2/9] x86/cpufeatures: Add CPUID feature bit for VIBS in SVM/SEV guests Manali Shukla
2026-10-08 17:28   ` Jim Mattson
2026-03-10  6:00 ` [PATCH v3 3/9] KVM: x86/cpuid: Add a KVM-only leaf for IBS capabilities Manali Shukla
2026-10-08 17:44   ` Jim Mattson
2026-10-22 10:16     ` Manali Shukla [this message]
2026-03-10  6:00 ` [PATCH v3 4/9] KVM: x86: Extend CPUID range to include new leaf Manali Shukla
2026-10-08 17:59   ` Jim Mattson
2026-10-22 12:00     ` Manali Shukla
2026-10-22 17:15       ` Jim Mattson
2026-03-10  6:00 ` [PATCH v3 5/9] KVM: SVM: Extend VMCB area for virtualized IBS registers Manali Shukla
2026-10-08 18:01   ` Jim Mattson
2026-03-10  6:00 ` [PATCH v3 6/9] KVM: SVM: Add support for IBS Virtualization Manali Shukla
2026-10-08 19:19   ` Jim Mattson
2026-10-08 21:28     ` Jim Mattson
2026-10-16 16:01       ` Sean Christopherson
2026-11-10 12:03         ` Manali Shukla
2026-11-10 11:30     ` Manali Shukla
2026-03-10  6:00 ` [PATCH v3 7/9] perf/x86/amd: Enable VPMU passthrough capability for IBS PMU Manali Shukla
2026-10-08 19:32   ` Jim Mattson
2026-11-18 13:39     ` Manali Shukla
2026-03-10  6:00 ` [PATCH v3 8/9] perf/x86/amd: Remove exclude_guest check from perf_ibs_init() Manali Shukla
2026-10-08 19:38   ` Jim Mattson
2026-11-18 13:38     ` Manali Shukla
2026-03-10  6:00 ` [PATCH v3 9/9] KVM: SVM: Add newly added IBS capabilities and MSRs Manali Shukla
2026-10-08 21:03   ` Jim Mattson
2026-11-11 12:11     ` Manali Shukla

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=100c5a35-e7e7-4bb0-9931-80cd078af7c6@amd.com \
    --to=manali.shukla@amd.com \
    --cc=Naveen.Rao@amd.com \
    --cc=Sandipan.Das@amd.com \
    --cc=bp@alien8.de \
    --cc=dapeng1.mi@linux.intel.com \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=nikunj.dadhania@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=santosh.shukla@amd.com \
    --cc=seanjc@google.com \
    --cc=x86@kernel.org \
    --cc=yosry@kernel.org \
    /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.