public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Manali Shukla <manali.shukla@amd.com>
To: Naveen N Rao <naveen@kernel.org>
Cc: <kvm@vger.kernel.org>, <linux-perf-users@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <seanjc@google.com>,
	<pbonzini@redhat.com>, <nikunj@amd.com>, <bp@alien8.de>,
	<peterz@infradead.org>, <mingo@redhat.com>, <mizhang@google.com>,
	<thomas.lendacky@amd.com>, <ravi.bangoria@amd.com>,
	<Sandipan.Das@amd.com>
Subject: Re: [PATCH v2 04/12] x86/cpufeatures: Add CPUID feature bit for Extended LVT
Date: Wed, 17 Sep 2025 21:04:57 +0530	[thread overview]
Message-ID: <1acb5a6d-377b-4f0a-8a70-0dddaefa149c@amd.com> (raw)
In-Reply-To: <kgavy7x2hweqc5fbg65fwxv7twmaiyt3l5brluqhxt57rjfvmq@aixr2qd436a2>

Hi Naveen,

Thank you for reviewing my patches.

On 9/8/2025 7:09 PM, Naveen N Rao wrote:
> On Mon, Sep 01, 2025 at 10:52:12AM +0530, Manali Shukla wrote:
>> From: Santosh Shukla <santosh.shukla@amd.com>
>>
>> Local interrupts can be extended to include more LVT registers in
>> order to allow additional interrupt sources, like Instruction Based
>> Sampling (IBS).
>>
>> The Extended APIC feature register indicates the number of extended
>> Local Vector Table(LVT) registers in the local APIC.  Currently, there
>> are 4 extended LVT registers available which are located at APIC
>> offsets (400h-530h).
>>
>> The EXTLVT feature bit changes the behavior associated with reading
>> and writing an extended LVT register when AVIC is enabled. When the
>> EXTLVT and AVIC are enabled, a write to an extended LVT register
>> changes from a fault style #VMEXIT to a trap style #VMEXIT and a read
>> of an extended LVT register no longer triggers a #VMEXIT [2].
>>
>> Presence of the EXTLVT feature is indicated via CPUID function
>> 0x8000000A_EDX[27].
>>
>> More details about the EXTLVT feature can be found at [1].
>>
>> [1]: AMD Programmer's Manual Volume 2,
>> Section 16.4.5 Extended Interrupts.
>> https://bugzilla.kernel.org/attachment.cgi?id=306250
>>
>> [2]: AMD Programmer's Manual Volume 2,
>> Table 15-22. Guest vAPIC Register Access Behavior.
>> https://bugzilla.kernel.org/attachment.cgi?id=306250
>>
>> Signed-off-by: Santosh Shukla <santosh.shukla@amd.com>
>> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>> ---
>>  arch/x86/include/asm/cpufeatures.h | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
>> index 286d509f9363..0dd44cbf7196 100644
>> --- a/arch/x86/include/asm/cpufeatures.h
>> +++ b/arch/x86/include/asm/cpufeatures.h
>> @@ -378,6 +378,7 @@
>>  #define X86_FEATURE_X2AVIC		(15*32+18) /* "x2avic" Virtual x2apic */
>>  #define X86_FEATURE_V_SPEC_CTRL		(15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
>>  #define X86_FEATURE_VNMI		(15*32+25) /* "vnmi" Virtual NMI */
>> +#define X86_FEATURE_EXTLVT		(15*32+27) /* Extended Local vector Table */
> 
> Per APM Vol 3, Appendix E.4.9 "Function 8000_000Ah", bit 27 is:
> ExtLvtAvicAccessChgExtended: Interrupt Local Vector Table Register AVIC 
> Access changes. See “Virtual APIC Register Accesses.”
> 
> And, APM Vol 2, 15.29.3.1 "Virtual APIC Register Accesses" says:
> Extended Interrupt [3:0] Local Vector Table Registers:
> 	CPUID Fn8000_000A_EDX[27]=1:
> 		Read: Allowed
> 		Write: #VMEXIT (trap)
> 	CPUID Fn8000_000A_EDX[27]=0:
> 		Read: #VMEXIT (fault)
> 		Write: #VMEXIT(fault)
> 
> So, as far as I can tell, this feature is only used to determine how 
> AVIC hardware handles accesses to the extended LVT entries. Does this 
> matter for vIBS? In the absence of this feature, we should take a fault 
> and KVM should be able to handle that.
> 

Yes, but KVM still needs to emulate extended LVT registers to handle the
fault when the guest IBS driver attempts to read/write extended LVT
registers.

"KVM: x86: Add emulation support for Extented LVT registers"
patch covers two aspects:

Extended LVT register emulation (EXTAPIC feature bit in
CPUID 0x80000001:ECX[3])

ExtLvtAvicAccessChgExtended which changes the behavior of read/write
access when AVIC is enabled.

> 
> - Naveen
> 




  reply	other threads:[~2025-09-17 15:36 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01  5:16 [PATCH v2 00/12] Implement support for IBS virtualization Manali Shukla
2025-09-01  5:19 ` [PATCH v2 01/12] perf/amd/ibs: Fix race condition in IBS Manali Shukla
2025-09-01  5:21 ` [PATCH v2 02/12] KVM: x86: Refactor APIC register mask handling to support extended APIC registers Manali Shukla
2025-10-06 16:12   ` Naveen N Rao
2025-10-13  5:53     ` Manali Shukla
2025-09-01  5:21 ` [PATCH v2 03/12] KVM: Add KVM_GET_EXT_LAPIC and KVM_SET_EXT_LAPIC for extapic Manali Shukla
2025-12-16 14:21   ` Naveen N Rao
2026-01-14 21:59     ` Sean Christopherson
2026-01-22 14:53       ` Manali Shukla
2025-09-01  5:22 ` [PATCH v2 04/12] x86/cpufeatures: Add CPUID feature bit for Extended LVT Manali Shukla
2025-09-08 13:39   ` Naveen N Rao
2025-09-17 15:34     ` Manali Shukla [this message]
2025-10-08  6:58       ` Naveen N Rao
2025-10-13  5:36         ` Manali Shukla
2025-09-01  5:22 ` [PATCH v2 05/12] KVM: x86: Add emulation support for Extented LVT registers Manali Shukla
2025-09-08 13:41   ` Naveen N Rao
2025-09-17 12:57     ` Manali Shukla
2025-10-08  7:00       ` Naveen N Rao
2025-10-13  5:38         ` Manali Shukla
2025-09-01  5:23 ` [PATCH v2 06/12] x86/cpufeatures: Add CPUID feature bit for VIBS in SVM/SEV guests Manali Shukla
2025-09-10 13:01   ` Nikunj A Dadhania
2025-09-17 15:40     ` Manali Shukla
2025-09-01  5:23 ` [PATCH v2 07/12] KVM: x86/cpuid: Add a KVM-only leaf for IBS capabilities Manali Shukla
2025-09-01  5:24 ` [PATCH v2 08/12] KVM: x86: Extend CPUID range to include new leaf Manali Shukla
2025-09-01  5:24 ` [PATCH v2 09/12] KVM: SVM: Extend VMCB area for virtualized IBS registers Manali Shukla
2025-09-01  5:25 ` [PATCH v2 10/12] KVM: SVM: Add support for IBS Virtualization Manali Shukla
2025-10-08  7:30   ` Naveen N Rao
2025-09-01  5:26 ` [PATCH v2 11/12] perf/x86/amd: Enable VPMU passthrough capability for IBS PMU Manali Shukla
2025-09-01  5:26 ` [PATCH v2 12/12] perf/x86/amd: Remove exclude_guest check from perf_ibs_init() 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=1acb5a6d-377b-4f0a-8a70-0dddaefa149c@amd.com \
    --to=manali.shukla@amd.com \
    --cc=Sandipan.Das@amd.com \
    --cc=bp@alien8.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mizhang@google.com \
    --cc=naveen@kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=ravi.bangoria@amd.com \
    --cc=seanjc@google.com \
    --cc=thomas.lendacky@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox