From mboxrd@z Thu Jan 1 00:00:00 1970 From: Razvan Cojocaru Subject: Re: [PATCH] libxc: Add xc_domain_hvm_get_mtrr_type() call Date: Wed, 19 Dec 2012 16:57:01 +0200 Message-ID: <50D1D5BD.8080001@gmail.com> References: <1355850255.14620.277.camel@zakaz.uk.xensource.com> <50D0A6B1.30702@gmail.com> <1355912063.14620.286.camel@zakaz.uk.xensource.com> <50D19A2B.2050006@gmail.com> <1355916539.14620.332.camel@zakaz.uk.xensource.com> <50D1A9D1.2020106@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <50D1A9D1.2020106@gmail.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "Tim (Xen.org)" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org >> 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. This is where it gets tricky: static void get_mtrr_range(uint64_t base_msr, uint64_t mask_msr, uint64_t *base, uint64_t *end) { [...] phys_addr = 36; if ( cpuid_eax(0x80000000) >= 0x80000008 ) phys_addr = (uint8_t)cpuid_eax(0x80000008); size_or_mask = ~((1 << (phys_addr - PAGE_SHIFT)) - 1); [...] } specifically, in the cpuid_eax() call, which doesn't make much sense in dom0 userspace. I did manage to take 'enabled' into account with what appears to be success, but if I've read the situation correctly, there's not much to do about 'overlap', unless we save it in hvm_save_mtrr_msr() like it's done with 'enabled'. What do you think? Thanks, Razvan Cojocaru