[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2] 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. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> --- v2: Suppress setting cpu_has_lmsl for now. --- 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; --- 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 i 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 * 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; --- 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) { Attachment:
SVM-cpu_data.patch _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |