All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: <xen-devel@lists.xenproject.org>, Jan Beulich <jbeulich@suse.com>,
	Wei Liu <wl@xen.org>
Subject: Re: [PATCH 2/8] x86/svm: silently drop writes to SYSCFG and related MSRs
Date: Wed, 19 Aug 2020 17:07:59 +0200	[thread overview]
Message-ID: <20200819150759.GS828@Air-de-Roger> (raw)
In-Reply-To: <667ecceb-e111-5da5-74f9-9b1cc8628a6a@citrix.com>

On Tue, Aug 18, 2020 at 03:53:16PM +0100, Andrew Cooper wrote:
> On 17/08/2020 16:57, Roger Pau Monne wrote:
> > diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> > index ca3bbfcbb3..671cdcb724 100644
> > --- a/xen/arch/x86/hvm/svm/svm.c
> > +++ b/xen/arch/x86/hvm/svm/svm.c
> > @@ -1917,6 +1917,13 @@ static int svm_msr_read_intercept(unsigned int msr, uint64_t *msr_content)
> >              goto gpf;
> >          break;
> >  
> > +    case MSR_K8_TOP_MEM1:
> > +    case MSR_K8_TOP_MEM2:
> > +    case MSR_K8_SYSCFG:
> > +        /* Return all 0s. */
> > +        *msr_content = 0;
> 
> On a Rome box, these are the normal values:
> 
> 0xc0010010 (SYSCFG) 0x740000
> 0xc001001a (MEM1) 0xb0000000
> 0xc001001d (MEM2) 0x3c50000000
> 
> The SYSCFG bits are MtrrFixDramEn[18], MtrrVarDramEn[20], MtrrTom2En[21]
> and Tom2ForceMemTypeWB[22].  In particular, bits 18 and 20 are expected
> to be set by the system firmware.
> 
> Clearly we shouldn't be leaking TOP_MEM{1,2} into guests, but Xen also
> doesn't have enough information to set these correctly yet either.
> 
> At a minimum, I think SYSCFG wants to report 0x40000 which means "the
> fixed MTRRs behave as expected", and the other bits being clear should
> mean that TOP_MEM{1,2} aren't enabled.

I didn't enable MtrrFixDramEn because AFAICT the emulated MTRR
implementation doesn't support the usage of the Extended type-field
format, and hence those bits will be 0. I'm fine with returning having
it set, as long as we don't allow setting MtrrFixDramModEn[19].

Thanks, Roger.


  reply	other threads:[~2020-08-19 15:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-17 15:57 [PATCH 0/8] x86: switch default MSR behavior Roger Pau Monne
2020-08-17 15:57 ` [PATCH 1/8] x86/vmx: handle writes to MISC_ENABLE MSR Roger Pau Monne
2020-08-18 14:57   ` Andrew Cooper
2020-08-17 15:57 ` [PATCH 2/8] x86/svm: silently drop writes to SYSCFG and related MSRs Roger Pau Monne
2020-08-18 14:53   ` Andrew Cooper
2020-08-19 15:07     ` Roger Pau Monné [this message]
2020-08-27 15:13     ` Jan Beulich
2020-08-17 15:57 ` [PATCH 3/8] x86/pv: handle writes to the EFER MSR Roger Pau Monne
2020-08-18 13:46   ` Andrew Cooper
2020-08-17 15:57 ` [PATCH 4/8] x86/pv: handle reads to the PAT MSR Roger Pau Monne
2020-08-18 13:50   ` Andrew Cooper
2020-08-18 14:11     ` Roger Pau Monné
2020-08-17 15:57 ` [PATCH 5/8] x86/pv: allow reading APIC_BASE MSR Roger Pau Monne
2020-08-18 14:31   ` Andrew Cooper
2020-08-17 15:57 ` [PATCH 6/8] x86/pv: allow reading FEATURE_CONTROL MSR Roger Pau Monne
2020-08-18 14:09   ` Andrew Cooper
2020-08-17 15:57 ` [PATCH 7/8] x86/pv: disallow access to unknown MSRs Roger Pau Monne
2020-08-18 14:24   ` Andrew Cooper
2020-08-17 15:57 ` [PATCH 8/8] x86/hvm: Disallow " Roger Pau Monne
2020-08-18 14:17   ` Andrew Cooper
2020-08-18 13:58 ` [PATCH 9/8] x86/msr: Drop compatibility #GP handling in guest_{rd, wr}msr() Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200819150759.GS828@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.