WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 3 of 4] ept mtrr: replace unsigned long with mfn_t fo

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 3 of 4] ept mtrr: replace unsigned long with mfn_t for mfns
From: Patrick Colp <Patrick.Colp@xxxxxxxxxx>
Date: Wed, 5 Aug 2009 15:00:49 +0100
Delivery-date: Wed, 05 Aug 2009 07:03:52 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1249480846@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1249480846@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Patrick Colp <Patrick.Colp@xxxxxxxxxx>
# Date 1249480778 -3600
# Node ID 9b2a92187e3cfac7753da4e4b1944e774cb01e6f
# Parent  a77221fe874c17b6a4ac3dc0ca40ab91949d8afa
ept mtrr: replace unsigned long with mfn_t for mfns.

Signed-off-by: Patrick Colp <Patrick.Colp@xxxxxxxxxx>

diff -r a77221fe874c -r 9b2a92187e3c xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c   Wed Aug 05 14:59:38 2009 +0100
+++ b/xen/arch/x86/hvm/mtrr.c   Wed Aug 05 14:59:38 2009 +0100
@@ -20,6 +20,7 @@
 #include <public/hvm/e820.h>
 #include <xen/types.h>
 #include <asm/e820.h>
+#include <asm/mm.h>
 #include <asm/paging.h>
 #include <asm/p2m.h>
 #include <xen/domain_page.h>
@@ -712,7 +713,7 @@
 
 uint8_t epte_get_entry_emt(
     struct domain *d, unsigned long gfn, 
-    unsigned long mfn, uint8_t *igmt, int direct_mmio)
+    mfn_t mfn, uint8_t *igmt, int direct_mmio)
 {
     uint8_t gmtrr_mtype, hmtrr_mtype;
     uint32_t type;
@@ -730,7 +731,7 @@
     if ( (v == current) && v->domain->arch.hvm_domain.is_in_uc_mode )
         return MTRR_TYPE_UNCACHABLE;
 
-    if ( !mfn_valid(mfn) )
+    if ( !mfn_valid(mfn_x(mfn)) )
         return MTRR_TYPE_UNCACHABLE;
 
     if ( hvm_get_mem_pinned_cacheattr(d, gfn, &type) )
@@ -752,6 +753,6 @@
     }
 
     gmtrr_mtype = get_mtrr_type(&v->arch.hvm_vcpu.mtrr, (gfn << PAGE_SHIFT));
-    hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn << PAGE_SHIFT));
+    hmtrr_mtype = get_mtrr_type(&mtrr_state, (mfn_x(mfn) << PAGE_SHIFT));
     return ((gmtrr_mtype <= hmtrr_mtype) ? gmtrr_mtype : hmtrr_mtype);
 }
diff -r a77221fe874c -r 9b2a92187e3c xen/arch/x86/mm/hap/p2m-ept.c
--- a/xen/arch/x86/mm/hap/p2m-ept.c     Wed Aug 05 14:59:38 2009 +0100
+++ b/xen/arch/x86/mm/hap/p2m-ept.c     Wed Aug 05 14:59:38 2009 +0100
@@ -168,7 +168,7 @@
     {
         if ( mfn_valid(mfn_x(mfn)) || (p2mt == p2m_mmio_direct) )
         {
-            ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn),
+            ept_entry->emt = epte_get_entry_emt(d, gfn, mfn,
                                 &igmt, direct_mmio);
             ept_entry->igmt = igmt;
             ept_entry->sp_avail = walk_level ? 1 : 0;
@@ -230,7 +230,7 @@
         {
             split_ept_entry = split_table + i;
             split_ept_entry->emt = epte_get_entry_emt(d,
-                                        gfn-offset+i, split_mfn+i, 
+                                        gfn-offset+i, _mfn(split_mfn+i), 
                                         &igmt, direct_mmio);
             split_ept_entry->igmt = igmt;
 
@@ -247,7 +247,7 @@
 
         /* Set the destinated 4k page as normal */
         split_ept_entry = split_table + offset;
-        split_ept_entry->emt = epte_get_entry_emt(d, gfn, mfn_x(mfn), 
+        split_ept_entry->emt = epte_get_entry_emt(d, gfn, mfn,
                                                 &igmt, direct_mmio);
         split_ept_entry->igmt = igmt;
 
@@ -406,7 +406,7 @@
                                     uint8_t o_emt, p2m_type_t p2mt)
 {
     uint8_t igmt, emt;
-    emt = epte_get_entry_emt(d, gfn, mfn_x(mfn), &igmt, 
+    emt = epte_get_entry_emt(d, gfn, mfn, &igmt, 
                                 (p2mt == p2m_mmio_direct));
     if ( (emt == o_emt) && (igmt == o_igmt) )
         return 0;
diff -r a77221fe874c -r 9b2a92187e3c xen/include/asm-x86/mtrr.h
--- a/xen/include/asm-x86/mtrr.h        Wed Aug 05 14:59:38 2009 +0100
+++ b/xen/include/asm-x86/mtrr.h        Wed Aug 05 14:59:38 2009 +0100
@@ -2,6 +2,7 @@
 #define __ASM_X86_MTRR_H__
 
 #include <xen/config.h>
+#include <asm/mm.h>
 
 /* These are the region types. They match the architectural specification. */
 #define MTRR_TYPE_UNCACHABLE 0
@@ -66,7 +67,7 @@
 extern u32 get_pat_flags(struct vcpu *v, u32 gl1e_flags, paddr_t gpaddr,
                   paddr_t spaddr, uint8_t gmtrr_mtype);
 extern uint8_t epte_get_entry_emt(
-    struct domain *d, unsigned long gfn, unsigned long mfn,
+    struct domain *d, unsigned long gfn, mfn_t mfn,
     uint8_t *igmt, int direct_mmio);
 extern void ept_change_entry_emt_with_range(
     struct domain *d, unsigned long start_gfn, unsigned long end_gfn);

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel