hvm: vmx/svm_cpu_up_prepare should be called only once
PATCH v2 1/1 hvm: vmx/svm_cpu_up_prepare should be called only once
These routines are first called via CPU_UP_PREPARE notifier by the BSP and then by the booting ASP from vmx_cpu_up()/_svm_cpu_up().
Avoid the unnecessary second call.
---
V2:
* Call *cpu_up_prepare() on BSP from start_svm/vmx()
xen/arch/x86/hvm/svm/svm.c | 6 +----- xen/arch/x86/hvm/vmx/vmcs.c | 3 --- xen/arch/x86/hvm/vmx/vmx.c | 2 +- 3 files changed, 2 insertions(+), 9 deletions(-)
xen/arch/x86/hvm/svm/svm.c +1 -5
@@ -1526,7 +1526,6 @@ static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t rstatic int _svm_cpu_up (bool bsp) {uint64_t msr_content; -int rc;unsigned int cpu =smp_processor_id ();const struct cpuinfo_x86 *c = &cpu_data[cpu];
@@ -1538,9 +1537,6 @@ static int _svm_cpu_up(bool bsp)return -EINVAL ; } -if ( (rc =svm_cpu_up_prepare (cpu)) !=0 ) -return rc; -write_efer (read_efer () |EFER_SVME );/* Initialize the HSA for this core. */
@@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)svm_host_osvw_reset (); -if (_svm_cpu_up (true) ) +if (svm_cpu_up_prepare (smp_processor_id ()) ||_svm_cpu_up (true) ) {printk ("SVM: failed to initialise.\n" );return NULL ;
xen/arch/x86/hvm/vmx/vmcs.c +0 -3
@@ -652,9 +652,6 @@ int vmx_cpu_up(void)INIT_LIST_HEAD (&this_cpu (active_vmcs_list)); -if ( (rc =vmx_cpu_up_prepare (cpu)) !=0 ) -return rc; -switch (__vmxon (this_cpu (vmxon_region)) ) {case -2 :/* #UD or #GP */
xen/arch/x86/hvm/vmx/vmx.c +1 -1
@@ -2433,7 +2433,7 @@ const struct hvm_function_table * __init start_vmx(void) {set_in_cr4 (X86_CR4_VMXE ); -if (vmx_cpu_up () ) +if (vmx_cpu_up_prepare (smp_processor_id ()) ||vmx_cpu_up () ) {printk ("VMX: failed to initialise.\n" );return NULL ;
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
xen/arch/x86/hvm/svm/svm.c const struct hvm_function_table * __init start_svm(void) · line 1588
Quoted 6 lines · Boris Ostrovsky
xen/arch/x86/hvm/svm/svm.c +1
-1@@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)svm_host_osvw_reset (); -if (_svm_cpu_up (true) ) +if (svm_cpu_up_prepare (smp_processor_id ()) ||_svm_cpu_up (true) )
Both of these could pass 0 rather than smp_processor_id(), but either way, Reviewed-by: Andrew Cooper <[email protected]>
xen/arch/x86/hvm/svm/svm.c const struct hvm_function_table * __init start_svm(void) · line 1591
Quoted 3 lines
xen/arch/x86/hvm/svm/svm.c +0
-0{printk ("SVM: failed to initialise.\n" );return NULL ;
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 9 lines · Andrew Cooper
xen/arch/x86/hvm/svm/svm.c const struct hvm_function_table * __init start_svm(void) · line 1588
Quoted 6 lines · Boris Ostrovsky
xen/arch/x86/hvm/svm/svm.c +1
-1@@ -1589,7 +1585,7 @@ const struct hvm_function_table * __init start_svm(void)svm_host_osvw_reset (); -if (_svm_cpu_up (true) ) +if (svm_cpu_up_prepare (smp_processor_id ()) ||_svm_cpu_up (true) )Both of these could pass 0 rather than
smp_processor_id(), but either way, Reviewed-by: Andrew Cooper <[email protected]>
This patch breaks VMX on Intel, let me rework it.
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel