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 4/9] KVM: x86: Extend CPUID range to include new leaf
Date: Thu, 22 Oct 2026 17:30:27 +0530 [thread overview]
Message-ID: <a3eee649-0719-46d7-bd82-4dbdb1c98c8b@amd.com> (raw)
In-Reply-To: <20261008175928.732268-1-jmattson@google.com>
On 10/8/2026 11:29 PM, Jim Mattson wrote:
> On Tue, Mar 10, 2026 at 06:00:16AM +0000, Manali Shukla wrote:
>> CPUID leaf 0x8000001b (EAX) provides information about Instruction-Based
>> sampling capabilities on AMD Platforms. Add the new leaf to
>> kvm_cpu_cap_init() using F() macros, which automatically gate each
>> capability bits against raw hardware CPUID via raw_cpuid_get().
>>
>> This allows vendor code to simply clear entire leaf when vibs is not
>> enabled, rather than reading hardware CPUID and calling
>> kvm_cpu_cap_set() for each capability bits inidividually in later
>> patches.
>>
>> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>
> The shortlog is not accurate. The CPUID range does not change; case
> 0x80000000 already limits the maximum extended leaf to 0x80000022, which
> includes 0x8000001B. Before this patch, leaf 0x8000001B went to the default
> case, which returns all zeros. This patch adds KVM's supported bits for the
> leaf and a case that reports them when X86_FEATURE_IBS is supported. Please
> change the shortlog to say that.
>
Agreed. I will change the shortlog
Probably something like this ?
KVM: x86: Report supported IBS capabilities in CPUID 0x8000001B
> Also, there are some typos in the changelog:
> - "Instruction-Based sampling" should be "Instruction-Based Sampling"
> - "capability bits" should be "capability bit" (twice)
> - "inidividually" should be "individually"
> - "vibs" should be "VIBS"
>
Will fix it in V4.
>> ---
>> arch/x86/kvm/cpuid.c | 25 +++++++++++++++++++++++++
>> 1 file changed, 25 insertions(+)
>>
>> diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
>> index 96a08a556543..4e626e77e6a6 100644
>> --- a/arch/x86/kvm/cpuid.c
>> +++ b/arch/x86/kvm/cpuid.c
>
> [...]
>
>> @@ -1848,6 +1864,15 @@ static inline int __do_cpuid_func(struct kvm_cpuid_array *array, u32 function)
>> entry->eax = entry->ebx = entry->ecx = 0;
>> entry->edx = 0; /* reserved */
>> break;
>> + /* AMD IBS capability */
>> + case 0x8000001B:
>> + if (!kvm_cpu_cap_has(X86_FEATURE_IBS))
>> + entry->eax = 0;
>> + else
>> + cpuid_entry_override(entry, CPUID_8000_001B_EAX);
>> +
>> + entry->ebx = entry->ecx = entry->edx = 0;
>> + break;
>
> Please put case 0x8000001b between case 0x8000001a and case 0x8000001e.
Will do in V4.
>
>> case 0x8000001F:
>> if (!kvm_cpu_cap_has(X86_FEATURE_SEV)) {
>> entry->eax = entry->ebx = entry->ecx = entry->edx = 0;
- Manali
next prev parent reply other threads:[~2026-10-22 12:00 UTC|newest]
Thread overview: 24+ 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
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 [this message]
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-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-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-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
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=a3eee649-0719-46d7-bd82-4dbdb1c98c8b@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox