diff mbox series

[v2,9/9] x86/vmx: move vmx_update_debug_state() in vmcs.c and declare it static

Message ID 20230222120023.3004624-10-burzalodowa@gmail.com (mailing list archive)
State New, archived
Headers show
Series x86/hvm: {svm,vmx}.{c,h} cleanup | expand

Commit Message

Xenia Ragiadakou Feb. 22, 2023, noon UTC
Move vmx_update_debug_state() in vmcs.c because it is used only in this
file and limit its scope to this file by declaring it static and removing
its declaration from private vmx.h

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---

Changes in v2:
  - remove it from the private vmx.h header instead of the global one

 xen/arch/x86/hvm/vmx/vmcs.c | 12 ++++++++++++
 xen/arch/x86/hvm/vmx/vmx.c  | 12 ------------
 xen/arch/x86/hvm/vmx/vmx.h  |  1 -
 3 files changed, 12 insertions(+), 13 deletions(-)

Comments

Jan Beulich Feb. 23, 2023, 11:21 a.m. UTC | #1
On 22.02.2023 13:00, Xenia Ragiadakou wrote:
> Move vmx_update_debug_state() in vmcs.c because it is used only in this
> file and limit its scope to this file by declaring it static and removing
> its declaration from private vmx.h
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

Perhaps move this ahead in the series, so you don't need to touch ...

> --- a/xen/arch/x86/hvm/vmx/vmx.h
> +++ b/xen/arch/x86/hvm/vmx/vmx.h
> @@ -14,7 +14,6 @@ void vmx_intr_assist(void);
>  void noreturn cf_check vmx_do_resume(void);
>  void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
>  void vmx_realmode(struct cpu_user_regs *regs);
> -void vmx_update_debug_state(struct vcpu *v);
>  void vmx_update_exception_bitmap(struct vcpu *v);
>  void vmx_update_cpu_exec_control(struct vcpu *v);
>  void vmx_update_secondary_exec_control(struct vcpu *v);
... this header again right away?

Jan
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index bc2acd3063..1492f85213 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1868,6 +1868,18 @@  void vmx_vmentry_failure(void)
 
 void noreturn vmx_asm_do_vmentry(void);
 
+static void vmx_update_debug_state(struct vcpu *v)
+{
+    if ( v->arch.hvm.debug_state_latch )
+        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
+    else
+        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
+
+    vmx_vmcs_enter(v);
+    vmx_update_exception_bitmap(v);
+    vmx_vmcs_exit(v);
+}
+
 void cf_check vmx_do_resume(void)
 {
     struct vcpu *v = current;
diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
index 5b210e0db4..ada36d6923 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1610,18 +1610,6 @@  static void cf_check vmx_update_host_cr3(struct vcpu *v)
     vmx_vmcs_exit(v);
 }
 
-void vmx_update_debug_state(struct vcpu *v)
-{
-    if ( v->arch.hvm.debug_state_latch )
-        v->arch.hvm.vmx.exception_bitmap |= 1U << TRAP_int3;
-    else
-        v->arch.hvm.vmx.exception_bitmap &= ~(1U << TRAP_int3);
-
-    vmx_vmcs_enter(v);
-    vmx_update_exception_bitmap(v);
-    vmx_vmcs_exit(v);
-}
-
 static void cf_check vmx_update_guest_cr(
     struct vcpu *v, unsigned int cr, unsigned int flags)
 {
diff --git a/xen/arch/x86/hvm/vmx/vmx.h b/xen/arch/x86/hvm/vmx/vmx.h
index ffc19539bc..7d4ecf6d59 100644
--- a/xen/arch/x86/hvm/vmx/vmx.h
+++ b/xen/arch/x86/hvm/vmx/vmx.h
@@ -14,7 +14,6 @@  void vmx_intr_assist(void);
 void noreturn cf_check vmx_do_resume(void);
 void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
 void vmx_realmode(struct cpu_user_regs *regs);
-void vmx_update_debug_state(struct vcpu *v);
 void vmx_update_exception_bitmap(struct vcpu *v);
 void vmx_update_cpu_exec_control(struct vcpu *v);
 void vmx_update_secondary_exec_control(struct vcpu *v);