Re: [PATCH v3 08/14] x86/vmx: move vmx_update_debug_state() in vmcs.c and declare it static

2023-02-27 Thread Andrew Cooper
On 24/02/2023 6:50 pm, 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 vmx.h.
>
> No functional change intended.
>
> Signed-off-by: Xenia Ragiadakou 

Acked-by: Andrew Cooper 



[PATCH v3 08/14] x86/vmx: move vmx_update_debug_state() in vmcs.c and declare it static

2023-02-24 Thread Xenia Ragiadakou
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 vmx.h.

No functional change intended.

Signed-off-by: Xenia Ragiadakou 
---

Changes in v3:
  - apply the change before moving the declarations into private headers
to avoid churn, suggested by Jan

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

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index ed71ecfb62..d3c75b3803 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 0ec33bcc18..294c8490b4 100644
--- a/xen/arch/x86/hvm/vmx/vmx.c
+++ b/xen/arch/x86/hvm/vmx/vmx.c
@@ -1613,18 +1613,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/include/asm/hvm/vmx/vmx.h 
b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
index f6308ed656..82a9487b40 100644
--- a/xen/arch/x86/include/asm/hvm/vmx/vmx.h
+++ b/xen/arch/x86/include/asm/hvm/vmx/vmx.h
@@ -88,7 +88,6 @@ void cf_check vmx_vlapic_msr_changed(struct vcpu *v);
 struct hvm_emulate_ctxt;
 void vmx_realmode_emulate_one(struct hvm_emulate_ctxt *hvmemul_ctxt);
 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);
-- 
2.37.2