From nobody Mon Feb 9 01:21:41 2026 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=1595898669; cv=none; d=zohomail.com; s=zohoarc; b=WhFix73zXnK84qVXGTaV6O4JtsfS2cnldtYRRIv91Wa6T7QSwhn+wTz1w1Ia0GVCe8fxo18QQuNf/X+EA9q56vD9B9rPNmNAN2x7nLc2/9oe5FE8rbQH+HouKkdvIBTHqj0vtu2XYvm9ACxWnvWGMJyzKIhWbGct1+E6WY7eTKk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898669; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=gzG26fUgybyS8dix7buhvOlYBPA8wprnYlxU/Q8JmzY=; b=IiDPlZOeB2EXvaDj31SBDBtMR/ZpLXR09k+J4+Afhm2pogI/vMf+MQBAPPEPuzOTULvN1hNQpiO/msU5aVm6hMmM+WGZpHEGc2zWG+dUlPITjfUn6g64Z/hdxrTVuBtmsofYW8dJ3Vjb9H3GGtFTZqgEGOphFs+zY7/uz1vh/iE= 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 1595898669059161.4759672635521; Mon, 27 Jul 2020 18:11:09 -0700 (PDT) Received: from localhost ([::1]:41488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0E95-0007De-MZ for importer@patchew.org; Mon, 27 Jul 2020 21:11:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD4-0003jc-EV for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:36692) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD0-0003Se-MZ for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:10 -0400 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 06S07acF098851; Tue, 28 Jul 2020 00:11:01 GMT Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 32hu1jcgnf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:11:01 +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 06S08elK157415; Tue, 28 Jul 2020 00:11:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 32hu5rvkmm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:01 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06S0B0kE020208; Tue, 28 Jul 2020 00:11:00 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:10:59 -0700 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; s=corp-2020-01-29; bh=gzG26fUgybyS8dix7buhvOlYBPA8wprnYlxU/Q8JmzY=; b=JTiFTXidXKVs3NeSuNTGVDF+YdBGoQSxmwIJVr+4+/F9o82pxhYyfIYcFYxoJhpQp3Ei ohkuDRkrV2NFbcr+QKeKBkxSOcOh+a6GXsNrNG596+3lOhsK7Y7LkUF8Dqpli1ANhITW 40Ca211UBG/kBlJCE1mLlh+rzzapAsYxLH6zReHncpfwaw4LGhi5ehgSUcRxz4TjyRxB k0M2V3zS/q/+3g7/noE2RrNvk9RU6EWKIx3VNQHIOsVEd3eXA7wHkOLb/t20RrVdNrj1 ESljplQcUn3B8gEwvhLPzu3P7FI9pOsMjQqX59BA+JVt8/lgkBdTC0jHAgX6P7amWtbZ ew== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 1/6 v3] KVM: x86: Change names of some of the kvm_x86_ops functions to make them more semantical and readable Date: Tue, 28 Jul 2020 00:10:45 +0000 Message-Id: <1595895050-105504-2-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 phishscore=0 bulkscore=0 malwarescore=0 suspectscore=4 spamscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1011 mlxlogscore=999 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=4 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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/07/27 20:11:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:14 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 | 12 ++++++------ arch/x86/kvm/svm/svm.c | 12 ++++++------ arch/x86/kvm/vmx/vmx.c | 8 ++++---- arch/x86/kvm/x86.c | 28 ++++++++++++++-------------- 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 ++-- 12 files changed, 43 insertions(+), 43 deletions(-) diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm= _host.h index c3e6fcc6..f5be4fa 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h @@ -545,7 +545,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 363e7a89..95cea05 100644 --- a/arch/mips/include/asm/kvm_host.h +++ b/arch/mips/include/asm/kvm_host.h @@ -1178,7 +1178,7 @@ extern int kvm_mips_trans_mtc0(union mips_instruction= inst, u32 *opc, 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 7e2d061..892b0e2 100644 --- a/arch/powerpc/include/asm/kvm_host.h +++ b/arch/powerpc/include/asm/kvm_host.h @@ -856,7 +856,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 d47c197..5cdddd9 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 be5363b..ccad66d 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1080,7 +1080,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 (*cpuid_update)(struct kvm_vcpu *vcpu); @@ -1141,7 +1141,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); @@ -1150,8 +1150,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); @@ -1258,8 +1258,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 diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index c0da4dd..24755eb 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3969,7 +3969,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, @@ -4016,15 +4016,15 @@ static int svm_vm_init(struct kvm *kvm) .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, @@ -4080,8 +4080,8 @@ static int svm_vm_init(struct kvm *kvm) .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 .need_emulation_on_page_fault =3D svm_need_emulation_on_page_fault, =20 diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index cb22f33..90d91524 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7844,7 +7844,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, @@ -7889,15 +7889,15 @@ static bool vmx_check_apicv_inhibit_reasons(ulong b= it) .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, diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 3b92db4..7cc164b 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -5256,13 +5256,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; @@ -5270,11 +5270,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; @@ -5282,8 +5282,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: { @@ -7788,10 +7788,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; } } @@ -7867,7 +7867,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); } @@ -7881,7 +7881,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)) @@ -8517,7 +8517,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 @@ -9793,9 +9793,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 d564855..b49312c 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h @@ -894,7 +894,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu= *vcpu, 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 4fdf303..cb6f153 100644 --- a/include/uapi/linux/kvm.h +++ b/include/uapi/linux/kvm.h @@ -1469,15 +1469,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 4fdf303..c341b2c 100644 --- a/tools/include/uapi/linux/kvm.h +++ b/tools/include/uapi/linux/kvm.h @@ -1469,15 +1469,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 a852af5..4625f3a 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -4786,7 +4786,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: @@ -4808,7 +4808,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 1.8.3.1 From nobody Mon Feb 9 01:21:41 2026 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=1595898809; cv=none; d=zohomail.com; s=zohoarc; b=eCwn/dFFJJtnjK00rrbfmCADHojnINlUdXAWFrduQUAZsgFuqC/ofLJw3BvySi+s6raXARx2k16a8bH/a/uup0z2AWj4wub3C8nwHInCoWpOQYI+StI6BJRfvSVLVSJetFWXykdfJz/awHX+NiHmo2DiOz8VLUWIzc+4BAdtLOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898809; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=EHwJgLiBWUs4j5AUKMLo7Lu4A4ReSKShHV6stWxyZDc=; b=kfus/e2xBUKiJi9aoUodzDAITjXeGdoMBHrMxG0ETcImq17JTajjHAvqz0/A8DXeUut6q7BoQnQoVJFazupNogZjgOY0y2rI/nudJXFmi8gFF3K9wIKmJXCFP1NVdrheeeIVNMLigzumWY1Og3dPInMwT1I2iH/dTDFTpa1r5qU= 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 1595898809296355.51257235151934; Mon, 27 Jul 2020 18:13:29 -0700 (PDT) Received: from localhost ([::1]:49050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0EBL-0001uD-PD for importer@patchew.org; Mon, 27 Jul 2020 21:13:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44474) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DEy-0003vU-3D for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:13:08 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37662) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DEv-0003cQ-Fl for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:13:07 -0400 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 06S07iSV098922; Tue, 28 Jul 2020 00:13:02 GMT Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 32hu1jcgs2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:13:01 +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 06S09KJv113691; Tue, 28 Jul 2020 00:11:01 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 32hu5rp0y0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:01 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06S0B0kp020209; Tue, 28 Jul 2020 00:11:00 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:11:00 -0700 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; s=corp-2020-01-29; bh=EHwJgLiBWUs4j5AUKMLo7Lu4A4ReSKShHV6stWxyZDc=; b=lbUV1pptvqNzXXXICx1+fXVOW5nXMIg9IVC1o7XX/Wq5+NvWbe8KWeOJd546PNVR/mGn eiBzhBssoQXR1UROlX6SJTZaziDtLK8H3komTtDGLQ3h9XZQYM8rpGMdz9DuSlJVvtCW oiTKq7Z9U58fvGNkXcpfKimuLBO7L67GHgwHXYzjKA28Qe4hjw5fyf/WDwT5LC50BHE3 cWh2Z3yZlcc7uP3M7OUbA+M927tj1Bmbvn/6HktGGQ2HjCJp3ttg/XDd/lAFnToTE6yM kXVM6PdEuwysNyVnfeqQHoqf5g0XB44lXEag/ZuJmMIJ70pR6sxPUp8wlxcumA39O40Q BQ== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 2/6 v3] KVM: SVM: Fill in conforming svm_x86_ops via macro Date: Tue, 28 Jul 2020 00:10:46 +0000 Message-Id: <1595895050-105504-3-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 mlxlogscore=999 mlxscore=0 suspectscore=3 bulkscore=0 malwarescore=0 spamscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxlogscore=999 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=3 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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/07/27 20:11:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:20 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 Signed-off-by: Krish Sadhukhan --- arch/x86/kvm/svm/avic.c | 4 +- arch/x86/kvm/svm/nested.c | 2 +- arch/x86/kvm/svm/sev.c | 6 +- arch/x86/kvm/svm/svm.c | 218 +++++++++++++++++++++++-------------------= ---- arch/x86/kvm/svm/svm.h | 8 +- 5 files changed, 120 insertions(+), 118 deletions(-) diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c index e80daa9..619391e 100644 --- a/arch/x86/kvm/svm/avic.c +++ b/arch/x86/kvm/svm/avic.c @@ -579,7 +579,7 @@ int avic_init_vcpu(struct vcpu_svm *svm) return ret; } =20 -void avic_post_state_restore(struct kvm_vcpu *vcpu) +void svm_avic_post_state_restore(struct kvm_vcpu *vcpu) { if (avic_handle_apic_id_update(vcpu) !=3D 0) return; @@ -660,7 +660,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_avic_post_state_restore(vcpu); vmcb->control.int_ctl |=3D AVIC_ENABLE_MASK; } else { vmcb->control.int_ctl &=3D ~AVIC_ENABLE_MASK; diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 6bceafb..3be6256 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -348,7 +348,7 @@ static void nested_prepare_vmcb_control(struct vcpu_svm= *svm) /* Guest paging mode is active - reset mmu */ kvm_mmu_reset_context(&svm->vcpu); =20 - svm_flush_tlb(&svm->vcpu); + svm_tlb_flush(&svm->vcpu); =20 svm->vmcb->control.tsc_offset =3D svm->vcpu.arch.tsc_offset =3D svm->vcpu.arch.l1_tsc_offset + svm->nested.ctl.tsc_offset; diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 5573a97..1ca9f60 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -969,7 +969,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; @@ -1038,8 +1038,8 @@ static void __unregister_enc_region_locked(struct kvm= *kvm, kfree(region); } =20 -int svm_unregister_enc_region(struct kvm *kvm, - struct kvm_enc_region *range) +int svm_mem_enc_unregister_region(struct kvm *kvm, + struct kvm_enc_region *range) { struct enc_region *region; int ret; diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 24755eb..d63181e 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -254,7 +254,7 @@ static inline void invlpga(unsigned long addr, u32 asid) asm volatile (__ex("invlpga %1, %0") : : "c"(asid), "a"(addr)); } =20 -static int get_npt_level(struct kvm_vcpu *vcpu) +static int svm_get_tdp_level(struct kvm_vcpu *vcpu) { #ifdef CONFIG_X86_64 return PT64_ROOT_4LEVEL; @@ -312,7 +312,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 @@ -351,7 +351,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; @@ -1153,7 +1153,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 *page; @@ -1232,7 +1232,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 @@ -1585,7 +1585,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) @@ -1627,7 +1627,7 @@ static void svm_set_segment(struct kvm_vcpu *vcpu, mark_dirty(svm->vmcb, VMCB_SEG); } =20 -static void update_bp_intercept(struct kvm_vcpu *vcpu) +static void svm_update_bp_intercept(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -2143,7 +2143,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 @@ -2909,7 +2909,7 @@ static void svm_get_exit_info(struct kvm_vcpu *vcpu, = u64 *info1, u64 *info2) *info2 =3D control->exit_info_2; } =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; @@ -3023,7 +3023,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 @@ -3036,7 +3036,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 @@ -3145,7 +3145,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 @@ -3169,7 +3169,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 @@ -3202,7 +3202,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 @@ -3219,7 +3219,7 @@ 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_gva(struct kvm_vcpu *vcpu, gva_t gva) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3857,7 +3857,7 @@ static int svm_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 svm_enable_smi_window(struct kvm_vcpu *vcpu) { struct vcpu_svm *svm =3D to_svm(vcpu); =20 @@ -3968,124 +3968,126 @@ static int svm_vm_init(struct kvm *kvm) return 0; } =20 +#define KVM_X86_OP(name) .name =3D svm_##name + 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(hardware_teardown), + KVM_X86_OP(hardware_enable), + KVM_X86_OP(hardware_disable), + KVM_X86_OP(cpu_has_accelerated_tpr), + KVM_X86_OP(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(vcpu_create), + KVM_X86_OP(vcpu_free), + KVM_X86_OP(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_bp_intercept =3D update_bp_intercept, - .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, + KVM_X86_OP(vm_init), + KVM_X86_OP(vm_destroy), + + KVM_X86_OP(prepare_guest_switch), + KVM_X86_OP(vcpu_load), + KVM_X86_OP(vcpu_put), + KVM_X86_OP(vcpu_blocking), + KVM_X86_OP(vcpu_unblocking), + + KVM_X86_OP(update_bp_intercept), + KVM_X86_OP(get_msr_feature), + KVM_X86_OP(get_msr), + KVM_X86_OP(set_msr), + KVM_X86_OP(get_segment_base), + KVM_X86_OP(get_segment), + KVM_X86_OP(set_segment), + KVM_X86_OP(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, + KVM_X86_OP(set_cr0), + KVM_X86_OP(set_cr4), + KVM_X86_OP(set_efer), + KVM_X86_OP(get_idt), + KVM_X86_OP(set_idt), + KVM_X86_OP(get_gdt), + KVM_X86_OP(set_gdt), + KVM_X86_OP(set_dr7), + KVM_X86_OP(sync_dirty_debug_regs), + KVM_X86_OP(cache_reg), + KVM_X86_OP(get_rflags), + KVM_X86_OP(set_rflags), + + .tlb_flush_all =3D svm_tlb_flush, + .tlb_flush_current =3D svm_tlb_flush, + KVM_X86_OP(tlb_flush_gva), + .tlb_flush_guest =3D svm_tlb_flush, + + KVM_X86_OP(vcpu_run), + KVM_X86_OP(handle_exit), + KVM_X86_OP(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, + KVM_X86_OP(set_interrupt_shadow), + KVM_X86_OP(get_interrupt_shadow), + KVM_X86_OP(patch_hypercall), + KVM_X86_OP(inject_irq), + KVM_X86_OP(inject_nmi), + KVM_X86_OP(queue_exception), + KVM_X86_OP(cancel_injection), + KVM_X86_OP(interrupt_allowed), + KVM_X86_OP(nmi_allowed), + KVM_X86_OP(get_nmi_mask), + KVM_X86_OP(set_nmi_mask), + KVM_X86_OP(enable_nmi_window), + KVM_X86_OP(enable_irq_window), + KVM_X86_OP(update_cr8_intercept), + KVM_X86_OP(set_virtual_apic_mode), + KVM_X86_OP(refresh_apicv_exec_ctrl), + KVM_X86_OP(check_apicv_inhibit_reasons), + KVM_X86_OP(pre_update_apicv_exec_ctrl), + KVM_X86_OP(load_eoi_exitmap), + KVM_X86_OP(hwapic_irr_update), + KVM_X86_OP(hwapic_isr_update), .sync_pir_to_irr =3D kvm_lapic_find_highest_irr, - .apicv_post_state_restore =3D avic_post_state_restore, + .apicv_post_state_restore =3D svm_avic_post_state_restore, =20 - .set_tss_addr =3D svm_set_tss_addr, - .set_identity_map_addr =3D svm_set_identity_map_addr, - .get_tdp_level =3D get_npt_level, - .get_mt_mask =3D svm_get_mt_mask, + KVM_X86_OP(set_tss_addr), + KVM_X86_OP(set_identity_map_addr), + KVM_X86_OP(get_tdp_level), + KVM_X86_OP(get_mt_mask), =20 - .get_exit_info =3D svm_get_exit_info, + KVM_X86_OP(get_exit_info), =20 - .cpuid_update =3D svm_cpuid_update, + KVM_X86_OP(cpuid_update), =20 - .has_wbinvd_exit =3D svm_has_wbinvd_exit, + KVM_X86_OP(has_wbinvd_exit), =20 - .write_l1_tsc_offset =3D svm_write_l1_tsc_offset, + KVM_X86_OP(write_l1_tsc_offset), =20 - .load_mmu_pgd =3D svm_load_mmu_pgd, + KVM_X86_OP(load_mmu_pgd), =20 - .check_intercept =3D svm_check_intercept, - .handle_exit_irqoff =3D svm_handle_exit_irqoff, + KVM_X86_OP(check_intercept), + KVM_X86_OP(handle_exit_irqoff), =20 .request_immediate_exit =3D __kvm_request_immediate_exit, =20 - .sched_in =3D svm_sched_in, + KVM_X86_OP(sched_in), =20 .pmu_ops =3D &amd_pmu_ops, .nested_ops =3D &svm_nested_ops, =20 .deliver_posted_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, + KVM_X86_OP(dy_apicv_has_pending_interrupt), + KVM_X86_OP(update_pi_irte), + KVM_X86_OP(setup_mce), =20 - .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, + KVM_X86_OP(smi_allowed), + KVM_X86_OP(pre_enter_smm), + KVM_X86_OP(pre_leave_smm), + KVM_X86_OP(enable_smi_window), =20 - .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, + KVM_X86_OP(mem_enc_op), + KVM_X86_OP(mem_enc_register_region), + KVM_X86_OP(mem_enc_unregister_region), =20 - .need_emulation_on_page_fault =3D svm_need_emulation_on_page_fault, + KVM_X86_OP(need_emulation_on_page_fault), =20 - .apic_init_signal_blocked =3D svm_apic_init_signal_blocked, + KVM_X86_OP(apic_init_signal_blocked), }; =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 6ac4c00..e2d5029 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -352,7 +352,7 @@ static inline bool gif_set(struct vcpu_svm *svm) void 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); @@ -444,7 +444,7 @@ static inline bool avic_vcpu_is_running(struct kvm_vcpu= *vcpu) 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); +void svm_avic_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); @@ -481,9 +481,9 @@ 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, +int svm_mem_enc_register_region(struct kvm *kvm, struct kvm_enc_region *range); -int svm_unregister_enc_region(struct kvm *kvm, +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); --=20 1.8.3.1 From nobody Mon Feb 9 01:21:41 2026 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=1595898670; cv=none; d=zohomail.com; s=zohoarc; b=JmCc/kbzrarjuZMHSw/AP6DtLd8xNH/wOkXlobFVj4em5m3NoJbA9yqBKs5wwft10NenZF0Og8jYAfJVBT2ZWf6+EgJZss7RMFJ8OGRcCBjmOotDxA3dMe1O5cJC81diEF9BcGpehindSZ1FJN0OUT/tDk7v1JeLmgUjPLeb8sk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898670; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=1uVks55KihUgSYCMq0k3DOhEyTRXQpuU/TvMQ/0yXqg=; b=h3EM/4Ifx/e+JQWvW6KR1wHIQJjDLZqSYRnXvWUq58Lw8jowKd9GuxRzKB8AyWeHwBdNrttaOme9oZ55cvm91HquKjUbgmTJaCl41lGUaVjCoLb1azLSd1JACGYpLe6TH3AEhht/YS0j2N5EMJHiWQobGuMYab2EdoNvxLpJGoE= 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 1595898670923689.4535644346769; Mon, 27 Jul 2020 18:11:10 -0700 (PDT) Received: from localhost ([::1]:41626 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0E97-0007Gx-Nn for importer@patchew.org; Mon, 27 Jul 2020 21:11:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44068) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD6-0003jz-JC for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:12 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:33122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD2-0003TS-KH for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:12 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06S06swi020875; Tue, 28 Jul 2020 00:11:03 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2130.oracle.com with ESMTP id 32hu1j4g3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:11:03 +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 06S08QnP040776; Tue, 28 Jul 2020 00:11:02 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 32hu5s4mm6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:02 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06S0B0Vl020214; Tue, 28 Jul 2020 00:11:01 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:11:00 -0700 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; s=corp-2020-01-29; bh=1uVks55KihUgSYCMq0k3DOhEyTRXQpuU/TvMQ/0yXqg=; b=XsXx7GUQ7F51LQduXwRA7ndSZZpox6o/w+5kT+f8Qw+vAvtQ+PgUDL0FiS2TIDvPUFK7 Lgn94gBrkCZ102rxdmCAqXqUr1d6QTJIZFLxNlsOD2QiRsXXLoMgJNLY4kxRGiJGl/SC pVMqdZcyhaI9BPkSJiVB0eCZlRVOlhnwd1jMO4+NdevIjSYcDdorSr8r+afa0v8WhTql +x4+nzhjAFjL7feAMseoihV6ERWepUejFMIVz9ewrdyDs845AkOHaVbCYOw7Hq7f/0U3 ryHYE6wvDtcOap/iAYS90UpU5BSHBRj9fY51d1TlXPAZP6vVNBl57fxqvHOglh4Ma9tr og== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 3/6 v3] KVM: nSVM: Fill in conforming svm_nested_ops via macro Date: Tue, 28 Jul 2020 00:10:47 +0000 Message-Id: <1595895050-105504-4-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1015 malwarescore=0 spamscore=0 suspectscore=1 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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.86; envelope-from=krish.sadhukhan@oracle.com; helo=userp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 20:11:06 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:17 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kvm/svm/nested.c b/arch/x86/kvm/svm/nested.c index 3be6256..7cb834a 100644 --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -718,7 +718,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; @@ -850,7 +850,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 @@ -933,7 +933,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) { @@ -990,7 +990,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) { @@ -1075,8 +1075,10 @@ static int svm_set_nested_state(struct kvm_vcpu *vcp= u, return 0; } =20 +#define KVM_X86_NESTED_OP(name) .name =3D nested_svm_##name + struct kvm_x86_nested_ops svm_nested_ops =3D { - .check_events =3D svm_check_nested_events, - .get_state =3D svm_get_nested_state, - .set_state =3D svm_set_nested_state, + KVM_X86_NESTED_OP(check_events), + KVM_X86_NESTED_OP(get_state), + KVM_X86_NESTED_OP(set_state), }; --=20 1.8.3.1 From nobody Mon Feb 9 01:21:41 2026 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=1595898865; cv=none; d=zohomail.com; s=zohoarc; b=b4qv+EyKfNyWElTXyiGDVSGGQXVU51RtF9TXtAGK8Fgnp2Tlo5SoWD5qXrFejbjsEnwVXXOAKfT51/9Y4z43nhlmTRwVXyTZSKNHVjLu1/lxxAJQ4RjHqonkPzWki7IwTBYPUx2c5incP5j6kuBWygh231AEH4CEkPDXnim7nYg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898865; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=MsD4vCZcp4Gq6Mao/DDqu5aEmgjQO67N4u9DdlODuzA=; b=Mkvj107InrNNsfDocxmQdBqgxo+Y30yj1XbSGhoy2RWThxHNS+FxmF/QkEcXRyN4SAIrz6/+TxQdNYyOsBQ+nKpYCN0YdmRmeDF7ApgD5x0y0XujUqJqlDDkaZK/TOLJMG1lGgOLGZNUhijf1hnbRMGL9n1hKOaWDgjHwNV3viI= 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 1595898865506831.6526132494654; Mon, 27 Jul 2020 18:14:25 -0700 (PDT) Received: from localhost ([::1]:51166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0ECG-0002ny-4K for importer@patchew.org; Mon, 27 Jul 2020 21:14:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DEy-0003vc-Au for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:13:08 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:37670) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DEw-0003cY-0F for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:13:08 -0400 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 06S08qIp099510; Tue, 28 Jul 2020 00:13:02 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 32hu1jcgs3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:13:02 +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 06S08R6E040923; Tue, 28 Jul 2020 00:11:02 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3020.oracle.com with ESMTP id 32hu5s4mm3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:01 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 06S0B1Ek016703; Tue, 28 Jul 2020 00:11:01 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:11:01 -0700 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; s=corp-2020-01-29; bh=MsD4vCZcp4Gq6Mao/DDqu5aEmgjQO67N4u9DdlODuzA=; b=pwYREKJpXNq/tAPfnzIEdu0oqgRXnSthXei2uySp/4Xdp16OS3zXbbUpBCsmHawKVk03 a4C23jY4leu7w7Mi3Nn9KUsFEK0uvFPB1j+wYJzvmr6FsT9tP8Avum3k/Kjp8bY3pILm 6aCZcY+m2Fuz6S8oi6b6AbKak1D040meimhrnoIRrYYoXvf6MYfs+hzvuWSyt2PQ1KbA 53h6O7/QzdUTzGl4VGelR5IWylq7R73cBFc0UBVSJepif1XkFXX5n3DRuAsOv0RQk7R+ aFjQiQtgjI6OgFfuElkm0uSxRQMzmAzk1wYLDXUagwOHPShBalVc4ePS6N5CqPsRaA6n 3A== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 4/6 v3] KVM: VMX: Fill in conforming vmx_x86_ops via macro Date: Tue, 28 Jul 2020 00:10:48 +0000 Message-Id: <1595895050-105504-5-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=986 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxlogscore=995 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=3 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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/07/27 20:11:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:21 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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/vmx/nested.c | 2 +- arch/x86/kvm/vmx/vmx.c | 234 +++++++++++++++++++++++-------------------= ---- arch/x86/kvm/vmx/vmx.h | 2 +- 3 files changed, 120 insertions(+), 118 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index d1af20b..a898b53 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3016,7 +3016,7 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcp= u *vcpu) =20 preempt_disable(); =20 - vmx_prepare_switch_to_guest(vcpu); + vmx_prepare_guest_switch(vcpu); =20 /* * Induce a consistency check VMExit by clearing bit 1 in GUEST_RFLAGS, diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 90d91524..f6a6674 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -1125,7 +1125,7 @@ void vmx_set_host_fs_gs(struct vmcs_host_state *host,= u16 fs_sel, u16 gs_sel, } } =20 -void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu) +void vmx_prepare_guest_switch(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx =3D to_vmx(vcpu); struct vmcs_host_state *host_state; @@ -2317,7 +2317,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)); @@ -2366,7 +2366,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(); @@ -2911,7 +2911,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 @@ -2934,7 +2934,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) { u64 root_hpa =3D vcpu->arch.mmu->root_hpa; =20 @@ -2950,16 +2950,16 @@ static void vmx_flush_tlb_current(struct kvm_vcpu *= vcpu) 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 - * vmx_flush_tlb_guest() for an explanation of why this is ok. + * vmx_tlb_flush_guest() for an explanation of why this is ok. */ 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 @@ -4455,16 +4455,16 @@ static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, b= ool 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 @@ -6173,7 +6173,7 @@ static void vmx_l1d_flush(struct kvm_vcpu *vcpu) : "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; @@ -6261,7 +6261,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 @@ -6837,7 +6837,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 @@ -6848,7 +6848,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; unsigned long *msr_bitmap; @@ -7802,7 +7802,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. */ } @@ -7827,7 +7827,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(); @@ -7843,134 +7843,136 @@ static bool vmx_check_apicv_inhibit_reasons(ulong= bit) return supported & BIT(bit); } =20 +#define KVM_X86_OP(name) .name =3D vmx_##name + static struct kvm_x86_ops vmx_x86_ops __initdata =3D { - .hardware_teardown =3D hardware_unsetup, + KVM_X86_OP(hardware_teardown), =20 - .hardware_enable =3D hardware_enable, - .hardware_disable =3D hardware_disable, + KVM_X86_OP(hardware_enable), + KVM_X86_OP(hardware_disable), .cpu_has_accelerated_tpr =3D report_flexpriority, - .has_emulated_msr =3D vmx_has_emulated_msr, + KVM_X86_OP(has_emulated_msr), =20 .vm_size =3D sizeof(struct kvm_vmx), - .vm_init =3D vmx_vm_init, + KVM_X86_OP(vm_init), =20 - .vcpu_create =3D vmx_create_vcpu, - .vcpu_free =3D vmx_free_vcpu, - .vcpu_reset =3D vmx_vcpu_reset, + KVM_X86_OP(vcpu_create), + KVM_X86_OP(vcpu_free), + KVM_X86_OP(vcpu_reset), =20 - .prepare_guest_switch =3D vmx_prepare_switch_to_guest, - .vcpu_load =3D vmx_vcpu_load, - .vcpu_put =3D vmx_vcpu_put, + KVM_X86_OP(prepare_guest_switch), + KVM_X86_OP(vcpu_load), + KVM_X86_OP(vcpu_put), =20 .update_bp_intercept =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_posted_interrupt =3D vmx_deliver_posted_interrupt, - .dy_apicv_has_pending_interrupt =3D vmx_dy_apicv_has_pending_interrupt, - - .set_tss_addr =3D vmx_set_tss_addr, - .set_identity_map_addr =3D vmx_set_identity_map_addr, - .get_tdp_level =3D vmx_get_tdp_level, - .get_mt_mask =3D vmx_get_mt_mask, - - .get_exit_info =3D vmx_get_exit_info, - - .cpuid_update =3D vmx_cpuid_update, + KVM_X86_OP(get_msr_feature), + KVM_X86_OP(get_msr), + KVM_X86_OP(set_msr), + KVM_X86_OP(get_segment_base), + KVM_X86_OP(get_segment), + KVM_X86_OP(set_segment), + KVM_X86_OP(get_cpl), + KVM_X86_OP(get_cs_db_l_bits), + KVM_X86_OP(set_cr0), + KVM_X86_OP(set_cr4), + KVM_X86_OP(set_efer), + KVM_X86_OP(get_idt), + KVM_X86_OP(set_idt), + KVM_X86_OP(get_gdt), + KVM_X86_OP(set_gdt), + KVM_X86_OP(set_dr7), + KVM_X86_OP(sync_dirty_debug_regs), + KVM_X86_OP(cache_reg), + KVM_X86_OP(get_rflags), + KVM_X86_OP(set_rflags), + + KVM_X86_OP(tlb_flush_all), + KVM_X86_OP(tlb_flush_current), + KVM_X86_OP(tlb_flush_gva), + KVM_X86_OP(tlb_flush_guest), + + KVM_X86_OP(vcpu_run), + KVM_X86_OP(handle_exit), + KVM_X86_OP(skip_emulated_instruction), + KVM_X86_OP(update_emulated_instruction), + KVM_X86_OP(set_interrupt_shadow), + KVM_X86_OP(get_interrupt_shadow), + KVM_X86_OP(patch_hypercall), + KVM_X86_OP(inject_irq), + KVM_X86_OP(inject_nmi), + KVM_X86_OP(queue_exception), + KVM_X86_OP(cancel_injection), + KVM_X86_OP(interrupt_allowed), + KVM_X86_OP(nmi_allowed), + KVM_X86_OP(get_nmi_mask), + KVM_X86_OP(set_nmi_mask), + KVM_X86_OP(enable_nmi_window), + KVM_X86_OP(enable_irq_window), + KVM_X86_OP(update_cr8_intercept), + KVM_X86_OP(set_virtual_apic_mode), + KVM_X86_OP(set_apic_access_page_addr), + KVM_X86_OP(refresh_apicv_exec_ctrl), + KVM_X86_OP(load_eoi_exitmap), + KVM_X86_OP(apicv_post_state_restore), + KVM_X86_OP(check_apicv_inhibit_reasons), + KVM_X86_OP(hwapic_irr_update), + KVM_X86_OP(hwapic_isr_update), + KVM_X86_OP(guest_apic_has_interrupt), + KVM_X86_OP(sync_pir_to_irr), + KVM_X86_OP(deliver_posted_interrupt), + KVM_X86_OP(dy_apicv_has_pending_interrupt), + + KVM_X86_OP(set_tss_addr), + KVM_X86_OP(set_identity_map_addr), + KVM_X86_OP(get_tdp_level), + KVM_X86_OP(get_mt_mask), + + KVM_X86_OP(get_exit_info), + + KVM_X86_OP(cpuid_update), =20 .has_wbinvd_exit =3D cpu_has_vmx_wbinvd_exit, =20 - .write_l1_tsc_offset =3D vmx_write_l1_tsc_offset, + KVM_X86_OP(write_l1_tsc_offset), =20 - .load_mmu_pgd =3D vmx_load_mmu_pgd, + KVM_X86_OP(load_mmu_pgd), =20 - .check_intercept =3D vmx_check_intercept, - .handle_exit_irqoff =3D vmx_handle_exit_irqoff, + KVM_X86_OP(check_intercept), + KVM_X86_OP(handle_exit_irqoff), =20 - .request_immediate_exit =3D vmx_request_immediate_exit, + KVM_X86_OP(request_immediate_exit), =20 - .sched_in =3D vmx_sched_in, + KVM_X86_OP(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(slot_enable_log_dirty), + KVM_X86_OP(slot_disable_log_dirty), + KVM_X86_OP(flush_log_dirty), + KVM_X86_OP(enable_log_dirty_pt_masked), .write_log_dirty =3D vmx_write_pml_buffer, =20 - .pre_block =3D vmx_pre_block, - .post_block =3D vmx_post_block, + KVM_X86_OP(pre_block), + KVM_X86_OP(post_block), =20 .pmu_ops =3D &intel_pmu_ops, .nested_ops =3D &vmx_nested_ops, =20 - .update_pi_irte =3D vmx_update_pi_irte, + KVM_X86_OP(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(set_hv_timer), + KVM_X86_OP(cancel_hv_timer), #endif =20 - .setup_mce =3D vmx_setup_mce, + KVM_X86_OP(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(smi_allowed), + KVM_X86_OP(pre_enter_smm), + KVM_X86_OP(pre_leave_smm), + KVM_X86_OP(enable_smi_window), =20 - .need_emulation_on_page_fault =3D vmx_need_emulation_on_page_fault, - .apic_init_signal_blocked =3D vmx_apic_init_signal_blocked, - .migrate_timers =3D vmx_migrate_timers, + KVM_X86_OP(need_emulation_on_page_fault), + KVM_X86_OP(apic_init_signal_blocked), + KVM_X86_OP(migrate_timers), }; =20 static __init int hardware_setup(void) diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index 639798e..8084ce0 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -325,7 +325,7 @@ void vmx_vcpu_load_vmcs(struct kvm_vcpu *vcpu, int cpu, int allocate_vpid(void); void free_vpid(int vpid); void vmx_set_constant_host_state(struct vcpu_vmx *vmx); -void vmx_prepare_switch_to_guest(struct kvm_vcpu *vcpu); +void vmx_prepare_guest_switch(struct kvm_vcpu *vcpu); void vmx_set_host_fs_gs(struct vmcs_host_state *host, u16 fs_sel, u16 gs_s= el, unsigned long fs_base, unsigned long gs_base); int vmx_get_cpl(struct kvm_vcpu *vcpu); --=20 1.8.3.1 From nobody Mon Feb 9 01:21:41 2026 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=1595898580; cv=none; d=zohomail.com; s=zohoarc; b=Mwpi4c5kMzJKPn3GnvDgSgQ8v4OeqqbxP3vFfgJGP8j3INpSI+KdJ7OiC7iJcwtXv9jGHRgyYaaPdjAgYQwlNQiDyal9si6nzMdi5Kont0/Wi/MQM4oEBEbnqV9Ox/h2c60gjHP/ulHstcXY8tMPi1KbyJsTNxiPQ9UDge6IlJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898580; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=vXnj/gnqmHKObJdeOI0HW17ejiMSjp3dJmhAljiBIXo=; b=FZ96UH3srV11mysxEkOTew9N3ifQLKfnksFTFjt/pd3vJ7goC+I81oBwE8YBUzWik9Bsivjeyc6M5XCxXmJeIe42RzjQtVRQFR0jXLLTCbejD9IN5VWSwAW3iUqxJjw5JMr3wkv0xaLzXzCBfyO0XtB/VQ2Xc+WV277ATIM6uSA= 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 15958985803501011.3884769076301; Mon, 27 Jul 2020 18:09:40 -0700 (PDT) Received: from localhost ([::1]:36350 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0E7f-00051S-4K for importer@patchew.org; Mon, 27 Jul 2020 21:09:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD8-0003kL-7n for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:14 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:36710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD2-0003TV-Lh for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:13 -0400 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 06S07dWi098897; Tue, 28 Jul 2020 00:11:04 GMT Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by userp2120.oracle.com with ESMTP id 32hu1jcgnk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:11:04 +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 06S08RQq040890; Tue, 28 Jul 2020 00:11:03 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3020.oracle.com with ESMTP id 32hu5s4mnd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:03 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06S0B1u4020224; Tue, 28 Jul 2020 00:11:01 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:11:01 -0700 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; s=corp-2020-01-29; bh=vXnj/gnqmHKObJdeOI0HW17ejiMSjp3dJmhAljiBIXo=; b=FCpMV570cbd+0qevU4Lup/EdxyBrxCdX91FMZf7h0MyjZzgEg0MbidehQALQGTZscbEZ Ka1afBr6vekJA/As/W0akfWe8PbVtjYptgm+aEyrO9T3leyOHRr6IAhhjRgVtLL/BDwR 1Xc7XRMSU6tliuwXtedSO2ds2qxv4zcW1++ZQXQW3iIMrA4fCK2zVXAYuyRcy924P542 HB4t6jxIbPSPJKtyI/7uQi/Vir5yJx8zNnuVPWJ1cXFw1EVF0NG8oRpg7GWFfVq/SB0+ 530QfBeI7uvRL1NcgK0qUmaw614LGqNg4toJq70KI94pcTZsjj4VK+WTVs2hhPF/L59A Bg== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 5/6 v3] KVM: nVMX: Fill in conforming vmx_nested_ops via macro Date: Tue, 28 Jul 2020 00:10:49 +0000 Message-Id: <1595895050-105504-6-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=3 adultscore=0 bulkscore=0 malwarescore=0 mlxscore=0 spamscore=0 mlxlogscore=826 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 clxscore=1015 mlxlogscore=835 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 phishscore=0 suspectscore=3 bulkscore=0 mlxscore=0 lowpriorityscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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/07/27 20:11:04 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:18 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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/nested.c | 24 +++++++++++++----------- arch/x86/kvm/vmx/nested.h | 2 +- arch/x86/kvm/vmx/vmx.c | 4 ++-- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index a898b53..fc09bb0 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3105,7 +3105,7 @@ static int nested_vmx_check_vmentry_hw(struct kvm_vcp= u *vcpu) return 0; } =20 -static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) +static bool nested_vmx_get_vmcs12_pages(struct kvm_vcpu *vcpu) { struct vmcs12 *vmcs12 =3D get_vmcs12(vcpu); struct vcpu_vmx *vmx =3D to_vmx(vcpu); @@ -3295,7 +3295,7 @@ enum nvmx_vmentry_status nested_vmx_enter_non_root_mo= de(struct kvm_vcpu *vcpu, prepare_vmcs02_early(vmx, vmcs12); =20 if (from_vmentry) { - if (unlikely(!nested_get_vmcs12_pages(vcpu))) + if (unlikely(!nested_vmx_get_vmcs12_pages(vcpu))) return NVMX_VMENTRY_KVM_INTERNAL_ERROR; =20 if (nested_vmx_check_vmentry_hw(vcpu)) { @@ -3711,7 +3711,7 @@ static bool nested_vmx_preemption_timer_pending(struc= t kvm_vcpu *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; @@ -5907,7 +5907,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) { @@ -6031,7 +6031,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) { @@ -6448,7 +6448,7 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msr= s *msrs, u32 ept_caps) msrs->vmcs_enum =3D VMCS12_MAX_FIELD_INDEX << 1; } =20 -void nested_vmx_hardware_unsetup(void) +void nested_vmx_hardware_teardown(void) { int i; =20 @@ -6473,7 +6473,7 @@ __init int nested_vmx_hardware_setup(int (*exit_handl= ers[])(struct kvm_vcpu *)) vmx_bitmap[i] =3D (unsigned long *) __get_free_page(GFP_KERNEL); if (!vmx_bitmap[i]) { - nested_vmx_hardware_unsetup(); + nested_vmx_hardware_teardown(); return -ENOMEM; } } @@ -6497,12 +6497,14 @@ __init int nested_vmx_hardware_setup(int (*exit_han= dlers[])(struct kvm_vcpu *)) return 0; } =20 +#define KVM_X86_NESTED_OP(name) .name =3D nested_vmx_##name + struct kvm_x86_nested_ops vmx_nested_ops =3D { - .check_events =3D vmx_check_nested_events, + KVM_X86_NESTED_OP(check_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_vmcs12_pages =3D nested_get_vmcs12_pages, + KVM_X86_NESTED_OP(get_state), + KVM_X86_NESTED_OP(set_state), + KVM_X86_NESTED_OP(get_vmcs12_pages), .enable_evmcs =3D nested_enable_evmcs, .get_evmcs_version =3D nested_get_evmcs_version, }; diff --git a/arch/x86/kvm/vmx/nested.h b/arch/x86/kvm/vmx/nested.h index 758bccc..ac6b561 100644 --- a/arch/x86/kvm/vmx/nested.h +++ b/arch/x86/kvm/vmx/nested.h @@ -18,7 +18,7 @@ enum nvmx_vmentry_status { =20 void vmx_leave_nested(struct kvm_vcpu *vcpu); void nested_vmx_setup_ctls_msrs(struct nested_vmx_msrs *msrs, u32 ept_caps= ); -void nested_vmx_hardware_unsetup(void); +void nested_vmx_hardware_teardown(void); __init int nested_vmx_hardware_setup(int (*exit_handlers[])(struct kvm_vcp= u *)); void nested_vmx_set_vmcs_shadowing_bitmap(void); void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu); diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index f6a6674..6512e6e 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -7830,7 +7830,7 @@ static void vmx_migrate_timers(struct kvm_vcpu *vcpu) static void vmx_hardware_teardown(void) { if (nested) - nested_vmx_hardware_unsetup(); + nested_vmx_hardware_teardown(); =20 free_kvm_area(); } @@ -8144,7 +8144,7 @@ static __init int hardware_setup(void) =20 r =3D alloc_kvm_area(); if (r) - nested_vmx_hardware_unsetup(); + nested_vmx_hardware_teardown(); return r; } =20 --=20 1.8.3.1 From nobody Mon Feb 9 01:21:41 2026 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=1595898749; cv=none; d=zohomail.com; s=zohoarc; b=fLXXd2mcGTH2v0fTAYjnoVs29CXiBr01EDZq8sqVvT7EkxEU9/sPz3NV3r9wtADKjlhKgtVtrbPxFMjS1mD5Kaczz2RbLekaY0gq183xm2HD3cSHDXpzqdYi/yYPJ+A3lsUdgHFAhnxen1DxIkxsohrnr0tQBkOObNKYJEla8jc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595898749; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=Tgt0IXNU0U1SE8rNFf9vnXgmFBtrz6jbIxlr/BMqz+Y=; b=DqtgYUDtonK+ClB1G7svcQ/GT7ggcVsal1ySiur8NzmlRtGQrj/2YO/euEUNNxpEQXtR/Tui/GZnrIF0b7hB5D8g1gOBu3NvH4yy1aizDiz5tu3LVwbnZSc62DiBoWIpKHEuYIlaMmh6+toBcz5FqDoG+iR9MAVBu25LYbK/pUc= 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 1595898749778443.7556397013908; Mon, 27 Jul 2020 18:12:29 -0700 (PDT) Received: from localhost ([::1]:45910 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k0EAO-0000bf-K2 for importer@patchew.org; Mon, 27 Jul 2020 21:12:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44088) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DDB-0003lP-NO for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:17 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:33120) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k0DD2-0003TR-Kt for qemu-devel@nongnu.org; Mon, 27 Jul 2020 20:11:17 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 06S07Cla020949; Tue, 28 Jul 2020 00:11:03 GMT Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 32hu1j4g3s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 28 Jul 2020 00:11:03 +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 06S08frR136391; Tue, 28 Jul 2020 00:11:02 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 32hu5tc69m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Jul 2020 00:11:02 +0000 Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 06S0B2TD031045; Tue, 28 Jul 2020 00:11:02 GMT Received: from nsvm-sadhukhan.osdevelopmeniad.oraclevcn.com (/100.100.231.196) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 27 Jul 2020 17:11:02 -0700 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; s=corp-2020-01-29; bh=Tgt0IXNU0U1SE8rNFf9vnXgmFBtrz6jbIxlr/BMqz+Y=; b=sxUxM6FO9FJd8IKEoKggLrRGMeLUE4WqPpR8EwzfSYsNm3w+FMG5FiKlxQ3sLgprEDtD 2bgPQa2R2JBVviRThWBCFbfBXjsf90YmmZlj8yXLv8CUKSf3ULMkAG7Y4hfuiLKD4knb LOyrSAE0xMmCKxmVxIPcqKN3dD0iv/a2z7aLCvWPPWsNSShd/Ov6Tco5r6b+nDF5EUmj 2aJvO1osto4yhMVnsUpHjdASYaaskWwPRn4RMC9SZQzru4YPwMKGV2JvQ2/Kg/ZjFi5Z x2hj03mOdNubtg2vr4dmKzaTaR7GfZfL1w93uLjfagOsegdQjD+Yoyrp8pBWpn/TL8+a nw== From: Krish Sadhukhan To: kvm@vger.kernel.org Subject: [PATCH 6/6 v3] QEMU: x86: Change KVM_MEMORY_ENCRYPT_* #defines to make them conformant to the kernel Date: Tue, 28 Jul 2020 00:10:50 +0000 Message-Id: <1595895050-105504-7-git-send-email-krish.sadhukhan@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> References: <1595895050-105504-1-git-send-email-krish.sadhukhan@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 mlxscore=0 adultscore=0 spamscore=0 phishscore=0 mlxlogscore=999 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9695 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 clxscore=1015 malwarescore=0 spamscore=0 suspectscore=1 bulkscore=0 priorityscore=1501 phishscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007270165 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.86; envelope-from=krish.sadhukhan@oracle.com; helo=userp2130.oracle.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/27 20:11:06 X-ACL-Warn: Detected OS = Linux 3.1-3.10 [fuzzy] X-Spam_score_int: -63 X-Spam_score: -6.4 X-Spam_bar: ------ X-Spam_report: (-6.4 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-1, 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=-1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 27 Jul 2020 21:08:19 -0400 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-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 --- target/i386/sev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index c3ecf86..0913782 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -113,7 +113,7 @@ sev_ioctl(int fd, int cmd, void *data, int *error) input.sev_fd =3D fd; input.data =3D (__u64)(unsigned long)data; =20 - r =3D kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, &input); + r =3D kvm_vm_ioctl(kvm_state, KVM_MEM_ENC_OP, &input); =20 if (error) { *error =3D input.error; @@ -187,7 +187,7 @@ sev_ram_block_added(RAMBlockNotifier *n, void *host, si= ze_t size) range.size =3D size; =20 trace_kvm_memcrypt_register_region(host, size); - r =3D kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_REG_REGION, &range); + r =3D kvm_vm_ioctl(kvm_state, KVM_MEM_ENC_REGISTER_REGION, &range); if (r) { error_report("%s: failed to register region (%p+%#zx) error '%s'", __func__, host, size, strerror(errno)); @@ -216,7 +216,7 @@ sev_ram_block_removed(RAMBlockNotifier *n, void *host, = size_t size) range.size =3D size; =20 trace_kvm_memcrypt_unregister_region(host, size); - r =3D kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_UNREG_REGION, &range); + r =3D kvm_vm_ioctl(kvm_state, KVM_MEM_ENC_UNREGISTER_REGION, &range); if (r) { error_report("%s: failed to unregister region (%p+%#zx)", __func__, host, size); @@ -454,7 +454,7 @@ sev_get_capabilities(Error **errp) error_setg(errp, "KVM not enabled"); return NULL; } - if (kvm_vm_ioctl(kvm_state, KVM_MEMORY_ENCRYPT_OP, NULL) < 0) { + if (kvm_vm_ioctl(kvm_state, KVM_MEM_ENC_OP, NULL) < 0) { error_setg(errp, "SEV is not enabled in KVM"); return NULL; } --=20 1.8.3.1