From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 6/6] Enable MTRR for EPT Date: Thu, 9 Oct 2008 16:49:34 +0800 Message-ID: <200810091649.34684.sheng@linux.intel.com> References: <1223539317-32379-1-git-send-email-sheng@linux.intel.com> <1223539317-32379-7-git-send-email-sheng@linux.intel.com> <48EDC463.7030408@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mga07.intel.com ([143.182.124.22]:48995 "EHLO azsmga101.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752257AbYJIIve (ORCPT ); Thu, 9 Oct 2008 04:51:34 -0400 In-Reply-To: <48EDC463.7030408@redhat.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Thursday 09 October 2008 16:44:19 Avi Kivity wrote: > Sheng Yang wrote: > > The effective memory type of EPT is the mixture of MSR_IA32_CR_PAT and > > memory type field of EPT entry. > > > > > > > > @@ -168,6 +168,7 @@ static u64 __read_mostly shadow_x_mask; /* mutual > > exclusive with nx_mask */ static u64 __read_mostly shadow_user_mask; > > static u64 __read_mostly shadow_accessed_mask; > > static u64 __read_mostly shadow_dirty_mask; > > +static u64 __read_mostly shadow_mt_mask; > > For shadow, the mt mask is different based on the level of the page > table, so we need an array here. This can of course be left until > shadow pat is implemented. > > > + if (mt_mask) { > > + mt_mask = get_memory_type(vcpu, gfn) << > > + kvm_x86_ops->get_mt_mask_shift(); > > + spte |= mt_mask; > > + } > > For shadow, it's not a simple shift, since for large pages one of the > bits is at position 12. So we would need the callback to calculate the > mask value. > > Perhaps even simpler, have a 4x8 array, with the first index the page > table level and the second index the memory type. The initialization > code can prepare the array like it prepares the other masks. > > This can wait until we have a shadow pat implementation. Yes, of course. Now this mask is just used by EPT, so I do it like this. Later shadow mtrr/pat would solve this as well. :) -- regards Yang, Sheng