From: Razvan Cojocaru <rzvncj@gmail.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Tim (Xen.org)" <tim@xen.org>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Subject: Re: [PATCH] libxc: Add xc_domain_hvm_get_mtrr_type() call
Date: Wed, 19 Dec 2012 13:49:37 +0200 [thread overview]
Message-ID: <50D1A9D1.2020106@gmail.com> (raw)
In-Reply-To: <1355916539.14620.332.camel@zakaz.uk.xensource.com>
> There is a section in the Intel SDM (chapter 10.4 in my copy) which
> explains the meanings etc of the registers, which are what is exposed in
> hvm_hw_mtrr I think.
Thanks, I'll look that up.
> xen/arch/x86/hvm/mtrr.c:mtrr_def_type_msr_set() seems to be where it is
> written, and it is called with hw_mtrr.msr_mtrr_def_type so it looks
> like it can be derived from that value in hvm_hw_mtrr.
Indeed it is, but this happens there:
uint8_t def_type = msr_content & 0xff;
uint8_t enabled = (msr_content >> 10) & 0x3;
So what ends up being put in def_type is only one byte of msr_content,
whereas enabled is some bits from another byte of msr_content. To make
matters worse, hw_mtrr.msr_mtrr_def_type is an uint64_t, so would that
mean that hw_mtrr.msr_mtrr_def_type is actually the whole of msr_content?
>> I'm also having a hard time figuring out how to map m->overlapped on the
>> hvm_hw_mtrr members.
>
> m->overlapped = is_var_mtrr_overlapped(m);
>
> Looks like that function contains the necessary logic.
You're right, but what happens there is that that function depends on
the get_mtrr_range() function, which in turn depends on the size_or_mask
global variable, which is initialized in hvm_mtrr_pat_init(), which then
depends on a global table, and so on. Putting that into libxc is pretty
much putting the whole mtrr.c file there.
Is this amount of copy/paste code a good thing, and wouldn't it be less
tedious and bug-prone to have that code in a single place, and just add
overlapped and enabled to hw_mtrr before sending it out into userspace?
Thanks,
Razvan Cojocaru
next prev parent reply other threads:[~2012-12-19 11:49 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-17 11:38 [PATCH] libxc: Add xc_domain_hvm_get_mtrr_type() call Razvan Cojocaru
2012-12-18 17:04 ` Ian Campbell
2012-12-18 17:24 ` Razvan Cojocaru
2012-12-19 10:14 ` Ian Campbell
2012-12-19 10:42 ` Razvan Cojocaru
2012-12-19 11:28 ` Ian Campbell
2012-12-19 11:49 ` Razvan Cojocaru [this message]
2012-12-19 12:00 ` Razvan Cojocaru
2012-12-19 14:57 ` Razvan Cojocaru
2012-12-19 15:00 ` Ian Campbell
2012-12-19 15:10 ` Razvan Cojocaru
2012-12-19 15:27 ` Andrew Cooper
2012-12-19 15:54 ` Ian Campbell
2012-12-19 16:11 ` Andrew Cooper
2012-12-19 16:15 ` Ian Campbell
2012-12-19 16:29 ` Razvan Cojocaru
2012-12-19 17:46 ` Tim Deegan
2012-12-19 19:35 ` Razvan Cojocaru
2012-12-20 11:57 ` Tim Deegan
2012-12-20 13:40 ` Razvan Cojocaru
2012-12-19 15:43 ` Razvan Cojocaru
2012-12-20 11:54 ` Tim Deegan
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=50D1A9D1.2020106@gmail.com \
--to=rzvncj@gmail.com \
--cc=Ian.Campbell@citrix.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).