On 06/16/16 14:03, Paolo Bonzini wrote:
On 16/06/2016 13:49, Haozhong Zhang wrote:
diff --git a/src/fw/paravirt.c b/src/fw/paravirt.c index 8ed4380..640ee4c 100644 --- a/src/fw/paravirt.c +++ b/src/fw/paravirt.c @@ -153,6 +153,9 @@ qemu_platform_setup(void) mtrr_setup(); smp_setup();
- // Initialize MSR_IA32_FEATURE_CONTROL
- msr_feature_control_setup();
- // Create bios tables pirtable_setup(); mptable_setup();
This must run before smp_setup(), because it is smp_setup() that calls handle_smp() on the APs.
I'll move it before smp_setup().
diff --git a/src/fw/msr_feature_control.c b/src/fw/msr_feature_control.c new file mode 100644 index 0000000..35d4ab8 --- /dev/null +++ b/src/fw/msr_feature_control.c @@ -0,0 +1,16 @@ +#include "util.h" // msr_feature_control_setup +#include "x86.h" // wrmsr +#include "romfile.h" // romfile_find
+u64 feature_control_bits;
+void msr_feature_control_setup(void) +{
- struct romfile_s *f = romfile_find("etc/msr_feature_control");
- if (!f)
return;
- f->copy(f, &feature_control_bits, sizeof(feature_control_bits));
- if (feature_control_bits)
wrmsr(MSR_IA32_FEATURE_CONTROL, feature_control_bits);
You can use wrmsr_smp and avoid the change below to handle_smp(). It also removes the need for the feature_control_bits global variable.
Good idea. I think I should also rename smp_mtrr and smp_mtrr_count to something like smp_msr and smp_msr_count, because they will not be used only for MTRR.
Thanks, Haozhong