[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [SeaBIOS] [PATCH v2] fw/msr_feature_control: add suppor
From: |
Haozhong Zhang |
Subject: |
Re: [Qemu-devel] [SeaBIOS] [PATCH v2] fw/msr_feature_control: add support to set MSR_IA32_FEATURE_CONTROL |
Date: |
Mon, 20 Jun 2016 09:06:10 +0800 |
User-agent: |
Mutt/1.6.1-neo (2016-05-02) |
On 06/17/16 11:26, Kevin O'Connor wrote:
> On Fri, Jun 17, 2016 at 03:20:10PM +0800, Haozhong Zhang wrote:
> > OS usually expects BIOS to set certain bits in MSR_IA32_FEATURE_CONTROL
> > for some features (e.g. VMX and LMCE). QEMU provides a fw_cfg file
> > "etc/msr_feature_control" to advise bits that should be set in
> > MSR_IA32_FEATURE_CONTROL. If this file exists, SeaBIOS will set the
> > advised bits in that MSR.
>
> Thanks - see my comments below.
>
> > --- /dev/null
> > +++ b/src/fw/msr_feature_control.c
> > @@ -0,0 +1,16 @@
> > +#include "util.h" // msr_feature_control_setup, wrmsr_smp
> > +#include "romfile.h" // romfile_find
> > +
> > +#define MSR_IA32_FEATURE_CONTROL 0x0000003a
> > +
> > +void msr_feature_control_setup(void)
> > +{
> > + struct romfile_s *f = romfile_find("etc/msr_feature_control");
> > + if (!f)
> > + return;
> > +
> > + u64 feature_control_bits;
> > + f->copy(f, &feature_control_bits, sizeof(feature_control_bits));
> > + if (feature_control_bits)
> > + wrmsr_smp(MSR_IA32_FEATURE_CONTROL, feature_control_bits);
> > +}
>
> Can you use romfile_loadint() instead? Something like:
>
> u64 feature_control_bits = romfile_loadint("etc/msr_feature_control", 0);
> if (feature_control_bits)
> wrmsr_smp(MSR_IA32_FEATURE_CONTROL, feature_control_bits);
>
> That should avoid the need for the separate romfile_find() call and it
> has the added benefit of additional sanity checks.
>
> Also, I think this code is small enough it can be placed directly in
> paravirt.c and does not need its own c file.
>
I'll use romfile_loadint and place the code in paravirt.c in the next version.
Thanks,
Haozhong