mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
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@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
This commit is contained in:
1 parent
3c76488305
commit
f2c6084442
3 files changed
+14
-8
No files matched your search
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||