[xen-unstable] Merge with ia64.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen-unstable] Merge with ia64.

Xen patchbot-unstable
# HG changeset patch
# User Keir Fraser <[hidden email]>
# Date 1196766365 0
# Node ID aa430556d33f671a1900e8db49625c96368fb3ca
# Parent  32ec5dbe2978fdff4682912de0c78a14d479a8a3
# Parent  0c234da66b4ac9e05d3c7380286c15632e39d467
Merge with ia64.
---
 Makefile                             |    6 +
 extras/mini-os/arch/x86/arch.mk      |    2
 tools/blktap/drivers/blktapctrl.c    |    2
 tools/blktap/drivers/bswap.h         |    7 +
 tools/blktap/drivers/qcow-create.c   |    1
 tools/blktap/drivers/tapdisk.c       |    1
 tools/blktap/lib/xenbus.c            |    1
 tools/blktap/lib/xs_api.c            |    1
 tools/libxc/xc_dom_core.c            |    8 +
 tools/python/xen/xend/XendNetwork.py |   14 ++-
 tools/vnet/libxutil/Makefile         |    2
 tools/vnet/vnet-module/Makefile.ver  |    6 -
 tools/vnet/vnet-module/sa.c          |    1
 tools/vnet/vnet-module/varp_socket.c |    7 -
 tools/xenmon/xenmon.py               |   25 ++++-
 tools/xentrace/xentrace.c            |   18 +--
 xen/arch/x86/domctl.c                |    7 +
 xen/arch/x86/hvm/vmx/vtd/dmar.c      |    6 -
 xen/arch/x86/mm.c                    |  160 +++++++++++++++++++++++------------
 xen/arch/x86/tboot.c                 |   41 ++++++++
 xen/common/domctl.c                  |   95 +-------------------
 xen/include/asm-x86/mm.h             |   54 -----------
 xen/include/asm-x86/tboot.h          |    6 +
 xen/include/public/io/blkif.h        |   15 +++
 xen/include/xsm/xsm.h                |  117 ++-----------------------
 25 files changed, 262 insertions(+), 341 deletions(-)

diff -r 32ec5dbe2978 -r aa430556d33f Makefile
--- a/Makefile Fri Nov 30 08:54:33 2007 -0700
+++ b/Makefile Tue Dec 04 11:06:05 2007 +0000
@@ -211,7 +211,7 @@ linux26:
 # tboot targets
 #
 
-TBOOT_TARFILE = tboot-20071029.tar.gz
+TBOOT_TARFILE = tboot-20071128.tar.gz
 TBOOT_BASE_URL = http://downloads.sourceforge.net/tboot
 
 .PHONY: build-tboot
@@ -222,6 +222,10 @@ install-tboot: download_tboot
 install-tboot: download_tboot
  $(MAKE) -C tboot install
 
+.PHONY: dist-tboot
+dist-tboot: download_tboot
+ $(MAKE) DESTDIR=$(DISTDIR)/install -C tboot dist
+
 .PHONY: clean-tboot
 clean-tboot:
  [ ! -d tboot ] || $(MAKE) -C tboot clean
diff -r 32ec5dbe2978 -r aa430556d33f extras/mini-os/arch/x86/arch.mk
--- a/extras/mini-os/arch/x86/arch.mk Fri Nov 30 08:54:33 2007 -0700
+++ b/extras/mini-os/arch/x86/arch.mk Tue Dec 04 11:06:05 2007 +0000
@@ -17,7 +17,7 @@ endif
 endif
 
 ifeq ($(TARGET_ARCH),x86_64)
-ARCH_CFLAGS := -m64 -mno-red-zone -fpic -fno-reorder-blocks
+ARCH_CFLAGS := -m64 -mno-red-zone -fno-reorder-blocks
 ARCH_CFLAGS += -fno-asynchronous-unwind-tables
 ARCH_ASFLAGS := -m64
 ARCH_LDFLAGS := -m elf_x86_64
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/drivers/blktapctrl.c Tue Dec 04 11:06:05 2007 +0000
@@ -41,7 +41,6 @@
 #include <err.h>
 #include <errno.h>
 #include <sys/types.h>
-#include <linux/types.h>
 #include <sys/wait.h>
 #include <signal.h>
 #include <fcntl.h>
@@ -50,7 +49,6 @@
 #include <string.h>
 #include <unistd.h>
 #include <xs.h>
-#include <printf.h>
 #include <sys/time.h>
 #include <syslog.h>
                                                                     
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/drivers/bswap.h
--- a/tools/blktap/drivers/bswap.h Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/drivers/bswap.h Tue Dec 04 11:06:05 2007 +0000
@@ -4,6 +4,11 @@
 //#include "config-host.h"
 
 #include <inttypes.h>
+
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+#include <sys/endian.h>
+#include <sys/types.h>
+#else
 
 #ifdef HAVE_BYTESWAP_H
 #include <byteswap.h>
@@ -73,6 +78,8 @@ static inline void bswap64s(uint64_t *s)
     *s = bswap64(*s);
 }
 
+#endif
+
 #if defined(WORDS_BIGENDIAN)
 #define be_bswap(v, size) (v)
 #define le_bswap(v, size) bswap ## size(v)
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/drivers/qcow-create.c
--- a/tools/blktap/drivers/qcow-create.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/drivers/qcow-create.c Tue Dec 04 11:06:05 2007 +0000
@@ -37,7 +37,6 @@
 #include <sys/statvfs.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
-#include <linux/fs.h>
 #include <string.h>
 #include "tapdisk.h"
 
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/drivers/tapdisk.c
--- a/tools/blktap/drivers/tapdisk.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/drivers/tapdisk.c Tue Dec 04 11:06:05 2007 +0000
@@ -27,7 +27,6 @@
 #include <poll.h>
 #include <sys/statvfs.h>
 #include <sys/ioctl.h>
-#include <linux/fs.h>
 #include "blktaplib.h"
 #include "tapdisk.h"
 
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/lib/xenbus.c
--- a/tools/blktap/lib/xenbus.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/lib/xenbus.c Tue Dec 04 11:06:05 2007 +0000
@@ -37,7 +37,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <printf.h>
 #include <string.h>
 #include <err.h>
 #include <stdarg.h>
diff -r 32ec5dbe2978 -r aa430556d33f tools/blktap/lib/xs_api.c
--- a/tools/blktap/lib/xs_api.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/blktap/lib/xs_api.c Tue Dec 04 11:06:05 2007 +0000
@@ -34,7 +34,6 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <printf.h>
 #include <string.h>
 #include <err.h>
 #include <stdarg.h>
diff -r 32ec5dbe2978 -r aa430556d33f tools/libxc/xc_dom_core.c
--- a/tools/libxc/xc_dom_core.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/libxc/xc_dom_core.c Tue Dec 04 11:06:05 2007 +0000
@@ -352,15 +352,19 @@ void *xc_dom_pfn_to_ptr(struct xc_dom_im
     }
     else
     {
+        int err;
+
         mode = "anonymous memory";
         phys->ptr = mmap(NULL, phys->count << page_shift,
                          PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON,
                          -1, 0);
         if ( phys->ptr == MAP_FAILED )
         {
+            err = errno;
             xc_dom_panic(XC_OUT_OF_MEMORY,
-                         "%s: oom: can't allocate 0x%" PRIpfn " pages\n",
-                         __FUNCTION__, count);
+                         "%s: oom: can't allocate 0x%" PRIpfn " pages"
+                         " [mmap, errno=%i (%s)]\n",
+                         __FUNCTION__, count, err, strerror(err));
             return NULL;
         }
         dom->alloc_mem_map += phys->count << page_shift;
diff -r 32ec5dbe2978 -r aa430556d33f tools/python/xen/xend/XendNetwork.py
--- a/tools/python/xen/xend/XendNetwork.py Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/python/xen/xend/XendNetwork.py Tue Dec 04 11:06:05 2007 +0000
@@ -65,7 +65,7 @@ class XendNetwork(XendBase):
         return XendBase.getMethods() + methods
 
     def getFuncs(self):
-        funcs = ['create']
+        funcs = ['create', 'get_by_name_label']
         return XendBase.getFuncs() + funcs
 
     getClass    = classmethod(getClass)
@@ -133,9 +133,15 @@ class XendNetwork(XendBase):
 
         return uuid
 
-    create_phy  = classmethod(create_phy)
-    recreate    = classmethod(recreate)
-    create      = classmethod(create)
+    def get_by_name_label(cls, name):
+        return [inst.get_uuid()
+                 for inst in XendAPIStore.get_all(cls.getClass())
+                 if inst.get_name_label() == name]
+    
+    create_phy        = classmethod(create_phy)
+    recreate          = classmethod(recreate)
+    create            = classmethod(create)
+    get_by_name_label = classmethod(get_by_name_label)
         
     def __init__(self, record, uuid):      
         XendBase.__init__(self, uuid, record)
diff -r 32ec5dbe2978 -r aa430556d33f tools/vnet/libxutil/Makefile
--- a/tools/vnet/libxutil/Makefile Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/vnet/libxutil/Makefile Tue Dec 04 11:06:05 2007 +0000
@@ -24,7 +24,7 @@ LIB_OBJS := $(LIB_SRCS:.c=.o)
 LIB_OBJS := $(LIB_SRCS:.c=.o)
 PIC_OBJS := $(LIB_SRCS:.c=.opic)
 
-CFLAGS   += -Werror -fno-strict-aliasing
+CFLAGS   += -Werror -fno-strict-aliasing $(call cc-option,$(CC),-fgnu89-inline,)
 CFLAGS   += -O3
 #CFLAGS   += -g
 
diff -r 32ec5dbe2978 -r aa430556d33f tools/vnet/vnet-module/Makefile.ver
--- a/tools/vnet/vnet-module/Makefile.ver Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/vnet/vnet-module/Makefile.ver Tue Dec 04 11:06:05 2007 +0000
@@ -20,14 +20,14 @@
 
 LINUX_SERIES?=2.6
 
-LINUX_VERSION?=$(shell (/bin/ls -d $(XEN_ROOT)/pristine-linux-$(LINUX_SERIES).* 2>/dev/null) | \
-                      sed -e 's!^.*linux-\(.\+\)!\1!' )
+LINUX_VERSION?=$(shell (/bin/ls -d $(XEN_ROOT)/linux-$(LINUX_SERIES).* 2>/dev/null) | \
+                      sed -e 's!^.*linux-\(.\+\).hg!\1!' )
 
 ifeq ($(LINUX_VERSION),)
 $(error Kernel source for linux $(LINUX_SERIES) not found)
 endif
 
-KERNEL_VERSION?=$(shell (/bin/ls -d $(XEN_ROOT)/build-linux-$(LINUX_VERSION)-xen* 2>/dev/null) | \
+KERNEL_VERSION?=$(shell (/bin/ls -d $(XEN_ROOT)/build-linux-$(LINUX_VERSION)* 2>/dev/null) | \
                       grep -v -m 1 -e '-xenU' | \
                       sed -e 's!^.*linux-\(.\+\)!\1!' )
 
diff -r 32ec5dbe2978 -r aa430556d33f tools/vnet/vnet-module/sa.c
--- a/tools/vnet/vnet-module/sa.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/vnet/vnet-module/sa.c Tue Dec 04 11:06:05 2007 +0000
@@ -16,7 +16,6 @@
  * 59 Temple Place, suite 330, Boston, MA 02111-1307 USA
  *
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 
 #include <tunnel.h>
diff -r 32ec5dbe2978 -r aa430556d33f tools/vnet/vnet-module/varp_socket.c
--- a/tools/vnet/vnet-module/varp_socket.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/vnet/vnet-module/varp_socket.c Tue Dec 04 11:06:05 2007 +0000
@@ -77,9 +77,10 @@ static inline _syscall3(int, fcntl,
  * Some architectures use socketcall() to multiplex the socket-related calls,
  * but others define individual syscalls instead.
  * Architectures using socketcall() define __ARCH_WANT_SYS_SOCKETCALL.
- */
-
-#ifdef __ARCH_WANT_SYS_SOCKETCALL
+ * NB. x86_64 architecture asserts __ARCH_WANT_SYS_SOCKETCALL in error.
+ */
+
+#if defined(__ARCH_WANT_SYS_SOCKETCALL) && !defined(__x86_64__)
 
 /* Define the socketcall() syscall.
  * Multiplexes all the socket-related calls.
diff -r 32ec5dbe2978 -r aa430556d33f tools/xenmon/xenmon.py
--- a/tools/xenmon/xenmon.py Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/xenmon/xenmon.py Tue Dec 04 11:06:05 2007 +0000
@@ -653,21 +653,36 @@ def writelog():
 # start xenbaked
 def start_xenbaked():
     global options
-    
-    os.system("killall -9 xenbaked")
-    # assumes that xenbaked is in your path
-    os.system("xenbaked --ms_per_sample=%d &" %
+    global kill_cmd
+    global xenbaked_cmd
+
+    os.system(kill_cmd)
+    os.system(xenbaked_cmd + " --ms_per_sample=%d &" %
               options.mspersample)
     time.sleep(1)
 
 # stop xenbaked
 def stop_xenbaked():
-    os.system("killall -s INT xenbaked")
+    global stop_cmd
+    os.system(stop_cmd)
 
 def main():
     global options
     global args
     global domains
+    global stop_cmd
+    global kill_cmd
+    global xenbaked_cmd
+
+    if os.uname()[0] == "SunOS":
+        xenbaked_cmd = "/usr/lib/xenbaked"
+ stop_cmd = "/usr/bin/pkill -INT -z global xenbaked"
+ kill_cmd = "/usr/bin/pkill -KILL -z global xenbaked"
+    else:
+        # assumes that xenbaked is in your path
+        xenbaked_cmd = "xenbaked"
+        stop_cmd = "/usr/bin/pkill -INT xenbaked"
+        kill_cmd = "/usr/bin/pkill -KILL xenbaked"
 
     parser = setup_cmdline_parser()
     (options, args) = parser.parse_args()
diff -r 32ec5dbe2978 -r aa430556d33f tools/xentrace/xentrace.c
--- a/tools/xentrace/xentrace.c Fri Nov 30 08:54:33 2007 -0700
+++ b/tools/xentrace/xentrace.c Tue Dec 04 11:06:05 2007 +0000
@@ -572,24 +572,24 @@ int main(int argc, char **argv)
 
     parse_args(argc, argv);
     
-    if (opts.evt_mask != 0) {
+    if ( opts.evt_mask != 0 )
         set_mask(opts.evt_mask, 0);
-    }
-
-    if (opts.cpu_mask != 0) {
+
+    if ( opts.cpu_mask != 0 )
         set_mask(opts.cpu_mask, 1);
-    }
 
     if ( opts.outfile )
-        outfd = open(opts.outfile, O_WRONLY | O_CREAT | O_LARGEFILE, 0644);
-
-    if(outfd < 0)
+        outfd = open(opts.outfile,
+                     O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE,
+                     0644);
+
+    if ( outfd < 0 )
     {
         perror("Could not open output file");
         exit(EXIT_FAILURE);
     }        
 
-    if(isatty(outfd))
+    if ( isatty(outfd) )
     {
         fprintf(stderr, "Cannot output to a TTY, specify a log file.\n");
         exit(EXIT_FAILURE);
diff -r 32ec5dbe2978 -r aa430556d33f xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/arch/x86/domctl.c Tue Dec 04 11:06:05 2007 +0000
@@ -546,7 +546,12 @@ long arch_do_domctl(
         devfn = (domctl->u.assign_device.machine_bdf >> 8) & 0xff;
 
         if ( device_assigned(bus, devfn) )
-            break;
+        {
+            gdprintk(XENLOG_ERR, "XEN_DOMCTL_assign_device: "
+                     "%x:%x:%x already assigned\n",
+                     bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+            break;
+        }
 
         ret = assign_device(d, bus, devfn);
         gdprintk(XENLOG_INFO, "XEN_DOMCTL_assign_device: bdf = %x:%x:%x\n",
diff -r 32ec5dbe2978 -r aa430556d33f xen/arch/x86/hvm/vmx/vtd/dmar.c
--- a/xen/arch/x86/hvm/vmx/vtd/dmar.c Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/arch/x86/hvm/vmx/vtd/dmar.c Tue Dec 04 11:06:05 2007 +0000
@@ -553,5 +553,7 @@ int acpi_dmar_init(void)
         return -ENODEV;
     }
 
-    return 0;
-}
+    printk("Intel VT-d has been enabled\n");
+
+    return 0;
+}
diff -r 32ec5dbe2978 -r aa430556d33f xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/arch/x86/mm.c Tue Dec 04 11:06:05 2007 +0000
@@ -620,6 +620,7 @@ get_page_from_l1e(
     unsigned long mfn = l1e_get_pfn(l1e);
     struct page_info *page = mfn_to_page(mfn);
     uint32_t l1f = l1e_get_flags(l1e);
+    struct vcpu *curr = current;
     int okay;
 
     if ( !(l1f & _PAGE_PRESENT) )
@@ -635,7 +636,7 @@ get_page_from_l1e(
     {
         /* DOMID_IO reverts to caller for privilege checks. */
         if ( d == dom_io )
-            d = current->domain;
+            d = curr->domain;
 
         if ( !iomem_access_permitted(d, mfn, mfn) )
         {
@@ -653,7 +654,7 @@ get_page_from_l1e(
      * qemu-dm helper process in dom0 to map the domain's memory without
      * messing up the count of "real" writable mappings.) */
     okay = (((l1f & _PAGE_RW) &&
-             !(unlikely(paging_mode_external(d) && (d != current->domain))))
+             !(unlikely(paging_mode_external(d) && (d != curr->domain))))
             ? get_page_and_type(page, d, PGT_writable_page)
             : get_page(page, d));
     if ( !okay )
@@ -673,7 +674,7 @@ get_page_from_l1e(
         {
             if ( (l1f & _PAGE_RW) &&
                  !(unlikely(paging_mode_external(d) &&
-                            (d != current->domain))) )
+                            (d != curr->domain))) )
                 put_page_type(page);
             put_page(page);
             MEM_LOG("Attempt to change cache attributes of Xen heap page");
@@ -1384,14 +1385,15 @@ static int mod_l1_entry(l1_pgentry_t *pl
                         unsigned long gl1mfn)
 {
     l1_pgentry_t ol1e;
-    struct domain *d = current->domain;
+    struct vcpu *curr = current;
+    struct domain *d = curr->domain;
     unsigned long mfn;
 
     if ( unlikely(__copy_from_user(&ol1e, pl1e, sizeof(ol1e)) != 0) )
         return 0;
 
     if ( unlikely(paging_mode_refcounts(d)) )
-        return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, current);
+        return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr);
 
     if ( l1e_get_flags(nl1e) & _PAGE_PRESENT )
     {
@@ -1413,12 +1415,12 @@ static int mod_l1_entry(l1_pgentry_t *pl
 
         /* Fast path for identical mapping, r/w and presence. */
         if ( !l1e_has_changed(ol1e, nl1e, _PAGE_RW | _PAGE_PRESENT) )
-            return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, current);
+            return UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr);
 
         if ( unlikely(!get_page_from_l1e(nl1e, FOREIGNDOM)) )
             return 0;
         
-        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, current)) )
+        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) )
         {
             put_page_from_l1e(nl1e, d);
             return 0;
@@ -1426,7 +1428,7 @@ static int mod_l1_entry(l1_pgentry_t *pl
     }
     else
     {
-        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, current)) )
+        if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, curr)) )
             return 0;
     }
 
@@ -1442,7 +1444,8 @@ static int mod_l2_entry(l2_pgentry_t *pl
                         unsigned long type)
 {
     l2_pgentry_t ol2e;
-    struct domain *d = current->domain;
+    struct vcpu *curr = current;
+    struct domain *d = curr->domain;
 
     if ( unlikely(!is_guest_l2_slot(d, type, pgentry_ptr_to_slot(pl2e))) )
     {
@@ -1466,18 +1469,18 @@ static int mod_l2_entry(l2_pgentry_t *pl
 
         /* Fast path for identical mapping and presence. */
         if ( !l2e_has_changed(ol2e, nl2e, _PAGE_PRESENT))
-            return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, current);
+            return UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr);
 
         if ( unlikely(!get_page_from_l2e(nl2e, pfn, d)) )
             return 0;
 
-        if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, current)) )
+        if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) )
         {
             put_page_from_l2e(nl2e, pfn);
             return 0;
         }
     }
-    else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, current)) )
+    else if ( unlikely(!UPDATE_ENTRY(l2, pl2e, ol2e, nl2e, pfn, curr)) )
     {
         return 0;
     }
@@ -1494,7 +1497,8 @@ static int mod_l3_entry(l3_pgentry_t *pl
                         unsigned long pfn)
 {
     l3_pgentry_t ol3e;
-    struct domain *d = current->domain;
+    struct vcpu *curr = current;
+    struct domain *d = curr->domain;
     int okay;
 
     if ( unlikely(!is_guest_l3_slot(pgentry_ptr_to_slot(pl3e))) )
@@ -1528,18 +1532,18 @@ static int mod_l3_entry(l3_pgentry_t *pl
 
         /* Fast path for identical mapping and presence. */
         if (!l3e_has_changed(ol3e, nl3e, _PAGE_PRESENT))
-            return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, current);
+            return UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr);
 
         if ( unlikely(!get_page_from_l3e(nl3e, pfn, d)) )
             return 0;
 
-        if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, current)) )
+        if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) )
         {
             put_page_from_l3e(nl3e, pfn);
             return 0;
         }
     }
-    else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, current)) )
+    else if ( unlikely(!UPDATE_ENTRY(l3, pl3e, ol3e, nl3e, pfn, curr)) )
     {
         return 0;
     }
@@ -1558,11 +1562,12 @@ static int mod_l3_entry(l3_pgentry_t *pl
 #if CONFIG_PAGING_LEVELS >= 4
 
 /* Update the L4 entry at pl4e to new value nl4e. pl4e is within frame pfn. */
-static int mod_l4_entry(struct domain *d,
-                        l4_pgentry_t *pl4e,
+static int mod_l4_entry(l4_pgentry_t *pl4e,
                         l4_pgentry_t nl4e,
                         unsigned long pfn)
 {
+    struct vcpu *curr = current;
+    struct domain *d = curr->domain;
     l4_pgentry_t ol4e;
 
     if ( unlikely(!is_guest_l4_slot(d, pgentry_ptr_to_slot(pl4e))) )
@@ -1583,22 +1588,22 @@ static int mod_l4_entry(struct domain *d
             return 0;
         }
 
-        adjust_guest_l4e(nl4e, current->domain);
+        adjust_guest_l4e(nl4e, d);
 
         /* Fast path for identical mapping and presence. */
         if (!l4e_has_changed(ol4e, nl4e, _PAGE_PRESENT))
-            return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, current);
-
-        if ( unlikely(!get_page_from_l4e(nl4e, pfn, current->domain)) )
+            return UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr);
+
+        if ( unlikely(!get_page_from_l4e(nl4e, pfn, d)) )
             return 0;
 
-        if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, current)) )
+        if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) )
         {
             put_page_from_l4e(nl4e, pfn);
             return 0;
         }
     }
-    else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, current)) )
+    else if ( unlikely(!UPDATE_ENTRY(l4, pl4e, ol4e, nl4e, pfn, curr)) )
     {
         return 0;
     }
@@ -1608,6 +1613,58 @@ static int mod_l4_entry(struct domain *d
 }
 
 #endif
+
+void put_page(struct page_info *page)
+{
+    u32 nx, x, y = page->count_info;
+
+    do {
+        x  = y;
+        nx = x - 1;
+    }
+    while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
+
+    if ( unlikely((nx & PGC_count_mask) == 0) )
+    {
+        cleanup_page_cacheattr(page);
+        free_domheap_page(page);
+    }
+}
+
+
+int get_page(struct page_info *page, struct domain *domain)
+{
+    u32 x, nx, y = page->count_info;
+    u32 d, nd = page->u.inuse._domain;
+    u32 _domain = pickle_domptr(domain);
+
+    do {
+        x  = y;
+        nx = x + 1;
+        d  = nd;
+        if ( unlikely((x & PGC_count_mask) == 0) ||  /* Not allocated? */
+             unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
+             unlikely(d != _domain) )                /* Wrong owner? */
+        {
+            if ( !_shadow_mode_refcounts(domain) && !domain->is_dying )
+                gdprintk(XENLOG_INFO,
+                         "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
+                         PRtype_info "\n",
+                         page_to_mfn(page), domain, unpickle_domptr(d),
+                         x, page->u.inuse.type_info);
+            return 0;
+        }
+        asm volatile (
+            LOCK_PREFIX "cmpxchg8b %3"
+            : "=d" (nd), "=a" (y), "=c" (d),
+            "=m" (*(volatile u64 *)(&page->count_info))
+            : "0" (d), "1" (x), "c" (d), "b" (nx) );
+    }
+    while ( unlikely(nd != d) || unlikely(y != x) );
+
+    return 1;
+}
+
 
 static int alloc_page_type(struct page_info *page, unsigned long type)
 {
@@ -1885,7 +1942,6 @@ int new_guest_cr3(unsigned long mfn)
         okay = paging_mode_refcounts(d)
             ? 0 /* Old code was broken, but what should it be? */
             : mod_l4_entry(
-                    d,
                     __va(pagetable_get_paddr(v->arch.guest_table)),
                     l4e_from_pfn(
                         mfn,
@@ -2117,7 +2173,7 @@ int do_mmuext_op(
             type = PGT_l4_page_table;
 
         pin_page:
-            rc = xsm_memory_pin_page(current->domain, page);
+            rc = xsm_memory_pin_page(d, page);
             if ( rc )
                 break;
 
@@ -2407,14 +2463,14 @@ int do_mmu_update(
              */
         case MMU_NORMAL_PT_UPDATE:
 
-            rc = xsm_mmu_normal_update(current->domain, req.val);
+            rc = xsm_mmu_normal_update(d, req.val);
             if ( rc )
                 break;
 
             gmfn = req.ptr >> PAGE_SHIFT;
             mfn = gmfn_to_mfn(d, gmfn);
 
-            if ( unlikely(!get_page_from_pagenr(mfn, current->domain)) )
+            if ( unlikely(!get_page_from_pagenr(mfn, d)) )
             {
                 MEM_LOG("Could not get page for normal update");
                 break;
@@ -2468,7 +2524,7 @@ int do_mmu_update(
                 case PGT_l4_page_table:
                 {
                     l4_pgentry_t l4e = l4e_from_intpte(req.val);
-                    okay = mod_l4_entry(d, va, l4e, mfn);
+                    okay = mod_l4_entry(va, l4e, mfn);
                 }
                 break;
 #endif
@@ -2501,7 +2557,7 @@ int do_mmu_update(
             mfn = req.ptr >> PAGE_SHIFT;
             gpfn = req.val;
 
-            rc = xsm_mmu_machphys_update(current->domain, mfn);
+            rc = xsm_mmu_machphys_update(d, mfn);
             if ( rc )
                 break;
 
@@ -2780,6 +2836,7 @@ int replace_grant_host_mapping(
 int replace_grant_host_mapping(
     uint64_t addr, unsigned long frame, uint64_t new_addr, unsigned int flags)
 {
+    struct vcpu *curr = current;
     l1_pgentry_t *pl1e, ol1e;
     unsigned long gl1mfn;
     int rc;
@@ -2787,16 +2844,16 @@ int replace_grant_host_mapping(
     if ( flags & GNTMAP_contains_pte )
     {
         if ( !new_addr )
-            return destroy_grant_pte_mapping(addr, frame, current->domain);
+            return destroy_grant_pte_mapping(addr, frame, curr->domain);
         
         MEM_LOG("Unsupported grant table operation");
         return GNTST_general_error;
     }
 
     if ( !new_addr )
-        return destroy_grant_va_mapping(addr, frame, current);
-
-    pl1e = guest_map_l1e(current, new_addr, &gl1mfn);
+        return destroy_grant_va_mapping(addr, frame, curr);
+
+    pl1e = guest_map_l1e(curr, new_addr, &gl1mfn);
     if ( !pl1e )
     {
         MEM_LOG("Could not find L1 PTE for address %lx",
@@ -2805,19 +2862,18 @@ int replace_grant_host_mapping(
     }
     ol1e = *pl1e;
 
-    if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(),
-                                gl1mfn, current)) )
+    if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, l1e_empty(), gl1mfn, curr)) )
     {
         MEM_LOG("Cannot delete PTE entry at %p", (unsigned long *)pl1e);
-        guest_unmap_l1e(current, pl1e);
+        guest_unmap_l1e(curr, pl1e);
         return GNTST_general_error;
     }
 
-    guest_unmap_l1e(current, pl1e);
-
-    rc = replace_grant_va_mapping(addr, frame, ol1e, current);
-    if ( rc && !paging_mode_refcounts(current->domain) )
-        put_page_from_l1e(ol1e, current->domain);
+    guest_unmap_l1e(curr, pl1e);
+
+    rc = replace_grant_va_mapping(addr, frame, ol1e, curr);
+    if ( rc && !paging_mode_refcounts(curr->domain) )
+        put_page_from_l1e(ol1e, curr->domain);
 
     return rc;
 }
@@ -2839,8 +2895,9 @@ int steal_page(
     y   = page->count_info;
     do {
         x = y;
-        if (unlikely((x & (PGC_count_mask|PGC_allocated)) !=
-                     (1 | PGC_allocated)) || unlikely(_nd != _d)) {
+        if ( unlikely((x & (PGC_count_mask|PGC_allocated)) !=
+                      (1 | PGC_allocated)) || unlikely(_nd != _d) )
+        {
             MEM_LOG("gnttab_transfer: Bad page %p: ed=%p(%u), sd=%p,"
                     " caf=%08x, taf=%" PRtype_info "\n",
                     (void *) page_to_mfn(page),
@@ -2849,7 +2906,7 @@ int steal_page(
             spin_unlock(&d->page_alloc_lock);
             return -1;
         }
-        __asm__ __volatile__(
+        asm volatile (
             LOCK_PREFIX "cmpxchg8b %2"
             : "=d" (_nd), "=a" (y),
             "=m" (*(volatile u64 *)(&page->count_info))
@@ -2930,8 +2987,8 @@ int do_update_va_mapping(unsigned long v
         switch ( (bmap_ptr = flags & ~UVMF_FLUSHTYPE_MASK) )
         {
         case UVMF_LOCAL:
-            if ( !paging_mode_enabled(d)
-                 || (paging_invlpg(current, va) != 0) )
+            if ( !paging_mode_enabled(d) ||
+                 (paging_invlpg(v, va) != 0) )
                 flush_tlb_one_local(va);
             break;
         case UVMF_ALL:
@@ -3040,6 +3097,7 @@ long do_set_gdt(XEN_GUEST_HANDLE(ulong)
 {
     int nr_pages = (entries + 511) / 512;
     unsigned long frames[16];
+    struct vcpu *curr = current;
     long ret;
 
     /* Rechecked in set_gdt, but ensures a sane limit for copy_from_user(). */
@@ -3049,12 +3107,12 @@ long do_set_gdt(XEN_GUEST_HANDLE(ulong)
     if ( copy_from_guest(frames, frame_list, nr_pages) )
         return -EFAULT;
 
-    LOCK_BIGLOCK(current->domain);
-
-    if ( (ret = set_gdt(current, frames, entries)) == 0 )
+    LOCK_BIGLOCK(curr->domain);
+
+    if ( (ret = set_gdt(curr, frames, entries)) == 0 )
         flush_tlb_local();
 
-    UNLOCK_BIGLOCK(current->domain);
+    UNLOCK_BIGLOCK(curr->domain);
 
     return ret;
 }
diff -r 32ec5dbe2978 -r aa430556d33f xen/arch/x86/tboot.c
--- a/xen/arch/x86/tboot.c Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/arch/x86/tboot.c Tue Dec 04 11:06:05 2007 +0000
@@ -43,16 +43,43 @@ void __init tboot_probe(void)
     printk("  s3_tb_wakeup_entry: 0x%08x\n", tboot_shared->s3_tb_wakeup_entry);
     printk("  s3_k_wakeup_entry: 0x%08x\n", tboot_shared->s3_k_wakeup_entry);
     printk("  &acpi_sinfo: 0x%p\n", &tboot_shared->acpi_sinfo);
+    if ( tboot_shared->version >= 0x02 )
+    {
+        printk("  tboot_base: 0x%08x\n", tboot_shared->tboot_base);
+        printk("  tboot_size: 0x%x\n", tboot_shared->tboot_size);
+    }
 }
 
 void tboot_shutdown(uint32_t shutdown_type)
 {
+    uint32_t map_base, map_size;
+    int err;
+
     g_tboot_shared->shutdown_type = shutdown_type;
 
     local_irq_disable();
 
-    /* Create identity map for 0-640k to include tboot code. */
-    map_pages_to_xen(0, 0, PFN_UP(0xa0000), __PAGE_HYPERVISOR);
+    /* Create identity map for tboot shutdown code. */
+    if ( g_tboot_shared->version >= 0x02 )
+    {
+        map_base = PFN_DOWN(g_tboot_shared->tboot_base);
+        map_size = PFN_UP(g_tboot_shared->tboot_size);
+    }
+    else
+    {
+        map_base = 0;
+        map_size = PFN_UP(0xa0000);
+    }
+
+    err = map_pages_to_xen(map_base << PAGE_SHIFT, map_base, map_size,
+                           __PAGE_HYPERVISOR);
+    if ( err != 0 )
+    {
+        printk("error (0x%x) mapping tboot pages (mfns) @ 0x%x, 0x%x\n", err,
+               map_base, map_size);
+        return;
+    }
+
     write_ptbase(idle_vcpu[0]);
 
 #ifdef __x86_64__
@@ -68,3 +95,13 @@ int tboot_in_measured_env(void)
 {
     return (g_tboot_shared != NULL);
 }
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 32ec5dbe2978 -r aa430556d33f xen/common/domctl.c
--- a/xen/common/domctl.c Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/common/domctl.c Tue Dec 04 11:06:05 2007 +0000
@@ -187,6 +187,9 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
 
     spin_lock(&domctl_lock);
 
+    if ( xsm_domctl(op) )
+        goto domctl_out;
+
     switch ( op->cmd )
     {
 
@@ -200,10 +203,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( d == NULL )
             break;
-
-        ret = xsm_setvcpucontext(d);
-        if ( ret )
-            goto svc_out;
 
         ret = -EINVAL;
         if ( (vcpu >= MAX_VIRT_CPUS) || ((v = d->vcpu[vcpu]) == NULL) )
@@ -252,17 +251,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( d != NULL )
         {
-            ret = xsm_pausedomain(d);
-            if ( ret )
-                goto pausedomain_out;
-
             ret = -EINVAL;
             if ( d != current->domain )
             {
                 domain_pause_by_systemcontroller(d);
                 ret = 0;
             }
-        pausedomain_out:
             rcu_unlock_domain(d);
         }
     }
@@ -275,14 +269,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( d == NULL )
             break;
-
-        ret = xsm_unpausedomain(d);
-        if ( ret )
-        {
-            rcu_unlock_domain(d);
-            break;
-        }
-
         domain_unpause_by_systemcontroller(d);
         rcu_unlock_domain(d);
         ret = 0;
@@ -296,13 +282,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( d == NULL )
             break;
-
-        ret = xsm_resumedomain(d);
-        if ( ret )
-        {
-            rcu_unlock_domain(d);
-            break;
-        }
 
         domain_resume(d);
         rcu_unlock_domain(d);
@@ -379,13 +358,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
             break;
 
-        ret = xsm_max_vcpus(d);
-        if ( ret )
-        {
-            rcu_unlock_domain(d);
-            break;
-        }
-
         /* Needed, for example, to ensure writable p.t. state is synced. */
         domain_pause(d);
 
@@ -422,7 +394,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( d != NULL )
         {
-            ret = xsm_destroydomain(d) ? : domain_kill(d);
+            domain_kill(d);
             rcu_unlock_domain(d);
         }
     }
@@ -440,10 +412,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( d == NULL )
             break;
 
-        ret = xsm_vcpuaffinity(op->cmd, d);
-        if ( ret )
-            goto vcpuaffinity_out;
-
         ret = -EINVAL;
         if ( op->u.vcpuaffinity.vcpu >= MAX_VIRT_CPUS )
             goto vcpuaffinity_out;
@@ -478,15 +446,10 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
             break;
 
-        ret = xsm_scheduler(d);
-        if ( ret )
-            goto scheduler_op_out;
-
         ret = sched_adjust(d, &op->u.scheduler_op);
         if ( copy_to_guest(u_domctl, op, 1) )
             ret = -EFAULT;
 
-    scheduler_op_out:
         rcu_unlock_domain(d);
     }
     break;
@@ -509,17 +472,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
             break;
         }
 
-        ret = xsm_getdomaininfo(d);
-        if ( ret )
-            goto getdomaininfo_out;
-
         getdomaininfo(d, &op->u.getdomaininfo);
 
         op->domain = op->u.getdomaininfo.domain;
         if ( copy_to_guest(u_domctl, op, 1) )
             ret = -EFAULT;
 
-    getdomaininfo_out:
         rcu_read_unlock(&domlist_read_lock);
     }
     break;
@@ -533,10 +491,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         ret = -ESRCH;
         if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
             break;
-
-        ret = xsm_getvcpucontext(d);
-        if ( ret )
-            goto getvcpucontext_out;
 
         ret = -EINVAL;
         if ( op->u.vcpucontext.vcpu >= MAX_VIRT_CPUS )
@@ -594,10 +548,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( (d = rcu_lock_domain_by_id(op->domain)) == NULL )
             break;
 
-        ret = xsm_getvcpuinfo(d);
-        if ( ret )
-            goto getvcpuinfo_out;
-
         ret = -EINVAL;
         if ( op->u.getvcpuinfo.vcpu >= MAX_VIRT_CPUS )
             goto getvcpuinfo_out;
@@ -633,10 +583,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( d == NULL )
             break;
 
-        ret = xsm_setdomainmaxmem(d);
-        if ( ret )
-            goto max_mem_out;
-
         ret = -EINVAL;
         new_max = op->u.max_mem.max_memkb >> (PAGE_SHIFT-10);
 
@@ -651,7 +597,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         }
         spin_unlock(&d->page_alloc_lock);
 
-    max_mem_out:
         rcu_unlock_domain(d);
     }
     break;
@@ -664,13 +609,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         d = rcu_lock_domain_by_id(op->domain);
         if ( d == NULL )
             break;
-
-        ret = xsm_setdomainhandle(d);
-        if ( ret )
-        {
-            rcu_unlock_domain(d);
-            break;
-        }
 
         memcpy(d->handle, op->u.setdomainhandle.handle,
                sizeof(xen_domain_handle_t));
@@ -687,13 +625,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         d = rcu_lock_domain_by_id(op->domain);
         if ( d == NULL )
             break;
-
-        ret = xsm_setdebugging(d);
-        if ( ret )
-        {
-            rcu_unlock_domain(d);
-            break;
-        }
 
         domain_pause(d);
         d->debugger_attached = !!op->u.setdebugging.enable;
@@ -717,16 +648,11 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         if ( d == NULL )
             break;
 
-        ret = xsm_irq_permission(d, pirq, op->u.irq_permission.allow_access);
-        if ( ret )
-            goto irq_permission_out;
-        
         if ( op->u.irq_permission.allow_access )
             ret = irq_permit_access(d, pirq);
         else
             ret = irq_deny_access(d, pirq);
 
-    irq_permission_out:
         rcu_unlock_domain(d);
     }
     break;
@@ -745,17 +671,12 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         d = rcu_lock_domain_by_id(op->domain);
         if ( d == NULL )
             break;
-
-        ret = xsm_iomem_permission(d, mfn, op->u.iomem_permission.allow_access);
-        if ( ret )
-            goto iomem_permission_out;
 
         if ( op->u.iomem_permission.allow_access )
             ret = iomem_permit_access(d, mfn, mfn + nr_mfns - 1);
         else
             ret = iomem_deny_access(d, mfn, mfn + nr_mfns - 1);
 
-    iomem_permission_out:
         rcu_unlock_domain(d);
     }
     break;
@@ -768,13 +689,6 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         d = rcu_lock_domain_by_id(op->domain);
         if ( d != NULL )
         {
-            ret = xsm_domain_settime(d);
-            if ( ret )
-            {
-                rcu_unlock_domain(d);
-                break;
-            }
-
             d->time_offset_seconds = op->u.settimeoffset.time_offset_seconds;
             rcu_unlock_domain(d);
             ret = 0;
@@ -787,6 +701,7 @@ long do_domctl(XEN_GUEST_HANDLE(xen_domc
         break;
     }
 
+domctl_out:
     spin_unlock(&domctl_lock);
 
     return ret;
diff -r 32ec5dbe2978 -r aa430556d33f xen/include/asm-x86/mm.h
--- a/xen/include/asm-x86/mm.h Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/include/asm-x86/mm.h Tue Dec 04 11:06:05 2007 +0000
@@ -149,60 +149,10 @@ int _shadow_mode_refcounts(struct domain
 
 void cleanup_page_cacheattr(struct page_info *page);
 
-static inline void put_page(struct page_info *page)
-{
-    u32 nx, x, y = page->count_info;
-
-    do {
-        x  = y;
-        nx = x - 1;
-    }
-    while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
-
-    if ( unlikely((nx & PGC_count_mask) == 0) )
-    {
-        cleanup_page_cacheattr(page);
-        free_domheap_page(page);
-    }
-}
-
-
-static inline int get_page(struct page_info *page,
-                           struct domain *domain)
-{
-    u32 x, nx, y = page->count_info;
-    u32 d, nd = page->u.inuse._domain;
-    u32 _domain = pickle_domptr(domain);
-
-    do {
-        x  = y;
-        nx = x + 1;
-        d  = nd;
-        if ( unlikely((x & PGC_count_mask) == 0) ||  /* Not allocated? */
-             unlikely((nx & PGC_count_mask) == 0) || /* Count overflow? */
-             unlikely(d != _domain) )                /* Wrong owner? */
-        {
-            if ( !_shadow_mode_refcounts(domain) )
-                gdprintk(XENLOG_INFO,
-                        "Error pfn %lx: rd=%p, od=%p, caf=%08x, taf=%"
-                        PRtype_info "\n",
-                        page_to_mfn(page), domain, unpickle_domptr(d),
-                        x, page->u.inuse.type_info);
-            return 0;
-        }
-        __asm__ __volatile__(
-            LOCK_PREFIX "cmpxchg8b %3"
-            : "=d" (nd), "=a" (y), "=c" (d),
-              "=m" (*(volatile u64 *)(&page->count_info))
-            : "0" (d), "1" (x), "c" (d), "b" (nx) );
-    }
-    while ( unlikely(nd != d) || unlikely(y != x) );
-
-    return 1;
-}
-
 int is_iomem_page(unsigned long mfn);
 
+void put_page(struct page_info *page);
+int  get_page(struct page_info *page, struct domain *domain);
 void put_page_type(struct page_info *page);
 int  get_page_type(struct page_info *page, unsigned long type);
 int  get_page_from_l1e(l1_pgentry_t l1e, struct domain *d);
diff -r 32ec5dbe2978 -r aa430556d33f xen/include/asm-x86/tboot.h
--- a/xen/include/asm-x86/tboot.h Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/include/asm-x86/tboot.h Tue Dec 04 11:06:05 2007 +0000
@@ -49,8 +49,9 @@ typedef struct __attribute__ ((__packed_
 #define MAX_TB_ACPI_SINFO_SIZE   64
 
 typedef struct __attribute__ ((__packed__)) {
+    /* version 0x01+ fields: */
     uuid_t    uuid;              /* {663C8DFF-E8B3-4b82-AABF-19EA4D057A08} */
-    uint32_t  version;           /* 0x01 */
+    uint32_t  version;           /* Version number: 0x01, 0x02, ... */
     uint32_t  log_addr;          /* physical addr of tb_log_t log */
     uint32_t  shutdown_entry32;  /* entry point for tboot shutdown from 32b */
     uint32_t  shutdown_entry64;  /* entry point for tboot shutdown from 64b */
@@ -59,6 +60,9 @@ typedef struct __attribute__ ((__packed_
     uint32_t  s3_k_wakeup_entry; /* entry point for xen s3 wake up */
     uint8_t   acpi_sinfo[MAX_TB_ACPI_SINFO_SIZE];
                                  /* where kernel put acpi sleep info in Sx */
+    /* version 0x02+ fields: */
+    uint32_t  tboot_base;        /* starting addr for tboot */
+    uint32_t  tboot_size;        /* size of tboot */
 } tboot_shared_t;
 
 #define TB_SHUTDOWN_REBOOT      0
diff -r 32ec5dbe2978 -r aa430556d33f xen/include/public/io/blkif.h
--- a/xen/include/public/io/blkif.h Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/include/public/io/blkif.h Tue Dec 04 11:06:05 2007 +0000
@@ -54,7 +54,7 @@
 #define BLKIF_OP_WRITE             1
 /*
  * Recognised only if "feature-barrier" is present in backend xenbus info.
- * The "feature_barrier" node contains a boolean indicating whether barrier
+ * The "feature-barrier" node contains a boolean indicating whether barrier
  * requests are likely to succeed or fail. Either way, a barrier request
  * may fail at any time with BLKIF_RSP_EOPNOTSUPP if it is unsupported by
  * the underlying block-device hardware. The boolean simply indicates whether
@@ -63,6 +63,19 @@
  * create the "feature-barrier" node!
  */
 #define BLKIF_OP_WRITE_BARRIER     2
+/*
+ * Recognised if "feature-flush-cache" is present in backend xenbus
+ * info.  A flush will ask the underlying storage hardware to flush its
+ * non-volatile caches as appropriate.  The "feature-flush-cache" node
+ * contains a boolean indicating whether flush requests are likely to
+ * succeed or fail. Either way, a flush request may fail at any time
+ * with BLKIF_RSP_EOPNOTSUPP if it is unsupported by the underlying
+ * block-device hardware. The boolean simply indicates whether or not it
+ * is worthwhile for the frontend to attempt flushes.  If a backend does
+ * not recognise BLKIF_OP_WRITE_FLUSH_CACHE, it should *not* create the
+ * "feature-flush-cache" node!
+ */
+#define BLKIF_OP_FLUSH_DISKCACHE   3
 
 /*
  * Maximum scatter/gather segments per request.
diff -r 32ec5dbe2978 -r aa430556d33f xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h Fri Nov 30 08:54:33 2007 -0700
+++ b/xen/include/xsm/xsm.h Tue Dec 04 11:06:05 2007 +0000
@@ -50,34 +50,18 @@ extern xsm_initcall_t __xsm_initcall_sta
 
 struct xsm_operations {
     void (*security_domaininfo) (struct domain *d,
-                                        struct xen_domctl_getdomaininfo *info);
-    int (*setvcpucontext) (struct domain *d);
-    int (*pausedomain) (struct domain *d);
-    int (*unpausedomain) (struct domain *d);
-    int (*resumedomain) (struct domain *d);
+                                 struct xen_domctl_getdomaininfo *info);
+    int (*domctl) (struct xen_domctl *domctl);
     int (*domain_create) (struct domain *d, u32 ssidref);
-    int (*max_vcpus) (struct domain *d);
-    int (*destroydomain) (struct domain *d);
-    int (*vcpuaffinity) (int cmd, struct domain *d);
-    int (*scheduler) (struct domain *d);
     int (*getdomaininfo) (struct domain *d);
-    int (*getvcpucontext) (struct domain *d);
-    int (*getvcpuinfo) (struct domain *d);
-    int (*domain_settime) (struct domain *d);
     int (*tbufcontrol) (void);
     int (*readconsole) (uint32_t clear);
     int (*sched_id) (void);
-    int (*setdomainmaxmem) (struct domain *d);
-    int (*setdomainhandle) (struct domain *d);
-    int (*setdebugging) (struct domain *d);
-    int (*irq_permission) (struct domain *d, uint8_t pirq, uint8_t access);
-    int (*iomem_permission) (struct domain *d, unsigned long mfn,
-                                                                uint8_t access);
     int (*perfcontrol) (void);
 
     int (*evtchn_unbound) (struct domain *d, struct evtchn *chn, domid_t id2);
     int (*evtchn_interdomain) (struct domain *d1, struct evtchn *chn1,
-                                        struct domain *d2, struct evtchn *chn2);
+                               struct domain *d2, struct evtchn *chn2);
     void (*evtchn_close_post) (struct evtchn *chn);
     int (*evtchn_send) (struct domain *d, struct evtchn *chn);
     int (*evtchn_status) (struct domain *d, struct evtchn *chn);
@@ -149,69 +133,19 @@ static inline void xsm_security_domainin
     xsm_call(security_domaininfo(d, info));
 }
 
-static inline int xsm_setvcpucontext(struct domain *d)
-{
-    return xsm_call(setvcpucontext(d));
-}
-
-static inline int xsm_pausedomain (struct domain *d)
-{
-    return xsm_call(pausedomain(d));
-}
-
-static inline int xsm_unpausedomain (struct domain *d)
-{
-    return xsm_call(unpausedomain(d));
-}
-
-static inline int xsm_resumedomain (struct domain *d)
-{
-    return xsm_call(resumedomain(d));
-}
-
-static inline int xsm_domain_create (struct domain *d, u32 ssidref)
+static inline int xsm_domctl(struct xen_domctl *domctl)
+{
+    return xsm_call(domctl(domctl));
+}
+
+static inline int xsm_domain_create(struct domain *d, u32 ssidref)
 {
     return xsm_call(domain_create(d, ssidref));
 }
 
-static inline int xsm_max_vcpus(struct domain *d)
-{
-    return xsm_call(max_vcpus(d));
-}
-
-static inline int xsm_destroydomain (struct domain *d)
-{
-    return xsm_call(destroydomain(d));
-}
-
-static inline int xsm_vcpuaffinity (int cmd, struct domain *d)
-{
-    return xsm_call(vcpuaffinity(cmd, d));
-}
-
-static inline int xsm_scheduler (struct domain *d)
-{
-    return xsm_call(scheduler(d));
-}
-
-static inline int xsm_getdomaininfo (struct domain *d)
-{
-    return xsm_call(getdomaininfo(d));
-}
-
-static inline int xsm_getvcpucontext (struct domain *d)
-{
-    return xsm_call(getvcpucontext(d));
-}
-
-static inline int xsm_getvcpuinfo (struct domain *d)
-{
-    return xsm_call(getvcpuinfo(d));
-}
-
-static inline int xsm_domain_settime (struct domain *d)
-{
-    return xsm_call(domain_settime(d));
+static inline int xsm_getdomaininfo(struct domain *d)
+{
+    return xsm_call(domain_getdomaininfo(d));
 }
 
 static inline int xsm_tbufcontrol (void)
@@ -227,33 +161,6 @@ static inline int xsm_sched_id (void)
 static inline int xsm_sched_id (void)
 {
     return xsm_call(sched_id());
-}
-
-static inline int xsm_setdomainmaxmem (struct domain *d)
-{
-    return xsm_call(setdomainmaxmem(d));
-}
-
-static inline int xsm_setdomainhandle (struct domain *d)
-{
-    return xsm_call(setdomainhandle(d));
-}
-
-static inline int xsm_setdebugging (struct domain *d)
-{
-    return xsm_call(setdebugging(d));
-}
-
-static inline int xsm_irq_permission (struct domain *d, uint8_t pirq,
-                                                                uint8_t access)
-{
-    return xsm_call(irq_permission(d, pirq, access));
-}
-
-static inline int xsm_iomem_permission (struct domain *d, unsigned long mfn,
-                                                                uint8_t access)
-{
-    return xsm_call(iomem_permission(d, mfn, access));
 }
 
 static inline int xsm_perfcontrol (void)

_______________________________________________
Xen-changelog mailing list
[hidden email]
http://lists.xensource.com/xen-changelog