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-changelog

[Xen-changelog] [xen-unstable] merge with xen-unstable.hg (staging)

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] merge with xen-unstable.hg (staging)
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 09 Nov 2007 04:21:22 -0800
Delivery-date: Fri, 09 Nov 2007 05:46:49 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Alex Williamson <alex.williamson@xxxxxx>
# Date 1194539826 25200
# Node ID ee935d2b8a632bad27fc1682daf9cda503e08277
# Parent  d0cd18d780749482866ab4b21e3f77b40141230e
# Parent  3e3b0418905f5900df24d1e1b6e916cff8a371ba
merge with xen-unstable.hg (staging)
---
 tools/ioemu/target-i386-dm/helper2.c      |   17 -
 tools/misc/xend                           |   14 -
 tools/python/xen/xm/main.py               |    6 
 xen/arch/ia64/vmx/mmio.c                  |    3 
 xen/arch/ia64/vmx/save.c                  |    6 
 xen/arch/ia64/xen/mm.c                    |    2 
 xen/arch/x86/hvm/intercept.c              |   18 -
 xen/arch/x86/hvm/save.c                   |   12 -
 xen/arch/x86/hvm/stdvga.c                 |    4 
 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    |   12 -
 xen/arch/x86/hvm/vmx/vtd/utils.c          |  360 +++++++++++-------------------
 xen/arch/x86/hvm/vpt.c                    |   26 --
 xen/arch/x86/mm.c                         |    8 
 xen/arch/x86/mm/shadow/multi.c            |    5 
 xen/common/grant_table.c                  |    2 
 xen/common/hvm/save.c                     |    4 
 xen/common/page_alloc.c                   |   11 
 xen/include/asm-ia64/mm.h                 |    5 
 xen/include/asm-powerpc/mm.h              |    3 
 xen/include/asm-x86/hvm/vmx/intel-iommu.h |   13 +
 xen/include/asm-x86/mm.h                  |    8 
 xen/include/public/hvm/ioreq.h            |   11 
 xen/include/xen/hvm/save.h                |    4 
 23 files changed, 236 insertions(+), 318 deletions(-)

diff -r d0cd18d78074 -r ee935d2b8a63 tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Wed Nov 07 15:11:44 2007 -0700
+++ b/tools/ioemu/target-i386-dm/helper2.c      Thu Nov 08 09:37:06 2007 -0700
@@ -541,27 +541,28 @@ void __handle_buffered_iopage(CPUState *
 {
     buf_ioreq_t *buf_req = NULL;
     ioreq_t req;
-    int qw = 0;
+    int qw;
 
     if (!buffered_io_page)
         return;
 
     while (buffered_io_page->read_pointer !=
            buffered_io_page->write_pointer) {
-        memset(&req, 0, sizeof(req));
-        buf_req = &buffered_io_page->buf_ioreq[buffered_io_page->read_pointer %
-                                      IOREQ_BUFFER_SLOT_NUM];
+        buf_req = &buffered_io_page->buf_ioreq[
+            buffered_io_page->read_pointer % IOREQ_BUFFER_SLOT_NUM];
         req.size = 1UL << buf_req->size;
         req.count = 1;
         req.addr = buf_req->addr;
         req.data = buf_req->data;
         req.state = STATE_IOREQ_READY;
-        req.dir  = buf_req->dir;
+        req.dir = buf_req->dir;
+        req.df = buf_req->df;
         req.type = buf_req->type;
-        qw = req.size == 8;
+        req.data_is_ptr = 0;
+        qw = (req.size == 8);
         if (qw) {
-            buf_req = 
&buffered_io_page->buf_ioreq[(buffered_io_page->read_pointer+1) %
-                                               IOREQ_BUFFER_SLOT_NUM];
+            buf_req = &buffered_io_page->buf_ioreq[
+                (buffered_io_page->read_pointer+1) % IOREQ_BUFFER_SLOT_NUM];
             req.data |= ((uint64_t)buf_req->data) << 32;
         }
 
diff -r d0cd18d78074 -r ee935d2b8a63 tools/misc/xend
--- a/tools/misc/xend   Wed Nov 07 15:11:44 2007 -0700
+++ b/tools/misc/xend   Thu Nov 08 09:37:06 2007 -0700
@@ -33,13 +33,13 @@ import time
 import time
 import commands
 
-result = commands.getstatusoutput(os.path.join(os.path.dirname(sys.argv[0]),
-                                               'xen-python-path'))
-if result[0] != 0:
-    print >>sys.stderr, result[1]
-    sys.exit(1)
-
-sys.path.append(result[1])
+xpp = os.path.join(os.path.dirname(sys.argv[0]), 'xen-python-path')
+if os.path.exists(xpp):
+    result = commands.getstatusoutput(xpp)
+    if result[0] != 0:
+        print >>sys.stderr, result[1]
+        sys.exit(1)
+    sys.path.append(result[1])
 
 from xen.xend.server import SrvDaemon
 
diff -r d0cd18d78074 -r ee935d2b8a63 tools/python/xen/xm/main.py
--- a/tools/python/xen/xm/main.py       Wed Nov 07 15:11:44 2007 -0700
+++ b/tools/python/xen/xm/main.py       Thu Nov 08 09:37:06 2007 -0700
@@ -1529,11 +1529,11 @@ def xm_sched_credit(args):
     cap = None
 
     for o, a in opts:
-        if o == "-d":
+        if o in ["-d", "--domain"]:
             domid = a
-        elif o == "-w":
+        elif o in ["-w", "--weight"]:
             weight = int(a)
-        elif o == "-c":
+        elif o in ["-c", "--cap"]:
             cap = int(a);
 
     doms = filter(lambda x : domid_match(domid, x),
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/ia64/vmx/mmio.c
--- a/xen/arch/ia64/vmx/mmio.c  Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/ia64/vmx/mmio.c  Thu Nov 08 09:37:06 2007 -0700
@@ -65,7 +65,7 @@ static int hvm_buffered_io_intercept(ior
 
     /* ignore READ ioreq_t and anything buffered io can't deal with */
     if (p->dir == IOREQ_READ || p->addr > 0xFFFFFUL ||
-        p->data_is_ptr || p->df || p->count != 1)
+        p->data_is_ptr || p->count != 1)
         return 0;
 
     for (i = 0; i < HVM_BUFFERED_IO_RANGE_NR; i++) {
@@ -80,6 +80,7 @@ static int hvm_buffered_io_intercept(ior
 
     bp.type = p->type;
     bp.dir = p->dir;
+    bp.df = p->df;
     switch (p->size) {
     case 1:
         bp.size = 0;
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/ia64/vmx/save.c
--- a/xen/arch/ia64/vmx/save.c  Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/ia64/vmx/save.c  Thu Nov 08 09:37:06 2007 -0700
@@ -23,8 +23,7 @@
 #include <xen/types.h>
 #include <xen/hvm/save.h>
 
-void
-arch_hvm_save(struct hvm_save_header *hdr)
+void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
 {
     unsigned int i;
     
@@ -32,8 +31,7 @@ arch_hvm_save(struct hvm_save_header *hd
         hdr->cpuid[i] = ia64_get_cpuid(i);
 }
 
-int
-arch_hvm_load(struct hvm_save_header *hdr)
+int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
 {
     unsigned int i;
     if (hdr->magic != HVM_FILE_MAGIC) {
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c    Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/ia64/xen/mm.c    Thu Nov 08 09:37:06 2007 -0700
@@ -2832,7 +2832,7 @@ arch_memory_op(int op, XEN_GUEST_HANDLE(
 
         /* Remove previously mapped page if it was present. */
         if (prev_mfn && mfn_valid(prev_mfn)) {
-            if (is_xen_heap_frame(mfn_to_page(prev_mfn)))
+            if (is_xen_heap_mfn(prev_mfn))
                 /* Xen heap frames are simply unhooked from this phys slot. */
                 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
             else
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c      Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/intercept.c      Thu Nov 08 09:37:06 2007 -0700
@@ -163,18 +163,20 @@ int hvm_buffered_io_send(ioreq_t *p)
     /* Ensure buffered_iopage fits in a page */
     BUILD_BUG_ON(sizeof(buffered_iopage_t) > PAGE_SIZE);
 
-    /* Return 0 for the cases we can't deal with. */
-    if ( (p->addr > 0xffffful) || p->data_is_ptr || p->df || (p->count != 1) )
-    {
-        gdprintk(XENLOG_DEBUG, "slow ioreq. type:%d size:%"PRIu64" addr:0x%"
-                 PRIx64" dir:%d ptr:%d df:%d count:%"PRIu64"\n",
-                 p->type, p->size, p->addr, !!p->dir,
-                 !!p->data_is_ptr, !!p->df, p->count);
+    /*
+     * Return 0 for the cases we can't deal with:
+     *  - 'addr' is only a 20-bit field, so we cannot address beyond 1MB
+     *  - we cannot buffer accesses to guest memory buffers, as the guest
+     *    may expect the memory buffer to be synchronously accessed
+     *  - the count field is usually used with data_is_ptr and since we don't
+     *    support data_is_ptr we do not waste space for the count field either
+     */
+    if ( (p->addr > 0xffffful) || p->data_is_ptr || (p->count != 1) )
         return 0;
-    }
 
     bp.type = p->type;
     bp.dir  = p->dir;
+    bp.df   = p->df;
     switch ( p->size )
     {
     case 1:
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/save.c
--- a/xen/arch/x86/hvm/save.c   Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/save.c   Thu Nov 08 09:37:06 2007 -0700
@@ -24,8 +24,7 @@
 #include <asm/hvm/support.h>
 #include <public/hvm/save.h>
 
-void
-arch_hvm_save(struct hvm_save_header *hdr)
+void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr)
 {
     uint32_t eax, ebx, ecx, edx;
 
@@ -36,10 +35,10 @@ arch_hvm_save(struct hvm_save_header *hd
     hdr->pad0 = 0;
 }
 
-int
-arch_hvm_load(struct hvm_save_header *hdr)
+int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr)
 {
     uint32_t eax, ebx, ecx, edx;
+
     if ( hdr->magic != HVM_FILE_MAGIC )
     {
         gdprintk(XENLOG_ERR, 
@@ -55,10 +54,13 @@ arch_hvm_load(struct hvm_save_header *hd
     }
 
     cpuid(1, &eax, &ebx, &ecx, &edx);
-    /*TODO: need to define how big a difference is acceptable */
+    /* TODO: need to define how big a difference is acceptable? */
     if ( hdr->cpuid != eax )
         gdprintk(XENLOG_WARNING, "HVM restore: saved CPUID (%#"PRIx32") "
                "does not match host (%#"PRIx32").\n", hdr->cpuid, eax);
+
+    /* VGA state is not saved/restored, so we nobble the cache. */
+    d->arch.hvm_domain.stdvga.cache = 0;
 
     return 0;
 }
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/stdvga.c
--- a/xen/arch/x86/hvm/stdvga.c Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/stdvga.c Thu Nov 08 09:37:06 2007 -0700
@@ -220,7 +220,9 @@ static void stdvga_outb(uint64_t addr, u
         gdprintk(XENLOG_INFO, "entering stdvga and caching modes\n");
     }
     else if ( prev_stdvga && !s->stdvga )
+    {
         gdprintk(XENLOG_INFO, "leaving stdvga\n");
+    }
 }
 
 static void stdvga_outv(uint64_t addr, uint64_t data, uint32_t size)
@@ -636,7 +638,7 @@ int stdvga_intercept_mmio(ioreq_t *p)
             buf = mmio_op(s, p);
             break;
         default:
-            gdprintk(XENLOG_ERR, "unsupported mmio request type:%d "
+            gdprintk(XENLOG_WARNING, "unsupported mmio request type:%d "
                      "addr:0x%04x data:0x%04x size:%d count:%d state:%d "
                      "isptr:%d dir:%d df:%d\n",
                      p->type, (int)p->addr, (int)p->data, (int)p->size,
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/vmx/vtd/intel-iommu.c
--- a/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/vmx/vtd/intel-iommu.c    Thu Nov 08 09:37:06 2007 -0700
@@ -115,18 +115,6 @@ static int device_context_mapped(struct 
     return ret;
 }
 
-/* page table handling */
-#define LEVEL_STRIDE        (9)
-#define LEVEL_MASK        ((1 << LEVEL_STRIDE) - 1)
-#define agaw_to_level(val) ((val) + 2)
-#define agaw_to_width(val) (30 + val * LEVEL_STRIDE)
-#define width_to_agaw(w)  ((w - 30)/LEVEL_STRIDE)
-#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE)
-#define address_level_offset(addr, level) \
-    ((addr >> level_to_offset_bits(level)) & LEVEL_MASK)
-#define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l))
-#define level_size(l) (1 << level_to_offset_bits(l))
-#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l))
 static struct page_info *addr_to_dma_page(struct domain *domain, u64 addr)
 {
     struct hvm_iommu *hd = domain_hvm_iommu(domain);
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/vmx/vtd/utils.c
--- a/xen/arch/x86/hvm/vmx/vtd/utils.c  Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/vmx/vtd/utils.c  Thu Nov 08 09:37:06 2007 -0700
@@ -32,8 +32,9 @@
 
 #include <xen/mm.h>
 #include <xen/xmalloc.h>
-
-#define VTDPREFIX "[VT-D]" 
+#include <xen/inttypes.h>
+
+#define VTDPREFIX "[VT-D]"
 #define INTEL   0x8086
 #define SEABURG 0x4000
 #define C_STEP  2
@@ -93,47 +94,57 @@ void disable_pmr(struct iommu *iommu)
             "Disabled protected memory registers\n");
 }
 
-#if defined(__x86_64__)
+
 void print_iommu_regs(struct acpi_drhd_unit *drhd)
 {
     struct iommu *iommu = drhd->iommu;
- 
-    printk("---- print_iommu_regs ----\n"); 
+
+    printk("---- print_iommu_regs ----\n");
     printk("print_iommu_regs: drhd->address = %lx\n", drhd->address);
     printk("print_iommu_regs: DMAR_VER_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_VER_REG));
-    printk("print_iommu_regs: DMAR_CAP_REG = %lx\n",
-                   dmar_readq(iommu->reg,DMAR_CAP_REG));
-    printk("print_iommu_regs: n_fault_reg = %lx\n",
-                   cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG)));
-    printk("print_iommu_regs: fault_recording_offset_l = %lx\n",
-                   cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)));
-    printk("print_iommu_regs: fault_recording_offset_h = %lx\n",
-                   cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) 
+ 8);
-    printk("print_iommu_regs: fault_recording_reg_l = %lx\n",
-        dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, 
DMAR_CAP_REG))));
-    printk("print_iommu_regs: fault_recording_reg_h = %lx\n",
-        dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, 
DMAR_CAP_REG)) + 8));
-    printk("print_iommu_regs: DMAR_ECAP_REG = %lx\n",
-                   dmar_readq(iommu->reg,DMAR_ECAP_REG));
+           dmar_readl(iommu->reg,DMAR_VER_REG));
+    printk("print_iommu_regs: DMAR_CAP_REG = %"PRIx64"\n",
+           dmar_readq(iommu->reg,DMAR_CAP_REG));
+    printk("print_iommu_regs: n_fault_reg = %"PRIx64"\n",
+           cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG)));
+    printk("print_iommu_regs: fault_recording_offset_l = %"PRIx64"\n",
+           cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)));
+    printk("print_iommu_regs: fault_recording_offset_h = %"PRIx64"\n",
+           cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 8);
+    printk("print_iommu_regs: fault_recording_reg_l = %"PRIx64"\n",
+           dmar_readq(iommu->reg,
+               cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG))));
+    printk("print_iommu_regs: fault_recording_reg_h = %"PRIx64"\n",
+           dmar_readq(iommu->reg,
+               cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) + 
8));
+    printk("print_iommu_regs: DMAR_ECAP_REG = %"PRIx64"\n",
+           dmar_readq(iommu->reg,DMAR_ECAP_REG));
     printk("print_iommu_regs: DMAR_GCMD_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_GCMD_REG));
+           dmar_readl(iommu->reg,DMAR_GCMD_REG));
     printk("print_iommu_regs: DMAR_GSTS_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_GSTS_REG));
-    printk("print_iommu_regs: DMAR_RTADDR_REG = %lx\n",
-                   dmar_readq(iommu->reg,DMAR_RTADDR_REG));
-    printk("print_iommu_regs: DMAR_CCMD_REG = %lx\n",
-                   dmar_readq(iommu->reg,DMAR_CCMD_REG));
+           dmar_readl(iommu->reg,DMAR_GSTS_REG));
+    printk("print_iommu_regs: DMAR_RTADDR_REG = %"PRIx64"\n",
+           dmar_readq(iommu->reg,DMAR_RTADDR_REG));
+    printk("print_iommu_regs: DMAR_CCMD_REG = %"PRIx64"\n",
+           dmar_readq(iommu->reg,DMAR_CCMD_REG));
     printk("print_iommu_regs: DMAR_FSTS_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FSTS_REG));
+           dmar_readl(iommu->reg,DMAR_FSTS_REG));
     printk("print_iommu_regs: DMAR_FECTL_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FECTL_REG));
+           dmar_readl(iommu->reg,DMAR_FECTL_REG));
     printk("print_iommu_regs: DMAR_FEDATA_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEDATA_REG));
+           dmar_readl(iommu->reg,DMAR_FEDATA_REG));
     printk("print_iommu_regs: DMAR_FEADDR_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEADDR_REG));
+           dmar_readl(iommu->reg,DMAR_FEADDR_REG));
     printk("print_iommu_regs: DMAR_FEUADDR_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEUADDR_REG));
+           dmar_readl(iommu->reg,DMAR_FEUADDR_REG));
+}
+
+u32 get_level_index(unsigned long gmfn, int level)
+{
+    while ( --level )
+        gmfn = gmfn >> LEVEL_STRIDE;
+
+    return gmfn & LEVEL_MASK;
 }
 
 void print_vtd_entries(struct domain *d, int bus, int devfn,
@@ -144,219 +155,120 @@ void print_vtd_entries(struct domain *d,
     struct iommu *iommu;
     struct context_entry *ctxt_entry;
     struct root_entry *root_entry;
-    u64 *l3, *l2, *l1;
-    u32 l3_index, l2_index, l1_index;
+    u64 *l4 = NULL, *l3, *l2, *l1;
+    u32 l4_index = 0, l3_index, l2_index, l1_index;
     u32 i = 0;
-
-    printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x devfn = %x, gmfn 
= %lx\n", d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), devfn, gmfn);
-
-    for_each_drhd_unit(drhd) {
+    int level = agaw_to_level(hd->agaw);
+
+    printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x gmfn = %lx\n",
+           d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), gmfn);
+
+    if ( hd->pgd == NULL )
+    {
+        printk("    hg->pgd == NULL\n");
+        return;
+    }
+    printk("    d->pgd = %p virt_to_maddr(hd->pgd) = %lx\n",
+           hd->pgd, virt_to_maddr(hd->pgd));
+
+    for_each_drhd_unit ( drhd )
+    {
         printk("---- print_vtd_entries %d ----\n", i++);
-
-        if (hd->pgd == NULL) {
-            printk("    hg->pgd == NULL\n");
-            return;
-        }
 
         iommu = drhd->iommu;
         root_entry = iommu->root_entry;
-        printk("    hd->pgd = %p virt_to_maddr(hd->pgd) = %lx\n",
-               hd->pgd, virt_to_maddr(hd->pgd));
-
         printk("    root_entry = %p\n", root_entry);
-        if (root_entry == NULL) {
+        if ( root_entry == NULL )
+        {
             printk("    root_entry == NULL\n");
-            return;
-        }
-
-        printk("    root_entry[%x] = %lx\n", bus, root_entry[bus].val);
+            continue;
+        }
+
+        printk("    root_entry[%x] = %"PRIx64"\n", bus, root_entry[bus].val);
         printk("    maddr_to_virt(root_entry[%x]) = %p\n",
-            bus, maddr_to_virt(root_entry[bus].val));
-
-        if (root_entry[bus].val == 0) {
+               bus, maddr_to_virt(root_entry[bus].val));
+
+        if ( root_entry[bus].val == 0 )
+        {
             printk("    root_entry[%x].lo == 0\n", bus);
-            return;
-        }
- 
-        ctxt_entry = maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << 
PAGE_SHIFT);
-        if (ctxt_entry == NULL) {
+            continue;
+        }
+
+        ctxt_entry =
+            maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << PAGE_SHIFT);
+        if ( ctxt_entry == NULL )
+        {
             printk("    ctxt_entry == NULL\n");
-            return;
-        }
-
-        if (ctxt_entry[devfn].lo == 0) {
+            continue;
+        }
+
+        if ( ctxt_entry[devfn].lo == 0 )
+        {
             printk("    ctxt_entry[%x].lo == 0\n", devfn);
-            return;
+            continue;
         }
 
         printk("    context = %p\n", ctxt_entry);
-        printk("    context[%x] = %lx %lx\n",
+        printk("    context[%x] = %"PRIx64" %"PRIx64"\n",
                devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo);
         printk("    maddr_to_virt(context[%x].lo) = %p\n",
                devfn, maddr_to_virt(ctxt_entry[devfn].lo));
-        printk("    context[%x] = %lx\n", devfn, ctxt_entry[devfn].lo); 
-
-        l3 = maddr_to_virt(ctxt_entry[devfn].lo);
-        l3 = (u64*)(((u64) l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        printk("    l3 = %p\n", l3); 
-        if (l3 == NULL) return;
-
-        l3_index = (gmfn >> 9 >> 9) & 0x1ff;
-        printk("    l3_index = %x\n", l3_index);
-        printk("    l3[%x] = %lx\n", l3_index, l3[l3_index]);
+        printk("    context[%x] = %"PRIx64"\n", devfn, ctxt_entry[devfn].lo);
+
+        switch ( level )
+        {
+        case VTD_PAGE_TABLE_LEVEL_3:
+            l3 = maddr_to_virt(ctxt_entry[devfn].lo);
+            l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
+            printk("    l3 = %p\n", l3);
+            if ( l3 == NULL )
+                continue;
+            l3_index = get_level_index(gmfn, 3);
+            printk("    l3_index = %x\n", l3_index);
+            printk("    l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]);
+
+            break;
+        case VTD_PAGE_TABLE_LEVEL_4:
+            l4 = maddr_to_virt(ctxt_entry[devfn].lo);
+            l4 = (u64*)(((unsigned long)l4 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
+            printk("    l4 = %p\n", l4);
+            if ( l4 == NULL )
+                continue;
+            l4_index = get_level_index(gmfn, 4);
+            printk("    l4_index = %x\n", l4_index);
+            printk("    l4[%x] = %"PRIx64"\n", l4_index, l4[l4_index]);
+
+            l3 = maddr_to_virt(l4[l4_index]);
+            l3 = (u64*)(((unsigned long)l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
+            printk("    l3 = %p\n", l3);
+            if ( l3 == NULL )
+                continue;
+            l3_index = get_level_index(gmfn, 3);
+            printk("    l3_index = %x\n", l3_index);
+            printk("    l3[%x] = %"PRIx64"\n", l3_index, l3[l3_index]);
+
+            break;
+        default:
+            printk("Unsupported VTD page table level (%d)!\n", level);
+            continue;
+        }
 
         l2 = maddr_to_virt(l3[l3_index]);
-        l2 = (u64*)(((u64) l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        printk("    l2 = %p\n", l2); 
-        if (l2 == NULL) return;
-
-        l2_index = (gmfn >> 9) & 0x1ff;
-        printk("    gmfn = %lx\n", gmfn);
-        printk("    gmfn >> 9= %lx\n", gmfn >> 9);
+        l2 = (u64*)(((unsigned long)l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
+        printk("    l2 = %p\n", l2);
+        if ( l2 == NULL )
+            continue;
+        l2_index = get_level_index(gmfn, 2);
         printk("    l2_index = %x\n", l2_index);
-        printk("    l2[%x] = %lx\n", l2_index, l2[l2_index]);
+        printk("    l2[%x] = %"PRIx64"\n", l2_index, l2[l2_index]);
 
         l1 = maddr_to_virt(l2[l2_index]);
-        l1 = (u64*)(((u64) l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        if (l1 == NULL) return;
-        l1_index = gmfn & 0x1ff;
-        printk("    l1 = %p\n", l1); 
+        l1 = (u64*)(((unsigned long)l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
+        printk("    l1 = %p\n", l1);
+        if ( l1 == NULL )
+            continue;
+        l1_index = get_level_index(gmfn, 1);
         printk("    l1_index = %x\n", l1_index);
-        printk("    l1[%x] = %lx\n", l1_index, l1[l1_index]); 
-    }
-}
-
-#else    // !m64
-
-void print_iommu_regs(struct acpi_drhd_unit *drhd)
-{
-    struct iommu *iommu = drhd->iommu;
- 
-    printk("---- print_iommu_regs ----\n"); 
-    printk("print_iommu_regs: drhd->address = %lx\n", drhd->address);
-    printk("print_iommu_regs: DMAR_VER_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_VER_REG));
-    printk("print_iommu_regs: DMAR_CAP_REG = %llx\n",
-                   dmar_readq(iommu->reg,DMAR_CAP_REG));
-    printk("print_iommu_regs: n_fault_reg = %llx\n",
-                   cap_num_fault_regs(dmar_readq(iommu->reg, DMAR_CAP_REG)));
-    printk("print_iommu_regs: fault_recording_offset_l = %llx\n",
-                   cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)));
-    printk("print_iommu_regs: fault_recording_offset_h = %llx\n",
-                   cap_fault_reg_offset(dmar_readq(iommu->reg, DMAR_CAP_REG)) 
+ 8);
-    printk("print_iommu_regs: fault_recording_reg_l = %llx\n",
-        dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, 
DMAR_CAP_REG))));
-    printk("print_iommu_regs: fault_recording_reg_h = %llx\n",
-        dmar_readq(iommu->reg, cap_fault_reg_offset(dmar_readq(iommu->reg, 
DMAR_CAP_REG)) + 8));
-    printk("print_iommu_regs: DMAR_ECAP_REG = %llx\n",
-                   dmar_readq(iommu->reg,DMAR_ECAP_REG));
-    printk("print_iommu_regs: DMAR_GCMD_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_GCMD_REG));
-    printk("print_iommu_regs: DMAR_GSTS_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_GSTS_REG));
-    printk("print_iommu_regs: DMAR_RTADDR_REG = %llx\n",
-                   dmar_readq(iommu->reg,DMAR_RTADDR_REG));
-    printk("print_iommu_regs: DMAR_CCMD_REG = %llx\n",
-                   dmar_readq(iommu->reg,DMAR_CCMD_REG));
-    printk("print_iommu_regs: DMAR_FSTS_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FSTS_REG));
-    printk("print_iommu_regs: DMAR_FECTL_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FECTL_REG));
-    printk("print_iommu_regs: DMAR_FEDATA_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEDATA_REG));
-    printk("print_iommu_regs: DMAR_FEADDR_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEADDR_REG));
-    printk("print_iommu_regs: DMAR_FEUADDR_REG = %x\n",
-                   dmar_readl(iommu->reg,DMAR_FEUADDR_REG));
-}
-
-void print_vtd_entries(struct domain *d, int bus, int devfn,
-                       unsigned long gmfn)
-{
-    struct hvm_iommu *hd = domain_hvm_iommu(d);
-    struct acpi_drhd_unit *drhd;
-    struct iommu *iommu;
-    struct context_entry *ctxt_entry;
-    struct root_entry *root_entry;
-    u64 *l3, *l2, *l1;
-    u32 l3_index, l2_index, l1_index;
-    u32 i = 0;
-
-    printk("print_vtd_entries: domain_id = %x bdf = %x:%x:%x devfn = %x, gmfn 
= %lx\n", d->domain_id, bus, PCI_SLOT(devfn), PCI_FUNC(devfn), devfn, gmfn);
-
-    for_each_drhd_unit(drhd) {
-        printk("---- print_vtd_entries %d ----\n", i++);
-
-        if (hd->pgd == NULL) {
-            printk("    hg->pgd == NULL\n");
-            return;
-        }
-
-        iommu = drhd->iommu;
-        root_entry = iommu->root_entry;
-        printk("    d->pgd = %p virt_to_maddr(hd->pgd) = %lx\n",
-               hd->pgd, virt_to_maddr(hd->pgd));
-
-        printk("    root_entry = %p\n", root_entry);
-        if (root_entry == NULL) {
-            printk("    root_entry == NULL\n");
-            return;
-        }
-
-        printk("    root_entry[%x] = %llx\n", bus, root_entry[bus].val);
-        printk("    maddr_to_virt(root_entry[%x]) = %p\n",
-            bus, maddr_to_virt(root_entry[bus].val));
-
-        if (root_entry[bus].val == 0) {
-            printk("    root_entry[%x].lo == 0\n", bus);
-            return;
-        }
- 
-        ctxt_entry = maddr_to_virt((root_entry[bus].val >> PAGE_SHIFT) << 
PAGE_SHIFT);
-        if (ctxt_entry == NULL) {
-            printk("    ctxt_entry == NULL\n");
-            return;
-        }
-
-        if (ctxt_entry[devfn].lo == 0) {
-            printk("    ctxt_entry[%x].lo == 0\n", devfn);
-            return;
-        }
-
-        printk("    context = %p\n", ctxt_entry);
-        printk("    context[%x] = %llx %llx\n",
-               devfn, ctxt_entry[devfn].hi, ctxt_entry[devfn].lo);
-        printk("    maddr_to_virt(context[%x].lo) = %p\n",
-               devfn, maddr_to_virt(ctxt_entry[devfn].lo));
-        printk("    context[%x] = %llx\n", devfn, ctxt_entry[devfn].lo); 
-
-        l3 = maddr_to_virt(ctxt_entry[devfn].lo);
-        l3 = (u64*)(((u32) l3 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        printk("    l3 = %p\n", l3); 
-        if (l3 == NULL) return;
-
-        l3_index = (gmfn >> 9 >> 9) & 0x1ff;
-        printk("    l3_index = %x\n", l3_index);
-        printk("    l3[%x] = %llx\n", l3_index, l3[l3_index]);
-
-        l2 = maddr_to_virt(l3[l3_index]);
-        l2 = (u64*)(((u32) l2 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        printk("    l2 = %p\n", l2); 
-        if (l2 == NULL) return;
-
-        l2_index = (gmfn >> 9) & 0x1ff;
-        printk("    gmfn = %lx\n", gmfn);
-        printk("    gmfn >> 9= %lx\n", gmfn >> 9);
-        printk("    l2_index = %x\n", l2_index);
-        printk("    l2[%x] = %llx\n", l2_index, l2[l2_index]);
-
-        l1 = maddr_to_virt(l2[l2_index]);
-        l1 = (u64*)(((u32) l1 >> PAGE_SHIFT_4K) << PAGE_SHIFT_4K);
-        if (l1 == NULL) return;
-        l1_index = gmfn & 0x1ff;
-        printk("    l1 = %p\n", l1); 
-        printk("    l1_index = %x\n", l1_index);
-        printk("    l1[%x] = %llx\n", l1_index, l1[l1_index]); 
-    }
-}
-#endif    // !m64
+        printk("    l1[%x] = %"PRIx64"\n", l1_index, l1[l1_index]);
+   }
+}
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/hvm/vpt.c
--- a/xen/arch/x86/hvm/vpt.c    Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/hvm/vpt.c    Thu Nov 08 09:37:06 2007 -0700
@@ -56,17 +56,9 @@ static void pt_process_missed_ticks(stru
     if ( missed_ticks <= 0 )
         return;
 
-    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
-    {
-        pt->pending_intr_nr = 1;
-        pt->scheduled = now + pt->period;
-    }
-    else
-    {
-        missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
-        pt->pending_intr_nr += missed_ticks;
-        pt->scheduled += missed_ticks * pt->period;
-    }
+    missed_ticks = missed_ticks / (s_time_t) pt->period + 1;
+    pt->pending_intr_nr += missed_ticks;
+    pt->scheduled += missed_ticks * pt->period;
 }
 
 static void pt_freeze_time(struct vcpu *v)
@@ -131,10 +123,7 @@ static void pt_timer_fn(void *data)
 
     pt_lock(pt);
 
-    if ( mode_is(pt->vcpu->domain, no_missed_tick_accounting) )
-        pt->pending_intr_nr = 1;
-    else
-        pt->pending_intr_nr++;
+    pt->pending_intr_nr++;
 
     if ( !pt->one_shot )
     {
@@ -235,11 +224,16 @@ void pt_intr_post(struct vcpu *v, struct
     }
     else
     {
-        pt->pending_intr_nr--;
         if ( mode_is(v->domain, no_missed_tick_accounting) )
+        {
             pt->last_plt_gtime = hvm_get_guest_time(v);
+            pt->pending_intr_nr = 0; /* 'collapse' all missed ticks */
+        }
         else
+        {
             pt->last_plt_gtime += pt->period_cycles;
+            pt->pending_intr_nr--;
+        }
     }
 
     if ( mode_is(v->domain, delay_for_missed_ticks) &&
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/mm.c Thu Nov 08 09:37:06 2007 -0700
@@ -674,7 +674,7 @@ get_page_from_l1e(
         uint32_t x, nx, y = page->count_info;
         uint32_t cacheattr = pte_flags_to_cacheattr(l1f);
 
-        if ( is_xen_heap_frame(page) )
+        if ( is_xen_heap_page(page) )
         {
             if ( (l1f & _PAGE_RW) &&
                  !(unlikely(paging_mode_external(d) &&
@@ -1866,7 +1866,7 @@ void cleanup_page_cacheattr(struct page_
 
     page->count_info &= ~PGC_cacheattr_mask;
 
-    BUG_ON(is_xen_heap_frame(page));
+    BUG_ON(is_xen_heap_page(page));
 
 #ifdef __x86_64__
     map_pages_to_xen((unsigned long)page_to_virt(page), page_to_mfn(page),
@@ -3200,7 +3200,7 @@ long arch_memory_op(int op, XEN_GUEST_HA
         prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
         if ( mfn_valid(prev_mfn) )
         {
-            if ( is_xen_heap_frame(mfn_to_page(prev_mfn)) )
+            if ( is_xen_heap_mfn(prev_mfn) )
                 /* Xen heap frames are simply unhooked from this phys slot. */
                 guest_physmap_remove_page(d, xatp.gpfn, prev_mfn);
             else
@@ -3583,7 +3583,7 @@ void free_xen_pagetable(void *v)
 
     BUG_ON(early_boot);
     
-    if ( is_xen_heap_frame(virt_to_page(v)) )
+    if ( is_xen_heap_page(virt_to_page(v)) )
         free_xenheap_page(v);
     else
         free_domheap_page(virt_to_page(v));
diff -r d0cd18d78074 -r ee935d2b8a63 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c    Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/arch/x86/mm/shadow/multi.c    Thu Nov 08 09:37:06 2007 -0700
@@ -745,10 +745,11 @@ _sh_propagate(struct vcpu *v,
 
     /*
      * For HVM domains with direct access to MMIO areas, set the correct
-     * caching attributes in the shadows to match what was asked for
+     * caching attributes in the shadows to match what was asked for.
      */
     if ( (level == 1) && is_hvm_domain(d) &&
-         !list_empty(&(domain_hvm_iommu(d)->pdev_list)) )
+         !list_empty(&(domain_hvm_iommu(d)->pdev_list)) &&
+         !is_xen_heap_mfn(mfn_x(target_mfn)) )
     {
         unsigned int type;
         if ( hvm_get_mem_pinned_cacheattr(d, gfn_x(target_gfn), &type) )
diff -r d0cd18d78074 -r ee935d2b8a63 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/common/grant_table.c  Thu Nov 08 09:37:06 2007 -0700
@@ -1057,7 +1057,7 @@ gnttab_transfer(
         }
 
         page = mfn_to_page(mfn);
-        if ( unlikely(is_xen_heap_frame(page)) )
+        if ( unlikely(is_xen_heap_page(page)) )
         { 
             gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n",
                     (unsigned long)gop.mfn);
diff -r d0cd18d78074 -r ee935d2b8a63 xen/common/hvm/save.c
--- a/xen/common/hvm/save.c     Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/common/hvm/save.c     Thu Nov 08 09:37:06 2007 -0700
@@ -94,7 +94,7 @@ int hvm_save(struct domain *d, hvm_domai
     else 
         hdr.changeset = -1ULL; /* Unknown */
 
-    arch_hvm_save(&hdr);
+    arch_hvm_save(d, &hdr);
 
     if ( hvm_save_entry(HEADER, 0, h, &hdr) != 0 )
     {
@@ -144,7 +144,7 @@ int hvm_load(struct domain *d, hvm_domai
     if ( hvm_load_entry(HEADER, h, &hdr) != 0 ) 
         return -1;
 
-    if ( arch_hvm_load(&hdr) )
+    if ( arch_hvm_load(d, &hdr) )
         return -1;
 
     c = strrchr(xen_changeset(), ':');
diff -r d0cd18d78074 -r ee935d2b8a63 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/common/page_alloc.c   Thu Nov 08 09:37:06 2007 -0700
@@ -559,8 +559,7 @@ static unsigned long avail_heap_pages(
     return free_pages;
 }
 
-#define avail_for_domheap(mfn) \
-    (!allocated_in_map(mfn) && !is_xen_heap_frame(mfn_to_page(mfn)))
+#define avail_for_domheap(mfn) !(allocated_in_map(mfn) || is_xen_heap_mfn(mfn))
 void __init end_boot_allocator(void)
 {
     unsigned long i;
@@ -615,7 +614,7 @@ void __init scrub_heap_pages(void)
         /* Re-check page status with lock held. */
         if ( !allocated_in_map(mfn) )
         {
-            if ( is_xen_heap_frame(mfn_to_page(mfn)) )
+            if ( is_xen_heap_mfn(mfn) )
             {
                 p = page_to_virt(mfn_to_page(mfn));
                 memguard_unguard_range(p, PAGE_SIZE);
@@ -655,9 +654,9 @@ void init_xenheap_pages(paddr_t ps, padd
      * Yuk! Ensure there is a one-page buffer between Xen and Dom zones, to
      * prevent merging of power-of-two blocks across the zone boundary.
      */
-    if ( ps && !is_xen_heap_frame(maddr_to_page(ps)-1) )
+    if ( ps && !is_xen_heap_mfn(paddr_to_pfn(ps)-1) )
         ps += PAGE_SIZE;
-    if ( !is_xen_heap_frame(maddr_to_page(pe)) )
+    if ( !is_xen_heap_mfn(paddr_to_pfn(pe)) )
         pe -= PAGE_SIZE;
 
     init_heap_pages(MEMZONE_XEN, maddr_to_page(ps), (pe - ps) >> PAGE_SHIFT);
@@ -838,7 +837,7 @@ void free_domheap_pages(struct page_info
 
     ASSERT(!in_irq());
 
-    if ( unlikely(is_xen_heap_frame(pg)) )
+    if ( unlikely(is_xen_heap_page(pg)) )
     {
         /* NB. May recursively lock from relinquish_memory(). */
         spin_lock_recursive(&d->page_alloc_lock);
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/asm-ia64/mm.h Thu Nov 08 09:37:06 2007 -0700
@@ -115,8 +115,9 @@ struct page_info
  /* 29-bit count of references to this frame. */
 #define PGC_count_mask      ((1UL<<29)-1)
 
-#define is_xen_heap_frame(pfn) ((page_to_maddr(pfn) < xenheap_phys_end) \
-                                && (page_to_maddr(pfn) >= xen_pstart))
+#define is_xen_heap_mfn(mfn)   (((mfn) < paddr_to_pfn(xenheap_phys_end)) \
+                                && ((mfn) >= paddr_to_pfn(xen_pstart)))
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
 
 extern void* xen_pickle_offset;
 #define __pickle(a)    ((unsigned long)a - (unsigned long)xen_pickle_offset)
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/asm-powerpc/mm.h
--- a/xen/include/asm-powerpc/mm.h      Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/asm-powerpc/mm.h      Thu Nov 08 09:37:06 2007 -0700
@@ -111,7 +111,8 @@ struct page_info
  /* 29-bit count of references to this frame. */
 #define PGC_count_mask      ((1UL<<28)-1)
 
-#define is_xen_heap_frame(pfn) (page_to_maddr(pfn) < xenheap_phys_end)
+#define is_xen_heap_mfn(mfn)   ((mfn) < paddr_to_pfn(xenheap_phys_end))
+#define is_xen_heap_page(page) (page_to_maddr(page) < xenheap_phys_end)
 
 static inline struct domain *unpickle_domptr(u32 _domain)
 { return ((_domain == 0) || (_domain & 1)) ? NULL : __va(_domain); }
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/asm-x86/hvm/vmx/intel-iommu.h
--- a/xen/include/asm-x86/hvm/vmx/intel-iommu.h Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/asm-x86/hvm/vmx/intel-iommu.h Thu Nov 08 09:37:06 2007 -0700
@@ -230,6 +230,19 @@ struct context_entry {
     do {(c).hi &= 0xff; (c).hi |= ((val + 1) & ((1 << 16) - 1)) << 8;} while(0)
 #define context_clear_entry(c) do {(c).lo = 0; (c).hi = 0;} while(0)
 
+/* page table handling */
+#define LEVEL_STRIDE       (9)
+#define LEVEL_MASK         ((1 << LEVEL_STRIDE) - 1)
+#define agaw_to_level(val) ((val) + 2)
+#define agaw_to_width(val) (30 + val * LEVEL_STRIDE)
+#define width_to_agaw(w)   ((w - 30)/LEVEL_STRIDE)
+#define level_to_offset_bits(l) (12 + (l - 1) * LEVEL_STRIDE)
+#define address_level_offset(addr, level) \
+            ((addr >> level_to_offset_bits(level)) & LEVEL_MASK)
+#define level_mask(l) (((u64)(-1)) << level_to_offset_bits(l))
+#define level_size(l) (1 << level_to_offset_bits(l))
+#define align_to_level(addr, l) ((addr + level_size(l) - 1) & level_mask(l))
+
 /*
  * 0: readable
  * 1: writable
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h  Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/asm-x86/mm.h  Thu Nov 08 09:37:06 2007 -0700
@@ -102,9 +102,11 @@ struct page_info
  /* 26-bit count of references to this frame. */
 #define PGC_count_mask      ((1U<<26)-1)
 
-#define is_xen_heap_frame(pfn) ({                                       \
-    paddr_t maddr = page_to_maddr(pfn);                                 \
-    ((maddr >= xenheap_phys_start) && (maddr < xenheap_phys_end));      \
+#define is_xen_heap_page(page) is_xen_heap_mfn(page_to_mfn(page))
+#define is_xen_heap_mfn(mfn) ({                         \
+    unsigned long _mfn = (mfn);                         \
+    ((_mfn >= paddr_to_pfn(xenheap_phys_start)) &&      \
+     (_mfn < paddr_to_pfn(xenheap_phys_end)));          \
 })
 
 #if defined(__i386__)
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/public/hvm/ioreq.h
--- a/xen/include/public/hvm/ioreq.h    Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/public/hvm/ioreq.h    Thu Nov 08 09:37:06 2007 -0700
@@ -78,11 +78,12 @@ typedef struct shared_iopage shared_iopa
 typedef struct shared_iopage shared_iopage_t;
 
 struct buf_ioreq {
-    uint8_t  type;   /*  I/O type                    */
-    uint8_t  dir:1;  /*  1=read, 0=write             */
-    uint8_t  size:2; /*  0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
-    uint32_t addr:20;/*  physical address            */
-    uint32_t data;   /*  data                        */
+    uint8_t  type;   /* I/O type                    */
+    uint8_t  df:1;   /* EFLAGS.DF                   */
+    uint8_t  dir:1;  /* 1=read, 0=write             */
+    uint8_t  size:2; /* 0=>1, 1=>2, 2=>4, 3=>8. If 8, use two buf_ioreqs */
+    uint32_t addr:20;/* physical address            */
+    uint32_t data;   /* data                        */
 };
 typedef struct buf_ioreq buf_ioreq_t;
 
diff -r d0cd18d78074 -r ee935d2b8a63 xen/include/xen/hvm/save.h
--- a/xen/include/xen/hvm/save.h        Wed Nov 07 15:11:44 2007 -0700
+++ b/xen/include/xen/hvm/save.h        Thu Nov 08 09:37:06 2007 -0700
@@ -155,7 +155,7 @@ int hvm_load(struct domain *d, hvm_domai
 
 /* Arch-specific definitions. */
 struct hvm_save_header;
-void arch_hvm_save(struct hvm_save_header *hdr);
-int arch_hvm_load(struct hvm_save_header *hdr);
+void arch_hvm_save(struct domain *d, struct hvm_save_header *hdr);
+int arch_hvm_load(struct domain *d, struct hvm_save_header *hdr);
 
 #endif /* __XEN_HVM_SAVE_H__ */

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