On Fri, Dec 28, 2018 at 12:39:31PM +0000, Andrew Cooper wrote: > This reduces the complexity of init_amd(), and collects related > workarounds together. > > It also offers us the opportunity to stop performing workarounds when > virtualised - doing so is wasteful, as it all involves poking MSRs which > no hypervisor will let us touch in practice. > > As amd.c has diverged almost entirely from its Linux heratage, start > switching it to using Xen hypervisor style. > > Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> > --- > CC: Jan Beulich <jbeul...@suse.com> > CC: Wei Liu <wei.l...@citrix.com> > CC: Roger Pau Monné <roger....@citrix.com> > > I've dropped various printk()s about working around some errata, because > their use was completely inconsistent. They want to be uniform, whether > that is missing or present. > --- > xen/arch/x86/cpu/amd.c | 266 > ++++++++++++++++++++++++++++--------------------- > 1 file changed, 153 insertions(+), 113 deletions(-) > > diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c > index c790416..c3aa1f4 100644 > --- a/xen/arch/x86/cpu/amd.c > +++ b/xen/arch/x86/cpu/amd.c > @@ -534,22 +534,165 @@ static void early_init_amd(struct cpuinfo_x86 *c) > ctxt_switch_levelling(NULL); > } > > +static void init_amd_k8(struct cpuinfo_x86 *c) > +{ > + uint64_t val; > + > + /* > + * Skip errata workarounds if we are virtualised. We won't have > + * sufficient control of hardware to do anything useful. > + */ > + if ( !cpu_has_hypervisor )
I think you want `if ( cpu_has_hypervisor ) return;` according to the comment (here and below). The rest LGTM, as is mostly code movement AFAICT: Reviewed-by: Roger Pau Monné <roger....@citrix.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel