From nobody Sun Apr 28 15:29:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605318743; cv=none; d=zohomail.com; s=zohoarc; b=mLTYcEahliuASip+VLXg2O4884ih5H9xHIYtZAxYC/SsndevVJ3pvmTMbCBTQdbimb+opzUd9hyE6e9sLXUsIUJCiBGbfaNJId+D6ZPlGUnI6Q6RdmVarvfdmRIuWd0eNCHDLQu4dFhyYuscCoNuZ/sfhiW+owBe/+47B/klnYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605318743; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Cm6XOO8cbo/PJmwZrYa3Do2ypmW6OxiOhWllufopg+U=; b=AzLIfK7B6lpxiTdGipGQL4Q1ycylV2KYKJBBR3csiaSPW1trUC/3BrYORWtFAW92syWeTtnFat/1e1WebPgDRrzfMDFhQywjrLlxJofxE3vGJIVSdI0anT6V40bnmZ1q6jseH6jX7yZPRmxNyHHDwuo1zIu6DbgbrCV6QvT9sF8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605318743022224.58725486616936; Fri, 13 Nov 2020 17:52:23 -0800 (PST) Received: from localhost ([::1]:56226 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdkjj-0008On-TZ for importer@patchew.org; Fri, 13 Nov 2020 20:52:19 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48642) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhv-0006v8-2v for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:27 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:33414) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhk-0002Zq-P8 for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:26 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1o7O7171657; Sat, 14 Nov 2020 01:50:07 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 34t4rag2m2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 14 Nov 2020 01:50:06 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1jMjH065501; Sat, 14 Nov 2020 01:50:06 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 34t598sefj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 14 Nov 2020 01:50:06 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AE1o50g009503; Sat, 14 Nov 2020 01:50:05 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.230.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 17:50:04 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=Cm6XOO8cbo/PJmwZrYa3Do2ypmW6OxiOhWllufopg+U=; b=hpYBHuTxxNeXASDU1Q86cU/Jz1ls1e1R04nBij1uCnnX8JgN+imJN9vhrSuNWyNHdCC+ 8D0NfUmWi4HVmNhHvWrdIsstTBhB58+m0/mAHCl16zaOUeFlXBJBYT/qR1nyJ9nkcDKV FZloz+dE/nz/a3cE+Xwo771rI6oBTIB7a9TVZwZrwCSfPWSJIJA4Bn04iRB9H5ThwS2Y 2rkuTAVWhu8ezMsePV98n0KI0kGQY+cBwaXrAiTIpEU0cp5t2i+X/2iWwUBZbNJcCd0j h6VcBbVuMsIOQmpbZgMKgMCP3Kw7ulyGsk56up31H3nHl62wHO9pqL6M9L+S7CgC4lf+ YA== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 1/5 v5] KVM: x86: Change names of some of the kvm_x86_ops functions to make them more semantical and readable Date: Sat, 14 Nov 2020 01:49:51 +0000 Message-Id: <20201114014955.19749-2-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201114014955.19749-1-krish.sadhukhan@oracle.com> References: <20201114014955.19749-1-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=999 suspectscore=4 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=4 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.79; envelope-from=krish.sadhukhan@oracle.com; helo=aserp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 18:55:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, vkuznets@redhat.com, qemu-devel@nongnu.org, sean.j.christopherson@intel.com, jmattson@google.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Suggested-by: Vitaly Kuznetsov Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson Signed-off-by: Krish Sadhukhan --- arch/arm64/include/asm/kvm_host.h | 2 +- arch/mips/include/asm/kvm_host.h | 2 +- arch/powerpc/include/asm/kvm_host.h | 2 +- arch/s390/kvm/kvm-s390.c | 2 +- arch/x86/include/asm/kvm_host.h | 18 ++++++++-------- arch/x86/kvm/lapic.c | 2 +- arch/x86/kvm/svm/nested.c | 2 +- arch/x86/kvm/svm/svm.c | 14 ++++++------- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/vmx.c | 10 ++++----- arch/x86/kvm/x86.c | 32 ++++++++++++++--------------- include/linux/kvm_host.h | 2 +- include/uapi/linux/kvm.h | 6 +++--- tools/include/uapi/linux/kvm.h | 6 +++--- virt/kvm/kvm_main.c | 4 ++-- 15 files changed, 53 insertions(+), 53 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm= _host.h index 781d029b8aa8..50d0768f3aef 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -592,7 +592,7 @@ static inline bool kvm_arch_requires_vhe(void) =20 void kvm_arm_vcpu_ptrauth_trap(struct kvm_vcpu *vcpu); =20 -static inline void kvm_arch_hardware_unsetup(void) {} +static inline void kvm_arch_hardware_teardown(void) {} static inline void kvm_arch_sync_events(struct kvm *kvm) {} static inline void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu) {} static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm/kvm_h= ost.h index 24f3d0f9996b..88ec47f7a56a 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h @@ -1145,7 +1145,7 @@ extern unsigned long kvm_mips_get_ramsize(struct kvm = *kvm); extern int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_mips_interrupt *irq); =20 -static inline void kvm_arch_hardware_unsetup(void) {} +static inline void kvm_arch_hardware_teardown(void) {} static inline void kvm_arch_sync_events(struct kvm *kvm) {} static inline void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot) {} diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm= /kvm_host.h index d67a470e95a3..5a702ce6398a 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -860,7 +860,7 @@ struct kvm_vcpu_arch { #define __KVM_HAVE_CREATE_DEVICE =20 static inline void kvm_arch_hardware_disable(void) {} -static inline void kvm_arch_hardware_unsetup(void) {} +static inline void kvm_arch_hardware_teardown(void) {} static inline void kvm_arch_sync_events(struct kvm *kvm) {} static inline void kvm_arch_memslots_updated(struct kvm *kvm, u64 gen) {} static inline void kvm_arch_flush_shadow_all(struct kvm *kvm) {} diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c index 6b74b92c1a58..e503263a0ef7 100644 --- a/arch/s390/kvm/kvm-s390.c +++ b/arch/s390/kvm/kvm-s390.c @@ -312,7 +312,7 @@ int kvm_arch_hardware_setup(void *opaque) return 0; } =20 -void kvm_arch_hardware_unsetup(void) +void kvm_arch_hardware_teardown(void) { gmap_unregister_pte_notifier(&gmap_notifier); gmap_unregister_pte_notifier(&vsie_gmap_notifier); diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_hos= t.h index d44858b69353..a7664db47cfd 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1085,7 +1085,7 @@ static inline u16 kvm_lapic_irq_dest_mode(bool dest_m= ode_logical) struct kvm_x86_ops { int (*hardware_enable)(void); void (*hardware_disable)(void); - void (*hardware_unsetup)(void); + void (*hardware_teardown)(void); bool (*cpu_has_accelerated_tpr)(void); bool (*has_emulated_msr)(u32 index); void (*vcpu_after_set_cpuid)(struct kvm_vcpu *vcpu); @@ -1099,7 +1099,7 @@ struct kvm_x86_ops { void (*vcpu_free)(struct kvm_vcpu *vcpu); void (*vcpu_reset)(struct kvm_vcpu *vcpu, bool init_event); =20 - void (*prepare_guest_switch)(struct kvm_vcpu *vcpu); + void (*prepare_switch_to_guest)(struct kvm_vcpu *vcpu); void (*vcpu_load)(struct kvm_vcpu *vcpu, int cpu); void (*vcpu_put)(struct kvm_vcpu *vcpu); =20 @@ -1146,7 +1146,7 @@ struct kvm_x86_ops { */ void (*tlb_flush_guest)(struct kvm_vcpu *vcpu); =20 - enum exit_fastpath_completion (*run)(struct kvm_vcpu *vcpu); + enum exit_fastpath_completion (*vcpu_run)(struct kvm_vcpu *vcpu); int (*handle_exit)(struct kvm_vcpu *vcpu, enum exit_fastpath_completion exit_fastpath); int (*skip_emulated_instruction)(struct kvm_vcpu *vcpu); @@ -1155,8 +1155,8 @@ struct kvm_x86_ops { u32 (*get_interrupt_shadow)(struct kvm_vcpu *vcpu); void (*patch_hypercall)(struct kvm_vcpu *vcpu, unsigned char *hypercall_addr); - void (*set_irq)(struct kvm_vcpu *vcpu); - void (*set_nmi)(struct kvm_vcpu *vcpu); + void (*inject_irq)(struct kvm_vcpu *vcpu); + void (*inject_nmi)(struct kvm_vcpu *vcpu); void (*queue_exception)(struct kvm_vcpu *vcpu); void (*cancel_injection)(struct kvm_vcpu *vcpu); int (*interrupt_allowed)(struct kvm_vcpu *vcpu, bool for_injection); @@ -1175,7 +1175,7 @@ struct kvm_x86_ops { void (*load_eoi_exitmap)(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); void (*set_virtual_apic_mode)(struct kvm_vcpu *vcpu); void (*set_apic_access_page_addr)(struct kvm_vcpu *vcpu); - int (*deliver_posted_interrupt)(struct kvm_vcpu *vcpu, int vector); + int (*deliver_interrupt)(struct kvm_vcpu *vcpu, int vector); int (*sync_pir_to_irr)(struct kvm_vcpu *vcpu); int (*set_tss_addr)(struct kvm *kvm, unsigned int addr); int (*set_identity_map_addr)(struct kvm *kvm, u64 ident_addr); @@ -1267,8 +1267,8 @@ struct kvm_x86_ops { void (*enable_smi_window)(struct kvm_vcpu *vcpu); =20 int (*mem_enc_op)(struct kvm *kvm, void __user *argp); - int (*mem_enc_reg_region)(struct kvm *kvm, struct kvm_enc_region *argp); - int (*mem_enc_unreg_region)(struct kvm *kvm, struct kvm_enc_region *argp); + int (*mem_enc_register_region)(struct kvm *kvm, struct kvm_enc_region *ar= gp); + int (*mem_enc_unregister_region)(struct kvm *kvm, struct kvm_enc_region *= argp); =20 int (*get_msr_feature)(struct kvm_msr_entry *entry); =20 @@ -1290,7 +1290,7 @@ struct kvm_x86_nested_ops { int (*set_state)(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state, struct kvm_nested_state *kvm_state); - bool (*get_nested_state_pages)(struct kvm_vcpu *vcpu); + bool (*get_pages)(struct kvm_vcpu *vcpu); int (*write_log_dirty)(struct kvm_vcpu *vcpu, gpa_t l2_gpa); =20 int (*enable_evmcs)(struct kvm_vcpu *vcpu, diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 105e7859d1f2..aa839724fe94 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c @@ -1090,7 +1090,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic, = int delivery_mode, apic->regs + APIC_TMR); } =20 - if (kvm_x86_ops.deliver_posted_interrupt(vcpu, vector)) { + if (kvm_x86_ops.deliver_interrupt(vcpu, vector)) { kvm_lapic_set_irr(vector, apic); kvm_make_request(KVM_REQ_EVENT, vcpu); kvm_vcpu_kick(vcpu); diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 9e4c226dbf7d..200674190449 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -1211,7 +1211,7 @@ static int svm_set_nested_state(struct kvm_vcpu *vcpu, =20 struct kvm_x86_nested_ops svm_nested_ops =3D { .check_events =3D svm_check_nested_events, - .get_nested_state_pages =3D svm_get_nested_state_pages, + .get_pages =3D svm_get_nested_state_pages, .get_state =3D svm_get_nested_state, .set_state =3D svm_set_nested_state, }; diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 2f32fd09e259..5ee8eef1905a 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4177,7 +4177,7 @@ static int svm_vm_init(struct kvm *kvm) } =20 static struct kvm_x86_ops svm_x86_ops __initdata =3D { - .hardware_unsetup =3D svm_hardware_teardown, + .hardware_teardown =3D svm_hardware_teardown, .hardware_enable =3D svm_hardware_enable, .hardware_disable =3D svm_hardware_disable, .cpu_has_accelerated_tpr =3D svm_cpu_has_accelerated_tpr, @@ -4224,15 +4224,15 @@ static struct kvm_x86_ops svm_x86_ops __initdata = =3D { .tlb_flush_gva =3D svm_flush_tlb_gva, .tlb_flush_guest =3D svm_flush_tlb, =20 - .run =3D svm_vcpu_run, + .vcpu_run =3D svm_vcpu_run, .handle_exit =3D handle_exit, .skip_emulated_instruction =3D skip_emulated_instruction, .update_emulated_instruction =3D NULL, .set_interrupt_shadow =3D svm_set_interrupt_shadow, .get_interrupt_shadow =3D svm_get_interrupt_shadow, .patch_hypercall =3D svm_patch_hypercall, - .set_irq =3D svm_set_irq, - .set_nmi =3D svm_inject_nmi, + .inject_irq =3D svm_set_irq, + .inject_nmi =3D svm_inject_nmi, .queue_exception =3D svm_queue_exception, .cancel_injection =3D svm_cancel_injection, .interrupt_allowed =3D svm_interrupt_allowed, @@ -4276,7 +4276,7 @@ static struct kvm_x86_ops svm_x86_ops __initdata =3D { .pmu_ops =3D &amd_pmu_ops, .nested_ops =3D &svm_nested_ops, =20 - .deliver_posted_interrupt =3D svm_deliver_avic_intr, + .deliver_interrupt =3D svm_deliver_avic_intr, .dy_apicv_has_pending_interrupt =3D svm_dy_apicv_has_pending_interrupt, .update_pi_irte =3D svm_update_pi_irte, .setup_mce =3D svm_setup_mce, @@ -4287,8 +4287,8 @@ static struct kvm_x86_ops svm_x86_ops __initdata =3D { .enable_smi_window =3D enable_smi_window, =20 .mem_enc_op =3D svm_mem_enc_op, - .mem_enc_reg_region =3D svm_register_enc_region, - .mem_enc_unreg_region =3D svm_unregister_enc_region, + .mem_enc_register_region =3D svm_register_enc_region, + .mem_enc_unregister_region =3D svm_unregister_enc_region, =20 .can_emulate_instruction =3D svm_can_emulate_instruction, =20 diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 89af692deb7e..6c32f73cffd5 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6573,7 +6573,7 @@ struct kvm_x86_nested_ops vmx_nested_ops =3D { .hv_timer_pending =3D nested_vmx_preemption_timer_pending, .get_state =3D vmx_get_nested_state, .set_state =3D vmx_set_nested_state, - .get_nested_state_pages =3D nested_get_vmcs12_pages, + .get_pages =3D nested_get_vmcs12_pages, .write_log_dirty =3D nested_vmx_write_pml_buffer, .enable_evmcs =3D nested_enable_evmcs, .get_evmcs_version =3D nested_get_evmcs_version, diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 47b8357b9751..ddfc127d5c4f 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7588,7 +7588,7 @@ static bool vmx_check_apicv_inhibit_reasons(ulong bit) } =20 static struct kvm_x86_ops vmx_x86_ops __initdata =3D { - .hardware_unsetup =3D hardware_unsetup, + .hardware_teardown =3D hardware_unsetup, =20 .hardware_enable =3D hardware_enable, .hardware_disable =3D hardware_disable, @@ -7633,15 +7633,15 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = =3D { .tlb_flush_gva =3D vmx_flush_tlb_gva, .tlb_flush_guest =3D vmx_flush_tlb_guest, =20 - .run =3D vmx_vcpu_run, + .vcpu_run =3D vmx_vcpu_run, .handle_exit =3D vmx_handle_exit, .skip_emulated_instruction =3D vmx_skip_emulated_instruction, .update_emulated_instruction =3D vmx_update_emulated_instruction, .set_interrupt_shadow =3D vmx_set_interrupt_shadow, .get_interrupt_shadow =3D vmx_get_interrupt_shadow, .patch_hypercall =3D vmx_patch_hypercall, - .set_irq =3D vmx_inject_irq, - .set_nmi =3D vmx_inject_nmi, + .inject_irq =3D vmx_inject_irq, + .inject_nmi =3D vmx_inject_nmi, .queue_exception =3D vmx_queue_exception, .cancel_injection =3D vmx_cancel_injection, .interrupt_allowed =3D vmx_interrupt_allowed, @@ -7661,7 +7661,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata =3D { .hwapic_isr_update =3D vmx_hwapic_isr_update, .guest_apic_has_interrupt =3D vmx_guest_apic_has_interrupt, .sync_pir_to_irr =3D vmx_sync_pir_to_irr, - .deliver_posted_interrupt =3D vmx_deliver_posted_interrupt, + .deliver_interrupt =3D vmx_deliver_posted_interrupt, .dy_apicv_has_pending_interrupt =3D pi_has_pending_interrupt, =20 .set_tss_addr =3D vmx_set_tss_addr, diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index f5ede41bf9e6..a982a971db7c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5607,13 +5607,13 @@ long kvm_arch_vm_ioctl(struct file *filp, r =3D 0; break; } - case KVM_MEMORY_ENCRYPT_OP: { + case KVM_MEM_ENC_OP: { r =3D -ENOTTY; if (kvm_x86_ops.mem_enc_op) r =3D kvm_x86_ops.mem_enc_op(kvm, argp); break; } - case KVM_MEMORY_ENCRYPT_REG_REGION: { + case KVM_MEM_ENC_REGISTER_REGION: { struct kvm_enc_region region; =20 r =3D -EFAULT; @@ -5621,11 +5621,11 @@ long kvm_arch_vm_ioctl(struct file *filp, goto out; =20 r =3D -ENOTTY; - if (kvm_x86_ops.mem_enc_reg_region) - r =3D kvm_x86_ops.mem_enc_reg_region(kvm, ®ion); + if (kvm_x86_ops.mem_enc_register_region) + r =3D kvm_x86_ops.mem_enc_register_region(kvm, ®ion); break; } - case KVM_MEMORY_ENCRYPT_UNREG_REGION: { + case KVM_MEM_ENC_UNREGISTER_REGION: { struct kvm_enc_region region; =20 r =3D -EFAULT; @@ -5633,8 +5633,8 @@ long kvm_arch_vm_ioctl(struct file *filp, goto out; =20 r =3D -ENOTTY; - if (kvm_x86_ops.mem_enc_unreg_region) - r =3D kvm_x86_ops.mem_enc_unreg_region(kvm, ®ion); + if (kvm_x86_ops.mem_enc_unregister_region) + r =3D kvm_x86_ops.mem_enc_unregister_region(kvm, ®ion); break; } case KVM_HYPERV_EVENTFD: { @@ -8180,10 +8180,10 @@ static void inject_pending_event(struct kvm_vcpu *v= cpu, bool *req_immediate_exit */ else if (!vcpu->arch.exception.pending) { if (vcpu->arch.nmi_injected) { - kvm_x86_ops.set_nmi(vcpu); + kvm_x86_ops.inject_nmi(vcpu); can_inject =3D false; } else if (vcpu->arch.interrupt.injected) { - kvm_x86_ops.set_irq(vcpu); + kvm_x86_ops.inject_irq(vcpu); can_inject =3D false; } } @@ -8259,7 +8259,7 @@ static void inject_pending_event(struct kvm_vcpu *vcp= u, bool *req_immediate_exit if (r) { --vcpu->arch.nmi_pending; vcpu->arch.nmi_injected =3D true; - kvm_x86_ops.set_nmi(vcpu); + kvm_x86_ops.inject_nmi(vcpu); can_inject =3D false; WARN_ON(kvm_x86_ops.nmi_allowed(vcpu, true) < 0); } @@ -8273,7 +8273,7 @@ static void inject_pending_event(struct kvm_vcpu *vcp= u, bool *req_immediate_exit goto busy; if (r) { kvm_queue_interrupt(vcpu, kvm_cpu_get_interrupt(vcpu), false); - kvm_x86_ops.set_irq(vcpu); + kvm_x86_ops.inject_irq(vcpu); WARN_ON(kvm_x86_ops.interrupt_allowed(vcpu, true) < 0); } if (kvm_cpu_has_injectable_intr(vcpu)) @@ -8710,7 +8710,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) =20 if (kvm_request_pending(vcpu)) { if (kvm_check_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu)) { - if (unlikely(!kvm_x86_ops.nested_ops->get_nested_state_pages(vcpu))) { + if (unlikely(!kvm_x86_ops.nested_ops->get_pages(vcpu))) { r =3D 0; goto out; } @@ -8846,7 +8846,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) =20 preempt_disable(); =20 - kvm_x86_ops.prepare_guest_switch(vcpu); + kvm_x86_ops.prepare_switch_to_guest(vcpu); =20 /* * Disable IRQs before setting IN_GUEST_MODE. Posted interrupt @@ -8910,7 +8910,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) vcpu->arch.switch_db_regs &=3D ~KVM_DEBUGREG_RELOAD; } =20 - exit_fastpath =3D kvm_x86_ops.run(vcpu); + exit_fastpath =3D kvm_x86_ops.vcpu_run(vcpu); =20 /* * Do this here before restoring debug registers on the host. And @@ -10178,9 +10178,9 @@ int kvm_arch_hardware_setup(void *opaque) return 0; } =20 -void kvm_arch_hardware_unsetup(void) +void kvm_arch_hardware_teardown(void) { - kvm_x86_ops.hardware_unsetup(); + kvm_x86_ops.hardware_teardown(); } =20 int kvm_arch_check_processor_compat(void *opaque) diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 7f2e2a09ebbd..b087488cf5fc 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -925,7 +925,7 @@ void kvm_arch_create_vcpu_debugfs(struct kvm_vcpu *vcpu= , struct dentry *debugfs_ int kvm_arch_hardware_enable(void); void kvm_arch_hardware_disable(void); int kvm_arch_hardware_setup(void *opaque); -void kvm_arch_hardware_unsetup(void); +void kvm_arch_hardware_teardown(void); int kvm_arch_check_processor_compat(void *opaque); int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu); bool kvm_arch_vcpu_in_kernel(struct kvm_vcpu *vcpu); diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h index ca41220b40b8..91239a6c8818 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1491,15 +1491,15 @@ struct kvm_s390_ucas_mapping { #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmm= a_log) #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma= _log) /* Memory Encryption Commands */ -#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) +#define KVM_MEM_ENC_OP _IOWR(KVMIO, 0xba, unsigned long) =20 struct kvm_enc_region { __u64 addr; __u64 size; }; =20 -#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_= region) -#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_= region) +#define KVM_MEM_ENC_REGISTER_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_re= gion) +#define KVM_MEM_ENC_UNREGISTER_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_re= gion) =20 /* Available with KVM_CAP_HYPERV_EVENTFD */ #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eve= ntfd) diff --git a/tools/include/uapi/linux/kvm.h b/tools/include/uapi/linux/kvm.h index 7d8eced6f459..ab651099d0c4 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -1475,15 +1475,15 @@ struct kvm_s390_ucas_mapping { #define KVM_S390_GET_CMMA_BITS _IOWR(KVMIO, 0xb8, struct kvm_s390_cmm= a_log) #define KVM_S390_SET_CMMA_BITS _IOW(KVMIO, 0xb9, struct kvm_s390_cmma= _log) /* Memory Encryption Commands */ -#define KVM_MEMORY_ENCRYPT_OP _IOWR(KVMIO, 0xba, unsigned long) +#define KVM_MEM_ENC_OP _IOWR(KVMIO, 0xba, unsigned long) =20 struct kvm_enc_region { __u64 addr; __u64 size; }; =20 -#define KVM_MEMORY_ENCRYPT_REG_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_= region) -#define KVM_MEMORY_ENCRYPT_UNREG_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_= region) +#define KVM_MEM_ENC_REGISTER_REGION _IOR(KVMIO, 0xbb, struct kvm_enc_re= gion) +#define KVM_MEM_ENC_UNREGISTER_REGION _IOR(KVMIO, 0xbc, struct kvm_enc_re= gion) =20 /* Available with KVM_CAP_HYPERV_EVENTFD */ #define KVM_HYPERV_EVENTFD _IOW(KVMIO, 0xbd, struct kvm_hyperv_eve= ntfd) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 2541a17ff1c4..309f027b8b72 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4858,7 +4858,7 @@ int kvm_init(void *opaque, unsigned vcpu_size, unsign= ed vcpu_align, unregister_reboot_notifier(&kvm_reboot_notifier); cpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING); out_free_2: - kvm_arch_hardware_unsetup(); + kvm_arch_hardware_teardown(); out_free_1: free_cpumask_var(cpus_hardware_enabled); out_free_0: @@ -4880,7 +4880,7 @@ void kvm_exit(void) unregister_reboot_notifier(&kvm_reboot_notifier); cpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING); on_each_cpu(hardware_disable_nolock, NULL, 1); - kvm_arch_hardware_unsetup(); + kvm_arch_hardware_teardown(); kvm_arch_exit(); kvm_irqfd_exit(); free_cpumask_var(cpus_hardware_enabled); --=20 2.27.0 From nobody Sun Apr 28 15:29:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605319080; cv=none; d=zohomail.com; s=zohoarc; b=gH7hfMwV4BQY1aYs+mwXp4kC9KsVQr+PGaJy/ArmFRhaq5Pd1JraieKTm+q1kIhdel8F+6kI1Ab7L+BQk4MnX49kLvRm8DMscleSkwaAcGCuHmb9cfsm5FxAOCiNy4YHaeviZVrR3p6jZPzYnI9eqmzd3wBkY37wD5ZHqqJiCU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605319080; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Je/fMNKSXxa8BJPNC8SEGTwmup/U77b+DQauDhsM0As=; b=GdRUPf28kjrR0XnJ0gR2C6H18jBK4PVbMcr5hypItmHHSax+QSaZsa+9vl1UW8wEa5HSlGRv83loCqckx0KgzKlYRYTNbdHkTtuBn3Ft8s0RjhxkpIx1t47mVuOxASbv4lPib7M7/oDy7qPqX81J/ndk36ftuWdpQOo69TXsIRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605319080461258.0967844610809; Fri, 13 Nov 2020 17:58:00 -0800 (PST) Received: from localhost ([::1]:38946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdkpD-0004Zj-3m for importer@patchew.org; Fri, 13 Nov 2020 20:57:59 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48634) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkht-0006rp-Ks for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:25 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:33438) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhj-0002a4-3k for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:25 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1o7O8171657; Sat, 14 Nov 2020 01:50:08 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by aserp2130.oracle.com with ESMTP id 34t4rag2m3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 14 Nov 2020 01:50:08 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1j5oW088977; Sat, 14 Nov 2020 01:50:08 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserp3020.oracle.com with ESMTP id 34p5g5th7q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 14 Nov 2020 01:50:07 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AE1o6XG022742; Sat, 14 Nov 2020 01:50:06 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.230.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 17:50:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=Je/fMNKSXxa8BJPNC8SEGTwmup/U77b+DQauDhsM0As=; b=rZlQdD4a40ntVLKDZtQeUeBJasIgct83CTYOL7hB1Yy5CpDHhn1nR148vyZSrudOtvGR wIKn0X/QP7e3gcIYquq6L95eeI18WHaQ5/6d0jy5+J3MyKHdm0SzjMPCPJGGptkOckLl UfGCFc7Aq7TdP2LE7AU/ukRagtw4KEjsNaqkLe9We9n4h0IkqE6xAJJcSvcmr5f5/nDv Cv1NDTlCEEwkw5Gg5Tp0ReXmKRrEZJj6kDUgUPJeAR5eMZn7SKfuu70u4xM0U1ETlJ4Q SnfyyMyBkL4Twvg7vALgt4+3aQhI6WJBtgw2Tm1FXQEVPyenLE4943mdHGx2CZqWbMmj Ug== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 2/5 v5] KVM: SVM: Fill in conforming svm_x86_ops via macro Date: Sat, 14 Nov 2020 01:49:52 +0000 Message-Id: <20201114014955.19749-3-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201114014955.19749-1-krish.sadhukhan@oracle.com> References: <20201114014955.19749-1-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 malwarescore=0 adultscore=0 phishscore=0 bulkscore=0 mlxlogscore=999 suspectscore=3 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 adultscore=0 phishscore=0 suspectscore=3 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.79; envelope-from=krish.sadhukhan@oracle.com; helo=aserp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 18:55:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, vkuznets@redhat.com, qemu-devel@nongnu.org, sean.j.christopherson@intel.com, jmattson@google.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The names of some of the svm_x86_ops functions do not have a corresponding 'svm_' prefix. Generate the names using a macro so that the names are conformant. Fixing the naming will help in better readability and maintenance of the code. Suggested-by: Vitaly Kuznetsov Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson Reported-by: kernel test robot Signed-off-by: Krish Sadhukhan --- arch/x86/kvm/pmu.h | 2 +- arch/x86/kvm/svm/avic.c | 11 +- arch/x86/kvm/svm/pmu.c | 2 +- arch/x86/kvm/svm/sev.c | 4 +- arch/x86/kvm/svm/svm.c | 298 ++++++++++++++++++++++------------------ arch/x86/kvm/svm/svm.h | 15 +- arch/x86/kvm/x86.c | 11 +- 7 files changed, 188 insertions(+), 155 deletions(-) diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index 067fef51760c..a7f1f048c6a8 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -161,5 +161,5 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, = void __user *argp); bool is_vmware_backdoor_pmc(u32 pmc_idx); =20 extern struct kvm_pmu_ops intel_pmu_ops; -extern struct kvm_pmu_ops amd_pmu_ops; +extern struct kvm_pmu_ops svm_pmu_ops; #endif /* __KVM_X86_PMU_H */ diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c index 8c550999ace0..1e709237a77f 100644 --- a/arch/x86/kvm/svm/avic.c +++ b/arch/x86/kvm/svm/avic.c @@ -577,7 +577,12 @@ int avic_init_vcpu(struct vcpu_svm *svm) return ret; } =20 -void avic_post_state_restore(struct kvm_vcpu *vcpu) +int svm_sync_pir_to_irr(struct kvm_vcpu *vcpu) +{ + return kvm_lapic_find_highest_irr(vcpu); +} + +void svm_apicv_post_state_restore(struct kvm_vcpu *vcpu) { if (avic_handle_apic_id_update(vcpu) !=3D 0) return; @@ -658,7 +663,7 @@ void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu) * we need to check and update the AVIC logical APIC ID table * accordingly before re-activating. */ - avic_post_state_restore(vcpu); + svm_apicv_post_state_restore(vcpu); vmcb->control.int_ctl |=3D AVIC_ENABLE_MASK; } else { vmcb->control.int_ctl &=3D ~AVIC_ENABLE_MASK; @@ -673,7 +678,7 @@ void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *e= oi_exit_bitmap) return; } =20 -int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec) +int svm_deliver_interrupt(struct kvm_vcpu *vcpu, int vec) { if (!vcpu->arch.apicv_active) return -1; diff --git a/arch/x86/kvm/svm/pmu.c b/arch/x86/kvm/svm/pmu.c index 035da07500e8..e518372ab292 100644 --- a/arch/x86/kvm/svm/pmu.c +++ b/arch/x86/kvm/svm/pmu.c @@ -311,7 +311,7 @@ static void amd_pmu_reset(struct kvm_vcpu *vcpu) } } =20 -struct kvm_pmu_ops amd_pmu_ops =3D { +struct kvm_pmu_ops svm_pmu_ops =3D { .find_arch_event =3D amd_find_arch_event, .find_fixed_event =3D amd_find_fixed_event, .pmc_is_enabled =3D amd_pmc_is_enabled, diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index c0b14106258a..53d8a6fbaf8e 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -984,7 +984,7 @@ int svm_mem_enc_op(struct kvm *kvm, void __user *argp) return r; } =20 -int svm_register_enc_region(struct kvm *kvm, +int svm_mem_enc_register_region(struct kvm *kvm, struct kvm_enc_region *range) { struct kvm_sev_info *sev =3D &to_kvm_svm(kvm)->sev_info; @@ -1053,7 +1053,7 @@ static void __unregister_enc_region_locked(struct kvm= *kvm, kfree(region); } =20 -int svm_unregister_enc_region(struct kvm *kvm, +int svm_mem_enc_unregister_region(struct kvm *kvm, struct kvm_enc_region *range) { struct enc_region *region; diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 5ee8eef1905a..2c96a0e88b1e 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -332,7 +332,7 @@ static void svm_set_interrupt_shadow(struct kvm_vcpu *v= cpu, int mask) =20 } =20 -static int skip_emulated_instruction(struct kvm_vcpu *vcpu) +static int svm_skip_emulated_instruction(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -371,7 +371,7 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu) * raises a fault that is not intercepted. Still better than * failing in all cases. */ - (void)skip_emulated_instruction(&svm->vcpu); + (void)svm_skip_emulated_instruction(&svm->vcpu); rip =3D kvm_rip_read(&svm->vcpu); svm->int3_rip =3D rip + svm->vmcb->save.cs.base; svm->int3_injected =3D rip - old_rip; @@ -1284,7 +1284,7 @@ static void svm_vcpu_reset(struct kvm_vcpu *vcpu, boo= l init_event) avic_update_vapic_bar(svm, APIC_DEFAULT_PHYS_BASE); } =20 -static int svm_create_vcpu(struct kvm_vcpu *vcpu) +static int svm_vcpu_create(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm; struct page *vmcb_page; @@ -1338,7 +1338,7 @@ static void svm_clear_current_vmcb(struct vmcb *vmcb) cmpxchg(&per_cpu(svm_data, i)->current_vmcb, vmcb, NULL); } =20 -static void svm_free_vcpu(struct kvm_vcpu *vcpu) +static void svm_vcpu_free(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -1648,6 +1648,15 @@ static void update_cr0_intercept(struct vcpu_svm *sv= m) } } =20 +static void svm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) +{ + struct kvm_segment cs; + + kvm_get_segment(vcpu, &cs, VCPU_SREG_CS); + *db =3D cs.db; + *l =3D cs.l; +} + void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { struct vcpu_svm *svm =3D to_svm(vcpu); @@ -1691,7 +1700,7 @@ int svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long = cr4) return 1; =20 if (npt_enabled && ((old_cr4 ^ cr4) & X86_CR4_PGE)) - svm_flush_tlb(vcpu); + svm_tlb_flush(vcpu); =20 vcpu->arch.cr4 =3D cr4; if (!npt_enabled) @@ -1733,7 +1742,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu, vmcb_mark_dirty(svm->vmcb, VMCB_SEG); } =20 -static void update_exception_bitmap(struct kvm_vcpu *vcpu) +static void svm_update_exception_bitmap(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -2248,7 +2257,7 @@ static int task_switch_interception(struct vcpu_svm *= svm) int_type =3D=3D SVM_EXITINTINFO_TYPE_SOFT || (int_type =3D=3D SVM_EXITINTINFO_TYPE_EXEPT && (int_vec =3D=3D OF_VECTOR || int_vec =3D=3D BP_VECTOR))) { - if (!skip_emulated_instruction(&svm->vcpu)) + if (!svm_skip_emulated_instruction(&svm->vcpu)) return 0; } =20 @@ -3058,7 +3067,7 @@ static void svm_get_exit_info(struct kvm_vcpu *vcpu, = u64 *info1, u64 *info2, *error_code =3D 0; } =20 -static int handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) +static int svm_handle_exit(struct kvm_vcpu *vcpu, fastpath_t exit_fastpath) { struct vcpu_svm *svm =3D to_svm(vcpu); struct kvm_run *kvm_run =3D vcpu->run; @@ -3164,7 +3173,7 @@ static void svm_inject_nmi(struct kvm_vcpu *vcpu) ++vcpu->stat.nmi_injections; } =20 -static void svm_set_irq(struct kvm_vcpu *vcpu) +static void svm_inject_irq(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3177,7 +3186,7 @@ static void svm_set_irq(struct kvm_vcpu *vcpu) SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR; } =20 -static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) +static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int i= rr) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3286,7 +3295,7 @@ static int svm_interrupt_allowed(struct kvm_vcpu *vcp= u, bool for_injection) return !svm_interrupt_blocked(vcpu); } =20 -static void enable_irq_window(struct kvm_vcpu *vcpu) +static void svm_enable_irq_window(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3310,7 +3319,7 @@ static void enable_irq_window(struct kvm_vcpu *vcpu) } } =20 -static void enable_nmi_window(struct kvm_vcpu *vcpu) +static void svm_enable_nmi_window(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3343,7 +3352,7 @@ static int svm_set_identity_map_addr(struct kvm *kvm,= u64 ident_addr) return 0; } =20 -void svm_flush_tlb(struct kvm_vcpu *vcpu) +void svm_tlb_flush(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3360,14 +3369,29 @@ void svm_flush_tlb(struct kvm_vcpu *vcpu) svm->asid_generation--; } =20 -static void svm_flush_tlb_gva(struct kvm_vcpu *vcpu, gva_t gva) +static void svm_tlb_flush_all(struct kvm_vcpu *vcpu) +{ + svm_tlb_flush(vcpu); +} + +static void svm_tlb_flush_current(struct kvm_vcpu *vcpu) +{ + svm_tlb_flush(vcpu); +} + +static void svm_tlb_flush_guest(struct kvm_vcpu *vcpu) +{ + svm_tlb_flush(vcpu); +} + +static void svm_tlb_flush_gva(struct kvm_vcpu *vcpu, gva_t gva) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 invlpga(gva, svm->vmcb->control.asid); } =20 -static void svm_prepare_guest_switch(struct kvm_vcpu *vcpu) +static void svm_prepare_switch_to_guest(struct kvm_vcpu *vcpu) { } =20 @@ -3962,6 +3986,11 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu, return ret; } =20 +static void svm_request_immediate_exit(struct kvm_vcpu *vcpu) +{ + __kvm_request_immediate_exit(vcpu); +} + static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu) { } @@ -4057,7 +4086,7 @@ static int svm_pre_leave_smm(struct kvm_vcpu *vcpu, c= onst char *smstate) return ret; } =20 -static void enable_smi_window(struct kvm_vcpu *vcpu) +static void svm_enable_smi_window(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -4176,125 +4205,132 @@ static int svm_vm_init(struct kvm *kvm) return 0; } =20 +#define KVM_X86_OP_NAME(name) .name =3D svm_##name +#define KVM_X86_OP_PTR(ptr) .ptr =3D &svm_##ptr + static struct kvm_x86_ops svm_x86_ops __initdata =3D { - .hardware_teardown =3D svm_hardware_teardown, - .hardware_enable =3D svm_hardware_enable, - .hardware_disable =3D svm_hardware_disable, - .cpu_has_accelerated_tpr =3D svm_cpu_has_accelerated_tpr, - .has_emulated_msr =3D svm_has_emulated_msr, + KVM_X86_OP_NAME(hardware_teardown), + KVM_X86_OP_NAME(hardware_enable), + KVM_X86_OP_NAME(hardware_disable), + KVM_X86_OP_NAME(cpu_has_accelerated_tpr), + KVM_X86_OP_NAME(has_emulated_msr), =20 - .vcpu_create =3D svm_create_vcpu, - .vcpu_free =3D svm_free_vcpu, - .vcpu_reset =3D svm_vcpu_reset, + KVM_X86_OP_NAME(vcpu_create), + KVM_X86_OP_NAME(vcpu_free), + KVM_X86_OP_NAME(vcpu_reset), =20 .vm_size =3D sizeof(struct kvm_svm), - .vm_init =3D svm_vm_init, - .vm_destroy =3D svm_vm_destroy, - - .prepare_guest_switch =3D svm_prepare_guest_switch, - .vcpu_load =3D svm_vcpu_load, - .vcpu_put =3D svm_vcpu_put, - .vcpu_blocking =3D svm_vcpu_blocking, - .vcpu_unblocking =3D svm_vcpu_unblocking, - - .update_exception_bitmap =3D update_exception_bitmap, - .get_msr_feature =3D svm_get_msr_feature, - .get_msr =3D svm_get_msr, - .set_msr =3D svm_set_msr, - .get_segment_base =3D svm_get_segment_base, - .get_segment =3D svm_get_segment, - .set_segment =3D svm_set_segment, - .get_cpl =3D svm_get_cpl, - .get_cs_db_l_bits =3D kvm_get_cs_db_l_bits, - .set_cr0 =3D svm_set_cr0, - .set_cr4 =3D svm_set_cr4, - .set_efer =3D svm_set_efer, - .get_idt =3D svm_get_idt, - .set_idt =3D svm_set_idt, - .get_gdt =3D svm_get_gdt, - .set_gdt =3D svm_set_gdt, - .set_dr7 =3D svm_set_dr7, - .sync_dirty_debug_regs =3D svm_sync_dirty_debug_regs, - .cache_reg =3D svm_cache_reg, - .get_rflags =3D svm_get_rflags, - .set_rflags =3D svm_set_rflags, - - .tlb_flush_all =3D svm_flush_tlb, - .tlb_flush_current =3D svm_flush_tlb, - .tlb_flush_gva =3D svm_flush_tlb_gva, - .tlb_flush_guest =3D svm_flush_tlb, - - .vcpu_run =3D svm_vcpu_run, - .handle_exit =3D handle_exit, - .skip_emulated_instruction =3D skip_emulated_instruction, - .update_emulated_instruction =3D NULL, - .set_interrupt_shadow =3D svm_set_interrupt_shadow, - .get_interrupt_shadow =3D svm_get_interrupt_shadow, - .patch_hypercall =3D svm_patch_hypercall, - .inject_irq =3D svm_set_irq, - .inject_nmi =3D svm_inject_nmi, - .queue_exception =3D svm_queue_exception, - .cancel_injection =3D svm_cancel_injection, - .interrupt_allowed =3D svm_interrupt_allowed, - .nmi_allowed =3D svm_nmi_allowed, - .get_nmi_mask =3D svm_get_nmi_mask, - .set_nmi_mask =3D svm_set_nmi_mask, - .enable_nmi_window =3D enable_nmi_window, - .enable_irq_window =3D enable_irq_window, - .update_cr8_intercept =3D update_cr8_intercept, - .set_virtual_apic_mode =3D svm_set_virtual_apic_mode, - .refresh_apicv_exec_ctrl =3D svm_refresh_apicv_exec_ctrl, - .check_apicv_inhibit_reasons =3D svm_check_apicv_inhibit_reasons, - .pre_update_apicv_exec_ctrl =3D svm_pre_update_apicv_exec_ctrl, - .load_eoi_exitmap =3D svm_load_eoi_exitmap, - .hwapic_irr_update =3D svm_hwapic_irr_update, - .hwapic_isr_update =3D svm_hwapic_isr_update, - .sync_pir_to_irr =3D kvm_lapic_find_highest_irr, - .apicv_post_state_restore =3D avic_post_state_restore, - - .set_tss_addr =3D svm_set_tss_addr, - .set_identity_map_addr =3D svm_set_identity_map_addr, - .get_mt_mask =3D svm_get_mt_mask, - - .get_exit_info =3D svm_get_exit_info, - - .vcpu_after_set_cpuid =3D svm_vcpu_after_set_cpuid, - - .has_wbinvd_exit =3D svm_has_wbinvd_exit, - - .write_l1_tsc_offset =3D svm_write_l1_tsc_offset, - - .load_mmu_pgd =3D svm_load_mmu_pgd, - - .check_intercept =3D svm_check_intercept, - .handle_exit_irqoff =3D svm_handle_exit_irqoff, - - .request_immediate_exit =3D __kvm_request_immediate_exit, - - .sched_in =3D svm_sched_in, - - .pmu_ops =3D &amd_pmu_ops, - .nested_ops =3D &svm_nested_ops, - - .deliver_interrupt =3D svm_deliver_avic_intr, - .dy_apicv_has_pending_interrupt =3D svm_dy_apicv_has_pending_interrupt, - .update_pi_irte =3D svm_update_pi_irte, - .setup_mce =3D svm_setup_mce, - - .smi_allowed =3D svm_smi_allowed, - .pre_enter_smm =3D svm_pre_enter_smm, - .pre_leave_smm =3D svm_pre_leave_smm, - .enable_smi_window =3D enable_smi_window, - - .mem_enc_op =3D svm_mem_enc_op, - .mem_enc_register_region =3D svm_register_enc_region, - .mem_enc_unregister_region =3D svm_unregister_enc_region, - - .can_emulate_instruction =3D svm_can_emulate_instruction, - - .apic_init_signal_blocked =3D svm_apic_init_signal_blocked, - - .msr_filter_changed =3D svm_msr_filter_changed, + + KVM_X86_OP_NAME(vm_init), + KVM_X86_OP_NAME(vm_destroy), + + KVM_X86_OP_NAME(prepare_switch_to_guest), + KVM_X86_OP_NAME(vcpu_load), + KVM_X86_OP_NAME(vcpu_put), + KVM_X86_OP_NAME(vcpu_blocking), + KVM_X86_OP_NAME(vcpu_unblocking), + + KVM_X86_OP_NAME(update_exception_bitmap), + KVM_X86_OP_NAME(get_msr_feature), + KVM_X86_OP_NAME(get_msr), + KVM_X86_OP_NAME(set_msr), + KVM_X86_OP_NAME(get_segment_base), + KVM_X86_OP_NAME(get_segment), + KVM_X86_OP_NAME(set_segment), + KVM_X86_OP_NAME(get_cpl), + + KVM_X86_OP_NAME(get_cs_db_l_bits), + + KVM_X86_OP_NAME(set_cr0), + KVM_X86_OP_NAME(set_cr4), + KVM_X86_OP_NAME(set_efer), + KVM_X86_OP_NAME(get_idt), + KVM_X86_OP_NAME(set_idt), + KVM_X86_OP_NAME(get_gdt), + KVM_X86_OP_NAME(set_gdt), + KVM_X86_OP_NAME(set_dr7), + KVM_X86_OP_NAME(sync_dirty_debug_regs), + KVM_X86_OP_NAME(cache_reg), + KVM_X86_OP_NAME(get_rflags), + KVM_X86_OP_NAME(set_rflags), + + KVM_X86_OP_NAME(tlb_flush_all), + KVM_X86_OP_NAME(tlb_flush_current), + KVM_X86_OP_NAME(tlb_flush_gva), + KVM_X86_OP_NAME(tlb_flush_guest), + + KVM_X86_OP_NAME(vcpu_run), + KVM_X86_OP_NAME(handle_exit), + KVM_X86_OP_NAME(skip_emulated_instruction), + + KVM_X86_OP_NAME(set_interrupt_shadow), + KVM_X86_OP_NAME(get_interrupt_shadow), + KVM_X86_OP_NAME(patch_hypercall), + KVM_X86_OP_NAME(inject_irq), + KVM_X86_OP_NAME(inject_nmi), + KVM_X86_OP_NAME(queue_exception), + KVM_X86_OP_NAME(cancel_injection), + KVM_X86_OP_NAME(interrupt_allowed), + KVM_X86_OP_NAME(nmi_allowed), + KVM_X86_OP_NAME(get_nmi_mask), + KVM_X86_OP_NAME(set_nmi_mask), + KVM_X86_OP_NAME(enable_nmi_window), + KVM_X86_OP_NAME(enable_irq_window), + KVM_X86_OP_NAME(update_cr8_intercept), + KVM_X86_OP_NAME(set_virtual_apic_mode), + KVM_X86_OP_NAME(refresh_apicv_exec_ctrl), + KVM_X86_OP_NAME(check_apicv_inhibit_reasons), + KVM_X86_OP_NAME(pre_update_apicv_exec_ctrl), + KVM_X86_OP_NAME(load_eoi_exitmap), + KVM_X86_OP_NAME(hwapic_irr_update), + KVM_X86_OP_NAME(hwapic_isr_update), + + KVM_X86_OP_NAME(sync_pir_to_irr), + KVM_X86_OP_NAME(apicv_post_state_restore), + + KVM_X86_OP_NAME(set_tss_addr), + KVM_X86_OP_NAME(set_identity_map_addr), + KVM_X86_OP_NAME(get_mt_mask), + + KVM_X86_OP_NAME(get_exit_info), + + KVM_X86_OP_NAME(vcpu_after_set_cpuid), + + KVM_X86_OP_NAME(has_wbinvd_exit), + + KVM_X86_OP_NAME(write_l1_tsc_offset), + + KVM_X86_OP_NAME(load_mmu_pgd), + + KVM_X86_OP_NAME(check_intercept), + KVM_X86_OP_NAME(handle_exit_irqoff), + + KVM_X86_OP_NAME(request_immediate_exit), + + KVM_X86_OP_NAME(sched_in), + + KVM_X86_OP_PTR(pmu_ops), + KVM_X86_OP_PTR(nested_ops), + + KVM_X86_OP_NAME(deliver_interrupt), + KVM_X86_OP_NAME(dy_apicv_has_pending_interrupt), + KVM_X86_OP_NAME(update_pi_irte), + KVM_X86_OP_NAME(setup_mce), + + KVM_X86_OP_NAME(smi_allowed), + KVM_X86_OP_NAME(pre_enter_smm), + KVM_X86_OP_NAME(pre_leave_smm), + KVM_X86_OP_NAME(enable_smi_window), + + KVM_X86_OP_NAME(mem_enc_op), + KVM_X86_OP_NAME(mem_enc_register_region), + KVM_X86_OP_NAME(mem_enc_unregister_region), + + KVM_X86_OP_NAME(can_emulate_instruction), + + KVM_X86_OP_NAME(apic_init_signal_blocked), + + KVM_X86_OP_NAME(msr_filter_changed), }; =20 static struct kvm_x86_init_ops svm_init_ops __initdata =3D { diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index 1d853fe4c778..de535a2d59a3 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -359,7 +359,7 @@ void svm_vcpu_free_msrpm(u32 *msrpm); int svm_set_efer(struct kvm_vcpu *vcpu, u64 efer); void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); int svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); -void svm_flush_tlb(struct kvm_vcpu *vcpu); +void svm_tlb_flush(struct kvm_vcpu *vcpu); void disable_nmi_singlestep(struct vcpu_svm *svm); bool svm_smi_blocked(struct kvm_vcpu *vcpu); bool svm_nmi_blocked(struct kvm_vcpu *vcpu); @@ -453,7 +453,8 @@ int avic_unaccelerated_access_interception(struct vcpu_= svm *svm); int avic_init_vcpu(struct vcpu_svm *svm); void avic_vcpu_load(struct kvm_vcpu *vcpu, int cpu); void avic_vcpu_put(struct kvm_vcpu *vcpu); -void avic_post_state_restore(struct kvm_vcpu *vcpu); +int svm_sync_pir_to_irr(struct kvm_vcpu *vcpu); +void svm_apicv_post_state_restore(struct kvm_vcpu *vcpu); void svm_set_virtual_apic_mode(struct kvm_vcpu *vcpu); void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu); bool svm_check_apicv_inhibit_reasons(ulong bit); @@ -461,7 +462,7 @@ void svm_pre_update_apicv_exec_ctrl(struct kvm *kvm, bo= ol activate); void svm_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap); void svm_hwapic_irr_update(struct kvm_vcpu *vcpu, int max_irr); void svm_hwapic_isr_update(struct kvm_vcpu *vcpu, int max_isr); -int svm_deliver_avic_intr(struct kvm_vcpu *vcpu, int vec); +int svm_deliver_interrupt(struct kvm_vcpu *vcpu, int vec); bool svm_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu); int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_irq, bool set); @@ -490,10 +491,10 @@ static inline bool svm_sev_enabled(void) =20 void sev_vm_destroy(struct kvm *kvm); int svm_mem_enc_op(struct kvm *kvm, void __user *argp); -int svm_register_enc_region(struct kvm *kvm, - struct kvm_enc_region *range); -int svm_unregister_enc_region(struct kvm *kvm, - struct kvm_enc_region *range); +int svm_mem_enc_register_region(struct kvm *kvm, + struct kvm_enc_region *range); +int svm_mem_enc_unregister_region(struct kvm *kvm, + struct kvm_enc_region *range); void pre_sev_run(struct vcpu_svm *svm, int cpu); int __init sev_hardware_setup(void); void sev_hardware_teardown(void); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index a982a971db7c..1517575dca61 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5807,6 +5807,7 @@ void kvm_get_segment(struct kvm_vcpu *vcpu, { kvm_x86_ops.get_segment(vcpu, var, seg); } +EXPORT_SYMBOL_GPL(kvm_get_segment); =20 gpa_t translate_nested_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access, struct x86_exception *exception) @@ -9363,16 +9364,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vc= pu, struct kvm_regs *regs) return 0; } =20 -void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l) -{ - struct kvm_segment cs; - - kvm_get_segment(vcpu, &cs, VCPU_SREG_CS); - *db =3D cs.db; - *l =3D cs.l; -} -EXPORT_SYMBOL_GPL(kvm_get_cs_db_l_bits); - static void __get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) { struct desc_ptr dt; --=20 2.27.0 From nobody Sun Apr 28 15:29:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605318859; cv=none; d=zohomail.com; s=zohoarc; b=V693LjNRh6PaColdXR+vPqleEwtjMwix7exzXoZSQtZJ4yIMe/mzl70YW7lqQJzO10Ru1ecSMyXiJBta4tIPXMyLrW2wvAupuydznFSLVVLBnbtrKTUqvnLZu8/tv41JAbBDo9m9FCvBlbCxPK7c3FrYfEc7ZwoJCVb+kRbtBsM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605318859; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RoY7vADXvZBH6eQ1YOmB9jmZ9jrthxlBzJHtzmbeFro=; b=ndjJHs83eU63fO/qVO54KZZxaGjicgGIji3hIMQGzD1e5HQCJLUbbAjOfL2eA0jj0mh0IIP+x2syLXkizXsQH9q9b8ZKaGT/1Jtng8ZuSj7iPQkV+HgL45hosbcwnmoknl6e6acOuEKvaD03oE/7jywokYpBq8iNGYTV1cKuWOs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605318859341686.6060868756547; Fri, 13 Nov 2020 17:54:19 -0800 (PST) Received: from localhost ([::1]:34206 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdkle-0002Wo-BF for importer@patchew.org; Fri, 13 Nov 2020 20:54:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48628) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhq-0006o4-4F for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:22 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:47700) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhj-0002Zf-3N for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:21 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1o8KY027197; Sat, 14 Nov 2020 01:50:08 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 34p72f31cq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 14 Nov 2020 01:50:08 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1kJr6142811; Sat, 14 Nov 2020 01:50:08 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3030.oracle.com with ESMTP id 34t4bsbp8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 14 Nov 2020 01:50:08 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AE1o7Wp022745; Sat, 14 Nov 2020 01:50:07 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.230.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 17:50:06 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=RoY7vADXvZBH6eQ1YOmB9jmZ9jrthxlBzJHtzmbeFro=; b=pa4zURwm0Ng7ZkvNYA4+P0E7k/J+yMvUjUJol2Xy+AzFX9DQcrmjma5i/moJ3+sSG/sw fy49r9TZTKhC4gynA3Z1xoVyoCle4PAQiRC9x+tkC0vbwglMH3YDQp1hLoUINToQsSJm Ioegyp5TDHlHsVlmYOw9sXiqSu8a63zAkmLB6F8eAfla+0GmS9Xwoql5z5HZsqg8dLhG vqTJwlVaPgrMmQVPwaUSEP8XJd8rHrCSRbLZaKlRiilRFcEwpNCnvfIXFqlpnhZO4Dmp ZjesXpoKRSByulHb4NZknKVOBFxzaZxzTjLMtC8A3gCVSY07uM6anugn9elwuFvSx19O mA== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 3/5 v5] KVM: nSVM: Fill in conforming svm_nested_ops via macro Date: Sat, 14 Nov 2020 01:49:53 +0000 Message-Id: <20201114014955.19749-4-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201114014955.19749-1-krish.sadhukhan@oracle.com> References: <20201114014955.19749-1-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 adultscore=0 mlxlogscore=999 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=1 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.85; envelope-from=krish.sadhukhan@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 20:50:10 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, vkuznets@redhat.com, qemu-devel@nongnu.org, sean.j.christopherson@intel.com, jmattson@google.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The names of the nested_svm_ops functions do not have a corresponding 'nested_svm_' prefix. Generate the names using a macro so that the names are conformant. Fixing the naming will help in better readability and maintenance of the code. Suggested-by: Vitaly Kuznetsov Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson Signed-off-by: Krish Sadhukhan --- arch/x86/kvm/svm/nested.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 200674190449..4cdeacaf768f 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -196,7 +196,7 @@ static bool nested_svm_vmrun_msrpm(struct vcpu_svm *svm) return true; } =20 -static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu) +static bool nested_svm_get_pages(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); if (!nested_svm_vmrun_msrpm(svm)) { @@ -834,7 +834,7 @@ static int nested_svm_intercept(struct vcpu_svm *svm) /* * Host-intercepted exceptions have been checked already in * nested_svm_exit_special. There is nothing to do here, - * the vmexit is injected by svm_check_nested_events. + * the vmexit is injected by nested_svm_check_events. */ vmexit =3D NESTED_EXIT_DONE; break; @@ -965,7 +965,7 @@ static void nested_svm_init(struct vcpu_svm *svm) } =20 =20 -static int svm_check_nested_events(struct kvm_vcpu *vcpu) +static int nested_svm_check_events(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); bool block_nested_events =3D @@ -1049,7 +1049,7 @@ int nested_svm_exit_special(struct vcpu_svm *svm) return NESTED_EXIT_CONTINUE; } =20 -static int svm_get_nested_state(struct kvm_vcpu *vcpu, +static int nested_svm_get_state(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state, u32 user_data_size) { @@ -1106,7 +1106,7 @@ static int svm_get_nested_state(struct kvm_vcpu *vcpu, return kvm_state.size; } =20 -static int svm_set_nested_state(struct kvm_vcpu *vcpu, +static int nested_svm_set_state(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state, struct kvm_nested_state *kvm_state) { @@ -1209,9 +1209,11 @@ static int svm_set_nested_state(struct kvm_vcpu *vcp= u, return ret; } =20 +#define KVM_X86_NESTED_OP_NAME(name) .name =3D nested_svm_##name + struct kvm_x86_nested_ops svm_nested_ops =3D { - .check_events =3D svm_check_nested_events, - .get_pages =3D svm_get_nested_state_pages, - .get_state =3D svm_get_nested_state, - .set_state =3D svm_set_nested_state, + KVM_X86_NESTED_OP_NAME(check_events), + KVM_X86_NESTED_OP_NAME(get_pages), + KVM_X86_NESTED_OP_NAME(get_state), + KVM_X86_NESTED_OP_NAME(set_state), }; --=20 2.27.0 From nobody Sun Apr 28 15:29:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605318865; cv=none; d=zohomail.com; s=zohoarc; b=fu96Kekrdj5M+HXU+YxzBApuQQeNLBFiXzQeUkrdHbVHLUhHcfhKA9IpoW80Z45TvxZfqr95LkgW905MupQM9le3QQzI+d1VDFbYi//fKORVOXtAQUdt4x4PeKRJtN2VDKZyMIq0F+EfW27GhUXt+LF1MQYAiWSDpVm5yhVzdeE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605318865; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=3PkGVVQL+HZ37SRMzxKwwnild564X8Vhiu55NW/g/Kc=; b=a97R4IERvftFpKAw94F2Qap2VyEbyimVOp+2XUBS6BxKpzzz5GJHb17qvQCMKBvndGg+lj3iFLIoLTOOXs2MiLgY0b0LrBeqXHC0hiuCw3O+FVZNi9YyryWe6KvKOEKL8MzFpQCNP9+ivQQ92CWnSywpAgljexSJNVp2ngruWfU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605318865826869.2186655359723; Fri, 13 Nov 2020 17:54:25 -0800 (PST) Received: from localhost ([::1]:34614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdklk-0002gp-NE for importer@patchew.org; Fri, 13 Nov 2020 20:54:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhs-0006p1-B0 for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:24 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:33420) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhj-0002Zs-AO for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:24 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1oAVx171662; Sat, 14 Nov 2020 01:50:10 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by aserp2130.oracle.com with ESMTP id 34t4rag2m4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 14 Nov 2020 01:50:09 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1kNA5143021; Sat, 14 Nov 2020 01:50:09 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 34t4bsbp94-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 14 Nov 2020 01:50:08 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0AE1o7c6007049; Sat, 14 Nov 2020 01:50:07 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.230.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 17:50:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=3PkGVVQL+HZ37SRMzxKwwnild564X8Vhiu55NW/g/Kc=; b=COBehHLkGPbydwrLgOp+ewn47haDtBpTp+wJzXZt/4WIlwziI0GZtxE9iunpPGIoyRlw Ks8yvhXIDwiVE0Pp8bmZlecntAsZASd3t6yLKhl7rYofHpVN4iBlfprkejq/qyY572MI 8JRwrgxqYFJSNRaQXokmQkNZszifq4VbYxMPBqvNAfBAlnUiDRNQsoGjFWVnRSue5Gpw OoJluyvLm4nWiFyUySN/iySQ9e0sO8HqgznQZRnm1pwT2VtGNBx3JFqrLrFW1p1WOQY6 P3WGHCArZu+smIm3zoO535k5iwDJ/oA+7u2Gg4KfOYcQe5Mh/kLCIcJK+vF8hLOpzpuf YQ== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 4/5 v5] KVM: VMX: Fill in conforming vmx_x86_ops via macro Date: Sat, 14 Nov 2020 01:49:54 +0000 Message-Id: <20201114014955.19749-5-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201114014955.19749-1-krish.sadhukhan@oracle.com> References: <20201114014955.19749-1-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 adultscore=0 mlxlogscore=938 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 clxscore=1015 malwarescore=0 impostorscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=951 adultscore=0 phishscore=0 suspectscore=3 spamscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=141.146.126.79; envelope-from=krish.sadhukhan@oracle.com; helo=aserp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 18:55:29 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, vkuznets@redhat.com, qemu-devel@nongnu.org, sean.j.christopherson@intel.com, jmattson@google.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The names of some of the vmx_x86_ops functions do not have a corresponding 'vmx_' prefix. Generate the names using a macro so that the names are conformant. Fixing the naming will help in better readability and maintenance of the code. Suggested-by: Vitaly Kuznetsov Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson Signed-off-by: Krish Sadhukhan --- arch/x86/kvm/pmu.h | 2 +- arch/x86/kvm/vmx/nested.c | 2 +- arch/x86/kvm/vmx/pmu_intel.c | 2 +- arch/x86/kvm/vmx/posted_intr.c | 6 +- arch/x86/kvm/vmx/posted_intr.h | 4 +- arch/x86/kvm/vmx/vmx.c | 260 +++++++++++++++++---------------- arch/x86/kvm/vmx/vmx.h | 2 +- 7 files changed, 141 insertions(+), 137 deletions(-) diff --git a/arch/x86/kvm/pmu.h b/arch/x86/kvm/pmu.h index a7f1f048c6a8..b8049ee4d1ab 100644 --- a/arch/x86/kvm/pmu.h +++ b/arch/x86/kvm/pmu.h @@ -160,6 +160,6 @@ int kvm_vm_ioctl_set_pmu_event_filter(struct kvm *kvm, = void __user *argp); =20 bool is_vmware_backdoor_pmc(u32 pmc_idx); =20 -extern struct kvm_pmu_ops intel_pmu_ops; +extern struct kvm_pmu_ops vmx_pmu_ops; extern struct kvm_pmu_ops svm_pmu_ops; #endif /* __KVM_X86_PMU_H */ diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 6c32f73cffd5..104d6782ddc3 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2532,7 +2532,7 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, stru= ct vmcs12 *vmcs12, * bitwise-or of what L1 wants to trap for L2, and what we want to * trap. Note that CR0.TS also needs updating - we do this later. */ - update_exception_bitmap(vcpu); + vmx_update_exception_bitmap(vcpu); vcpu->arch.cr0_guest_owned_bits &=3D ~vmcs12->cr0_guest_host_mask; vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); =20 diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index a886a47daebd..c39f1dbcd436 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -427,7 +427,7 @@ static void intel_pmu_reset(struct kvm_vcpu *vcpu) pmu->global_ovf_ctrl =3D 0; } =20 -struct kvm_pmu_ops intel_pmu_ops =3D { +struct kvm_pmu_ops vmx_pmu_ops =3D { .find_arch_event =3D intel_find_arch_event, .find_fixed_event =3D intel_find_fixed_event, .pmc_is_enabled =3D intel_pmc_is_enabled, diff --git a/arch/x86/kvm/vmx/posted_intr.c b/arch/x86/kvm/vmx/posted_intr.c index f02962dcc72c..39c7ccabfd82 100644 --- a/arch/x86/kvm/vmx/posted_intr.c +++ b/arch/x86/kvm/vmx/posted_intr.c @@ -228,7 +228,7 @@ void __init pi_init_cpu(int cpu) spin_lock_init(&per_cpu(blocked_vcpu_on_cpu_lock, cpu)); } =20 -bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) +bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu) { struct pi_desc *pi_desc =3D vcpu_to_pi_desc(vcpu); =20 @@ -238,7 +238,7 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) =20 =20 /* - * pi_update_irte - set IRTE for Posted-Interrupts + * vmx_pi_update_irte - set IRTE for Posted-Interrupts * * @kvm: kvm * @host_irq: host irq of the interrupt @@ -246,7 +246,7 @@ bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu) * @set: set or unset PI * returns 0 on success, < 0 on failure */ -int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_= irq, +int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, uint32_t gu= est_irq, bool set) { struct kvm_kernel_irq_routing_entry *e; diff --git a/arch/x86/kvm/vmx/posted_intr.h b/arch/x86/kvm/vmx/posted_intr.h index 0bdc41391c5b..76ab06faec26 100644 --- a/arch/x86/kvm/vmx/posted_intr.h +++ b/arch/x86/kvm/vmx/posted_intr.h @@ -92,8 +92,8 @@ int pi_pre_block(struct kvm_vcpu *vcpu); void pi_post_block(struct kvm_vcpu *vcpu); void pi_wakeup_handler(void); void __init pi_init_cpu(int cpu); -bool pi_has_pending_interrupt(struct kvm_vcpu *vcpu); -int pi_update_irte(struct kvm *kvm, unsigned int host_irq, uint32_t guest_= irq, +bool vmx_dy_apicv_has_pending_interrupt(struct kvm_vcpu *vcpu); +int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq, uint32_t gu= est_irq, bool set); =20 #endif /* __KVM_X86_VMX_POSTED_INTR_H */ diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index ddfc127d5c4f..0b8539759ad9 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -629,7 +629,7 @@ static inline bool cpu_need_virtualize_apic_accesses(st= ruct kvm_vcpu *vcpu) return flexpriority_enabled && lapic_in_kernel(vcpu); } =20 -static inline bool report_flexpriority(void) +static inline bool vmx_cpu_has_accelerated_tpr(void) { return flexpriority_enabled; } @@ -807,7 +807,7 @@ static u32 vmx_read_guest_seg_ar(struct vcpu_vmx *vmx, = unsigned seg) return *p; } =20 -void update_exception_bitmap(struct kvm_vcpu *vcpu) +void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu) { u32 eb; =20 @@ -2283,7 +2283,7 @@ static int kvm_cpu_vmxon(u64 vmxon_pointer) return -EFAULT; } =20 -static int hardware_enable(void) +static int vmx_hardware_enable(void) { int cpu =3D raw_smp_processor_id(); u64 phys_addr =3D __pa(per_cpu(vmxarea, cpu)); @@ -2332,7 +2332,7 @@ static void kvm_cpu_vmxoff(void) cr4_clear_bits(X86_CR4_VMXE); } =20 -static void hardware_disable(void) +static void vmx_hardware_disable(void) { vmclear_local_loaded_vmcss(); kvm_cpu_vmxoff(); @@ -2740,7 +2740,7 @@ static void enter_pmode(struct kvm_vcpu *vcpu) vmcs_writel(GUEST_CR4, (vmcs_readl(GUEST_CR4) & ~X86_CR4_VME) | (vmcs_readl(CR4_READ_SHADOW) & X86_CR4_VME)); =20 - update_exception_bitmap(vcpu); + vmx_update_exception_bitmap(vcpu); =20 fix_pmode_seg(vcpu, VCPU_SREG_CS, &vmx->rmode.segs[VCPU_SREG_CS]); fix_pmode_seg(vcpu, VCPU_SREG_SS, &vmx->rmode.segs[VCPU_SREG_SS]); @@ -2820,7 +2820,7 @@ static void enter_rmode(struct kvm_vcpu *vcpu) =20 vmcs_writel(GUEST_RFLAGS, flags); vmcs_writel(GUEST_CR4, vmcs_readl(GUEST_CR4) | X86_CR4_VME); - update_exception_bitmap(vcpu); + vmx_update_exception_bitmap(vcpu); =20 fix_rmode_seg(VCPU_SREG_SS, &vmx->rmode.segs[VCPU_SREG_SS]); fix_rmode_seg(VCPU_SREG_CS, &vmx->rmode.segs[VCPU_SREG_CS]); @@ -2881,7 +2881,7 @@ static void exit_lmode(struct kvm_vcpu *vcpu) =20 #endif =20 -static void vmx_flush_tlb_all(struct kvm_vcpu *vcpu) +static void vmx_tlb_flush_all(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); =20 @@ -2904,7 +2904,7 @@ static void vmx_flush_tlb_all(struct kvm_vcpu *vcpu) } } =20 -static void vmx_flush_tlb_current(struct kvm_vcpu *vcpu) +static void vmx_tlb_flush_current(struct kvm_vcpu *vcpu) { struct kvm_mmu *mmu =3D vcpu->arch.mmu; u64 root_hpa =3D mmu->root_hpa; @@ -2922,7 +2922,7 @@ static void vmx_flush_tlb_current(struct kvm_vcpu *vc= pu) vpid_sync_context(nested_get_vpid02(vcpu)); } =20 -static void vmx_flush_tlb_gva(struct kvm_vcpu *vcpu, gva_t addr) +static void vmx_tlb_flush_gva(struct kvm_vcpu *vcpu, gva_t addr) { /* * vpid_sync_vcpu_addr() is a nop if vmx->vpid=3D=3D0, see the comment in @@ -2931,7 +2931,7 @@ static void vmx_flush_tlb_gva(struct kvm_vcpu *vcpu, = gva_t addr) vpid_sync_vcpu_addr(to_vmx(vcpu)->vpid, addr); } =20 -static void vmx_flush_tlb_guest(struct kvm_vcpu *vcpu) +static void vmx_tlb_flush_guest(struct kvm_vcpu *vcpu) { /* * vpid_sync_context() is a nop if vmx->vpid=3D=3D0, e.g. if enable_vpid= =3D=3D0 @@ -3979,7 +3979,7 @@ static int vmx_deliver_nested_posted_interrupt(struct= kvm_vcpu *vcpu, * 2. If target vcpu isn't running(root mode), kick it to pick up the * interrupt from PIR in next vmentry. */ -static int vmx_deliver_posted_interrupt(struct kvm_vcpu *vcpu, int vector) +static int vmx_deliver_interrupt(struct kvm_vcpu *vcpu, int vector) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); int r; @@ -4470,23 +4470,23 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, b= ool init_event) vmx_set_cr4(vcpu, 0); vmx_set_efer(vcpu, 0); =20 - update_exception_bitmap(vcpu); + vmx_update_exception_bitmap(vcpu); =20 vpid_sync_context(vmx->vpid); if (init_event) vmx_clear_hlt(vcpu); } =20 -static void enable_irq_window(struct kvm_vcpu *vcpu) +static void vmx_enable_irq_window(struct kvm_vcpu *vcpu) { exec_controls_setbit(to_vmx(vcpu), CPU_BASED_INTR_WINDOW_EXITING); } =20 -static void enable_nmi_window(struct kvm_vcpu *vcpu) +static void vmx_enable_nmi_window(struct kvm_vcpu *vcpu) { if (!enable_vnmi || vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_STI) { - enable_irq_window(vcpu); + vmx_enable_irq_window(vcpu); return; } =20 @@ -6149,7 +6149,7 @@ static noinstr void vmx_l1d_flush(struct kvm_vcpu *vc= pu) : "eax", "ebx", "ecx", "edx"); } =20 -static void update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) +static void vmx_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int i= rr) { struct vmcs12 *vmcs12 =3D get_vmcs12(vcpu); int tpr_threshold; @@ -6237,7 +6237,7 @@ static void vmx_set_apic_access_page_addr(struct kvm_= vcpu *vcpu) return; =20 vmcs_write64(APIC_ACCESS_ADDR, page_to_phys(page)); - vmx_flush_tlb_current(vcpu); + vmx_tlb_flush_current(vcpu); =20 /* * Do not pin apic access page in memory, the MMU notifier @@ -6822,7 +6822,7 @@ static fastpath_t vmx_vcpu_run(struct kvm_vcpu *vcpu) return exit_fastpath; } =20 -static void vmx_free_vcpu(struct kvm_vcpu *vcpu) +static void vmx_vcpu_free(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); =20 @@ -6833,7 +6833,7 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu) free_loaded_vmcs(vmx->loaded_vmcs); } =20 -static int vmx_create_vcpu(struct kvm_vcpu *vcpu) +static int vmx_vcpu_create(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx; int i, cpu, err; @@ -7261,7 +7261,7 @@ static void vmx_vcpu_after_set_cpuid(struct kvm_vcpu = *vcpu) set_cr4_guest_host_mask(vmx); =20 /* Refresh #PF interception to account for MAXPHYADDR changes. */ - update_exception_bitmap(vcpu); + vmx_update_exception_bitmap(vcpu); } =20 static __init void vmx_set_cpu_caps(void) @@ -7551,7 +7551,7 @@ static int vmx_pre_leave_smm(struct kvm_vcpu *vcpu, c= onst char *smstate) return 0; } =20 -static void enable_smi_window(struct kvm_vcpu *vcpu) +static void vmx_enable_smi_window(struct kvm_vcpu *vcpu) { /* RSM will cause a vmexit anyway. */ } @@ -7571,7 +7571,7 @@ static void vmx_migrate_timers(struct kvm_vcpu *vcpu) } } =20 -static void hardware_unsetup(void) +static void vmx_hardware_teardown(void) { if (nested) nested_vmx_hardware_unsetup(); @@ -7587,134 +7587,138 @@ static bool vmx_check_apicv_inhibit_reasons(ulong= bit) return supported & BIT(bit); } =20 +#define KVM_X86_OP_NAME(name) .name =3D vmx_##name +#define KVM_X86_OP_PTR(ptr) .ptr =3D &vmx_##ptr + static struct kvm_x86_ops vmx_x86_ops __initdata =3D { - .hardware_teardown =3D hardware_unsetup, + KVM_X86_OP_NAME(hardware_teardown), =20 - .hardware_enable =3D hardware_enable, - .hardware_disable =3D hardware_disable, - .cpu_has_accelerated_tpr =3D report_flexpriority, - .has_emulated_msr =3D vmx_has_emulated_msr, + KVM_X86_OP_NAME(hardware_enable), + KVM_X86_OP_NAME(hardware_disable), + KVM_X86_OP_NAME(cpu_has_accelerated_tpr), + KVM_X86_OP_NAME(has_emulated_msr), =20 .vm_size =3D sizeof(struct kvm_vmx), - .vm_init =3D vmx_vm_init, - - .vcpu_create =3D vmx_create_vcpu, - .vcpu_free =3D vmx_free_vcpu, - .vcpu_reset =3D vmx_vcpu_reset, - - .prepare_guest_switch =3D vmx_prepare_switch_to_guest, - .vcpu_load =3D vmx_vcpu_load, - .vcpu_put =3D vmx_vcpu_put, - - .update_exception_bitmap =3D update_exception_bitmap, - .get_msr_feature =3D vmx_get_msr_feature, - .get_msr =3D vmx_get_msr, - .set_msr =3D vmx_set_msr, - .get_segment_base =3D vmx_get_segment_base, - .get_segment =3D vmx_get_segment, - .set_segment =3D vmx_set_segment, - .get_cpl =3D vmx_get_cpl, - .get_cs_db_l_bits =3D vmx_get_cs_db_l_bits, - .set_cr0 =3D vmx_set_cr0, - .set_cr4 =3D vmx_set_cr4, - .set_efer =3D vmx_set_efer, - .get_idt =3D vmx_get_idt, - .set_idt =3D vmx_set_idt, - .get_gdt =3D vmx_get_gdt, - .set_gdt =3D vmx_set_gdt, - .set_dr7 =3D vmx_set_dr7, - .sync_dirty_debug_regs =3D vmx_sync_dirty_debug_regs, - .cache_reg =3D vmx_cache_reg, - .get_rflags =3D vmx_get_rflags, - .set_rflags =3D vmx_set_rflags, - - .tlb_flush_all =3D vmx_flush_tlb_all, - .tlb_flush_current =3D vmx_flush_tlb_current, - .tlb_flush_gva =3D vmx_flush_tlb_gva, - .tlb_flush_guest =3D vmx_flush_tlb_guest, - - .vcpu_run =3D vmx_vcpu_run, - .handle_exit =3D vmx_handle_exit, - .skip_emulated_instruction =3D vmx_skip_emulated_instruction, - .update_emulated_instruction =3D vmx_update_emulated_instruction, - .set_interrupt_shadow =3D vmx_set_interrupt_shadow, - .get_interrupt_shadow =3D vmx_get_interrupt_shadow, - .patch_hypercall =3D vmx_patch_hypercall, - .inject_irq =3D vmx_inject_irq, - .inject_nmi =3D vmx_inject_nmi, - .queue_exception =3D vmx_queue_exception, - .cancel_injection =3D vmx_cancel_injection, - .interrupt_allowed =3D vmx_interrupt_allowed, - .nmi_allowed =3D vmx_nmi_allowed, - .get_nmi_mask =3D vmx_get_nmi_mask, - .set_nmi_mask =3D vmx_set_nmi_mask, - .enable_nmi_window =3D enable_nmi_window, - .enable_irq_window =3D enable_irq_window, - .update_cr8_intercept =3D update_cr8_intercept, - .set_virtual_apic_mode =3D vmx_set_virtual_apic_mode, - .set_apic_access_page_addr =3D vmx_set_apic_access_page_addr, - .refresh_apicv_exec_ctrl =3D vmx_refresh_apicv_exec_ctrl, - .load_eoi_exitmap =3D vmx_load_eoi_exitmap, - .apicv_post_state_restore =3D vmx_apicv_post_state_restore, - .check_apicv_inhibit_reasons =3D vmx_check_apicv_inhibit_reasons, - .hwapic_irr_update =3D vmx_hwapic_irr_update, - .hwapic_isr_update =3D vmx_hwapic_isr_update, - .guest_apic_has_interrupt =3D vmx_guest_apic_has_interrupt, - .sync_pir_to_irr =3D vmx_sync_pir_to_irr, - .deliver_interrupt =3D vmx_deliver_posted_interrupt, - .dy_apicv_has_pending_interrupt =3D pi_has_pending_interrupt, - - .set_tss_addr =3D vmx_set_tss_addr, - .set_identity_map_addr =3D vmx_set_identity_map_addr, - .get_mt_mask =3D vmx_get_mt_mask, - - .get_exit_info =3D vmx_get_exit_info, - - .vcpu_after_set_cpuid =3D vmx_vcpu_after_set_cpuid, + KVM_X86_OP_NAME(vm_init), + + KVM_X86_OP_NAME(vcpu_create), + KVM_X86_OP_NAME(vcpu_free), + KVM_X86_OP_NAME(vcpu_reset), + + KVM_X86_OP_NAME(prepare_switch_to_guest), + KVM_X86_OP_NAME(vcpu_load), + KVM_X86_OP_NAME(vcpu_put), + + KVM_X86_OP_NAME(update_exception_bitmap), + + KVM_X86_OP_NAME(get_msr_feature), + KVM_X86_OP_NAME(get_msr), + KVM_X86_OP_NAME(set_msr), + KVM_X86_OP_NAME(get_segment_base), + KVM_X86_OP_NAME(get_segment), + KVM_X86_OP_NAME(set_segment), + KVM_X86_OP_NAME(get_cpl), + KVM_X86_OP_NAME(get_cs_db_l_bits), + KVM_X86_OP_NAME(set_cr0), + KVM_X86_OP_NAME(set_cr4), + KVM_X86_OP_NAME(set_efer), + KVM_X86_OP_NAME(get_idt), + KVM_X86_OP_NAME(set_idt), + KVM_X86_OP_NAME(get_gdt), + KVM_X86_OP_NAME(set_gdt), + KVM_X86_OP_NAME(set_dr7), + KVM_X86_OP_NAME(sync_dirty_debug_regs), + KVM_X86_OP_NAME(cache_reg), + KVM_X86_OP_NAME(get_rflags), + KVM_X86_OP_NAME(set_rflags), + + KVM_X86_OP_NAME(tlb_flush_all), + KVM_X86_OP_NAME(tlb_flush_current), + KVM_X86_OP_NAME(tlb_flush_gva), + KVM_X86_OP_NAME(tlb_flush_guest), + + KVM_X86_OP_NAME(vcpu_run), + KVM_X86_OP_NAME(handle_exit), + KVM_X86_OP_NAME(skip_emulated_instruction), + KVM_X86_OP_NAME(update_emulated_instruction), + KVM_X86_OP_NAME(set_interrupt_shadow), + KVM_X86_OP_NAME(get_interrupt_shadow), + KVM_X86_OP_NAME(patch_hypercall), + KVM_X86_OP_NAME(inject_irq), + KVM_X86_OP_NAME(inject_nmi), + KVM_X86_OP_NAME(queue_exception), + KVM_X86_OP_NAME(cancel_injection), + KVM_X86_OP_NAME(interrupt_allowed), + KVM_X86_OP_NAME(nmi_allowed), + KVM_X86_OP_NAME(get_nmi_mask), + KVM_X86_OP_NAME(set_nmi_mask), + KVM_X86_OP_NAME(enable_nmi_window), + KVM_X86_OP_NAME(enable_irq_window), + KVM_X86_OP_NAME(update_cr8_intercept), + KVM_X86_OP_NAME(set_virtual_apic_mode), + KVM_X86_OP_NAME(set_apic_access_page_addr), + KVM_X86_OP_NAME(refresh_apicv_exec_ctrl), + KVM_X86_OP_NAME(load_eoi_exitmap), + KVM_X86_OP_NAME(apicv_post_state_restore), + KVM_X86_OP_NAME(check_apicv_inhibit_reasons), + KVM_X86_OP_NAME(hwapic_irr_update), + KVM_X86_OP_NAME(hwapic_isr_update), + KVM_X86_OP_NAME(guest_apic_has_interrupt), + KVM_X86_OP_NAME(sync_pir_to_irr), + KVM_X86_OP_NAME(deliver_interrupt), + KVM_X86_OP_NAME(dy_apicv_has_pending_interrupt), + + KVM_X86_OP_NAME(set_tss_addr), + KVM_X86_OP_NAME(set_identity_map_addr), + KVM_X86_OP_NAME(get_mt_mask), + + KVM_X86_OP_NAME(get_exit_info), + + KVM_X86_OP_NAME(vcpu_after_set_cpuid), =20 .has_wbinvd_exit =3D cpu_has_vmx_wbinvd_exit, =20 - .write_l1_tsc_offset =3D vmx_write_l1_tsc_offset, + KVM_X86_OP_NAME(write_l1_tsc_offset), =20 - .load_mmu_pgd =3D vmx_load_mmu_pgd, + KVM_X86_OP_NAME(load_mmu_pgd), =20 - .check_intercept =3D vmx_check_intercept, - .handle_exit_irqoff =3D vmx_handle_exit_irqoff, + KVM_X86_OP_NAME(check_intercept), + KVM_X86_OP_NAME(handle_exit_irqoff), =20 - .request_immediate_exit =3D vmx_request_immediate_exit, + KVM_X86_OP_NAME(request_immediate_exit), =20 - .sched_in =3D vmx_sched_in, + KVM_X86_OP_NAME(sched_in), =20 - .slot_enable_log_dirty =3D vmx_slot_enable_log_dirty, - .slot_disable_log_dirty =3D vmx_slot_disable_log_dirty, - .flush_log_dirty =3D vmx_flush_log_dirty, - .enable_log_dirty_pt_masked =3D vmx_enable_log_dirty_pt_masked, + KVM_X86_OP_NAME(slot_enable_log_dirty), + KVM_X86_OP_NAME(slot_disable_log_dirty), + KVM_X86_OP_NAME(flush_log_dirty), + KVM_X86_OP_NAME(enable_log_dirty_pt_masked), =20 - .pre_block =3D vmx_pre_block, - .post_block =3D vmx_post_block, + KVM_X86_OP_NAME(pre_block), + KVM_X86_OP_NAME(post_block), =20 - .pmu_ops =3D &intel_pmu_ops, - .nested_ops =3D &vmx_nested_ops, + KVM_X86_OP_PTR(pmu_ops), + KVM_X86_OP_PTR(nested_ops), =20 - .update_pi_irte =3D pi_update_irte, + KVM_X86_OP_NAME(update_pi_irte), =20 #ifdef CONFIG_X86_64 - .set_hv_timer =3D vmx_set_hv_timer, - .cancel_hv_timer =3D vmx_cancel_hv_timer, + KVM_X86_OP_NAME(set_hv_timer), + KVM_X86_OP_NAME(cancel_hv_timer), #endif =20 - .setup_mce =3D vmx_setup_mce, + KVM_X86_OP_NAME(setup_mce), =20 - .smi_allowed =3D vmx_smi_allowed, - .pre_enter_smm =3D vmx_pre_enter_smm, - .pre_leave_smm =3D vmx_pre_leave_smm, - .enable_smi_window =3D enable_smi_window, + KVM_X86_OP_NAME(smi_allowed), + KVM_X86_OP_NAME(pre_enter_smm), + KVM_X86_OP_NAME(pre_leave_smm), + KVM_X86_OP_NAME(enable_smi_window), =20 - .can_emulate_instruction =3D vmx_can_emulate_instruction, - .apic_init_signal_blocked =3D vmx_apic_init_signal_blocked, - .migrate_timers =3D vmx_migrate_timers, + KVM_X86_OP_NAME(can_emulate_instruction), + KVM_X86_OP_NAME(apic_init_signal_blocked), + KVM_X86_OP_NAME(migrate_timers), =20 - .msr_filter_changed =3D vmx_msr_filter_changed, + KVM_X86_OP_NAME(msr_filter_changed), }; =20 static __init int hardware_setup(void) diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index f6f66e5c6510..42c90c1a6ea9 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -329,7 +329,7 @@ void vmx_set_segment(struct kvm_vcpu *vcpu, struct kvm_= segment *var, int seg); u64 construct_eptp(struct kvm_vcpu *vcpu, unsigned long root_hpa, int root_level); =20 -void update_exception_bitmap(struct kvm_vcpu *vcpu); +void vmx_update_exception_bitmap(struct kvm_vcpu *vcpu); void vmx_update_msr_bitmap(struct kvm_vcpu *vcpu); bool vmx_nmi_blocked(struct kvm_vcpu *vcpu); bool vmx_interrupt_blocked(struct kvm_vcpu *vcpu); --=20 2.27.0 From nobody Sun Apr 28 15:29:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1605318712; cv=none; d=zohomail.com; s=zohoarc; b=JM7G5JG96uBryKDbsKdGJqWBBcl7x4ksNjdRby6MDRQ+BcqkSuPOCPGJjyGy5tTQhieay/1/jp4H+X3o2hWIFRaalfgArcZLXNPheWB9DJc7XNcY/YSgu6WfU9yoo/k/ty/vqiBAzOOryKrh9ee7xewRUMnAlJ5jNxdQxTaubTw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605318712; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ISfln+HaDRfa94Trku7ZBKLGbuFAluUA4VyQ8Coqkqo=; b=S1a9WnZfbTHHoMNvO+fnqewxH7DwdOMYEaSjDJjqKYIIFRrUtduATft+f1TPBaNoBc6ErURpXdbh/U4CQ+0JsJTj+WdHk6aBUOKBKqnEHLmsMBT6QA8oTADRfHoNVVDRBdb9I2LI6Nld4Jm2vjWxxmDosdiVwY8qqav3ktoEx2I= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605318712331687.1009799948378; Fri, 13 Nov 2020 17:51:52 -0800 (PST) Received: from localhost ([::1]:55806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kdkjH-0008EX-Ar for importer@patchew.org; Fri, 13 Nov 2020 20:51:51 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48624) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkho-0006nu-Hx for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:20 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:47728) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kdkhj-0002Zo-3B for qemu-devel@nongnu.org; Fri, 13 Nov 2020 20:50:20 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1nnO2026863; Sat, 14 Nov 2020 01:50:09 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 34p72f31cr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 14 Nov 2020 01:50:09 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0AE1jHqZ167743; Sat, 14 Nov 2020 01:50:09 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by userp3020.oracle.com with ESMTP id 34rt58vky9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 14 Nov 2020 01:50:09 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 0AE1o8rS009507; Sat, 14 Nov 2020 01:50:08 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.230.216) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 13 Nov 2020 17:50:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2020-01-29; bh=ISfln+HaDRfa94Trku7ZBKLGbuFAluUA4VyQ8Coqkqo=; b=TPiM7nEzK6CBEmb2m6p6Uq56TPLX8VZeLCkbVxxArru8tdYzp+RRUmLIUQ8syfHHk004 dv4loWU9e62wyZYSQI9dMGluz2rcTtJkz5/8S55fqP6G4pKKqF7AjBhROECgvee/grh7 FRsxxBBQN+REav/v62B90yE77nlHSL/P6zbqDca4meNn7rmocPWUzUw8VegdPGbCGdyn zoHZ+f4noWFKFQlCHIcYTEmT9PKzVTAA6QdO7J4sQh5ViEVuueGCokWVSwAO7ZYjezRH EWOesPgxMeh0yXIldIoLZ5zKqS1pLTD8TXhspWqMqCCJ8T+M/KeZm2iger06CsuNIDY/ 2Q== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 5/5 v5] KVM: nVMX: Fill in conforming vmx_nested_ops via macro Date: Sat, 14 Nov 2020 01:49:55 +0000 Message-Id: <20201114014955.19749-6-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201114014955.19749-1-krish.sadhukhan@oracle.com> References: <20201114014955.19749-1-krish.sadhukhan@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 bulkscore=0 mlxscore=0 mlxlogscore=999 suspectscore=3 adultscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9804 signatures=668682 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 mlxlogscore=999 mlxscore=0 malwarescore=0 suspectscore=3 lowpriorityscore=0 adultscore=0 phishscore=0 priorityscore=1501 spamscore=0 impostorscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2011140009 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=156.151.31.85; envelope-from=krish.sadhukhan@oracle.com; helo=userp2120.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/13 20:50:10 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: pbonzini@redhat.com, vkuznets@redhat.com, qemu-devel@nongnu.org, sean.j.christopherson@intel.com, jmattson@google.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" The names of some of the vmx_nested_ops functions do not have a correspondi= ng 'nested_vmx_' prefix. Generate the names using a macro so that the names are conformant. Fixing the naming will help in better readability and maintenance of the code. Suggested-by: Vitaly Kuznetsov Suggested-by: Paolo Bonzini Signed-off-by: Sean Christopherson Signed-off-by: Krish Sadhukhan --- arch/x86/kvm/vmx/evmcs.c | 6 +++--- arch/x86/kvm/vmx/evmcs.h | 4 ++-- arch/x86/kvm/vmx/nested.c | 35 +++++++++++++++++++++-------------- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c index f3199bb02f22..e54b366ea114 100644 --- a/arch/x86/kvm/vmx/evmcs.c +++ b/arch/x86/kvm/vmx/evmcs.c @@ -324,7 +324,7 @@ bool nested_enlightened_vmentry(struct kvm_vcpu *vcpu, = u64 *evmcs_gpa) return true; } =20 -uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu) +uint16_t nested_vmx_get_evmcs_version(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); /* @@ -418,7 +418,7 @@ int nested_evmcs_check_controls(struct vmcs12 *vmcs12) return ret; } =20 -int nested_enable_evmcs(struct kvm_vcpu *vcpu, +int nested_vmx_enable_evmcs(struct kvm_vcpu *vcpu, uint16_t *vmcs_version) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); @@ -426,7 +426,7 @@ int nested_enable_evmcs(struct kvm_vcpu *vcpu, vmx->nested.enlightened_vmcs_enabled =3D true; =20 if (vmcs_version) - *vmcs_version =3D nested_get_evmcs_version(vcpu); + *vmcs_version =3D nested_vmx_get_evmcs_version(vcpu); =20 return 0; } diff --git a/arch/x86/kvm/vmx/evmcs.h b/arch/x86/kvm/vmx/evmcs.h index bd41d9462355..150e7921b5fd 100644 --- a/arch/x86/kvm/vmx/evmcs.h +++ b/arch/x86/kvm/vmx/evmcs.h @@ -205,8 +205,8 @@ enum nested_evmptrld_status { }; =20 bool nested_enlightened_vmentry(struct kvm_vcpu *vcpu, u64 *evmcs_gpa); -uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu); -int nested_enable_evmcs(struct kvm_vcpu *vcpu, +uint16_t nested_vmx_get_evmcs_version(struct kvm_vcpu *vcpu); +int nested_vmx_enable_evmcs(struct kvm_vcpu *vcpu, uint16_t *vmcs_version); void nested_evmcs_filter_control_msr(u32 msr_index, u64 *pdata); int nested_evmcs_check_controls(struct vmcs12 *vmcs12); diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 104d6782ddc3..ecff1117f598 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3223,7 +3223,12 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu = *vcpu) return true; } =20 -static int nested_vmx_write_pml_buffer(struct kvm_vcpu *vcpu, gpa_t gpa) +static bool nested_vmx_get_pages(struct kvm_vcpu *vcpu) +{ + return nested_get_vmcs12_pages(vcpu); +} + +static int nested_vmx_write_log_dirty(struct kvm_vcpu *vcpu, gpa_t gpa) { struct vmcs12 *vmcs12; struct vcpu_vmx *vmx =3D to_vmx(vcpu); @@ -3769,13 +3774,13 @@ static void nested_vmx_update_pending_dbg(struct kv= m_vcpu *vcpu) vcpu->arch.exception.payload); } =20 -static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu) +static bool nested_vmx_hv_timer_pending(struct kvm_vcpu *vcpu) { return nested_cpu_has_preemption_timer(get_vmcs12(vcpu)) && to_vmx(vcpu)->nested.preemption_timer_expired; } =20 -static int vmx_check_nested_events(struct kvm_vcpu *vcpu) +static int nested_vmx_check_events(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); unsigned long exit_qual; @@ -3830,7 +3835,7 @@ static int vmx_check_nested_events(struct kvm_vcpu *v= cpu) return 0; } =20 - if (nested_vmx_preemption_timer_pending(vcpu)) { + if (nested_vmx_hv_timer_pending(vcpu)) { if (block_nested_events) return -EBUSY; nested_vmx_vmexit(vcpu, EXIT_REASON_PREEMPTION_TIMER, 0, 0); @@ -5964,7 +5969,7 @@ bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu) return true; } =20 -static int vmx_get_nested_state(struct kvm_vcpu *vcpu, +static int nested_vmx_get_state(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state, u32 user_data_size) { @@ -6088,7 +6093,7 @@ void vmx_leave_nested(struct kvm_vcpu *vcpu) free_nested(vcpu); } =20 -static int vmx_set_nested_state(struct kvm_vcpu *vcpu, +static int nested_vmx_set_state(struct kvm_vcpu *vcpu, struct kvm_nested_state __user *user_kvm_nested_state, struct kvm_nested_state *kvm_state) { @@ -6568,13 +6573,15 @@ __init int nested_vmx_hardware_setup(int (*exit_han= dlers[])(struct kvm_vcpu *)) return 0; } =20 +#define KVM_X86_NESTED_OP_NAME(name) .name =3D nested_vmx_##name + struct kvm_x86_nested_ops vmx_nested_ops =3D { - .check_events =3D vmx_check_nested_events, - .hv_timer_pending =3D nested_vmx_preemption_timer_pending, - .get_state =3D vmx_get_nested_state, - .set_state =3D vmx_set_nested_state, - .get_pages =3D nested_get_vmcs12_pages, - .write_log_dirty =3D nested_vmx_write_pml_buffer, - .enable_evmcs =3D nested_enable_evmcs, - .get_evmcs_version =3D nested_get_evmcs_version, + KVM_X86_NESTED_OP_NAME(check_events), + KVM_X86_NESTED_OP_NAME(hv_timer_pending), + KVM_X86_NESTED_OP_NAME(get_state), + KVM_X86_NESTED_OP_NAME(set_state), + KVM_X86_NESTED_OP_NAME(get_pages), + KVM_X86_NESTED_OP_NAME(write_log_dirty), + KVM_X86_NESTED_OP_NAME(enable_evmcs), + KVM_X86_NESTED_OP_NAME(get_evmcs_version), }; --=20 2.27.0