Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755538AbcDGIV6 (ORCPT ); Thu, 7 Apr 2016 04:21:58 -0400 Received: from mail-by2on0079.outbound.protection.outlook.com ([207.46.100.79]:6816 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751231AbcDGIVx (ORCPT ); Thu, 7 Apr 2016 04:21:53 -0400 Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=amd.com; From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PART1 RFC v4 06/11] KVM: x86: Detect and Initialize AVIC support Date: Thu, 7 Apr 2016 03:20:27 -0500 Message-ID: <1460017232-17429-7-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1460017232-17429-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: KL1PR02CA0009.apcprd02.prod.outlook.com (10.165.15.19) To SN1PR12MB0445.namprd12.prod.outlook.com (10.162.105.139) X-MS-Office365-Filtering-Correlation-Id: d75f616b-ec28-42a1-1c04-08d35ebdab14 X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0445;2:bqurr8LDRZif/PgNZlgqgk/Ip9RZawIkEN/yn1MHXpxovBAbx+XDk73eUNwJIcX+Z1fqVjzKXcLbXGv0OOXfrpdwwugMxQ02ERCWHSrOvnwPAEV1Lq3uiaE9sfaWIhU3uyCCm0Ou/Sp/GGLVDc/9D8y/ywx9abwCr9NTUkrO6w9WHjkcT8jLqr89oRaeuzU7;3:Xtp0f2+eFfZ1YXyiDxyi+vTCoUpXQIbPb17YcOhWZeN+mpL7Y6H2iKYLw98XB7dbb+3wzPY6SMM4oDhq9rO+jiQwO/kJZO37FDDR6JAHM3G5wRxDNwbXLpIXnwLbRcK9;25:m4hmMz8mopQbznIpLP16EDXjcfovlnQSh1M4FZYR9IXeTmzGwS1CSmCiOmn0271IA4fFr+ub++PrgNK9AfyLO8eGRoQOuxNFXd+IMdy68eHi8WZ5qKtqyArGuwUoYCKPpKK/X6SckE78EpTf9MtA18Qbse835R0rQKuYF4+BVIKnvR7OEjkvVvKgAksXPQdaKsRwj7t3BL35ihmuj8A4pLYP8oagCBz2bBlU3Y7JZwRtUSRqYEMNxdOKlhEsWW+zw9uB2djgI7N5yXTPZ26GH17gpBammpL8PXL+kcyjVyKf1+SynqnLSLN19PC0ev2huLjXZ663SxdjuwriDDG5xw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0445; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0445;20:gbexHc2d7H6FVt3av8FD9SxWpa9NQKxkzu5MXr47rBQltgYwsOrimy1hp8G3gFwQ6kq5GXJ9JYT/0GWQ+9LLWgsJoNhXcpwn/LXxmj6Py4FpQ5uRjPHwquut67pICaIkTX9efc/lC4l0s+Ya59rR33OVXUs5JVshjcxWkJ+QdWHTIP/WM2xL94fUlsYyMgb4CXLB0rwkBwLXSyMQ354ll749LVgESEj/nvUF3X+UKJHG7Ze1AtyRs/r5JG8Yq9Q+5iKKH2kzTgMr0vRXg7DBbyygdb4CR7TKq8HMrQDzsMVv4XR+4tYXD65VRxlI5Lai/EyMFKRlKGQL5+h/y3dCUB+/+90cytXjHFVsJhu95TL6w5L9MoQ4GFDznM4/Qnx4KOPrCvDU6iaJlWvdRhCYgbQOgkh5unqAs2aE7cTfbn1nb4XJf4wCH9/hzNFG6nsF60OyfTdP3+Qz2nSihQ/H9JVbUwydgcmp8y+1Rlj8ezVy44ohb0YvNs/mSznipE3o;4:dE3aVRVmy21fmMQNM1Yo5rDKxHzEczrKG4kz0kr4Z8HFYHwtoRJdNePcSKyl8h5LWj6eL41QsT+JrJUL5dlcwXDHOmRYv4ObZwO5KMR60qmdQl9tNwvuusrNoCYWFWbQHRJuOh/U3jyLf8dLxtBoR9x3Vb0xc2DdHxMIsj4503BE4p18YeRGU/3yY8w6qpDi7AOiEtGrDVboLO3ccfHSGzHCzAeGiBTEyVrErb7O5L3ifHGHsb2SPrKFJFQe8AI4EJRi01thyl/twVau1nMhHSVI7g7dZRYXBD82XNkmOie15zIMe+smpP7xBJrDepCJqEoHD3lrgpE4KvvxIN8QAO/I/U116BQAQE9u1Vza7lQmPbMQKwhwvdZVB+hojmRk X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001);SRVR:SN1PR12MB0445;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0445; X-Forefront-PRVS: 0905A6B2C7 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6069001)(6009001)(5001770100001)(50466002)(2906002)(48376002)(575784001)(50986999)(189998001)(77096005)(4326007)(2950100001)(36756003)(5003940100001)(92566002)(76176999)(47776003)(19580395003)(19580405001)(81166005)(2201001)(229853001)(50226001)(86362001)(42186005)(586003)(3846002)(5008740100001)(66066001)(1096002)(6116002);DIR:OUT;SFP:1101;SCL:1;SRVR:SN1PR12MB0445;H:localhost.localdomain;FPR:;SPF:None;MLV:sfv;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0445;23:XE/7AcWNONB/QSuP2HLjrRBHYm1pYP8a141pFFYjG2kCkjXNGL8wYFiyRe4p1ibQ2FPhMSr2v4uQpOqvcCy+qQRD+qChenY5PCnPv61bVTOVBFwuJuXOAPAah5bV+jiJNsToCQkpb3iwKzHR8OpC9+rdB8vqJpX7ktQRKYxvP1iMPRtZYYOh9om9wExcpyKpbEVlxX5HtzJOOt6VLcTOVlL78bgsrsNM+GU8+a0WFF4WKTT1kXb8aRfSAZGnYsXtwJuu2ZW8BtMe4NKCyLeub9KcM8npfslddOMels36i5bXSImI1v622uTbBR48Dc/4Da7udWmhlDpIi1+zUX854BxkW7NMHzBZinzePRx3gSTtNnPmZF+CmIQEbMMzgm2JhC9e9ISQ56Knjr3bUfjtQIFru3vu7dEjFSGrq4+A1DRPdVs+lvNstPjmWGlapThxcLt2/cluUKf/F5uejGkwlXKt8EQL67P4904WiRfJZxoEq807oCumElixRoH7Aaijz05sxKIuOXJQ59vVvDx8r9vvcM7aGZ4jixTpQOaaiLZNvif09rvDLmTcMQvT5pddVzQLR9R3gLVFR0FdysWVJU4sBYA5a3BgrEf9MPsa6cwHpfNOQdmP/PpCr7KYduZahFcmLie4loZhAAulQeulrx80oHRZoXdbXNjJMnSDaW5bqsX9SyUh4uFRUA0ZTS+n23JyjGspy6c7oJiemDP0re4FQIzyN+KD30EBf580oJAKPoJzofV341+SjRJkuR3hsksm/8aVG2a59cadLb+/OPdTw57mcYM8ziTsM1qNafmslJgHzGw8iqC1fKMibnNxkHba0o+M4jaZln+2GnSUkQPyIidgRU6MaTcKcdmdU88J/USLyu21YItjELC0F05o X-Microsoft-Exchange-Diagnostics: 1;SN1PR12MB0445;5:D6VBadq9o+agoe0hLmq1T8uYn+wxJVaVaxX6wegTfxSfQo3RvhgedrLZmw2CG6gbQYUJvO3G3iAyr/02mPaJYOje/8i8DLgWjH7KsjwsHbPD7nlEULUPK0iOHhNs0iIMYNkgmX3sTked7gFmA6c2pA==;24:ShiOYrBsu5q0tRgsv2e2zOCKGcWEKsgm+ethxjFe88csixyqThGipzf6J6ntwPP8WAN2W23sMuuCuEqOvtY2d/7BPjdTeZaQIvcFIyDiO4U=;20:zS87yIeQancB2diHF/r+ggcm3lfH28nlFOomh8DE2SyIPF/hjiA4B3ex3qvKZWi9/2dzSKptJZBVeV4AaOebtpTVAqgzrRIpPQs8HIER/quQ9eudY5IXEQOThyouNupAfmDSynNvh3YW4ns8S6tRLrr7oQQS+h8Zf02As261lJQZ892tZ8CJrxjeLeYhuE+6qXdMUbs9jJpiR+goL/WBFhPwikfySY5mmIM6mUsvnFtLwQ0rWZyvfXvxE2sD8lif X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2016 08:21:41.4701 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0445 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 12079 Lines: 418 This patch introduces AVIC-related data structure, and AVIC initialization code. There are three main data structures for AVIC: * Virtual APIC (vAPIC) backing page (per-VCPU) * Physical APIC ID table (per-VM) * Logical APIC ID table (per-VM) Currently, AVIC is disabled by default. Users can manually enable AVIC via kernel boot option kvm-amd.avic=1 or during kvm-amd module loading with parameter avic=1. Signed-off-by: Suravee Suthikulpanit --- arch/x86/include/asm/kvm_host.h | 5 + arch/x86/include/asm/svm.h | 3 + arch/x86/kvm/svm.c | 238 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 245 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 2268f4c..1df946f 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -774,6 +774,11 @@ struct kvm_arch { u8 nr_reserved_ioapic_pins; bool disabled_lapic_found; + + /* Struct members for AVIC */ + u32 ldr_mode; + struct page *avic_logical_id_table_page; + struct page *avic_physical_id_table_page; }; struct kvm_vm_stat { diff --git a/arch/x86/include/asm/svm.h b/arch/x86/include/asm/svm.h index 4711fa4..d0fe23e 100644 --- a/arch/x86/include/asm/svm.h +++ b/arch/x86/include/asm/svm.h @@ -116,6 +116,9 @@ struct __attribute__ ((__packed__)) vmcb_control_area { #define V_INTR_MASKING_SHIFT 24 #define V_INTR_MASKING_MASK (1 << V_INTR_MASKING_SHIFT) +#define AVIC_ENABLE_SHIFT 31 +#define AVIC_ENABLE_MASK (1 << AVIC_ENABLE_SHIFT) + #define SVM_INTERRUPT_SHADOW_MASK 1 #define SVM_IOIO_STR_SHIFT 2 diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 31346a3..137cf18 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -14,6 +14,9 @@ * the COPYING file in the top-level directory. * */ + +#define pr_fmt(fmt) "SVM: " fmt + #include #include "irq.h" @@ -78,6 +81,11 @@ MODULE_DEVICE_TABLE(x86cpu, svm_cpu_id); #define TSC_RATIO_MIN 0x0000000000000001ULL #define TSC_RATIO_MAX 0x000000ffffffffffULL +#define AVIC_HPA_MASK ~((0xFFFULL << 52) || 0xFFF) + +/* NOTE: Current max index allowed for physical APIC ID table is 255 */ +#define AVIC_PHYSICAL_ID_MAX 0xFF + static bool erratum_383_found __read_mostly; static const u32 host_save_user_msrs[] = { @@ -162,8 +170,19 @@ struct vcpu_svm { /* cached guest cpuid flags for faster access */ bool nrips_enabled : 1; + + struct page *avic_backing_page; + u64 *avic_physical_id_cache; }; +#define AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK (0xFF) +#define AVIC_LOGICAL_ID_ENTRY_VALID_MASK (1 << 31) + +#define AVIC_PHYSICAL_ID_ENTRY_HOST_PHYSICAL_ID_MASK (0xFFULL) +#define AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK (0xFFFFFFFFFFULL << 12) +#define AVIC_PHYSICAL_ID_ENTRY_IS_RUNNING_MASK (1ULL << 62) +#define AVIC_PHYSICAL_ID_ENTRY_VALID_MASK (1ULL << 63) + static DEFINE_PER_CPU(u64, current_tsc_ratio); #define TSC_RATIO_DEFAULT 0x0100000000ULL @@ -205,6 +224,10 @@ module_param(npt, int, S_IRUGO); static int nested = true; module_param(nested, int, S_IRUGO); +/* enable / disable AVIC */ +static int avic; +module_param(avic, int, S_IRUGO); + static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); static void svm_flush_tlb(struct kvm_vcpu *vcpu); static void svm_complete_interrupts(struct vcpu_svm *svm); @@ -234,6 +257,18 @@ enum { /* TPR and CR2 are always written before VMRUN */ #define VMCB_ALWAYS_DIRTY_MASK ((1U << VMCB_INTR) | (1U << VMCB_CR2)) +#define VMCB_AVIC_APIC_BAR_MASK 0xFFFFFFFFFF000ULL + +static inline bool svm_vcpu_avic_enabled(struct vcpu_svm *svm) +{ + return (avic && (svm->vmcb->control.int_ctl & AVIC_ENABLE_MASK)); +} + +static inline void avic_update_vapic_bar(struct vcpu_svm *svm, u64 data) +{ + svm->vmcb->control.avic_vapic_bar = data & VMCB_AVIC_APIC_BAR_MASK; +} + static inline void mark_all_dirty(struct vmcb *vmcb) { vmcb->control.clean = 0; @@ -923,6 +958,13 @@ static __init int svm_hardware_setup(void) } else kvm_disable_tdp(); + if (avic && (!npt_enabled || !boot_cpu_has(X86_FEATURE_AVIC))) + avic = false; + + if (avic) { + printk(KERN_INFO "kvm: AVIC enabled\n"); + } + return 0; err: @@ -1000,6 +1042,24 @@ static void svm_adjust_tsc_offset_guest(struct kvm_vcpu *vcpu, s64 adjustment) mark_dirty(svm->vmcb, VMCB_INTERCEPTS); } +static void avic_init_vmcb(struct vcpu_svm *svm) +{ + struct vmcb *vmcb = svm->vmcb; + struct kvm_arch *vm_data = &svm->vcpu.kvm->arch; + phys_addr_t bpa = page_to_phys(svm->avic_backing_page); + phys_addr_t lpa = page_to_phys(vm_data->avic_logical_id_table_page); + phys_addr_t ppa = page_to_phys(vm_data->avic_physical_id_table_page); + + if (!vmcb) + return; + + vmcb->control.avic_backing_page = bpa & AVIC_HPA_MASK; + vmcb->control.avic_logical_id = lpa & AVIC_HPA_MASK; + vmcb->control.avic_physical_id = ppa & AVIC_HPA_MASK; + vmcb->control.avic_physical_id |= AVIC_PHYSICAL_ID_MAX; + vmcb->control.int_ctl |= AVIC_ENABLE_MASK; +} + static void init_vmcb(struct vcpu_svm *svm) { struct vmcb_control_area *control = &svm->vmcb->control; @@ -1113,6 +1173,142 @@ static void init_vmcb(struct vcpu_svm *svm) mark_all_dirty(svm->vmcb); enable_gif(svm); + + if (avic) + avic_init_vmcb(svm); +} + +static u64 *avic_get_physical_id_entry(struct kvm_vcpu *vcpu, int index) +{ + u64 *avic_physical_id_table; + struct kvm_arch *vm_data = &vcpu->kvm->arch; + + /* Note: APIC ID = 0xff is used for broadcast. + * APIC ID > 0xff is reserved. + */ + if (index >= 0xff) + return NULL; + + avic_physical_id_table = page_address(vm_data->avic_physical_id_table_page); + + return &avic_physical_id_table[index]; +} + +/** + * Note: + * AVIC hardware walks the nested page table to check permissions, + * but does not use the SPA address specified in the leaf page + * table entry since it uses address in the AVIC_BACKING_PAGE pointer + * field of the VMCB. Therefore, we set up the + * APIC_ACCESS_PAGE_PRIVATE_MEMSLOT (4KB) here. + */ +static int avic_init_access_page(struct kvm_vcpu *vcpu) +{ + int ret = 0; + struct kvm *kvm = vcpu->kvm; + + if (!kvm->arch.apic_access_page_done) { + ret = x86_set_memory_region(kvm, + APIC_ACCESS_PAGE_PRIVATE_MEMSLOT, + APIC_DEFAULT_PHYS_BASE, + PAGE_SIZE); + if (ret) + return ret; + kvm->arch.apic_access_page_done = true; + } + + return ret; +} + +static int avic_init_backing_page(struct kvm_vcpu *vcpu) +{ + int ret; + u64 *entry, new_entry; + int id = vcpu->vcpu_id; + struct vcpu_svm *svm = to_svm(vcpu); + + ret = avic_init_access_page(vcpu); + if (ret) + return ret; + + if (id >= AVIC_PHYSICAL_ID_MAX) + return -EINVAL; + + if (!svm->vcpu.arch.apic->regs) + return -EINVAL; + + svm->avic_backing_page = virt_to_page(svm->vcpu.arch.apic->regs); + + avic_init_vmcb(svm); + + /* Setting AVIC backing page address in the phy APIC ID table */ + entry = avic_get_physical_id_entry(vcpu, id); + if (!entry) + return -EINVAL; + + new_entry = READ_ONCE(*entry); + new_entry = (page_to_phys(svm->avic_backing_page) & + AVIC_PHYSICAL_ID_ENTRY_BACKING_PAGE_MASK) | + AVIC_PHYSICAL_ID_ENTRY_VALID_MASK; + WRITE_ONCE(*entry, new_entry); + + svm->avic_physical_id_cache = entry; + + return 0; +} + +static void avic_vm_uninit(struct kvm *kvm) +{ + struct kvm_arch *vm_data = &kvm->arch; + + if (vm_data->avic_logical_id_table_page) + __free_page(vm_data->avic_logical_id_table_page); + if (vm_data->avic_physical_id_table_page) + __free_page(vm_data->avic_physical_id_table_page); +} + +static void avic_vcpu_uninit(struct kvm_vcpu *vcpu) +{ + struct vcpu_svm *svm = to_svm(vcpu); + + if (!avic) + return; + + if (svm->avic_physical_id_cache) + svm->avic_physical_id_cache = NULL; +} + +static int avic_vm_init(struct kvm *kvm) +{ + int err = -ENOMEM; + struct kvm_arch *vm_data = &kvm->arch; + struct page *p_page; + struct page *l_page; + + if (!avic) + return 0; + + /* Allocating physical APIC ID table (4KB) */ + p_page = alloc_page(GFP_KERNEL); + if (!p_page) + goto free_avic; + + vm_data->avic_physical_id_table_page = p_page; + clear_page(page_address(p_page)); + + /* Allocating logical APIC ID table (4KB) */ + l_page = alloc_page(GFP_KERNEL); + if (!l_page) + goto free_avic; + + vm_data->avic_logical_id_table_page = l_page; + clear_page(page_address(l_page)); + + return 0; + +free_avic: + avic_vm_uninit(kvm); + return err; } static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) @@ -1131,6 +1327,9 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) kvm_cpuid(vcpu, &eax, &dummy, &dummy, &dummy); kvm_register_write(vcpu, VCPU_REGS_RDX, eax); + + if (svm_vcpu_avic_enabled(svm) && !init_event) + avic_update_vapic_bar(svm, APIC_DEFAULT_PHYS_BASE); } static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) @@ -1169,6 +1368,14 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) if (!hsave_page) goto free_page3; + if (avic) { + err = avic_init_backing_page(&svm->vcpu); + if (err) { + avic_vcpu_uninit(&svm->vcpu); + goto free_page4; + } + } + svm->nested.hsave = page_address(hsave_page); svm->msrpm = page_address(msrpm_pages); @@ -1187,6 +1394,8 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id) return &svm->vcpu; +free_page4: + __free_page(hsave_page); free_page3: __free_pages(nested_msrpm_pages, MSRPM_ALLOC_ORDER); free_page2: @@ -1209,6 +1418,7 @@ static void svm_free_vcpu(struct kvm_vcpu *vcpu) __free_pages(virt_to_page(svm->msrpm), MSRPM_ALLOC_ORDER); __free_page(virt_to_page(svm->nested.hsave)); __free_pages(virt_to_page(svm->nested.msrpm), MSRPM_ALLOC_ORDER); + avic_vcpu_uninit(vcpu); kvm_vcpu_uninit(vcpu); kmem_cache_free(kvm_vcpu_cache, svm); } @@ -3212,6 +3422,10 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) case MSR_VM_IGNNE: vcpu_unimpl(vcpu, "unimplemented wrmsr: 0x%x data 0x%llx\n", ecx, data); break; + case MSR_IA32_APICBASE: + if (svm_vcpu_avic_enabled(svm)) + avic_update_vapic_bar(to_svm(vcpu), data); + /* Follow through */ default: return kvm_set_msr_common(vcpu, msr); } @@ -3375,6 +3589,7 @@ static void dump_vmcb(struct kvm_vcpu *vcpu) pr_err("%-20s%08x\n", "exit_int_info_err:", control->exit_int_info_err); pr_err("%-20s%lld\n", "nested_ctl:", control->nested_ctl); pr_err("%-20s%016llx\n", "nested_cr3:", control->nested_cr3); + pr_err("%-20s%016llx\n", "avic_vapic_bar:", control->avic_vapic_bar); pr_err("%-20s%08x\n", "event_inj:", control->event_inj); pr_err("%-20s%08x\n", "event_inj_err:", control->event_inj_err); pr_err("%-20s%lld\n", "lbr_ctl:", control->lbr_ctl); @@ -3606,11 +3821,27 @@ static void svm_set_virtual_x2apic_mode(struct kvm_vcpu *vcpu, bool set) static bool svm_get_enable_apicv(void) { - return false; + return avic; } +static void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr) +{ +} + +static void svm_hwapic_isr_update(struct kvm *kvm, int isr) +{ +} + +/* Note: Currently only used by Hyper-V. */ static void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) { + struct vcpu_svm *svm = to_svm(vcpu); + struct vmcb *vmcb = svm->vmcb; + + if (!avic) + return; + + vmcb->control.int_ctl &= ~AVIC_ENABLE_MASK; } static void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) @@ -4322,6 +4553,9 @@ static struct kvm_x86_ops svm_x86_ops = { .vcpu_free = svm_free_vcpu, .vcpu_reset = svm_vcpu_reset, + .vm_init = avic_vm_init, + .vm_uninit = avic_vm_uninit, + .prepare_guest_switch = svm_prepare_guest_switch, .vcpu_load = svm_vcpu_load, .vcpu_put = svm_vcpu_put, @@ -4382,6 +4616,8 @@ static struct kvm_x86_ops svm_x86_ops = { .refresh_apicv_exec_ctrl = svm_refresh_apicv_exec_ctrl, .load_eoi_exitmap = svm_load_eoi_exitmap, .sync_pir_to_irr = svm_sync_pir_to_irr, + .hwapic_irr_update = svm_hwapic_irr_update, + .hwapic_isr_update = svm_hwapic_isr_update, .set_tss_addr = svm_set_tss_addr, .get_tdp_level = get_npt_level, -- 1.9.1