[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220308163926.563994-1-suravee.suthikulpanit@amd.com>
Date: Tue, 8 Mar 2022 10:39:14 -0600
From: Suravee Suthikulpanit <suravee.suthikulpanit@....com>
To: <linux-kernel@...r.kernel.org>, <kvm@...r.kernel.org>
CC: <pbonzini@...hat.com>, <mlevitsk@...hat.com>, <seanjc@...gle.com>,
<joro@...tes.org>, <jon.grimm@....com>, <wei.huang2@....com>,
<terry.bowman@....com>,
Suravee Suthikulpanit <suravee.suthikulpanit@....com>
Subject: [RFCv2 PATCH 00/12] Introducing AMD x2APIC Virtualization (x2AVIC) support.
Previously, with AVIC, guest needs to disable x2APIC capability and
can only run in APIC mode to activate hardware-accelerated interrupt
virtualization. With x2AVIC, guest can run in x2APIC mode.
This feature is indicated by the CPUID Fn8000_000A EDX[14],
and it can be activated by setting bit 31 (enable AVIC) and
bit 30 (x2APIC mode) of VMCB offset 60h.
The mode of interrupt virtualization can dynamically change during runtime.
For example, when AVIC is enabled, the hypervisor currently keeps track of
the AVIC activation and set the VMCB bit 31 accordingly. With x2AVIC,
the guest OS can also switch between APIC and x2APIC modes during runtime.
The kvm_amd driver needs to also keep track and set the VMCB
bit 30 accordingly.
Besides, for x2AVIC, kvm_amd driver needs to disable interception for the
x2APIC MSR range to allow AVIC hardware to virtualize register accesses.
Testing:
* This series has been tested booting a Linux VM with x2APIC physical
and logical modes upto 512 vCPUs.
Regards,
Suravee
Change from RFCv1 (https://lkml.org/lkml/2022/2/20/435)
* Mostly update the series based on review comments from Maxim.
* Patch 2/12 is new to the series
* Patch 3/12 removes unused helper function.
* Patch 6/12 update commit message w/ the expected hardware
behavior when writing to x2APIC LDR register to address
a concern in the review comment.
* Patch 7/12 has been redesigned to return proper error code
and move the function definition to arch/x86/kvm/lapic.c.
* Patch 9/12 moves logic into svm_set_virtual_apic_mode().
* Patch 11/12 separates the warning removal into a separate patch
w/ detail description.
* Remove non-x2AVIC related patches, which will be sent separately.
Suravee Suthikulpanit (12):
x86/cpufeatures: Introduce x2AVIC CPUID bit
KVM: x86: lapic: Rename [GET/SET]_APIC_DEST_FIELD to
[GET/SET]_XAPIC_DEST_FIELD
KVM: SVM: Detect X2APIC virtualization (x2AVIC) support
KVM: SVM: Update max number of vCPUs supported for x2AVIC mode
KVM: SVM: Update avic_kick_target_vcpus to support 32-bit APIC ID
KVM: SVM: Do not update logical APIC ID table when in x2APIC mode
KVM: SVM: Introduce helper function kvm_get_apic_id
KVM: SVM: Adding support for configuring x2APIC MSRs interception
KVM: SVM: Refresh AVIC settings when changing APIC mode
KVM: SVM: Introduce helper functions to (de)activate AVIC and x2AVIC
KVM: SVM: Do not throw warning when calling avic_vcpu_load on a
running vcpu
KVM: SVM: Do not inhibit APICv when x2APIC is present
arch/x86/hyperv/hv_apic.c | 2 +-
arch/x86/include/asm/apicdef.h | 4 +-
arch/x86/include/asm/cpufeatures.h | 1 +
arch/x86/include/asm/svm.h | 16 ++-
arch/x86/kernel/apic/apic.c | 2 +-
arch/x86/kernel/apic/ipi.c | 2 +-
arch/x86/kvm/lapic.c | 25 ++++-
arch/x86/kvm/lapic.h | 5 +-
arch/x86/kvm/svm/avic.c | 171 ++++++++++++++++++++++++++---
arch/x86/kvm/svm/svm.c | 93 +++++++++-------
arch/x86/kvm/svm/svm.h | 9 ++
11 files changed, 262 insertions(+), 68 deletions(-)
--
2.25.1
Powered by blists - more mailing lists