[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86/SVM: correct boot time cpu_data[] handling
commit f2c608444261824a9463a7847be2d08ee3ae0c48 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Fri Mar 3 17:08:36 2017 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Fri Mar 3 17:08:36 2017 +0100 x86/SVM: correct boot time cpu_data[] handling start_svm() already runs after cpu_data[] was set up, so it shouldn't modify it anymore (at least not directly). Constify the involved pointers. Furthermore LMSLE feature detection was broken by 566ddbe833 ("x86: Fail CPU bringup cleanly if it cannot initialise HVM"), as Andrew Cooper has pointed out: c couldn't possibly equal &boot_cpu_data anymore. (But since it's unsafe migration-wise for some more time, suppress the feature actually being enabled for us.) Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper@xxxxxxxxxx> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> --- xen/arch/x86/hvm/svm/asid.c | 2 +- xen/arch/x86/hvm/svm/svm.c | 18 ++++++++++++------ xen/include/asm-x86/hvm/svm/asid.h | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/xen/arch/x86/hvm/svm/asid.c b/xen/arch/x86/hvm/svm/asid.c index 5ca8f0e..4861daa 100644 --- a/xen/arch/x86/hvm/svm/asid.c +++ b/xen/arch/x86/hvm/svm/asid.c @@ -22,7 +22,7 @@ #include <asm/amd.h> #include <asm/hvm/nestedhvm.h> -void svm_asid_init(struct cpuinfo_x86 *c) +void svm_asid_init(const struct cpuinfo_x86 *c) { int nasids = 0; diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c index b88f91d..43241d6 100644 --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -1330,7 +1330,7 @@ static int svm_cpu_up_prepare(unsigned int cpu) return 0; } -static void svm_init_erratum_383(struct cpuinfo_x86 *c) +static void svm_init_erratum_383(const struct cpuinfo_x86 *c) { uint64_t msr_content; @@ -1365,11 +1365,12 @@ static int svm_handle_osvw(struct vcpu *v, uint32_t msr, uint64_t *val, bool_t r return 0; } -static int svm_cpu_up(void) +static int _svm_cpu_up(bool bsp) { uint64_t msr_content; - int rc, cpu = smp_processor_id(); - struct cpuinfo_x86 *c = &cpu_data[cpu]; + int rc; + unsigned int cpu = smp_processor_id(); + const struct cpuinfo_x86 *c = &cpu_data[cpu]; /* Check whether SVM feature is disabled in BIOS */ rdmsrl(MSR_K8_VM_CR, msr_content); @@ -1402,7 +1403,7 @@ static int svm_cpu_up(void) rdmsrl(MSR_EFER, msr_content); if ( msr_content & EFER_LMSLE ) { - if ( c == &boot_cpu_data ) + if ( 0 && /* FIXME: Migration! */ bsp ) cpu_has_lmsl = 1; wrmsrl(MSR_EFER, msr_content ^ EFER_LMSLE); } @@ -1419,13 +1420,18 @@ static int svm_cpu_up(void) return 0; } +static int svm_cpu_up(void) +{ + return _svm_cpu_up(false); +} + const struct hvm_function_table * __init start_svm(void) { bool_t printed = 0; svm_host_osvw_reset(); - if ( svm_cpu_up() ) + if ( _svm_cpu_up(true) ) { printk("SVM: failed to initialise.\n"); return NULL; diff --git a/xen/include/asm-x86/hvm/svm/asid.h b/xen/include/asm-x86/hvm/svm/asid.h index 83fab60..154f4da 100644 --- a/xen/include/asm-x86/hvm/svm/asid.h +++ b/xen/include/asm-x86/hvm/svm/asid.h @@ -22,7 +22,7 @@ #include <asm/hvm/asid.h> #include <asm/processor.h> -void svm_asid_init(struct cpuinfo_x86 *c); +void svm_asid_init(const struct cpuinfo_x86 *c); static inline void svm_asid_g_invlpg(struct vcpu *v, unsigned long g_vaddr) { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |