From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:55:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:55:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOAl-0000Pp-TF; Tue, 01 Nov 2011 16:55:15 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAj-0000Ot-DM
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:13 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1320191710!1590576!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21584 invoked from network); 1 Nov 2011 23:55:10 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:10 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAf-0007Yo-Md
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:09 +0000
Message-Id: <E1RLOAf-0007Yo-Md@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:08 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove generated file
	testidl.c on clean
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930555 -3600
# Node ID 03850b2653066066e21522ed54fbd5f8c2743048
# Parent  0fea1ad50ce32173a5c9e7ebf5a6adbc4c351ee4
libxl: remove generated file testidl.c on clean

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 0fea1ad50ce3 -r 03850b265306 tools/libxl/Makefile
--- a/tools/libxl/Makefile	Fri Oct 28 17:23:51 2011 +0100
+++ b/tools/libxl/Makefile	Tue Oct 18 10:35:55 2011 +0100
@@ -150,6 +150,7 @@
 clean:
 	$(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
 	$(RM) -f _*.c *.pyc _libxl_paths.*.tmp
+	$(RM) -f testidl.c.new testidl.c
 #	$(RM) -f $(AUTOSRCS) $(AUTOINCS)
 
 distclean: clean

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:55:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:55:30 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOAy-0000Uq-TZ; Tue, 01 Nov 2011 16:55:29 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAj-0000Ou-EP
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1320191697!44021861!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18020 invoked from network); 1 Nov 2011 23:54:57 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:54:57 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAg-0007Z3-By
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:10 +0000
Message-Id: <E1RLOAg-0007Z3-By@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: idl: use "dispose" rather
	than "destroy" for function to free IDL types
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930555 -3600
# Node ID 224359634904e327a73941d613551f00232ac777
# Parent  03850b2653066066e21522ed54fbd5f8c2743048
libxl: idl: use "dispose" rather than "destroy" for function to free IDL types

Destroy is an overloaded term which would commonly like to be used for actual
destructive operations, such as destroying a domain etc.

Dispose isn't a great term but it does the job.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 03850b265306 -r 224359634904 tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/gentest.py	Tue Oct 18 10:35:55 2011 +0100
@@ -256,8 +256,8 @@
         f.write("    printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename)
         f.write("    if (s == NULL) abort();\n")
         f.write("    free(s);\n")
-        if ty.destructor_fn is not None:
-            f.write("    %s(&%s_val);\n" % (ty.destructor_fn, ty.typename))
+        if ty.dispose_fn is not None:
+            f.write("    %s(&%s_val);\n" % (ty.dispose_fn, ty.typename))
         f.write("\n")
 
     f.write("    printf(\"Testing Enumerations\\n\");\n")
diff -r 03850b265306 -r 224359634904 tools/libxl/gentypes.py
--- a/tools/libxl/gentypes.py	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/gentypes.py	Tue Oct 18 10:35:55 2011 +0100
@@ -74,7 +74,7 @@
         raise NotImplementedError("%s" % type(ty))
     return s.replace("\n", "\n%s" % indent)
 
-def libxl_C_type_destroy(ty, v, indent = "    ", parent = None):
+def libxl_C_type_dispose(ty, v, indent = "    ", parent = None):
     s = ""
     if isinstance(ty, libxltypes.KeyedUnion):
         if parent is None:
@@ -83,16 +83,16 @@
         for f in ty.fields:
             (nparent,fexpr) = ty.member(v, f, parent is None)
             s += "case %s:\n" % f.enumname
-            s += libxl_C_type_destroy(f.type, fexpr, indent + "    ", nparent)
+            s += libxl_C_type_dispose(f.type, fexpr, indent + "    ", nparent)
             s += "    break;\n"
         s += "}\n"
-    elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.destructor_fn is None):
+    elif isinstance(ty, libxltypes.Struct) and (parent is None or ty.dispose_fn is None):
         for f in [f for f in ty.fields if not f.const]:
             (nparent,fexpr) = ty.member(v, f, parent is None)
-            s += libxl_C_type_destroy(f.type, fexpr, "", nparent)
+            s += libxl_C_type_dispose(f.type, fexpr, "", nparent)
     else:
-        if ty.destructor_fn is not None:
-            s += "%s(%s);\n" % (ty.destructor_fn, ty.pass_arg(v, parent is None))
+        if ty.dispose_fn is not None:
+            s += "%s(%s);\n" % (ty.dispose_fn, ty.pass_arg(v, parent is None))
 
     if s != "":
         s = indent + s
@@ -217,8 +217,8 @@
 
     for ty in types:
         f.write(libxl_C_type_define(ty) + ";\n")
-        if ty.destructor_fn is not None:
-            f.write("void %s(%s);\n" % (ty.destructor_fn, ty.make_arg("p")))
+        if ty.dispose_fn is not None:
+            f.write("void %s(%s);\n" % (ty.dispose_fn, ty.make_arg("p")))
         if ty.json_fn is not None:
             f.write("char *%s_to_json(libxl_ctx *ctx, %s);\n" % (ty.typename, ty.make_arg("p")))
         if isinstance(ty, libxltypes.Enumeration):
@@ -277,10 +277,10 @@
 
 """ % " ".join(sys.argv))
 
-    for ty in [t for t in types if t.destructor_fn is not None and t.autogenerate_destructor]:
-        f.write("void %s(%s)\n" % (ty.destructor_fn, ty.make_arg("p")))
+    for ty in [t for t in types if t.dispose_fn is not None and t.autogenerate_dispose_fn]:
+        f.write("void %s(%s)\n" % (ty.dispose_fn, ty.make_arg("p")))
         f.write("{\n")
-        f.write(libxl_C_type_destroy(ty, "p"))
+        f.write(libxl_C_type_dispose(ty, "p"))
         f.write("    memset(p, LIBXL_DTOR_POISON, sizeof(*p));\n")
         f.write("}\n")
         f.write("\n")
diff -r 03850b265306 -r 224359634904 tools/libxl/idl.txt
--- a/tools/libxl/idl.txt	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/idl.txt	Tue Oct 18 10:35:55 2011 +0100
@@ -39,14 +39,14 @@
    libxltypes.PASS_BY_VALUE
    libxltypes.PASS_BY_REFERENCE
 
-Type.destructor_fn: (default: typename + "_destroy" or None if type == None)
+Type.dispose_fn: (default: typename + "_dispose" or None if type == None)
 
  The name of the C function which will free all dynamically allocated
  memory contained within this type (but not the type itself).
 
-Type.autogenerate_destructor: (default: True)
+Type.autogenerate_dispose_fn: (default: True)
 
- Indicates if the above named Type.destructor_fn should be
+ Indicates if the above named Type.dispose_fn should be
  autogenerated.
 
 Type.json_fn: (default: typename + "_gen_json" or None if type == None)
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -87,12 +87,12 @@
 {
     if (!ctx) return 0;
     if (ctx->xch) xc_interface_close(ctx->xch);
-    libxl_version_info_destroy(&ctx->version_info);
+    libxl_version_info_dispose(&ctx->version_info);
     if (ctx->xsh) xs_daemon_close(ctx->xsh);
     return 0;
 }
 
-void libxl_string_list_destroy(libxl_string_list *psl)
+void libxl_string_list_dispose(libxl_string_list *psl)
 {
     int i;
     libxl_string_list sl = *psl;
@@ -105,7 +105,7 @@
     free(sl);
 }
 
-void libxl_key_value_list_destroy(libxl_key_value_list *pkvl)
+void libxl_key_value_list_dispose(libxl_key_value_list *pkvl)
 {
     int i;
     libxl_key_value_list kvl = *pkvl;
@@ -767,7 +767,7 @@
         libxl__qmp_cleanup(&gc, domid);
     }
     if (libxl__devices_destroy(&gc, domid, force) < 0)
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_destroy_devices failed for %d", domid);
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "libxl_devices_dispose failed for %d", domid);
 
     vm_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vm", dom_path));
     if (vm_path)
@@ -1641,7 +1641,7 @@
     }
 out:
     for (i = 0; i < num; i++)
-        libxl_device_disk_destroy(&disks[i]);
+        libxl_device_disk_dispose(&disks[i]);
     free(disks);
     return ret;
 }
@@ -2241,7 +2241,7 @@
     xc_hypercall_buffer_free(ctx->xch, coremap);
     xc_hypercall_buffer_free(ctx->xch, socketmap);
     xc_hypercall_buffer_free(ctx->xch, nodemap);
-    libxl_topologyinfo_destroy(info);
+    libxl_topologyinfo_dispose(info);
     return ERROR_FAIL;
 }
 
@@ -2722,7 +2722,7 @@
     return rc;
 }
 
-void libxl_file_reference_destroy(libxl_file_reference *f)
+void libxl_file_reference_dispose(libxl_file_reference *f)
 {
     libxl__file_reference_unmap(f);
     free(f->path);
@@ -2852,7 +2852,7 @@
     rc = 0;
 
 out1:
-    libxl_cpumap_destroy(&cpumap);
+    libxl_cpumap_dispose(&cpumap);
 out:
     xc_cpupool_infofree(ctx->xch, info);
     libxl__free_all(&gc);
@@ -2941,10 +2941,10 @@
         }
     }
 
-    libxl_topologyinfo_destroy(&topology);
+    libxl_topologyinfo_dispose(&topology);
 
 out:
-    libxl_cpumap_destroy(&freemap);
+    libxl_cpumap_dispose(&freemap);
     return rc;
 }
 
@@ -2993,11 +2993,11 @@
         }
     }
 
-    libxl_topologyinfo_destroy(&topology);
+    libxl_topologyinfo_dispose(&topology);
 
 out:
     for (p = 0; p < n_pools; p++) {
-        libxl_cpupoolinfo_destroy(poolinfo + p);
+        libxl_cpupoolinfo_dispose(poolinfo + p);
     }
 
     return ret;
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
@@ -144,10 +144,10 @@
 #define LIBXL_MAC_BYTES(mac) mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]
 
 typedef char **libxl_string_list;
-void libxl_string_list_destroy(libxl_string_list *sl);
+void libxl_string_list_dispose(libxl_string_list *sl);
 
 typedef char **libxl_key_value_list;
-void libxl_key_value_list_destroy(libxl_key_value_list *kvl);
+void libxl_key_value_list_dispose(libxl_key_value_list *kvl);
 
 typedef uint32_t libxl_hwcap[8];
 
@@ -155,14 +155,14 @@
     uint32_t size;          /* number of bytes in map */
     uint8_t *map;
 } libxl_cpumap;
-void libxl_cpumap_destroy(libxl_cpumap *map);
+void libxl_cpumap_dispose(libxl_cpumap *map);
 
 typedef struct {
     uint32_t entries;
     uint32_t *array;
 } libxl_cpuarray;
 #define LIBXL_CPUARRAY_INVALID_ENTRY  ~0
-void libxl_cpuarray_destroy(libxl_cpuarray *array);
+void libxl_cpuarray_dispose(libxl_cpuarray *array);
 
 typedef struct {
     /*
@@ -174,7 +174,7 @@
     void * data;
     size_t size;
 } libxl_file_reference;
-void libxl_file_reference_destroy(libxl_file_reference *p);
+void libxl_file_reference_dispose(libxl_file_reference *p);
 
 /* libxl_cpuid_policy_list is a dynamic array storing CPUID policies
  * for multiple leafs. It is terminated with an entry holding
@@ -182,7 +182,7 @@
  */
 typedef struct libxl__cpuid_policy libxl_cpuid_policy;
 typedef libxl_cpuid_policy * libxl_cpuid_policy_list;
-void libxl_cpuid_destroy(libxl_cpuid_policy_list *cpuid_list);
+void libxl_cpuid_dispose(libxl_cpuid_policy_list *cpuid_list);
 
 #define LIBXL_PCI_FUNC_ALL (~0U)
 
@@ -261,7 +261,7 @@
 typedef int (*libxl_console_ready)(libxl_ctx *ctx, uint32_t domid, void *priv);
 int libxl_domain_create_new(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid);
 int libxl_domain_create_restore(libxl_ctx *ctx, libxl_domain_config *d_config, libxl_console_ready cb, void *priv, uint32_t *domid, int restore_fd);
-void libxl_domain_config_destroy(libxl_domain_config *d_config);
+void libxl_domain_config_dispose(libxl_domain_config *d_config);
 int libxl_domain_suspend(libxl_ctx *ctx, libxl_domain_suspend_info *info,
                           uint32_t domid, int fd);
 int libxl_domain_resume(libxl_ctx *ctx, uint32_t domid);
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl_cpuid.c
--- a/tools/libxl/libxl_cpuid.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl_cpuid.c	Tue Oct 18 10:35:55 2011 +0100
@@ -16,7 +16,7 @@
 #include "libxl_osdeps.h"
 #include "libxl_internal.h"
 
-void libxl_cpuid_destroy(libxl_cpuid_policy_list *p_cpuid_list)
+void libxl_cpuid_dispose(libxl_cpuid_policy_list *p_cpuid_list)
 {
     int i, j;
     libxl_cpuid_policy_list cpuid_list = *p_cpuid_list;
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl_create.c	Tue Oct 18 10:35:55 2011 +0100
@@ -31,33 +31,33 @@
 #include "libxl_internal.h"
 #include "flexarray.h"
 
-void libxl_domain_config_destroy(libxl_domain_config *d_config)
+void libxl_domain_config_dispose(libxl_domain_config *d_config)
 {
     int i;
 
     for (i=0; i<d_config->num_disks; i++)
-        libxl_device_disk_destroy(&d_config->disks[i]);
+        libxl_device_disk_dispose(&d_config->disks[i]);
     free(d_config->disks);
 
     for (i=0; i<d_config->num_vifs; i++)
-        libxl_device_nic_destroy(&d_config->vifs[i]);
+        libxl_device_nic_dispose(&d_config->vifs[i]);
     free(d_config->vifs);
 
     for (i=0; i<d_config->num_pcidevs; i++)
-        libxl_device_pci_destroy(&d_config->pcidevs[i]);
+        libxl_device_pci_dispose(&d_config->pcidevs[i]);
     free(d_config->pcidevs);
 
     for (i=0; i<d_config->num_vfbs; i++)
-        libxl_device_vfb_destroy(&d_config->vfbs[i]);
+        libxl_device_vfb_dispose(&d_config->vfbs[i]);
     free(d_config->vfbs);
 
     for (i=0; i<d_config->num_vkbs; i++)
-        libxl_device_vkb_destroy(&d_config->vkbs[i]);
+        libxl_device_vkb_dispose(&d_config->vkbs[i]);
     free(d_config->vkbs);
 
-    libxl_domain_create_info_destroy(&d_config->c_info);
-    libxl_domain_build_info_destroy(&d_config->b_info);
-    libxl_device_model_info_destroy(&d_config->dm_info);
+    libxl_domain_create_info_dispose(&d_config->c_info);
+    libxl_domain_build_info_dispose(&d_config->b_info);
+    libxl_device_model_info_dispose(&d_config->dm_info);
 }
 
 int libxl_init_create_info(libxl_ctx *ctx, libxl_domain_create_info *c_info)
@@ -512,7 +512,7 @@
         if ( ret )
             goto error_out;
         libxl__device_console_add(gc, domid, &console, &state);
-        libxl_device_console_destroy(&console);
+        libxl_device_console_dispose(&console);
 
         dm_info->domid = domid;
         ret = libxl__create_device_model(gc, dm_info,
@@ -549,7 +549,7 @@
              console.consback = LIBXL_CONSOLE_BACKEND_IOEMU;
 
         libxl__device_console_add(gc, domid, &console, &state);
-        libxl_device_console_destroy(&console);
+        libxl_device_console_dispose(&console);
 
         if (need_qemu) {
             /* only copy those useful configs */
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl_types.idl	Tue Oct 18 10:35:55 2011 +0100
@@ -8,13 +8,13 @@
 libxl_domid = Builtin("domid", json_fn = "yajl_gen_integer", autogenerate_json = False)
 libxl_uuid = Builtin("uuid", passby=PASS_BY_REFERENCE)
 libxl_mac = Builtin("mac", passby=PASS_BY_REFERENCE)
-libxl_cpumap = Builtin("cpumap", destructor_fn="libxl_cpumap_destroy", passby=PASS_BY_REFERENCE)
-libxl_cpuarray = Builtin("cpuarray", destructor_fn="libxl_cpuarray_destroy", passby=PASS_BY_REFERENCE)
-libxl_cpuid_policy_list = Builtin("cpuid_policy_list", destructor_fn="libxl_cpuid_destroy", passby=PASS_BY_REFERENCE)
+libxl_cpumap = Builtin("cpumap", dispose_fn="libxl_cpumap_dispose", passby=PASS_BY_REFERENCE)
+libxl_cpuarray = Builtin("cpuarray", dispose_fn="libxl_cpuarray_dispose", passby=PASS_BY_REFERENCE)
+libxl_cpuid_policy_list = Builtin("cpuid_policy_list", dispose_fn="libxl_cpuid_dispose", passby=PASS_BY_REFERENCE)
 
-libxl_string_list = Builtin("string_list", destructor_fn="libxl_string_list_destroy", passby=PASS_BY_REFERENCE)
-libxl_key_value_list = Builtin("key_value_list", destructor_fn="libxl_key_value_list_destroy", passby=PASS_BY_REFERENCE)
-libxl_file_reference = Builtin("file_reference", destructor_fn="libxl_file_reference_destroy", passby=PASS_BY_REFERENCE)
+libxl_string_list = Builtin("string_list", dispose_fn="libxl_string_list_dispose", passby=PASS_BY_REFERENCE)
+libxl_key_value_list = Builtin("key_value_list", dispose_fn="libxl_key_value_list_dispose", passby=PASS_BY_REFERENCE)
+libxl_file_reference = Builtin("file_reference", dispose_fn="libxl_file_reference_dispose", passby=PASS_BY_REFERENCE)
 
 libxl_hwcap = Builtin("hwcap", passby=PASS_BY_REFERENCE)
 
@@ -109,7 +109,7 @@
     ("cpu_time",    uint64),
     ("vcpu_max_id", uint32),
     ("vcpu_online", uint32),
-    ], destructor_fn=None)
+    ], dispose_fn=None)
 
 libxl_cpupoolinfo = Struct("cpupoolinfo", [
     ("poolid",      uint32),
@@ -121,7 +121,7 @@
 libxl_vminfo = Struct("vminfo", [
     ("uuid", libxl_uuid),
     ("domid", libxl_domid),
-    ], destructor_fn=None)
+    ], dispose_fn=None)
 
 libxl_version_info = Struct("version_info", [
     ("xen_version_major", integer),
@@ -362,7 +362,7 @@
     ("nr_nodes", uint32),
     ("hw_cap", libxl_hwcap),
     ("phys_cap", uint32),
-    ], destructor_fn=None, dir=DIR_OUT)
+    ], dispose_fn=None, dir=DIR_OUT)
 
 libxl_topologyinfo = Struct("topologyinfo", [
     ("coremap", libxl_cpuarray,   False, "cpu to core map"),
@@ -373,4 +373,4 @@
 libxl_sched_credit = Struct("sched_credit", [
     ("weight", integer),
     ("cap", integer),
-    ], destructor_fn=None)
+    ], dispose_fn=None)
diff -r 03850b265306 -r 224359634904 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 18 10:35:55 2011 +0100
@@ -157,7 +157,7 @@
             }
             free(poolname);
         }
-        libxl_cpupoolinfo_destroy(poolinfo + i);
+        libxl_cpupoolinfo_dispose(poolinfo + i);
     }
     free(poolinfo);
     return ret;
@@ -478,7 +478,7 @@
     }
 
     for (i=0; i<nb; i++)
-        libxl_nicinfo_destroy(&nics[i]);
+        libxl_nicinfo_dispose(&nics[i]);
     free(nics);
     return rc;
 }
@@ -579,7 +579,7 @@
     return 0;
 }
 
-void libxl_cpumap_destroy(libxl_cpumap *map)
+void libxl_cpumap_dispose(libxl_cpumap *map)
 {
     free(map->map);
 }
@@ -624,7 +624,7 @@
     return 0;
 }
 
-void libxl_cpuarray_destroy(libxl_cpuarray *array)
+void libxl_cpuarray_dispose(libxl_cpuarray *array)
 {
     free(array->array);
 }
diff -r 03850b265306 -r 224359634904 tools/libxl/libxltypes.py
--- a/tools/libxl/libxltypes.py	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxltypes.py	Tue Oct 18 10:35:55 2011 +0100
@@ -44,11 +44,11 @@
             self.rawname = typename
 
         if self.typename is not None:
-            self.destructor_fn = kwargs.setdefault('destructor_fn', self.typename + "_destroy")
+            self.dispose_fn = kwargs.setdefault('dispose_fn', self.typename + "_dispose")
         else:
-            self.destructor_fn = kwargs.setdefault('destructor_fn', None)
+            self.dispose_fn = kwargs.setdefault('dispose_fn', None)
 
-        self.autogenerate_destructor = kwargs.setdefault('autogenerate_destructor', True)
+        self.autogenerate_dispose_fn = kwargs.setdefault('autogenerate_dispose_fn', True)
 
         if self.typename is not None:
             self.json_fn = kwargs.setdefault('json_fn', self.typename + "_gen_json")
@@ -88,15 +88,15 @@
 class Builtin(Type):
     """Builtin type"""
     def __init__(self, typename, **kwargs):
-        kwargs.setdefault('destructor_fn', None)
-        kwargs.setdefault('autogenerate_destructor', False)
+        kwargs.setdefault('dispose_fn', None)
+        kwargs.setdefault('autogenerate_dispose_fn', False)
         kwargs.setdefault('autogenerate_json', False)
         Type.__init__(self, typename, **kwargs)
 
 class Number(Builtin):
     def __init__(self, ctype, **kwargs):
         kwargs.setdefault('namespace', None)
-        kwargs.setdefault('destructor_fn', None)
+        kwargs.setdefault('dispose_fn', None)
         kwargs.setdefault('signed', False)
         kwargs.setdefault('json_fn', "yajl_gen_integer")
         self.signed = kwargs['signed']
@@ -105,7 +105,7 @@
 class UInt(Number):
     def __init__(self, w, **kwargs):
         kwargs.setdefault('namespace', None)
-        kwargs.setdefault('destructor_fn', None)
+        kwargs.setdefault('dispose_fn', None)
         Number.__init__(self, "uint%d_t" % w, **kwargs)
 
         self.width = w
@@ -122,7 +122,7 @@
 
 class Enumeration(Type):
     def __init__(self, typename, values, **kwargs):
-        kwargs.setdefault('destructor_fn', None)
+        kwargs.setdefault('dispose_fn', None)
         Type.__init__(self, typename, **kwargs)
 
         self.values = []
@@ -205,7 +205,7 @@
         # union therefore any specific instance of this class will
         # need to provide an explicit destructor function.
         kwargs.setdefault('passby', PASS_BY_REFERENCE)
-        kwargs.setdefault('destructor_fn', None)
+        kwargs.setdefault('dispose_fn', None)
         Aggregate.__init__(self, "union", name, fields, **kwargs)
 
 class KeyedUnion(Aggregate):
@@ -244,7 +244,7 @@
 uint32 = UInt(32)
 uint64 = UInt(64)
 
-string = Builtin("char *", namespace = None, destructor_fn = "free",
+string = Builtin("char *", namespace = None, dispose_fn = "free",
                  json_fn = "libxl__string_gen_json",
                  autogenerate_json = False)
 
diff -r 03850b265306 -r 224359634904 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -1685,7 +1685,7 @@
             case LIBXL_EVENT_TYPE_DISK_EJECT:
                 if (libxl_event_get_disk_eject_info(ctx, domid, &event, &disk)) {
                     libxl_cdrom_insert(ctx, domid, &disk);
-                    libxl_device_disk_destroy(&disk);
+                    libxl_device_disk_dispose(&disk);
                 }
                 break;
         }
@@ -1701,7 +1701,7 @@
     if (logfile != 2)
         close(logfile);
 
-    libxl_domain_config_destroy(&d_config);
+    libxl_domain_config_dispose(&d_config);
 
     free(config_data);
 
@@ -2047,7 +2047,7 @@
         printf("%02x.%01x %04x:%02x:%02x.%01x\n",
                (pcidevs[i].vdevfn >> 3) & 0x1f, pcidevs[i].vdevfn & 0x7,
                pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func);
-        libxl_device_pci_destroy(&pcidevs[i]);
+        libxl_device_pci_dispose(&pcidevs[i]);
     }
     free(pcidevs);
 }
@@ -2078,7 +2078,7 @@
         exit(2);
     }
     libxl_device_pci_remove(ctx, domid, &pcidev, force);
-    libxl_device_pci_destroy(&pcidev);
+    libxl_device_pci_dispose(&pcidev);
 }
 
 int main_pcidetach(int argc, char **argv)
@@ -2115,7 +2115,7 @@
         exit(2);
     }
     libxl_device_pci_add(ctx, domid, &pcidev);
-    libxl_device_pci_destroy(&pcidev);
+    libxl_device_pci_dispose(&pcidev);
 }
 
 int main_pciattach(int argc, char **argv)
@@ -2231,7 +2231,7 @@
         memset(&d_config, 0x00, sizeof(d_config));
         parse_config_data(config_file, (char *)data, len, &d_config, &dm_info);
         printf_info(info[i].domid, &d_config, &dm_info);
-        libxl_domain_config_destroy(&d_config);
+        libxl_domain_config_dispose(&d_config);
         free(data);
         free(config_file);
     }
@@ -3323,7 +3323,7 @@
 
     for (i = 0; i < nb_vcpu; i++) {
         print_vcpuinfo(domid, &vcpuinfo[i], nr_cpus);
-        libxl_vcpuinfo_destroy(&vcpuinfo[i]);
+        libxl_vcpuinfo_dispose(&vcpuinfo[i]);
     }
 
     free(vcpuinfo);
@@ -3445,7 +3445,7 @@
         }
     }
   vcpupin_out1:
-    libxl_cpumap_destroy(&cpumap);
+    libxl_cpumap_dispose(&cpumap);
   vcpupin_out:
     ;
 }
@@ -3485,7 +3485,7 @@
     if (libxl_set_vcpuonline(ctx, domid, &cpumap) < 0)
         fprintf(stderr, "libxl_set_vcpuonline failed domid=%d max_vcpus=%d\n", domid, max_vcpus);
 
-    libxl_cpumap_destroy(&cpumap);
+    libxl_cpumap_dispose(&cpumap);
 }
 
 int main_vcpuset(int argc, char **argv)
@@ -3609,7 +3609,7 @@
 
     printf("numa_info              : none\n");
 
-    libxl_topologyinfo_destroy(&info);
+    libxl_topologyinfo_dispose(&info);
 
     return;
 }
@@ -4018,7 +4018,7 @@
         fprintf(stderr, "libxl_device_nic_add failed.\n");
         return 1;
     }
-    libxl_device_nic_destroy(&nic);
+    libxl_device_nic_dispose(&nic);
     return 0;
 }
 
@@ -4051,7 +4051,7 @@
             printf("%6d %5d %6d %5d/%-11d %-30s\n",
                    nics[i].devid, nics[i].state, nics[i].evtch,
                    nics[i].rref_tx, nics[i].rref_rx, nics[i].backend);
-            libxl_nicinfo_destroy(&nics[i]);
+            libxl_nicinfo_dispose(&nics[i]);
         }
         free(nics);
     }
@@ -4086,7 +4086,7 @@
         fprintf(stderr, "libxl_device_nic_del failed.\n");
         return 1;
     }
-    libxl_device_nic_destroy(&nic);
+    libxl_device_nic_dispose(&nic);
     return 0;
 }
 
@@ -4152,9 +4152,9 @@
                 printf("%-5d %-3d %-6d %-5d %-6d %-8d %-30s\n",
                        diskinfo.devid, diskinfo.backend_id, diskinfo.frontend_id,
                        diskinfo.state, diskinfo.evtch, diskinfo.rref, diskinfo.backend);
-                libxl_diskinfo_destroy(&diskinfo);
+                libxl_diskinfo_dispose(&diskinfo);
             }
-            libxl_device_disk_destroy(&disks[i]);
+            libxl_device_disk_dispose(&disks[i]);
         }
         free(disks);
     }
@@ -4791,7 +4791,7 @@
             n_nodes++;
         }
 
-        libxl_topologyinfo_destroy(&topology);
+        libxl_topologyinfo_dispose(&topology);
 
         if (n_cpus == 0) {
             fprintf(stderr, "no free cpu found\n");
@@ -4931,7 +4931,7 @@
                 printf("\n");
             }
         }
-        libxl_cpupoolinfo_destroy(poolinfo + p);
+        libxl_cpupoolinfo_dispose(poolinfo + p);
     }
 
     return ret;
@@ -5132,7 +5132,7 @@
     poolid = poolinfo[0].poolid;
     schedid = poolinfo[0].sched_id;
     for (p = 0; p < n_pools; p++) {
-        libxl_cpupoolinfo_destroy(poolinfo + p);
+        libxl_cpupoolinfo_dispose(poolinfo + p);
     }
     if (n_pools > 1) {
         fprintf(stderr, "splitting not possible, already cpupools in use\n");
@@ -5146,7 +5146,7 @@
 
     if (libxl_cpumap_alloc(ctx, &cpumap)) {
         fprintf(stderr, "Failed to allocate cpumap\n");
-        libxl_topologyinfo_destroy(&topology);
+        libxl_topologyinfo_dispose(&topology);
         return -ERROR_FAIL;
     }
 
@@ -5229,8 +5229,8 @@
     }
 
 out:
-    libxl_topologyinfo_destroy(&topology);
-    libxl_cpumap_destroy(&cpumap);
+    libxl_topologyinfo_dispose(&topology);
+    libxl_cpumap_dispose(&cpumap);
 
     return ret;
 }
diff -r 03850b265306 -r 224359634904 tools/python/genwrap.py
--- a/tools/python/genwrap.py	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/python/genwrap.py	Tue Oct 18 10:35:55 2011 +0100
@@ -100,8 +100,8 @@
 
 def py_object_def(ty):
     l = []
-    if ty.destructor_fn is not None:
-        dtor = '    %s(&self->obj);\n'%ty.destructor_fn
+    if ty.dispose_fn is not None:
+        dtor = '    %s(&self->obj);\n'%ty.dispose_fn
     else:
         dtor = ''
 
diff -r 03850b265306 -r 224359634904 tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -246,7 +246,7 @@
 int attrib__libxl_key_value_list_set(PyObject *v, libxl_key_value_list *pptr)
 {
     if ( *pptr ) {
-        libxl_key_value_list_destroy(pptr);
+        libxl_key_value_list_dispose(pptr);
         *pptr = NULL;
     }
     if ( v == Py_None )

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:55:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:55:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOB8-0000Yx-9F; Tue, 01 Nov 2011 16:55:38 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAk-0000P0-JI
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:14 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1320191711!1933748!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31216 invoked from network); 1 Nov 2011 23:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAg-0007ZI-TF
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:10 +0000
Message-Id: <E1RLOAg-0007ZI-TF@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_destroy_cpumap becomes
	libxl_cpumap_destroy
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930555 -3600
# Node ID b9fd399d614b0ebdd153a65f28f91dc0dbb6325e
# Parent  224359634904e327a73941d613551f00232ac777
libxl: libxl_destroy_cpumap becomes libxl_cpumap_destroy

Now that IDL type destructors are no longer libxl_*_destroy we can use the more
common libxl_NOUN_VERB structure here.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 224359634904 -r b9fd399d614b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -2775,7 +2775,7 @@
             if (rc) {
                 LIBXL__LOG_ERRNOVAL(ctx, LIBXL__LOG_ERROR, rc,
                     "Error moving cpu to cpupool");
-                libxl_destroy_cpupool(ctx, *poolid);
+                libxl_cpupool_destroy(ctx, *poolid);
                 libxl__free_all(&gc);
                 return ERROR_FAIL;
             }
@@ -2799,7 +2799,7 @@
     }
 }
 
-int libxl_destroy_cpupool(libxl_ctx *ctx, uint32_t poolid)
+int libxl_cpupool_destroy(libxl_ctx *ctx, uint32_t poolid)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     int rc, i;
diff -r 224359634904 -r b9fd399d614b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
@@ -503,7 +503,7 @@
 int libxl_create_cpupool(libxl_ctx *ctx, const char *name, int schedid,
                          libxl_cpumap cpumap, libxl_uuid *uuid,
                          uint32_t *poolid);
-int libxl_destroy_cpupool(libxl_ctx *ctx, uint32_t poolid);
+int libxl_cpupool_destroy(libxl_ctx *ctx, uint32_t poolid);
 int libxl_cpupool_rename(libxl_ctx *ctx, const char *name, uint32_t poolid);
 int libxl_cpupool_cpuadd(libxl_ctx *ctx, uint32_t poolid, int cpu);
 int libxl_cpupool_cpuadd_node(libxl_ctx *ctx, uint32_t poolid, int node, int *cpus);
diff -r 224359634904 -r b9fd399d614b tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -4954,7 +4954,7 @@
         return -ERROR_FAIL;
     }
 
-    return -libxl_destroy_cpupool(ctx, poolid);
+    return -libxl_cpupool_destroy(ctx, poolid);
 }
 
 int main_cpupoolrename(int argc, char **argv)

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:55:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:55:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBI-0000cm-A9; Tue, 01 Nov 2011 16:55:48 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAk-0000P1-RN
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1320191711!2577217!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1120 invoked from network); 1 Nov 2011 23:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAh-0007ZX-Cw
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:11 +0000
Message-Id: <E1RLOAh-0007ZX-Cw@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add a comment describing the
	device interfaces.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930555 -3600
# Node ID c4f7fd30c0b8f6bdc9b07466c1b46c3260a1631a
# Parent  b9fd399d614b0ebdd153a65f28f91dc0dbb6325e
libxl: add a comment describing the device interfaces.

Subsequent patches will endeavour to make reality match this defined
interface.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r b9fd399d614b -r c4f7fd30c0b8 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 10:35:55 2011 +0100
@@ -379,6 +379,65 @@
 libxl_cpupoolinfo * libxl_list_cpupool(libxl_ctx*, int *nb_pool);
 libxl_vminfo * libxl_list_vm(libxl_ctx *ctx, int *nb_vm);
 
+/*
+ * Devices
+ * =======
+ *
+ * Each device is represented by a libxl_device_<TYPE> data structure
+ * which is defined via the IDL. In addition some devices have an
+ * additional data type libxl_device_<TYPE>_getinfo which contains
+ * further runtime information about the device.
+ *
+ * A common set of methods are available for each device type. These
+ * are described below.
+ *
+ * Querying
+ * --------
+ *
+ * libxl_device_<type>_list(ctx, domid, nr):
+ *
+ *   Returns an array of libxl_device_<type> length nr representing
+ *   the devices attached to the specified domain.
+ *
+ * libxl_device_<type>_getinfo(ctx, domid, device, info):
+ *
+ *   Initialises info with details of the given device which must be
+ *   attached to the specified domain.
+ *
+ * Creation / Control
+ * ------------------
+ *
+ * libxl_device_<type>_init(ctx, device):
+ *
+ *    Initalises device to a default configuration.
+ *
+ * libxl_device_<type>_add(ctx, domid, device):
+ *
+ *   Adds the given device to the specified domain. This can be called
+ *   while the guest is running (hotplug) or before boot (coldplug).
+ *
+ *   This function only sets up the device but does not wait for the
+ *   domain to connect to the device and therefore cannot block on the
+ *   guest.
+ *
+ * libxl_device_<type>_remove(ctx, domid, device):
+ *
+ *   Removes the given device from the specified domain by performing
+ *   an orderly unplug with guest co-operation. This requires that the
+ *   guest is running.
+ *
+ *   This method is currently synchronous and therefore can block
+ *   while interacting with the guest.
+ *
+ * libxl_device_<type>_destroy(ctx, domid, device):
+ *
+ *   Removes the given device from the specified domain without guest
+ *   co-operation. It is guest specific what affect this will have on
+ *   a running guest.
+ *
+ *   This function does not interact with the guest and therefore
+ *   cannot block on the guest.
+ */
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
 int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, int wait);
 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num);

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:55:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:55:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBP-0000fr-Iv; Tue, 01 Nov 2011 16:55:55 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAl-0000P3-F0
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-27.messagelabs.com!1320191689!50611630!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12406 invoked from network); 1 Nov 2011 23:54:50 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:54:50 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAi-0007a2-DP
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:12 +0000
Message-Id: <E1RLOAi-0007a2-DP@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: refactor code to construct
	disk from xenstore backend
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930556 -3600
# Node ID f2a50026376cb070df4f2023520395ebb722b41c
# Parent  444fb1a6e8036108aaf7e2dfbe927752a22a525d
libxl: refactor code to construct disk from xenstore backend

Temporarily retain unsafe behaviour of reading f.e. directory.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 444fb1a6e803 -r f2a50026376c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 10:35:56 2011 +0100
@@ -1505,24 +1505,69 @@
     return ERROR_NI;
 }
 
+static void libxl__device_disk_from_xs_be(libxl__gc *gc,
+                                          const char *be_path,
+                                          libxl_device_disk *disk)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    unsigned int len;
+    char *tmp;
+    const char *fe_path; /* XXX unsafe */
+
+    memset(disk, 0, sizeof(*disk));
+
+    tmp = xs_read(ctx->xsh, XBT_NULL,
+                  libxl__sprintf(gc, "%s/params", be_path), &len);
+    if (tmp && strchr(tmp, ':')) {
+        disk->pdev_path = strdup(strchr(tmp, ':') + 1);
+        free(tmp);
+    } else {
+        disk->pdev_path = tmp;
+    }
+    libxl_string_to_backend(ctx,
+                        libxl__xs_read(gc, XBT_NULL,
+                                       libxl__sprintf(gc, "%s/type", be_path)),
+                        &(disk->backend));
+    disk->vdev = xs_read(ctx->xsh, XBT_NULL,
+                         libxl__sprintf(gc, "%s/dev", be_path), &len);
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf
+                         (gc, "%s/removable", be_path));
+
+    if (tmp)
+        disk->removable = atoi(tmp);
+    else
+        disk->removable = 0;
+
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/mode", be_path));
+    if (!strcmp(tmp, "w"))
+        disk->readwrite = 1;
+    else
+        disk->readwrite = 0;
+
+    fe_path = libxl__xs_read(gc, XBT_NULL,
+                             libxl__sprintf(gc, "%s/frontend", be_path));
+    tmp = libxl__xs_read(gc, XBT_NULL,
+                         libxl__sprintf(gc, "%s/device-type", fe_path));
+    disk->is_cdrom = !strcmp(tmp, "cdrom");
+
+    disk->format = LIBXL_DISK_FORMAT_UNKNOWN;
+}
+
 static int libxl__append_disk_list_of_type(libxl__gc *gc,
                                            uint32_t domid,
                                            const char *type,
                                            libxl_device_disk **disks,
                                            int *ndisks)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *be_path = NULL;
     char **dir = NULL;
-    unsigned int n = 0, len = 0;
+    unsigned int n = 0;
     libxl_device_disk *pdisk = NULL, *pdisk_end = NULL;
-    char *physpath_tmp = NULL;
 
     be_path = libxl__sprintf(gc, "%s/backend/%s/%d",
                              libxl__xs_get_dompath(gc, 0), type, domid);
     dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
     if (dir) {
-        char *removable;
         libxl_device_disk *tmp;
         tmp = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
         if (tmp == NULL)
@@ -1532,32 +1577,10 @@
         *ndisks += n;
         pdisk_end = *disks + *ndisks;
         for (; pdisk < pdisk_end; pdisk++, dir++) {
-            memset(pdisk, 0, sizeof(*pdisk));
+            const char *p;
+            p = libxl__sprintf(gc, "%s/%s", be_path, *dir);
+            libxl__device_disk_from_xs_be(gc, p, pdisk);
             pdisk->backend_domid = 0;
-            physpath_tmp = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/%s/params", be_path, *dir), &len);
-            if (physpath_tmp && strchr(physpath_tmp, ':')) {
-                pdisk->pdev_path = strdup(strchr(physpath_tmp, ':') + 1);
-                free(physpath_tmp);
-            } else {
-                pdisk->pdev_path = physpath_tmp;
-            }
-            libxl_string_to_backend(ctx, libxl__xs_read(gc, XBT_NULL,
-                libxl__sprintf(gc, "%s/%s/type", be_path, *dir)),
-                &(pdisk->backend));
-            pdisk->vdev = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/%s/dev", be_path, *dir), &len);
-            removable = libxl__xs_read(gc, XBT_NULL, libxl__sprintf
-                                       (gc, "%s/%s/removable", be_path, *dir));
-            if (removable)
-                pdisk->removable = atoi(removable);
-            else
-                pdisk->removable = 0;
-            if (!strcmp(libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s/mode", be_path, *dir)), "w"))
-                pdisk->readwrite = 1;
-            else
-                pdisk->readwrite = 0;
-            type = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/device-type", libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s/frontend", be_path, *dir))));
-            pdisk->is_cdrom = !strcmp(type, "cdrom");
-            pdisk->format = LIBXL_DISK_FORMAT_UNKNOWN;
         }
     }
     return 0;

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:02 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:02 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBW-0000jT-0x; Tue, 01 Nov 2011 16:56:02 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAl-0000P2-BF
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:15 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1320191712!1589117!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29636 invoked from network); 1 Nov 2011 23:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAh-0007Zm-TG
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:11 +0000
Message-Id: <E1RLOAh-0007Zm-TG@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: various fixes to
	libxl_device_disk_list (and internals)
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318930555 -3600
# Node ID 444fb1a6e8036108aaf7e2dfbe927752a22a525d
# Parent  c4f7fd30c0b8f6bdc9b07466c1b46c3260a1631a
libxl: various fixes to libxl_device_disk_list (and internals)

- handle realloc errors
- remove redundancy of libxl__append_disk_list_of_type return value
  and ndisks paramter.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r c4f7fd30c0b8 -r 444fb1a6e803 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 10:35:55 2011 +0100
@@ -1505,11 +1505,11 @@
     return ERROR_NI;
 }
 
-static unsigned int libxl__append_disk_list_of_type(libxl__gc *gc,
-                                                    uint32_t domid,
-                                                    const char *type,
-                                                    libxl_device_disk **disks,
-                                                    unsigned int *ndisks)
+static int libxl__append_disk_list_of_type(libxl__gc *gc,
+                                           uint32_t domid,
+                                           const char *type,
+                                           libxl_device_disk **disks,
+                                           int *ndisks)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *be_path = NULL;
@@ -1523,11 +1523,16 @@
     dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
     if (dir) {
         char *removable;
-        *disks = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
+        libxl_device_disk *tmp;
+        tmp = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
+        if (tmp == NULL)
+            return ERROR_NOMEM;
+        *disks = tmp;
         pdisk = *disks + *ndisks;
         *ndisks += n;
         pdisk_end = *disks + *ndisks;
         for (; pdisk < pdisk_end; pdisk++, dir++) {
+            memset(pdisk, 0, sizeof(*pdisk));
             pdisk->backend_domid = 0;
             physpath_tmp = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(gc, "%s/%s/params", be_path, *dir), &len);
             if (physpath_tmp && strchr(physpath_tmp, ':')) {
@@ -1555,22 +1560,37 @@
             pdisk->format = LIBXL_DISK_FORMAT_UNKNOWN;
         }
     }
-
-    return n;
+    return 0;
 }
 
 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl_device_disk *disks = NULL;
-    unsigned int ndisks = 0;
-
-    *num = libxl__append_disk_list_of_type(&gc, domid, "vbd", &disks, &ndisks);
-    *num += libxl__append_disk_list_of_type(&gc, domid, "tap", &disks, &ndisks);
-    *num += libxl__append_disk_list_of_type(&gc, domid, "qdisk", &disks, &ndisks);
+    int rc;
+
+    *num = 0;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "vbd", &disks, num);
+    if (rc) goto out_err;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "tap", &disks, num);
+    if (rc) goto out_err;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "qdisk", &disks, num);
+    if (rc) goto out_err;
 
     libxl__free_all(&gc);
     return disks;
+
+out_err:
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to list disks");
+    while (disks && *num) {
+        (*num)--;
+        libxl_device_disk_dispose(&disks[*num]);
+    }
+    free(disks);
+    return NULL;
 }
 
 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:07 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:07 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBb-0000mD-BV; Tue, 01 Nov 2011 16:56:07 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAm-0000P4-9j
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1320191713!1590875!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32302 invoked from network); 1 Nov 2011 23:55:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAi-0007aH-Tg
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:12 +0000
Message-Id: <E1RLOAi-0007aH-Tg@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: do not read f.e. xenstore dir
	in disk list function
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941375 -3600
# Node ID 2b6d3f4b78fc3be33e40826769bbc719cd6f907b
# Parent  f2a50026376cb070df4f2023520395ebb722b41c
libxl: do not read f.e. xenstore dir in disk list function

Instead store a duplicate of the "device-type" node in the backend dir
and use that instead.

This maintains the invariant that the list function is always "safe".

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r f2a50026376c -r 2b6d3f4b78fc tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 10:35:56 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:15 2011 +0100
@@ -1018,6 +1018,8 @@
     flexarray_append(back, libxl__device_disk_string_of_backend(disk->backend));
     flexarray_append(back, "mode");
     flexarray_append(back, disk->readwrite ? "w" : "r");
+    flexarray_append(back, "device-type");
+    flexarray_append(back, disk->is_cdrom ? "cdrom" : "disk");
 
     flexarray_append(front, "backend-id");
     flexarray_append(front, libxl__sprintf(&gc, "%d", disk->backend_domid));
@@ -1512,7 +1514,6 @@
     libxl_ctx *ctx = libxl__gc_owner(gc);
     unsigned int len;
     char *tmp;
-    const char *fe_path; /* XXX unsafe */
 
     memset(disk, 0, sizeof(*disk));
 
@@ -1544,10 +1545,8 @@
     else
         disk->readwrite = 0;
 
-    fe_path = libxl__xs_read(gc, XBT_NULL,
-                             libxl__sprintf(gc, "%s/frontend", be_path));
     tmp = libxl__xs_read(gc, XBT_NULL,
-                         libxl__sprintf(gc, "%s/device-type", fe_path));
+                         libxl__sprintf(gc, "%s/device-type", be_path));
     disk->is_cdrom = !strcmp(tmp, "cdrom");
 
     disk->format = LIBXL_DISK_FORMAT_UNKNOWN;

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:14 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBi-0000pZ-0q; Tue, 01 Nov 2011 16:56:14 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAm-0000P9-Pu
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320191713!1941239!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5326 invoked from network); 1 Nov 2011 23:55:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAj-0007aW-Ej
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:13 +0000
Message-Id: <E1RLOAj-0007aW-Ej@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: update nic list API to use
	common device API style
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 8b9ec0ab3aae22c9683e90d28c8862248195b518
# Parent  2b6d3f4b78fc3be33e40826769bbc719cd6f907b
libxl: update nic list API to use common device API style

libxl_device_nic_list returns an array of libxl_device_nic and
libxl_device_nic_getinfo retrieves further information.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 2b6d3f4b78fc -r 8b9ec0ab3aae tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:15 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1291,60 +1291,138 @@
     return rc;
 }
 
-libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb)
+static void libxl__device_nic_from_xs_be(libxl__gc *gc,
+                                         const char *be_path,
+                                         libxl_device_nic *nic)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    unsigned int len;
+    char *tmp;
+    int rc;
+
+    memset(nic, 0, sizeof(*nic));
+
+    tmp = xs_read(ctx->xsh, XBT_NULL,
+                  libxl__sprintf(gc, "%s/handle", be_path), &len);
+    if ( tmp )
+        nic->devid = atoi(tmp);
+    else
+        nic->devid = 0;
+
+    /* nic->mtu = */
+
+    tmp = xs_read(ctx->xsh, XBT_NULL,
+                  libxl__sprintf(gc, "%s/mac", be_path), &len);
+    rc = libxl__parse_mac(tmp, nic->mac);
+    if (rc)
+            memset(nic->mac, 0, sizeof(nic->mac));
+
+    nic->ip = xs_read(ctx->xsh, XBT_NULL,
+                      libxl__sprintf(gc, "%s/ip", be_path), &len);
+
+    nic->bridge = xs_read(ctx->xsh, XBT_NULL,
+                      libxl__sprintf(gc, "%s/bridge", be_path), &len);
+
+    nic->script = xs_read(ctx->xsh, XBT_NULL,
+                      libxl__sprintf(gc, "%s/script", be_path), &len);
+
+    /* XXX ioemu nics are not in xenstore at all? */
+    nic->nictype = LIBXL_NIC_TYPE_VIF;
+    nic->model = NULL; /* XXX Only for TYPE_IOEMU */
+    nic->ifname = NULL; /* XXX Only for TYPE_IOEMU */
+}
+
+static int libxl__append_nic_list_of_type(libxl__gc *gc,
+                                           uint32_t domid,
+                                           const char *type,
+                                           libxl_device_nic **nics,
+                                           int *nnics)
+{
+    char *be_path = NULL;
+    char **dir = NULL;
+    unsigned int n = 0;
+    libxl_device_nic *pnic = NULL, *pnic_end = NULL;
+
+    be_path = libxl__sprintf(gc, "%s/backend/%s/%d",
+                             libxl__xs_get_dompath(gc, 0), type, domid);
+    dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
+    if (dir) {
+        libxl_device_nic *tmp;
+        tmp = realloc(*nics, sizeof (libxl_device_nic) * (*nnics + n));
+        if (tmp == NULL)
+            return ERROR_NOMEM;
+        *nics = tmp;
+        pnic = *nics + *nnics;
+        *nnics += n;
+        pnic_end = *nics + *nnics;
+        for (; pnic < pnic_end; pnic++, dir++) {
+            const char *p;
+            p = libxl__sprintf(gc, "%s/%s", be_path, *dir);
+            libxl__device_nic_from_xs_be(gc, p, pnic);
+            pnic->backend_domid = 0;
+        }
+    }
+    return 0;
+}
+
+libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx, uint32_t domid, int *num)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *dompath, *nic_path_fe;
-    char **l, **list;
-    char *val, *tok;
-    unsigned int nb_nics, i;
-    libxl_nicinfo *res, *nics;
+    libxl_device_nic *nics = NULL;
+    int rc;
+
+    *num = 0;
+
+    rc = libxl__append_nic_list_of_type(&gc, domid, "vif", &nics, num);
+    if (rc) goto out_err;
+
+    libxl__free_all(&gc);
+    return nics;
+
+out_err:
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to list nics");
+    while (*num) {
+        (*num)--;
+        libxl_device_nic_dispose(&nics[*num]);
+    }
+    free(nics);
+    return NULL;
+}
+
+int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_nic *nic, libxl_nicinfo *nicinfo)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *dompath, *nicpath;
+    char *val;
 
     dompath = libxl__xs_get_dompath(&gc, domid);
-    if (!dompath)
-        goto err;
-    list = l = libxl__xs_directory(&gc, XBT_NULL,
-                           libxl__sprintf(&gc, "%s/device/vif", dompath), &nb_nics);
-    if (!l)
-        goto err;
-    nics = res = calloc(nb_nics, sizeof (libxl_nicinfo));
-    if (!res)
-        goto err;
-    for (*nb = nb_nics; nb_nics > 0; --nb_nics, ++l, ++nics) {
-        nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, *l);
-
-        nics->backend = xs_read(ctx->xsh, XBT_NULL,
-                                libxl__sprintf(&gc, "%s/backend", nic_path_fe), NULL);
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
-        nics->backend_id = val ? strtoul(val, NULL, 10) : -1;
-
-        nics->devid = strtoul(*l, NULL, 10);
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", nic_path_fe));
-        nics->state = val ? strtoul(val, NULL, 10) : -1;
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
-        for (i = 0, tok = strtok(val, ":"); tok && (i < 6);
-             ++i, tok = strtok(NULL, ":")) {
-            nics->mac[i] = strtoul(tok, NULL, 16);
-        }
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", nic_path_fe));
-        nics->evtch = val ? strtol(val, NULL, 10) : -1;
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/tx-ring-ref", nic_path_fe));
-        nics->rref_tx = val ? strtol(val, NULL, 10) : -1;
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/rx-ring-ref", nic_path_fe));
-        nics->rref_rx = val ? strtol(val, NULL, 10) : -1;
-        nics->frontend = xs_read(ctx->xsh, XBT_NULL,
-                                 libxl__sprintf(&gc, "%s/frontend", nics->backend), NULL);
-        val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", nics->backend));
-        nics->frontend_id = val ? strtoul(val, NULL, 10) : -1;
-        nics->script = xs_read(ctx->xsh, XBT_NULL,
-                               libxl__sprintf(&gc, "%s/script", nics->backend), NULL);
+    nicinfo->devid = nic->devid;
+
+    nicpath = libxl__sprintf(&gc, "%s/device/vif/%d", dompath, nicinfo->devid);
+    nicinfo->backend = xs_read(ctx->xsh, XBT_NULL,
+                                libxl__sprintf(&gc, "%s/backend", nicpath), NULL);
+    if (!nicinfo->backend) {
+        libxl__free_all(&gc);
+        return ERROR_FAIL;
     }
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nicpath));
+    nicinfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", nicpath));
+    nicinfo->state = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", nicpath));
+    nicinfo->evtch = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/tx-ring-ref", nicpath));
+    nicinfo->rref_tx = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/rx-ring-ref", nicpath));
+    nicinfo->rref_rx = val ? strtoul(val, NULL, 10) : -1;
+    nicinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
+                                 libxl__sprintf(&gc, "%s/frontend", nicinfo->backend), NULL);
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", nicinfo->backend));
+    nicinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
 
     libxl__free_all(&gc);
-    return res;
-err:
-    libxl__free_all(&gc);
-    return NULL;
+    return 0;
 }
 
 /******************************************************************************/
diff -r 2b6d3f4b78fc -r 8b9ec0ab3aae tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:15 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
@@ -454,7 +454,9 @@
 int libxl_device_nic_init(libxl_device_nic *nic, int dev_num);
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
 int libxl_device_nic_del(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic, int wait);
-libxl_nicinfo *libxl_list_nics(libxl_ctx *ctx, uint32_t domid, unsigned int *nb);
+libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx, uint32_t domid, int *num);
+int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
 int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console);
 
diff -r 2b6d3f4b78fc -r 8b9ec0ab3aae tools/libxl/libxl_types.idl
--- a/tools/libxl/libxl_types.idl	Tue Oct 18 13:36:15 2011 +0100
+++ b/tools/libxl/libxl_types.idl	Tue Oct 18 13:36:42 2011 +0100
@@ -330,8 +330,6 @@
     ("frontend_id", uint32),
     ("devid", integer),
     ("state", integer),
-    ("script", string),
-    ("mac", libxl_mac),
     ("evtch", integer),
     ("rref_tx", integer),
     ("rref_rx", integer),
diff -r 2b6d3f4b78fc -r 8b9ec0ab3aae tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:15 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:42 2011 +0100
@@ -451,15 +451,15 @@
 int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
                             const char *mac, libxl_device_nic *nic)
 {
-    libxl_nicinfo *nics;
-    unsigned int nb, rc, i;
+    libxl_device_nic *nics;
+    int nb, rc, i;
     libxl_mac mac_n;
 
     rc = libxl__parse_mac(mac, mac_n);
     if (rc)
         return rc;
 
-    nics = libxl_list_nics(ctx, domid, &nb);
+    nics = libxl_device_nic_list(ctx, domid, &nb);
     if (!nics)
         return ERROR_FAIL;
 
@@ -468,17 +468,17 @@
     rc = ERROR_INVAL;
     for (i = 0; i < nb; ++i) {
         if (!libxl__compare_macs(&mac_n, &nics[i].mac)) {
-            nic->backend_domid = nics[i].backend_id;
-            nic->devid = nics[i].devid;
-            memcpy(nic->mac, nics[i].mac, sizeof (nic->mac));
-            nic->script = strdup(nics[i].script);
+            *nic = nics[i];
             rc = 0;
+            i++; /* Do not dispose this NIC on exit path */
             break;
         }
+        libxl_device_nic_dispose(&nics[i]);
     }
 
-    for (i=0; i<nb; i++)
-        libxl_nicinfo_dispose(&nics[i]);
+    for (; i<nb; i++)
+        libxl_device_nic_dispose(&nics[i]);
+
     free(nics);
     return rc;
 }
diff -r 2b6d3f4b78fc -r 8b9ec0ab3aae tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:15 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -4025,8 +4025,9 @@
 int main_networklist(int argc, char **argv)
 {
     int opt;
-    libxl_nicinfo *nics;
-    unsigned int nb, i;
+    libxl_device_nic *nics;
+    libxl_nicinfo nicinfo;
+    int nb, i;
 
     if ((opt = def_getopt(argc, argv, "", "network-list", 1)) != -1)
         return opt;
@@ -4039,19 +4040,23 @@
             fprintf(stderr, "%s is an invalid domain identifier\n", *argv);
             continue;
         }
-        if (!(nics = libxl_list_nics(ctx, domid, &nb))) {
+        nics = libxl_device_nic_list(ctx, domid, &nb);
+        if (!nics) {
             continue;
         }
         for (i = 0; i < nb; ++i) {
-            /* Idx BE */
-            printf("%-3d %-2d ", nics[i].devid, nics[i].backend_id);
-            /* MAC */
-            printf(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac));
-            /* Hdl  Sta  evch txr/rxr  BE-path */
-            printf("%6d %5d %6d %5d/%-11d %-30s\n",
-                   nics[i].devid, nics[i].state, nics[i].evtch,
-                   nics[i].rref_tx, nics[i].rref_rx, nics[i].backend);
-            libxl_nicinfo_dispose(&nics[i]);
+            if (!libxl_device_nic_getinfo(ctx, domid, &nics[i], &nicinfo)) {
+                /* Idx BE */
+                printf("%-3d %-2d ", nicinfo.devid, nicinfo.backend_id);
+                /* MAC */
+                printf(LIBXL_MAC_FMT, LIBXL_MAC_BYTES(nics[i].mac));
+                /* Hdl  Sta  evch txr/rxr  BE-path */
+                printf("%6d %5d %6d %5d/%-11d %-30s\n",
+                       nicinfo.devid, nicinfo.state, nicinfo.evtch,
+                       nicinfo.rref_tx, nicinfo.rref_rx, nicinfo.backend);
+                libxl_nicinfo_dispose(&nicinfo);
+            }
+            libxl_device_nic_dispose(&nics[i]);
         }
         free(nics);
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:22 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:22 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBq-0000tR-0L; Tue, 01 Nov 2011 16:56:22 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAn-0000PO-H8
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1320191714!1587527!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 14857 invoked from network); 1 Nov 2011 23:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAj-0007am-VG
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:13 +0000
Message-Id: <E1RLOAj-0007am-VG@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: reimplement devid->nic in
	terms of from_xs_be function.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID cb040b65b10880d38d40fe254008259fb195e95a
# Parent  8b9ec0ab3aae22c9683e90d28c8862248195b518
libxl: reimplement devid->nic in terms of from_xs_be function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 8b9ec0ab3aae -r cb040b65b108 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1315,7 +1315,7 @@
                   libxl__sprintf(gc, "%s/mac", be_path), &len);
     rc = libxl__parse_mac(tmp, nic->mac);
     if (rc)
-            memset(nic->mac, 0, sizeof(nic->mac));
+        memset(nic->mac, 0, sizeof(nic->mac));
 
     nic->ip = xs_read(ctx->xsh, XBT_NULL,
                       libxl__sprintf(gc, "%s/ip", be_path), &len);
@@ -1332,6 +1332,32 @@
     nic->ifname = NULL; /* XXX Only for TYPE_IOEMU */
 }
 
+int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
+                              const char *devid, libxl_device_nic *nic)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *dompath, *path;
+    int rc = ERROR_FAIL;
+
+    memset(nic, 0, sizeof (libxl_device_nic));
+    dompath = libxl__xs_get_dompath(&gc, domid);
+    if (!dompath)
+        goto out;
+
+    path = libxl__xs_read(&gc, XBT_NULL,
+                          libxl__sprintf(&gc, "%s/device/vif/%s/backend",
+                                         dompath, devid));
+    if (!path)
+        goto out;
+
+    libxl__device_nic_from_xs_be(&gc, path, nic);
+
+    rc = 0;
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
 static int libxl__append_nic_list_of_type(libxl__gc *gc,
                                            uint32_t domid,
                                            const char *type,
diff -r 8b9ec0ab3aae -r cb040b65b108 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:42 2011 +0100
@@ -483,41 +483,6 @@
     return rc;
 }
 
-int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
-                              const char *devid, libxl_device_nic *nic)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *val;
-    char *dompath, *nic_path_fe, *nic_path_be;
-    int rc = ERROR_FAIL;
-
-    memset(nic, 0, sizeof (libxl_device_nic));
-    dompath = libxl__xs_get_dompath(&gc, domid);
-    if (!dompath) {
-        goto out;
-    }
-    nic_path_fe = libxl__sprintf(&gc, "%s/device/vif/%s", dompath, devid);
-    nic_path_be = libxl__xs_read(&gc, XBT_NULL,
-                                libxl__sprintf(&gc, "%s/backend", nic_path_fe));
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", nic_path_fe));
-    if ( NULL == val ) {
-        goto out;
-    }
-    nic->backend_domid = strtoul(val, NULL, 10);
-    nic->devid = strtoul(devid, NULL, 10);
-
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mac", nic_path_fe));
-    rc = libxl__parse_mac(val, nic->mac);
-    if (rc)
-        goto out;
-
-    nic->script = xs_read(ctx->xsh, XBT_NULL, libxl__sprintf(&gc, "%s/script", nic_path_be), NULL);
-    rc = 0;
-out:
-    libxl__free_all(&gc);
-    return rc;
-}
-
 int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
                                const char *devid, libxl_device_disk *disk)
 {

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:28 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOBw-0000we-NM; Tue, 01 Nov 2011 16:56:28 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAn-0000Pf-Rd
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320191714!1941240!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5334 invoked from network); 1 Nov 2011 23:55:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAk-0007b2-FP
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:14 +0000
Message-Id: <E1RLOAk-0007b2-FP@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: reimplement devid->disk in
	terms of from_xs_be function.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID a0af8f2ccb7e8c9e36ca6352c3b7f8e3f4bc557b
# Parent  cb040b65b10880d38d40fe254008259fb195e95a
libxl: reimplement devid->disk in terms of from_xs_be function.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r cb040b65b108 -r a0af8f2ccb7e tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1656,6 +1656,33 @@
     disk->format = LIBXL_DISK_FORMAT_UNKNOWN;
 }
 
+int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
+                               const char *devid, libxl_device_disk *disk)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *dompath, *path;
+    int rc = ERROR_FAIL;
+
+    memset(disk, 0, sizeof (libxl_device_disk));
+    dompath = libxl__xs_get_dompath(&gc, domid);
+    if (!dompath) {
+        goto out;
+    }
+    path = libxl__xs_read(&gc, XBT_NULL,
+                          libxl__sprintf(&gc, "%s/device/vbd/%s/backend",
+                                         dompath, devid));
+    if (!path)
+        goto out;
+
+    libxl__device_disk_from_xs_be(&gc, path, disk);
+
+    rc = 0;
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
+
 static int libxl__append_disk_list_of_type(libxl__gc *gc,
                                            uint32_t domid,
                                            const char *type,
diff -r cb040b65b108 -r a0af8f2ccb7e tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_utils.c	Tue Oct 18 13:36:42 2011 +0100
@@ -483,50 +483,6 @@
     return rc;
 }
 
-int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
-                               const char *devid, libxl_device_disk *disk)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *val;
-    char *dompath, *diskpath, *be_path;
-    unsigned int devid_n;
-    int rc = ERROR_INVAL;
-
-    devid_n = libxl__device_disk_dev_number(devid, NULL, NULL);
-    if (devid_n < 0) {
-        goto out;
-    }
-    rc = ERROR_FAIL;
-    dompath = libxl__xs_get_dompath(&gc, domid);
-    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, devid_n);
-    if (!diskpath) {
-        goto out;
-    }
-
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
-    if (!val)
-        goto out;
-    disk->backend_domid = strtoul(val, NULL, 10);
-    be_path = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend", diskpath));
-    disk->pdev_path = xs_read(ctx->xsh, XBT_NULL,
-                              libxl__sprintf(&gc, "%s/params", be_path), NULL);
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/type", be_path));
-    libxl_string_to_backend(ctx, val, &(disk->backend));
-    disk->vdev = xs_read(ctx->xsh, XBT_NULL,
-                         libxl__sprintf(&gc, "%s/dev", be_path), NULL);
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/removable", be_path));
-    disk->removable = !strcmp(val, "1");
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/mode", be_path));
-    disk->readwrite = !!strcmp(val, "w");
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/device-type", diskpath));
-    disk->is_cdrom = !strcmp(val, "cdrom");
-    rc = 0;
-
-out:
-    libxl__free_all(&gc);
-    return rc;
-}
-
 int libxl_cpumap_alloc(libxl_ctx *ctx, libxl_cpumap *cpumap)
 {
     int max_cpus;

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOC2-0000zU-9s; Tue, 01 Nov 2011 16:56:34 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAo-0000Q4-DD
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1320191715!3272389!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12052 invoked from network); 1 Nov 2011 23:55:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAl-0007bH-07
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:15 +0000
Message-Id: <E1RLOAl-0007bH-07@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_devid_to_* should take
	an integer device id
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 90b21171c8c0e25ff7d1648dcd55c7e806b88e11
# Parent  a0af8f2ccb7e8c9e36ca6352c3b7f8e3f4bc557b
libxl: libxl_devid_to_* should take an integer device id

Currently takes a string.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r a0af8f2ccb7e -r 90b21171c8c0 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1333,7 +1333,7 @@
 }
 
 int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
-                              const char *devid, libxl_device_nic *nic)
+                              int devid, libxl_device_nic *nic)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     char *dompath, *path;
@@ -1345,7 +1345,7 @@
         goto out;
 
     path = libxl__xs_read(&gc, XBT_NULL,
-                          libxl__sprintf(&gc, "%s/device/vif/%s/backend",
+                          libxl__sprintf(&gc, "%s/device/vif/%d/backend",
                                          dompath, devid));
     if (!path)
         goto out;
@@ -1657,7 +1657,7 @@
 }
 
 int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
-                               const char *devid, libxl_device_disk *disk)
+                               int devid, libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     char *dompath, *path;
@@ -1669,7 +1669,7 @@
         goto out;
     }
     path = libxl__xs_read(&gc, XBT_NULL,
-                          libxl__sprintf(&gc, "%s/device/vbd/%s/backend",
+                          libxl__sprintf(&gc, "%s/device/vbd/%d/backend",
                                          dompath, devid));
     if (!path)
         goto out;
diff -r a0af8f2ccb7e -r 90b21171c8c0 tools/libxl/libxl_utils.h
--- a/tools/libxl/libxl_utils.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_utils.h	Tue Oct 18 13:36:42 2011 +0100
@@ -60,11 +60,11 @@
 
 int libxl_mac_to_device_nic(libxl_ctx *ctx, uint32_t domid,
                             const char *mac, libxl_device_nic *nic);
-int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid,
-                              const char *devid, libxl_device_nic *nic);
+int libxl_devid_to_device_nic(libxl_ctx *ctx, uint32_t domid, int devid,
+                              libxl_device_nic *nic);
 
-int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
-                               const char *devid, libxl_device_disk *disk);
+int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid, int devid,
+                               libxl_device_disk *disk);
 
 int libxl_cpumap_alloc(libxl_ctx *ctx, libxl_cpumap *cpumap);
 int libxl_cpumap_test(libxl_cpumap *cpumap, int cpu);
diff -r a0af8f2ccb7e -r 90b21171c8c0 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -4077,7 +4077,7 @@
     }
 
     if (!strchr(argv[optind+1], ':')) {
-        if (libxl_devid_to_device_nic(ctx, domid, argv[optind+1], &nic)) {
+        if (libxl_devid_to_device_nic(ctx, domid, atoi(argv[optind+1]), &nic)) {
             fprintf(stderr, "Unknown device %s.\n", argv[optind+1]);
             return 1;
         }
@@ -4178,7 +4178,7 @@
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
         return 1;
     }
-    if (libxl_devid_to_device_disk(ctx, domid, argv[optind+1], &disk)) {
+    if (libxl_devid_to_device_disk(ctx, domid, atoi(argv[optind+1]), &disk)) {
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOC9-00012Z-6o; Tue, 01 Nov 2011 16:56:41 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAp-0000QT-08
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1320191715!1935072!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11723 invoked from network); 1 Nov 2011 23:55:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAl-0007bW-Gi
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:15 +0000
Message-Id: <E1RLOAl-0007bW-Gi@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: separate forced and
	non-forced device remove.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 18505ddad997630e6696089c6fc6fe2b0e35014a
# Parent  90b21171c8c0e25ff7d1648dcd55c7e806b88e11
libxl: separate forced and non-forced device remove.

The function libxl__device_destroy currently takes a force parameter however:

  * in the forced case we initiate a graceful shutdown and then
    immediately nuke the backend directory, quite likely before anyone
    got a chance to react.

  * the callers all have a "wait" variable and pass in "!wait" as the
    force argument which is confusing since not waiting is not really
    the same thing as forcing the destroy.

Therefore split the function into libxl__device_remove and
libxl__device_destroy. The former initiates a graceful shutdown which
the latter simply nukes the backend directory.

This makes some of the callers look a bit odd but that should fall out as I
continue to pull this piece of string.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 90b21171c8c0 -r 18505ddad997 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -365,7 +365,7 @@
     return -1;
 }
 
-int libxl__device_destroy(libxl__gc *gc, char *be_path, int force)
+int libxl__device_remove(libxl__gc *gc, char *be_path)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     xs_transaction_t t;
@@ -393,17 +393,22 @@
             goto out;
         }
     }
-    if (!force) {
-        xs_watch(ctx->xsh, state_path, be_path);
-        rc = 1;
-    } else {
-        xs_rm(ctx->xsh, XBT_NULL, be_path);
-    }
+
+    xs_watch(ctx->xsh, state_path, be_path);
     libxl__device_destroy_tapdisk(gc, be_path);
+    rc = 1;
 out:
     return rc;
 }
 
+int libxl__device_destroy(libxl__gc *gc, char *be_path)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    xs_rm(ctx->xsh, XBT_NULL, be_path);
+    libxl__device_destroy_tapdisk(gc, be_path);
+    return 0;
+}
+
 static int wait_for_dev_destroy(libxl__gc *gc, struct timeval *tv)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -461,7 +466,9 @@
             fe_path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
             be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
             if (be_path != NULL) {
-                if (libxl__device_destroy(gc, be_path, force) > 0)
+                int rc = force ? libxl__device_destroy(gc, be_path)
+                               : libxl__device_remove(gc, be_path);
+                if (rc > 0)
                     n_watches++;
             } else {
                 xs_rm(ctx->xsh, XBT_NULL, path);
@@ -473,7 +480,9 @@
     fe_path = libxl__sprintf(gc, "/local/domain/%d/console", domid);
     be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
     if (be_path && strcmp(be_path, "")) {
-        if (libxl__device_destroy(gc, be_path, force) > 0)
+        int rc = force ? libxl__device_destroy(gc, be_path)
+                       : libxl__device_remove(gc, be_path);
+        if (rc > 0)
             n_watches++;
     }
 
@@ -506,7 +515,10 @@
 
     backend_path = libxl__device_backend_path(gc, dev);
 
-    rc = libxl__device_destroy(gc, backend_path, !wait);
+    if (wait)
+        rc = libxl__device_remove(gc, backend_path);
+    else
+        rc = libxl__device_destroy(gc, backend_path);
     if (rc == -1) {
         rc = ERROR_FAIL;
         goto out;
diff -r 90b21171c8c0 -r 18505ddad997 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
@@ -253,7 +253,8 @@
 _hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
 _hidden char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device);
 _hidden int libxl__device_del(libxl__gc *gc, libxl__device *dev, int wait);
-_hidden int libxl__device_destroy(libxl__gc *gc, char *be_path, int force);
+_hidden int libxl__device_remove(libxl__gc *gc, char *be_path);
+_hidden int libxl__device_destroy(libxl__gc *gc, char *be_path);
 _hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
 
diff -r 90b21171c8c0 -r 18505ddad997 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
@@ -411,8 +411,7 @@
 
     if (num == 1) {
         char *fe_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", be_path));
-        libxl__device_destroy(gc, be_path, 1);
-        xs_rm(ctx->xsh, XBT_NULL, be_path);
+        libxl__device_destroy(gc, be_path);
         xs_rm(ctx->xsh, XBT_NULL, fe_path);
         return 0;
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOCG-00016L-KD; Tue, 01 Nov 2011 16:56:48 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAq-0000R8-ED
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1320191717!2532813!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2197 invoked from network); 1 Nov 2011 23:55:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAn-0007cG-1U
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:17 +0000
Message-Id: <E1RLOAn-0007cG-1U@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: do not remove unidentified
	frontend paths in libxl__devices_destroy
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID b26fc82addde34fc36e95e21dc566a1104e5042a
# Parent  2d999cdc37f71521ee1fdb8ecaa7aca4a159faa6
libxl: do not remove unidentified frontend paths in libxl__devices_destroy

Currently this appears to only include "/local/domain/<domid>/device/suspend".
Ultimately the caller will nuke the whole guest directory anyway but not having
this function remove things which don't look like devices seems less
surprising.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 2d999cdc37f7 -r b26fc82addde tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -463,8 +463,6 @@
                     if (libxl__device_remove(gc, be_path) > 0)
                         n_watches++;
                 }
-            } else {
-                xs_rm(ctx->xsh, XBT_NULL, path);
             }
         }
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:56:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:56:55 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOCN-00019Z-2U; Tue, 01 Nov 2011 16:56:55 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAp-0000Qc-GQ
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1320191716!1053206!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23067 invoked from network); 1 Nov 2011 23:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAm-0007bm-19
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:16 +0000
Message-Id: <E1RLOAm-0007bm-19@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: split forced and non-forced
	uses of libxl__device_del
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 781c6672a25394a57b4c1eeaae40de9d05e5b9b6
# Parent  18505ddad997630e6696089c6fc6fe2b0e35014a
libxl: split forced and non-forced uses of libxl__device_del

Most forced users can now simply call libxl__device_destroy directly.

libxl__devices_destroy is something of a special case, it is really
just iterating over an opaque set of xenstore directories and removing
them. Until this can be refactored just do the force-remove case
manually, doing otherwise led to too much entanglement with the other
callers of libxl__device_destroy which do know about specific device
types.

For the time being do the same in libxl__device_pci_remove_xenstore.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 18505ddad997 -r 781c6672a253 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1074,7 +1074,10 @@
     device.domid            = domid;
     device.devid            = devid;
     device.kind             = DEVICE_VBD;
-    rc = libxl__device_del(&gc, &device, wait);
+    if (wait)
+        rc = libxl__device_del(&gc, &device);
+    else
+        rc = libxl__device_destroy(&gc, &device);
 out_free:
     libxl__free_all(&gc);
     return rc;
@@ -1286,7 +1289,11 @@
     device.domid            = domid;
     device.kind             = DEVICE_VIF;
 
-    rc = libxl__device_del(&gc, &device, wait);
+    if (wait)
+        rc = libxl__device_del(&gc, &device);
+    else
+        rc = libxl__device_destroy(&gc, &device);
+
     libxl__free_all(&gc);
     return rc;
 }
diff -r 18505ddad997 -r 781c6672a253 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -401,11 +401,17 @@
     return rc;
 }
 
-int libxl__device_destroy(libxl__gc *gc, char *be_path)
+int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *be_path = libxl__device_backend_path(gc, dev);
+    char *fe_path = libxl__device_frontend_path(gc, dev);
+
     xs_rm(ctx->xsh, XBT_NULL, be_path);
+    xs_rm(ctx->xsh, XBT_NULL, fe_path);
+
     libxl__device_destroy_tapdisk(gc, be_path);
+
     return 0;
 }
 
@@ -466,10 +472,14 @@
             fe_path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
             be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
             if (be_path != NULL) {
-                int rc = force ? libxl__device_destroy(gc, be_path)
-                               : libxl__device_remove(gc, be_path);
-                if (rc > 0)
-                    n_watches++;
+                if (force) {
+                    xs_rm(ctx->xsh, XBT_NULL, be_path);
+                    xs_rm(ctx->xsh, XBT_NULL, fe_path);
+                    libxl__device_destroy_tapdisk(gc, be_path);
+                } else {
+                    if (libxl__device_remove(gc, be_path) > 0)
+                        n_watches++;
+                }
             } else {
                 xs_rm(ctx->xsh, XBT_NULL, path);
             }
@@ -480,10 +490,13 @@
     fe_path = libxl__sprintf(gc, "/local/domain/%d/console", domid);
     be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
     if (be_path && strcmp(be_path, "")) {
-        int rc = force ? libxl__device_destroy(gc, be_path)
-                       : libxl__device_remove(gc, be_path);
-        if (rc > 0)
-            n_watches++;
+        if (force) {
+            xs_rm(ctx->xsh, XBT_NULL, be_path);
+            xs_rm(ctx->xsh, XBT_NULL, fe_path);
+        } else {
+            if (libxl__device_remove(gc, be_path) > 0)
+                n_watches++;
+        }
     }
 
     if (!force) {
@@ -507,29 +520,24 @@
     return 0;
 }
 
-int libxl__device_del(libxl__gc *gc, libxl__device *dev, int wait)
+int libxl__device_del(libxl__gc *gc, libxl__device *dev)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
+    struct timeval tv;
     char *backend_path;
     int rc;
 
     backend_path = libxl__device_backend_path(gc, dev);
 
-    if (wait)
-        rc = libxl__device_remove(gc, backend_path);
-    else
-        rc = libxl__device_destroy(gc, backend_path);
+    rc = libxl__device_remove(gc, backend_path);
     if (rc == -1) {
         rc = ERROR_FAIL;
         goto out;
     }
 
-    if (wait) {
-        struct timeval tv;
-        tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
-        tv.tv_usec = 0;
-        (void)wait_for_dev_destroy(gc, &tv);
-    }
+    tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
+    tv.tv_usec = 0;
+    (void)wait_for_dev_destroy(gc, &tv);
 
     xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
     rc = 0;
diff -r 18505ddad997 -r 781c6672a253 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
@@ -252,9 +252,9 @@
                              char **bents, char **fents);
 _hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
 _hidden char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device);
-_hidden int libxl__device_del(libxl__gc *gc, libxl__device *dev, int wait);
+_hidden int libxl__device_del(libxl__gc *gc, libxl__device *dev);
 _hidden int libxl__device_remove(libxl__gc *gc, char *be_path);
-_hidden int libxl__device_destroy(libxl__gc *gc, char *be_path);
+_hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
 _hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
 
diff -r 18505ddad997 -r 781c6672a253 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
@@ -411,7 +411,7 @@
 
     if (num == 1) {
         char *fe_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", be_path));
-        libxl__device_destroy(gc, be_path);
+        xs_rm(ctx->xsh, XBT_NULL, be_path);
         xs_rm(ctx->xsh, XBT_NULL, fe_path);
         return 0;
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:57:03 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:57:03 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOCV-0001Ct-9z; Tue, 01 Nov 2011 16:57:03 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAq-0000RN-WC
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1320191717!2577224!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1223 invoked from network); 1 Nov 2011 23:55:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAn-0007cV-Hd
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:17 +0000
Message-Id: <E1RLOAn-0007cV-Hd@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use libxl__device in
	libxl_devices_destroy etc.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 3d4e9f0daad6f6c6b5f18672ca6534bc5a56ceda
# Parent  b26fc82addde34fc36e95e21dc566a1104e5042a
libxl: use libxl__device in libxl_devices_destroy etc.

Use libxl__device in libxl_devices_destroy and
libxl__device_pci_remove_xenstore.

Doing this allows us to use the common functions for removing devices.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r b26fc82addde -r 3d4e9f0daad6 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -49,6 +49,25 @@
                           device->domid, device->devid);
 }
 
+int libxl__parse_backend_path(libxl__gc *gc,
+                              const char *path,
+                              libxl__device *dev)
+{
+    /* /local/domain/<domid>/backend/<kind>/<domid>/<devid> */
+    char strkind[16]; /* Longest is actually "console" */
+    uint32_t domain;
+    int rc = sscanf(path, "/local/domain/%d/backend/%15[^/]/%d/%d",
+                    &dev->backend_domid,
+                    strkind,
+                    &domain,
+                    &dev->backend_devid);
+
+    if (rc != 4)
+        return ERROR_FAIL;
+
+    return libxl__device_kind_from_string(strkind, &dev->backend_kind);
+}
+
 int libxl__device_generic_add(libxl__gc *gc, libxl__device *device,
                              char **bents, char **fents)
 {
@@ -348,10 +367,11 @@
     return -1;
 }
 
-int libxl__device_remove(libxl__gc *gc, char *be_path)
+int libxl__device_remove(libxl__gc *gc, libxl__device *dev)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     xs_transaction_t t;
+    char *be_path = libxl__device_backend_path(gc, dev);
     char *state_path = libxl__sprintf(gc, "%s/state", be_path);
     char *state = libxl__xs_read(gc, XBT_NULL, state_path);
     int rc = 0;
@@ -429,10 +449,12 @@
 int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    char *path, *be_path, *fe_path;
+    char *path;
     unsigned int num1, num2;
     char **l1 = NULL, **l2 = NULL;
     int i, j, n_watches = 0;
+    libxl__device dev;
+    libxl__device_kind kind;
 
     path = libxl__sprintf(gc, "/local/domain/%d/device", domid);
     l1 = libxl__xs_directory(gc, XBT_NULL, path, &num1);
@@ -445,22 +467,25 @@
         num1 = 0;
     }
     for (i = 0; i < num1; i++) {
-        if (!strcmp("vfs", l1[i]))
+        if (libxl__device_kind_from_string(l1[i], &kind))
             continue;
         path = libxl__sprintf(gc, "/local/domain/%d/device/%s", domid, l1[i]);
         l2 = libxl__xs_directory(gc, XBT_NULL, path, &num2);
         if (!l2)
             continue;
         for (j = 0; j < num2; j++) {
-            fe_path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s", domid, l1[i], l2[j]);
-            be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
-            if (be_path != NULL) {
+            path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend",
+                                  domid, l1[i], l2[j]);
+            path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path));
+            if (path && libxl__parse_backend_path(gc, path, &dev) == 0) {
+                dev.domid = domid;
+                dev.kind = kind;
+                dev.devid = atoi(l2[j]);
+
                 if (force) {
-                    xs_rm(ctx->xsh, XBT_NULL, be_path);
-                    xs_rm(ctx->xsh, XBT_NULL, fe_path);
-                    libxl__device_destroy_tapdisk(gc, be_path);
+                    libxl__device_destroy(gc, &dev);
                 } else {
-                    if (libxl__device_remove(gc, be_path) > 0)
+                    if (libxl__device_remove(gc, &dev) > 0)
                         n_watches++;
                 }
             }
@@ -468,14 +493,18 @@
     }
 
     /* console 0 frontend directory is not under /local/domain/<domid>/device */
-    fe_path = libxl__sprintf(gc, "/local/domain/%d/console", domid);
-    be_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/backend", fe_path));
-    if (be_path && strcmp(be_path, "")) {
+    path = libxl__sprintf(gc, "/local/domain/%d/console/backend", domid);
+    path = libxl__xs_read(gc, XBT_NULL, path);
+    if (path && strcmp(path, "") &&
+        libxl__parse_backend_path(gc, path, &dev) == 0) {
+        dev.domid = domid;
+        dev.kind = LIBXL__DEVICE_KIND_CONSOLE;
+        dev.devid = 0;
+
         if (force) {
-            xs_rm(ctx->xsh, XBT_NULL, be_path);
-            xs_rm(ctx->xsh, XBT_NULL, fe_path);
+            libxl__device_destroy(gc, &dev);
         } else {
-            if (libxl__device_remove(gc, be_path) > 0)
+            if (libxl__device_remove(gc, &dev) > 0)
                 n_watches++;
         }
     }
@@ -505,12 +534,9 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     struct timeval tv;
-    char *backend_path;
     int rc;
 
-    backend_path = libxl__device_backend_path(gc, dev);
-
-    rc = libxl__device_remove(gc, backend_path);
+    rc = libxl__device_remove(gc, dev);
     if (rc == -1) {
         rc = ERROR_FAIL;
         goto out;
diff -r b26fc82addde -r 3d4e9f0daad6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
@@ -240,8 +240,10 @@
                              char **bents, char **fents);
 _hidden char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device);
 _hidden char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device);
+_hidden int libxl__parse_backend_path(libxl__gc *gc, const char *path,
+                                      libxl__device *dev);
 _hidden int libxl__device_del(libxl__gc *gc, libxl__device *dev);
-_hidden int libxl__device_remove(libxl__gc *gc, char *be_path);
+_hidden int libxl__device_remove(libxl__gc *gc, libxl__device *dev);
 _hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
 _hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);
diff -r b26fc82addde -r 3d4e9f0daad6 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
@@ -410,9 +410,15 @@
             goto retry_transaction2;
 
     if (num == 1) {
-        char *fe_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/frontend", be_path));
-        xs_rm(ctx->xsh, XBT_NULL, be_path);
-        xs_rm(ctx->xsh, XBT_NULL, fe_path);
+        libxl__device dev;
+        if (libxl__parse_backend_path(gc, be_path, &dev) != 0)
+            return ERROR_FAIL;
+
+        dev.domid = domid;
+        dev.kind = LIBXL__DEVICE_KIND_PCI;
+        dev.devid = 0;
+
+        libxl__device_destroy(gc, &dev);
         return 0;
     }
 

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:57:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:57:16 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOCi-0001IQ-2n; Tue, 01 Nov 2011 16:57:16 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAp-0000Qm-Vp
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1320191716!2454506!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31226 invoked from network); 1 Nov 2011 23:55:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAm-0007c1-Hs
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:16 +0000
Message-Id: <E1RLOAm-0007c1-Hs@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use IDL to define device
	front- and back-end kinds
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 2d999cdc37f71521ee1fdb8ecaa7aca4a159faa6
# Parent  781c6672a25394a57b4c1eeaae40de9d05e5b9b6
libxl: use IDL to define device front- and back-end kinds

I'd like to use the from_string functionality...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 781c6672a253 -r 2d999cdc37f7 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -962,7 +962,7 @@
     device.backend_domid = disk->backend_domid;
     device.devid = devid;
     device.domid = domid;
-    device.kind = DEVICE_VBD;
+    device.kind = LIBXL__DEVICE_KIND_VBD;
 
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_PHY:
@@ -975,7 +975,7 @@
             flexarray_append(back, "params");
             flexarray_append(back, dev);
 
-            device.backend_kind = DEVICE_VBD;
+            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
             break;
         case LIBXL_DISK_BACKEND_TAP:
             dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format);
@@ -994,7 +994,7 @@
             flexarray_append(back, "params");
             flexarray_append(back, libxl__sprintf(&gc, "%s:%s",
                           libxl__device_disk_string_of_format(disk->format), disk->pdev_path));
-            device.backend_kind = DEVICE_QDISK;
+            device.backend_kind = LIBXL__DEVICE_KIND_QDISK;
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n", disk->backend);
@@ -1057,13 +1057,13 @@
 
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_PHY:
-            device.backend_kind = DEVICE_VBD;
+            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
             break;
         case LIBXL_DISK_BACKEND_TAP:
-            device.backend_kind = DEVICE_VBD;
+            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
             break;
         case LIBXL_DISK_BACKEND_QDISK:
-            device.backend_kind = DEVICE_QDISK;
+            device.backend_kind = LIBXL__DEVICE_KIND_QDISK;
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n",
@@ -1073,7 +1073,7 @@
     }
     device.domid            = domid;
     device.devid            = devid;
-    device.kind             = DEVICE_VBD;
+    device.kind             = LIBXL__DEVICE_KIND_VBD;
     if (wait)
         rc = libxl__device_del(&gc, &device);
     else
@@ -1221,10 +1221,10 @@
 
     device.backend_devid = nic->devid;
     device.backend_domid = nic->backend_domid;
-    device.backend_kind = DEVICE_VIF;
+    device.backend_kind = LIBXL__DEVICE_KIND_VIF;
     device.devid = nic->devid;
     device.domid = domid;
-    device.kind = DEVICE_VIF;
+    device.kind = LIBXL__DEVICE_KIND_VIF;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
@@ -1284,10 +1284,10 @@
 
     device.backend_devid    = nic->devid;
     device.backend_domid    = nic->backend_domid;
-    device.backend_kind     = DEVICE_VIF;
+    device.backend_kind     = LIBXL__DEVICE_KIND_VIF;
     device.devid            = nic->devid;
     device.domid            = domid;
-    device.kind             = DEVICE_VIF;
+    device.kind             = LIBXL__DEVICE_KIND_VIF;
 
     if (wait)
         rc = libxl__device_del(&gc, &device);
@@ -1486,10 +1486,10 @@
 
     device.backend_devid = console->devid;
     device.backend_domid = console->backend_domid;
-    device.backend_kind = DEVICE_CONSOLE;
+    device.backend_kind = LIBXL__DEVICE_KIND_CONSOLE;
     device.devid = console->devid;
     device.domid = domid;
-    device.kind = DEVICE_CONSOLE;
+    device.kind = LIBXL__DEVICE_KIND_CONSOLE;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(gc, "%d", domid));
@@ -1577,10 +1577,10 @@
 
     device.backend_devid = vkb->devid;
     device.backend_domid = vkb->backend_domid;
-    device.backend_kind = DEVICE_VKBD;
+    device.backend_kind = LIBXL__DEVICE_KIND_VKBD;
     device.devid = vkb->devid;
     device.domid = domid;
-    device.kind = DEVICE_VKBD;
+    device.kind = LIBXL__DEVICE_KIND_VKBD;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
@@ -1864,10 +1864,10 @@
 
     device.backend_devid = vfb->devid;
     device.backend_domid = vfb->backend_domid;
-    device.backend_kind = DEVICE_VFB;
+    device.backend_kind = LIBXL__DEVICE_KIND_VFB;
     device.devid = vfb->devid;
     device.domid = domid;
-    device.kind = DEVICE_VFB;
+    device.kind = LIBXL__DEVICE_KIND_VFB;
 
     flexarray_append_pair(back, "frontend-id", libxl__sprintf(&gc, "%d", domid));
     flexarray_append_pair(back, "online", "1");
diff -r 781c6672a253 -r 2d999cdc37f7 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -24,30 +24,20 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-
 #include "libxl.h"
 #include "libxl_internal.h"
 
-static const char *string_of_kinds[] = {
-    [DEVICE_VIF] = "vif",
-    [DEVICE_VBD] = "vbd",
-    [DEVICE_QDISK] = "qdisk",
-    [DEVICE_PCI] = "pci",
-    [DEVICE_VFB] = "vfb",
-    [DEVICE_VKBD] = "vkbd",
-    [DEVICE_CONSOLE] = "console",
-};
-
 char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device)
 {
     char *dom_path = libxl__xs_get_dompath(gc, device->domid);
 
     /* Console 0 is a special case */
-    if (device->kind == DEVICE_CONSOLE && device->devid == 0)
+    if (device->kind == LIBXL__DEVICE_KIND_CONSOLE && device->devid == 0)
         return libxl__sprintf(gc, "%s/console", dom_path);
 
     return libxl__sprintf(gc, "%s/device/%s/%d", dom_path,
-                          string_of_kinds[device->kind], device->devid);
+                          libxl__device_kind_to_string(device->kind),
+                          device->devid);
 }
 
 char *libxl__device_backend_path(libxl__gc *gc, libxl__device *device)
@@ -55,7 +45,7 @@
     char *dom_path = libxl__xs_get_dompath(gc, device->backend_domid);
 
     return libxl__sprintf(gc, "%s/backend/%s/%u/%d", dom_path,
-                          string_of_kinds[device->backend_kind],
+                          libxl__device_kind_to_string(device->backend_kind),
                           device->domid, device->devid);
 }
 
@@ -67,12 +57,6 @@
     xs_transaction_t t;
     struct xs_permissions frontend_perms[2];
     struct xs_permissions backend_perms[2];
-    int rc;
-
-    if (!is_valid_device_kind(device->backend_kind) || !is_valid_device_kind(device->kind)) {
-        rc = ERROR_INVAL;
-        goto out;
-    }
 
     frontend_path = libxl__device_frontend_path(gc, device);
     backend_path = libxl__device_backend_path(gc, device);
@@ -113,9 +97,8 @@
         else
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs transaction failed");
     }
-    rc = 0;
-out:
-    return rc;
+
+    return 0;
 }
 
 typedef struct {
diff -r 781c6672a253 -r 2d999cdc37f7 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
@@ -97,25 +97,13 @@
     libxl_version_info version_info;
 };
 
-typedef enum {
-    DEVICE_VIF = 1,
-    DEVICE_VBD,
-    DEVICE_QDISK,
-    DEVICE_PCI,
-    DEVICE_VFB,
-    DEVICE_VKBD,
-    DEVICE_CONSOLE,
-} libxl__device_kinds;
-
-#define is_valid_device_kind(kind) (((kind) >= DEVICE_VIF) && ((kind) <= DEVICE_CONSOLE))
-
 typedef struct {
     uint32_t backend_devid;
     uint32_t backend_domid;
     uint32_t devid;
     uint32_t domid;
-    libxl__device_kinds backend_kind;
-    libxl__device_kinds kind;
+    libxl__device_kind backend_kind;
+    libxl__device_kind kind;
 } libxl__device;
 
 #define XC_PCI_BDF             "0x%x, 0x%x, 0x%x, 0x%x"
diff -r 781c6672a253 -r 2d999cdc37f7 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:42 2011 +0100
@@ -244,10 +244,10 @@
     /* add pci device */
     device.backend_devid = 0;
     device.backend_domid = 0;
-    device.backend_kind = DEVICE_PCI;
+    device.backend_kind = LIBXL__DEVICE_KIND_PCI;
     device.devid = 0;
     device.domid = domid;
-    device.kind = DEVICE_PCI;
+    device.kind = LIBXL__DEVICE_KIND_PCI;
 
     flexarray_append_pair(back, "frontend-id", libxl__sprintf(gc, "%d", domid));
     flexarray_append_pair(back, "online", "1");
diff -r 781c6672a253 -r 2d999cdc37f7 tools/libxl/libxl_types_internal.idl
--- a/tools/libxl/libxl_types_internal.idl	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_types_internal.idl	Tue Oct 18 13:36:42 2011 +0100
@@ -1,9 +1,19 @@
 namespace("libxl__")
 
-libxl__qmp_message_type  = Enumeration("qmp_message_type", [
+libxl__qmp_message_type = Enumeration("qmp_message_type", [
     (1, "QMP"),
     (2, "return"),
     (3, "error"),
     (4, "event"),
     (5, "invalid"),
     ])
+
+libxl__device_kind = Enumeration("device_kind", [
+    (1, "VIF"),
+    (2, "VBD"),
+    (3, "QDISK"),
+    (4, "PCI"),
+    (5, "VFB"),
+    (6, "VKBD"),
+    (7, "CONSOLE"),
+    ])

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:57:27 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:57:27 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOCs-0001Nf-9n; Tue, 01 Nov 2011 16:57:26 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAr-0000Rm-Kw
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1320191683!61555355!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30038 invoked from network); 1 Nov 2011 23:54:43 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:54:43 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAo-0007d0-I6
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:18 +0000
Message-Id: <E1RLOAo-0007d0-I6@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: use more descriptive variable
	names in libxl__devices_destroy.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID ae1e145bdac024835980370473bc82269c9f9c67
# Parent  3505f6b5787bfb7b06f961019a1130b1ebe98882
libxl: use more descriptive variable names in libxl__devices_destroy.

It's not immediately clear that "l1" iterates over device types and "l2"
iterates over individual devices. Name things in a way which makes this more
obvious.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 3505f6b5787b -r ae1e145bdac0 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -464,37 +464,38 @@
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path;
-    unsigned int num1, num2;
-    char **l1 = NULL, **l2 = NULL;
+    unsigned int num_kinds, num_devs;
+    char **kinds = NULL, **devs = NULL;
     int i, j, n_watches = 0;
     libxl__device dev;
     libxl__device_kind kind;
 
     path = libxl__sprintf(gc, "/local/domain/%d/device", domid);
-    l1 = libxl__xs_directory(gc, XBT_NULL, path, &num1);
-    if (!l1) {
+    kinds = libxl__xs_directory(gc, XBT_NULL, path, &num_kinds);
+    if (!kinds) {
         if (errno != ENOENT) {
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "unable to get xenstore"
                              " device listing %s", path);
             goto out;
         }
-        num1 = 0;
+        num_kinds = 0;
     }
-    for (i = 0; i < num1; i++) {
-        if (libxl__device_kind_from_string(l1[i], &kind))
+    for (i = 0; i < num_kinds; i++) {
+        if (libxl__device_kind_from_string(kinds[i], &kind))
             continue;
-        path = libxl__sprintf(gc, "/local/domain/%d/device/%s", domid, l1[i]);
-        l2 = libxl__xs_directory(gc, XBT_NULL, path, &num2);
-        if (!l2)
+
+        path = libxl__sprintf(gc, "/local/domain/%d/device/%s", domid, kinds[i]);
+        devs = libxl__xs_directory(gc, XBT_NULL, path, &num_devs);
+        if (!devs)
             continue;
-        for (j = 0; j < num2; j++) {
+        for (j = 0; j < num_devs; j++) {
             path = libxl__sprintf(gc, "/local/domain/%d/device/%s/%s/backend",
-                                  domid, l1[i], l2[j]);
+                                  domid, kinds[i], devs[j]);
             path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, path));
             if (path && libxl__parse_backend_path(gc, path, &dev) == 0) {
                 dev.domid = domid;
                 dev.kind = kind;
-                dev.devid = atoi(l2[j]);
+                dev.devid = atoi(devs[j]);
 
                 if (force) {
                     libxl__device_destroy(gc, &dev);

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:57:37 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:57:37 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOD2-0001Rr-KT; Tue, 01 Nov 2011 16:57:37 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAr-0000Rf-J6
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1320191718!1053211!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23083 invoked from network); 1 Nov 2011 23:55:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAo-0007ck-2I
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:18 +0000
Message-Id: <E1RLOAo-0007ck-2I@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: merge libxl__device_del into
	libxl__device_remove
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 3505f6b5787bfb7b06f961019a1130b1ebe98882
# Parent  3d4e9f0daad6f6c6b5f18672ca6534bc5a56ceda
libxl: merge libxl__device_del into libxl__device_remove

Note that the "wait" parameter added to libxl_device_remove is different to the
wait paramter previously used by similar functions. In the past not-wait meant
forced whereas now in means wait for a graceful shutdown, as opposed to setting
off a graceful shutdown but not waiting.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 3d4e9f0daad6 -r 3505f6b5787b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1075,7 +1075,7 @@
     device.devid            = devid;
     device.kind             = LIBXL__DEVICE_KIND_VBD;
     if (wait)
-        rc = libxl__device_del(&gc, &device);
+        rc = libxl__device_remove(&gc, &device, wait);
     else
         rc = libxl__device_destroy(&gc, &device);
 out_free:
@@ -1290,7 +1290,7 @@
     device.kind             = LIBXL__DEVICE_KIND_VIF;
 
     if (wait)
-        rc = libxl__device_del(&gc, &device);
+        rc = libxl__device_remove(&gc, &device, wait);
     else
         rc = libxl__device_destroy(&gc, &device);
 
diff -r 3d4e9f0daad6 -r 3505f6b5787b tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_device.c	Tue Oct 18 13:36:42 2011 +0100
@@ -367,57 +367,6 @@
     return -1;
 }
 
-int libxl__device_remove(libxl__gc *gc, libxl__device *dev)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    xs_transaction_t t;
-    char *be_path = libxl__device_backend_path(gc, dev);
-    char *state_path = libxl__sprintf(gc, "%s/state", be_path);
-    char *state = libxl__xs_read(gc, XBT_NULL, state_path);
-    int rc = 0;
-
-    if (!state)
-        goto out;
-    if (atoi(state) != 4) {
-        libxl__device_destroy_tapdisk(gc, be_path);
-        xs_rm(ctx->xsh, XBT_NULL, be_path);
-        goto out;
-    }
-
-retry_transaction:
-    t = xs_transaction_start(ctx->xsh);
-    xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/online", be_path), "0", strlen("0"));
-    xs_write(ctx->xsh, t, state_path, "5", strlen("5"));
-    if (!xs_transaction_end(ctx->xsh, t, 0)) {
-        if (errno == EAGAIN)
-            goto retry_transaction;
-        else {
-            rc = -1;
-            goto out;
-        }
-    }
-
-    xs_watch(ctx->xsh, state_path, be_path);
-    libxl__device_destroy_tapdisk(gc, be_path);
-    rc = 1;
-out:
-    return rc;
-}
-
-int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    char *be_path = libxl__device_backend_path(gc, dev);
-    char *fe_path = libxl__device_frontend_path(gc, dev);
-
-    xs_rm(ctx->xsh, XBT_NULL, be_path);
-    xs_rm(ctx->xsh, XBT_NULL, fe_path);
-
-    libxl__device_destroy_tapdisk(gc, be_path);
-
-    return 0;
-}
-
 static int wait_for_dev_destroy(libxl__gc *gc, struct timeval *tv)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -446,6 +395,71 @@
     return rc;
 }
 
+/*
+ * Returns 0 (device already destroyed) or 1 (caller must
+ * wait_for_dev_destroy) on success, ERROR_* on fail.
+ */
+int libxl__device_remove(libxl__gc *gc, libxl__device *dev, int wait)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    xs_transaction_t t;
+    char *be_path = libxl__device_backend_path(gc, dev);
+    char *state_path = libxl__sprintf(gc, "%s/state", be_path);
+    char *state = libxl__xs_read(gc, XBT_NULL, state_path);
+    int rc = 0;
+
+    if (!state)
+        goto out;
+    if (atoi(state) != 4) {
+        libxl__device_destroy_tapdisk(gc, be_path);
+        xs_rm(ctx->xsh, XBT_NULL, be_path);
+        goto out;
+    }
+
+retry_transaction:
+    t = xs_transaction_start(ctx->xsh);
+    xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/online", be_path), "0", strlen("0"));
+    xs_write(ctx->xsh, t, state_path, "5", strlen("5"));
+    if (!xs_transaction_end(ctx->xsh, t, 0)) {
+        if (errno == EAGAIN)
+            goto retry_transaction;
+        else {
+            rc = ERROR_FAIL;
+            goto out;
+        }
+    }
+
+    xs_watch(ctx->xsh, state_path, be_path);
+    libxl__device_destroy_tapdisk(gc, be_path);
+
+    if (wait) {
+        struct timeval tv;
+        tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
+        tv.tv_usec = 0;
+        (void)wait_for_dev_destroy(gc, &tv);
+        xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
+    } else {
+        rc = 1; /* Caller must wait_for_dev_destroy */
+    }
+
+out:
+    return rc;
+}
+
+int libxl__device_destroy(libxl__gc *gc, libxl__device *dev)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *be_path = libxl__device_backend_path(gc, dev);
+    char *fe_path = libxl__device_frontend_path(gc, dev);
+
+    xs_rm(ctx->xsh, XBT_NULL, be_path);
+    xs_rm(ctx->xsh, XBT_NULL, fe_path);
+
+    libxl__device_destroy_tapdisk(gc, be_path);
+
+    return 0;
+}
+
 int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -485,8 +499,12 @@
                 if (force) {
                     libxl__device_destroy(gc, &dev);
                 } else {
-                    if (libxl__device_remove(gc, &dev) > 0)
-                        n_watches++;
+                    int rc = libxl__device_remove(gc, &dev, 0);
+                    if (rc < 0)
+                        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                                   "cannot remove device %s\n", path);
+                    else
+                        n_watches += rc;
                 }
             }
         }
@@ -504,8 +522,12 @@
         if (force) {
             libxl__device_destroy(gc, &dev);
         } else {
-            if (libxl__device_remove(gc, &dev) > 0)
-                n_watches++;
+            int rc = libxl__device_remove(gc, &dev, 0);
+            if (rc < 0)
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                           "cannot remove device %s\n", path);
+            else
+                n_watches += rc;
         }
     }
 
@@ -530,29 +552,6 @@
     return 0;
 }
 
-int libxl__device_del(libxl__gc *gc, libxl__device *dev)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    struct timeval tv;
-    int rc;
-
-    rc = libxl__device_remove(gc, dev);
-    if (rc == -1) {
-        rc = ERROR_FAIL;
-        goto out;
-    }
-
-    tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
-    tv.tv_usec = 0;
-    (void)wait_for_dev_destroy(gc, &tv);
-
-    xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
-    rc = 0;
-
-out:
-    return rc;
-}
-
 int libxl__wait_for_device_model(libxl__gc *gc,
                                  uint32_t domid, char *state,
                                  libxl__spawn_starting *spawning,
diff -r 3d4e9f0daad6 -r 3505f6b5787b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:42 2011 +0100
@@ -242,8 +242,7 @@
 _hidden char *libxl__device_frontend_path(libxl__gc *gc, libxl__device *device);
 _hidden int libxl__parse_backend_path(libxl__gc *gc, const char *path,
                                       libxl__device *dev);
-_hidden int libxl__device_del(libxl__gc *gc, libxl__device *dev);
-_hidden int libxl__device_remove(libxl__gc *gc, libxl__device *dev);
+_hidden int libxl__device_remove(libxl__gc *gc, libxl__device *dev, int wait);
 _hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev);
 _hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid, int force);
 _hidden int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state);

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:57:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:57:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLODF-0001Um-Lg; Tue, 01 Nov 2011 16:57:49 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAs-0000S3-GH
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1320191719!1867877!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9554 invoked from network); 1 Nov 2011 23:55:19 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:19 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAp-0007dG-38
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:19 +0000
Message-Id: <E1RLOAp-0007dG-38@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: convert disk handling to
	device API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 7357a4c2c0113afb971a074f4b21b5c67eb5140b
# Parent  ae1e145bdac024835980370473bc82269c9f9c67
libxl: convert disk handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r ae1e145bdac0 -r 7357a4c2c011 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -916,13 +916,58 @@
 
 /******************************************************************************/
 
+int libxl_device_disk_init(libxl_ctx *ctx, libxl_device_disk *disk)
+{
+    memset(disk, 0x00, sizeof(libxl_device_disk));
+    return 0;
+}
+
+static int libxl__device_from_disk(libxl__gc *gc, uint32_t domid,
+                                   libxl_device_disk *disk,
+                                   libxl__device *device)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    int devid;
+
+    devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
+    if (devid==-1) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
+               " virtual disk identifier %s", disk->vdev);
+        return ERROR_INVAL;
+    }
+
+    device->backend_domid = disk->backend_domid;
+    device->backend_devid = devid;
+
+    switch (disk->backend) {
+        case LIBXL_DISK_BACKEND_PHY:
+            device->backend_kind = LIBXL__DEVICE_KIND_VBD;
+            break;
+        case LIBXL_DISK_BACKEND_TAP:
+            device->backend_kind = LIBXL__DEVICE_KIND_VBD;
+            break;
+        case LIBXL_DISK_BACKEND_QDISK:
+            device->backend_kind = LIBXL__DEVICE_KIND_QDISK;
+            break;
+        default:
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n",
+                       disk->backend);
+            return ERROR_INVAL;
+    }
+
+    device->domid = domid;
+    device->devid = devid;
+    device->kind  = LIBXL__DEVICE_KIND_VBD;
+
+    return 0;
+}
+
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     flexarray_t *front;
     flexarray_t *back;
     char *dev;
-    int devid;
     libxl__device device;
     int major, minor, rc;
 
@@ -950,20 +995,13 @@
         goto out_free;
     }
 
-    devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
-    if (devid==-1) {
+    rc = libxl__device_from_disk(&gc, domid, disk, &device);
+    if (rc != 0) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Invalid or unsupported"
                " virtual disk identifier %s", disk->vdev);
-        rc = ERROR_INVAL;
         goto out_free;
     }
 
-    device.backend_devid = devid;
-    device.backend_domid = disk->backend_domid;
-    device.devid = devid;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_VBD;
-
     switch (disk->backend) {
         case LIBXL_DISK_BACKEND_PHY:
             dev = disk->pdev_path;
@@ -975,7 +1013,7 @@
             flexarray_append(back, "params");
             flexarray_append(back, dev);
 
-            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
+            assert(device.backend_kind == LIBXL__DEVICE_KIND_VBD);
             break;
         case LIBXL_DISK_BACKEND_TAP:
             dev = libxl__blktap_devpath(&gc, disk->pdev_path, disk->format);
@@ -994,7 +1032,7 @@
             flexarray_append(back, "params");
             flexarray_append(back, libxl__sprintf(&gc, "%s:%s",
                           libxl__device_disk_string_of_format(disk->format), disk->pdev_path));
-            device.backend_kind = LIBXL__DEVICE_KIND_QDISK;
+            assert(device.backend_kind == LIBXL__DEVICE_KIND_QDISK);
             break;
         default:
             LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n", disk->backend);
@@ -1026,7 +1064,7 @@
     flexarray_append(front, "state");
     flexarray_append(front, libxl__sprintf(&gc, "%d", 1));
     flexarray_append(front, "virtual-device");
-    flexarray_append(front, libxl__sprintf(&gc, "%d", devid));
+    flexarray_append(front, libxl__sprintf(&gc, "%d", device.devid));
     flexarray_append(front, "device-type");
     flexarray_append(front, disk->is_cdrom ? "cdrom" : "disk");
 
@@ -1044,45 +1082,37 @@
     return rc;
 }
 
-int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid,
-                          libxl_device_disk *disk, int wait)
+int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid,
+                             libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl__device device;
-    int devid, rc;
-
-    devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
-    device.backend_domid    = disk->backend_domid;
-    device.backend_devid    = devid;
-
-    switch (disk->backend) {
-        case LIBXL_DISK_BACKEND_PHY:
-            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
-            break;
-        case LIBXL_DISK_BACKEND_TAP:
-            device.backend_kind = LIBXL__DEVICE_KIND_VBD;
-            break;
-        case LIBXL_DISK_BACKEND_QDISK:
-            device.backend_kind = LIBXL__DEVICE_KIND_QDISK;
-            break;
-        default:
-            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "unrecognized disk backend type: %d\n",
-                       disk->backend);
-            rc = ERROR_INVAL;
-            goto out_free;
-    }
-    device.domid            = domid;
-    device.devid            = devid;
-    device.kind             = LIBXL__DEVICE_KIND_VBD;
-    if (wait)
-        rc = libxl__device_remove(&gc, &device, wait);
-    else
-        rc = libxl__device_destroy(&gc, &device);
-out_free:
+    int rc;
+
+    rc = libxl__device_from_disk(&gc, domid, disk, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_remove(&gc, &device, 1);
+out:
     libxl__free_all(&gc);
     return rc;
 }
 
+int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_disk *disk)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_disk(&gc, domid, disk, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_destroy(&gc, &device);
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
@@ -1626,7 +1656,7 @@
     unsigned int len;
     char *tmp;
 
-    memset(disk, 0, sizeof(*disk));
+    libxl_device_disk_init(ctx, disk);
 
     tmp = xs_read(ctx->xsh, XBT_NULL,
                   libxl__sprintf(gc, "%s/params", be_path), &len);
@@ -1670,7 +1700,8 @@
     char *dompath, *path;
     int rc = ERROR_FAIL;
 
-    memset(disk, 0, sizeof (libxl_device_disk));
+    libxl_device_disk_init(ctx, disk);
+
     dompath = libxl__xs_get_dompath(&gc, domid);
     if (!dompath) {
         goto out;
@@ -1812,11 +1843,11 @@
 
     ret = 0;
 
-    libxl_device_disk_del(ctx, domid, disks + i, 1);
+    libxl_device_disk_remove(ctx, domid, disks + i);
     libxl_device_disk_add(ctx, domid, disk);
     stubdomid = libxl_get_stubdom_id(ctx, domid);
     if (stubdomid) {
-        libxl_device_disk_del(ctx, stubdomid, disks + i, 1);
+        libxl_device_disk_remove(ctx, stubdomid, disks + i);
         libxl_device_disk_add(ctx, stubdomid, disk);
     }
 out:
diff -r ae1e145bdac0 -r 7357a4c2c011 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
@@ -438,15 +438,27 @@
  *   This function does not interact with the guest and therefore
  *   cannot block on the guest.
  */
+
+/* Disks */
+int libxl_device_disk_init(libxl_ctx *ctx, libxl_device_disk *disk);
 int libxl_device_disk_add(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
-int libxl_device_disk_del(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk, int wait);
+int libxl_device_disk_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
+int libxl_device_disk_destroy(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_disk *disk);
+
 libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num);
 int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_disk *disk, libxl_diskinfo *diskinfo);
+
+/*
+ * Insert a CD-ROM device. A device corresponding to disk must already
+ * be attached to the guest.
+ */
 int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk);
 
 /*
- * Make a disk available in this domain. Returns path to a device.
+ * Make a disk available in this (the control) domain. Returns path to
+ * a device.
  */
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk);
 int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk);
diff -r ae1e145bdac0 -r 7357a4c2c011 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -494,7 +494,7 @@
 {
     int e;
 
-    memset(disk, 0, sizeof(*disk));
+    libxl_device_disk_init(ctx, disk);
 
     if (!*config) {
         *config = xlu_cfg_init(stderr, "command line");
@@ -1893,6 +1893,8 @@
     disk.backend_domid = 0;
 
     libxl_cdrom_insert(ctx, domid, &disk);
+
+    libxl_device_disk_dispose(&disk);
     free(buf);
 }
 
@@ -4182,8 +4184,8 @@
         fprintf(stderr, "Error: Device %s not connected.\n", argv[optind+1]);
         return 1;
     }
-    if (libxl_device_disk_del(ctx, domid, &disk, 1)) {
-        fprintf(stderr, "libxl_device_disk_del failed.\n");
+    if (libxl_device_disk_remove(ctx, domid, &disk)) {
+        fprintf(stderr, "libxl_device_disk_remove failed.\n");
     }
     return 0;
 }
diff -r ae1e145bdac0 -r 7357a4c2c011 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:42 2011 +0100
@@ -16,6 +16,11 @@
     "libxl_hwcap":          ("int32 array",            None,                                "Val_hwcap(&%(c)s)"),
     }
 
+DEVICE_FUNCTIONS = [ ("add",            ["t", "domid", "unit"]),
+                     ("remove",         ["t", "domid", "unit"]),
+                     ("destroy",        ["t", "domid", "unit"]),
+                   ]
+
 functions = { # ( name , [type1,type2,....] )
     "device_vfb":     [ ("add",            ["t", "domid", "unit"]),
                         ("clean_shutdown", ["domid", "unit"]),
@@ -27,9 +32,7 @@
                       ],
     "device_console": [ ("add",            ["t", "domid", "unit"]),
                       ],
-    "device_disk":    [ ("add",            ["t", "domid", "unit"]),
-                        ("del",            ["t", "domid", "unit"]),
-                      ],
+    "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     [ ("add",            ["t", "domid", "unit"]),
                         ("del",            ["t", "domid", "unit"]),
                       ],
diff -r ae1e145bdac0 -r 7357a4c2c011 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:42 2011 +0100
@@ -247,7 +247,7 @@
 	device_disk_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_disk_del(ctx, Int_val(domid), &c_info, 0);
+	ret = libxl_device_disk_remove(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("disk_del", &lg);
 	FREE_CTX();

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:58:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:58:18 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLODh-0001aE-Oz; Tue, 01 Nov 2011 16:58:17 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAt-0000S5-1V
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1320191719!1935504!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6457 invoked from network); 1 Nov 2011 23:55:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAp-0007dV-Ka
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:19 +0000
Message-Id: <E1RLOAp-0007dV-Ka@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: convert NIC handling to
	device API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941402 -3600
# Node ID 11ae241660f62c85dba0d6f7d8f85197f748e47a
# Parent  7357a4c2c0113afb971a074f4b21b5c67eb5140b
libxl: convert NIC handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 7357a4c2c011 -r 11ae241660f6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -1187,32 +1187,46 @@
 }
 
 /******************************************************************************/
-int libxl_device_nic_init(libxl_device_nic *nic_info, int devnum)
+int libxl_device_nic_init(libxl_ctx *ctx, libxl_device_nic *nic)
 {
     const uint8_t *r;
     libxl_uuid uuid;
 
     libxl_uuid_generate(&uuid);
     r = libxl_uuid_bytearray(&uuid);
-    memset(nic_info, '\0', sizeof(*nic_info));
-
-    nic_info->backend_domid = 0;
-    nic_info->devid = devnum;
-    nic_info->mtu = 1492;
-    nic_info->model = strdup("rtl8139");
-    nic_info->mac[0] = 0x00;
-    nic_info->mac[1] = 0x16;
-    nic_info->mac[2] = 0x3e;
-    nic_info->mac[3] = r[0] & 0x7f;
-    nic_info->mac[4] = r[1];
-    nic_info->mac[5] = r[2];
-    nic_info->ifname = NULL;
-    nic_info->bridge = strdup("xenbr0");
-    nic_info->ip = NULL;
-    if ( asprintf(&nic_info->script, "%s/vif-bridge",
+    memset(nic, '\0', sizeof(*nic));
+
+    nic->backend_domid = 0;
+    nic->devid = -1;
+    nic->mtu = 1492;
+    nic->model = strdup("rtl8139");
+    nic->mac[0] = 0x00;
+    nic->mac[1] = 0x16;
+    nic->mac[2] = 0x3e;
+    nic->mac[3] = r[0] & 0x7f;
+    nic->mac[4] = r[1];
+    nic->mac[5] = r[2];
+    nic->ifname = NULL;
+    nic->bridge = strdup("xenbr0");
+    nic->ip = NULL;
+    if ( asprintf(&nic->script, "%s/vif-bridge",
                libxl_xen_script_dir_path()) < 0 )
         return ERROR_FAIL;
-    nic_info->nictype = LIBXL_NIC_TYPE_IOEMU;
+    nic->nictype = LIBXL_NIC_TYPE_IOEMU;
+    return 0;
+}
+
+static int libxl__device_from_nic(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_nic *nic,
+                                  libxl__device *device)
+{
+    device->backend_devid    = nic->devid;
+    device->backend_domid    = nic->backend_domid;
+    device->backend_kind     = LIBXL__DEVICE_KIND_VIF;
+    device->devid            = nic->devid;
+    device->domid            = domid;
+    device->kind             = LIBXL__DEVICE_KIND_VIF;
+
     return 0;
 }
 
@@ -1249,12 +1263,8 @@
         }
     }
 
-    device.backend_devid = nic->devid;
-    device.backend_domid = nic->backend_domid;
-    device.backend_kind = LIBXL__DEVICE_KIND_VIF;
-    device.devid = nic->devid;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_VIF;
+    rc = libxl__device_from_nic(&gc, domid, nic, &device);
+    if ( rc != 0 ) goto out_free;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
@@ -1305,29 +1315,37 @@
     return rc;
 }
 
-int libxl_device_nic_del(libxl_ctx *ctx, uint32_t domid,
-                         libxl_device_nic *nic, int wait)
+int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_nic *nic)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl__device device;
     int rc;
 
-    device.backend_devid    = nic->devid;
-    device.backend_domid    = nic->backend_domid;
-    device.backend_kind     = LIBXL__DEVICE_KIND_VIF;
-    device.devid            = nic->devid;
-    device.domid            = domid;
-    device.kind             = LIBXL__DEVICE_KIND_VIF;
-
-    if (wait)
-        rc = libxl__device_remove(&gc, &device, wait);
-    else
-        rc = libxl__device_destroy(&gc, &device);
-
+    rc = libxl__device_from_nic(&gc, domid, nic, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_remove(&gc, &device, 1);
+out:
     libxl__free_all(&gc);
     return rc;
 }
 
+int libxl_device_nic_destroy(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_device_nic *nic)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_nic(&gc, domid, nic, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_destroy(&gc, &device);
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
 static void libxl__device_nic_from_xs_be(libxl__gc *gc,
                                          const char *be_path,
                                          libxl_device_nic *nic)
diff -r 7357a4c2c011 -r 11ae241660f6 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
@@ -463,9 +463,12 @@
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk);
 int libxl_device_disk_local_detach(libxl_ctx *ctx, libxl_device_disk *disk);
 
-int libxl_device_nic_init(libxl_device_nic *nic, int dev_num);
+/* Network Interfaces */
+int libxl_device_nic_init(libxl_ctx *ctx, libxl_device_nic *nic);
 int libxl_device_nic_add(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
-int libxl_device_nic_del(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic, int wait);
+int libxl_device_nic_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
+int libxl_device_nic_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_nic *nic);
+
 libxl_device_nic *libxl_device_nic_list(libxl_ctx *ctx, uint32_t domid, int *num);
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
diff -r 7357a4c2c011 -r 11ae241660f6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:42 2011 +0100
@@ -762,7 +762,8 @@
 
             d_config->vifs = (libxl_device_nic *) realloc(d_config->vifs, sizeof (libxl_device_nic) * (d_config->num_vifs+1));
             nic = d_config->vifs + d_config->num_vifs;
-            CHK_ERRNO( libxl_device_nic_init(nic, d_config->num_vifs) );
+            CHK_ERRNO( libxl_device_nic_init(ctx, nic) );
+            nic->devid = d_config->num_vifs;
 
             if (default_vifscript) {
                 free(nic->script);
@@ -3972,7 +3973,7 @@
         fprintf(stderr, "%s is an invalid domain identifier\n", argv[optind]);
         return 1;
     }
-    libxl_device_nic_init(&nic, -1);
+    libxl_device_nic_init(ctx, &nic);
     for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) {
         if (MATCH_OPTION("type", *argv, oparg)) {
             if (!strcmp("vif", oparg)) {
@@ -4089,7 +4090,7 @@
             return 1;
         }
     }
-    if (libxl_device_nic_del(ctx, domid, &nic, 1)) {
+    if (libxl_device_nic_remove(ctx, domid, &nic)) {
         fprintf(stderr, "libxl_device_nic_del failed.\n");
         return 1;
     }
diff -r 7357a4c2c011 -r 11ae241660f6 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:42 2011 +0100
@@ -33,9 +33,7 @@
     "device_console": [ ("add",            ["t", "domid", "unit"]),
                       ],
     "device_disk":    DEVICE_FUNCTIONS,
-    "device_nic":     [ ("add",            ["t", "domid", "unit"]),
-                        ("del",            ["t", "domid", "unit"]),
-                      ],
+    "device_nic":     DEVICE_FUNCTIONS,
     "device_pci":     [ ("add",            ["t", "domid", "unit"]),
                         ("remove",         ["t", "domid", "unit"]),
                         ("shutdown",       ["domid", "unit"]),
diff -r 7357a4c2c011 -r 11ae241660f6 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:42 2011 +0100
@@ -281,7 +281,7 @@
 	device_nic_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_nic_del(ctx, Int_val(domid), &c_info, 0);
+	ret = libxl_device_nic_remove(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("nic_del", &lg);
 	FREE_CTX();

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:58:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:58:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOE3-0001di-IE; Tue, 01 Nov 2011 16:58:39 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAt-0000S9-JD
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:23 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-182.messagelabs.com!1320191720!1591314!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16719 invoked from network); 1 Nov 2011 23:55:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAq-0007dk-58
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:20 +0000
Message-Id: <E1RLOAq-0007dk-58@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: remove
	libxl_device_console_add.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID 97a2a4c27d2335b9be435f982025d2a9562b9b89
# Parent  11ae241660f62c85dba0d6f7d8f85197f748e47a
libxl: remove libxl_device_console_add.

It has no callers, the only code which adds consoles in internal to libxl and
uses libxl__device_console_add directly.

Rather than worrying about what the public API should look like in this case
simply remove it, adding new APIs is much easier than fixing broken ones...

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 11ae241660f6 -r 97a2a4c27d23 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -1585,18 +1585,6 @@
     return rc;
 }
 
-int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_console *console)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    int rc = ERROR_INVAL;
-
-    rc = libxl__device_console_add(&gc, domid, console, NULL);
-
-    libxl__free_all(&gc);
-    return rc;
-}
-
 /******************************************************************************/
 void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num)
 {
diff -r 11ae241660f6 -r 97a2a4c27d23 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
@@ -473,8 +473,6 @@
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
-int libxl_device_console_add(libxl_ctx *ctx, uint32_t domid, libxl_device_console *console);
-
 void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num);
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
diff -r 11ae241660f6 -r 97a2a4c27d23 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
@@ -30,8 +30,6 @@
                         ("clean_shutdown", ["domid", "unit"]),
                         ("hard_shutdown",  ["domid", "unit"]),
                       ],
-    "device_console": [ ("add",            ["t", "domid", "unit"]),
-                      ],
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
     "device_pci":     [ ("add",            ["t", "domid", "unit"]),
diff -r 11ae241660f6 -r 97a2a4c27d23 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:42 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
@@ -288,23 +288,6 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_console_add(value info, value domid)
-{
-	CAMLparam2(info, domid);
-	libxl_device_console c_info;
-	int ret;
-	INIT_STRUCT();
-
-	device_console_val(&gc, &lg, &c_info, info);
-
-	INIT_CTX();
-	ret = libxl_device_console_add(ctx, Int_val(domid), &c_info);
-	if (ret != 0)
-		failwith_xl("console_add", &lg);
-	FREE_CTX();
-	CAMLreturn(Val_unit);
-}
-
 value stub_xl_device_vkb_add(value info, value domid)
 {
 	CAMLparam2(info, domid);

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:59:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:59:15 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOEc-0001i1-0d; Tue, 01 Nov 2011 16:59:14 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAu-0000SM-4e
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-182.messagelabs.com!1320191720!1582808!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13988 invoked from network); 1 Nov 2011 23:55:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAq-0007e4-MR
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:20 +0000
Message-Id: <E1RLOAq-0007e4-MR@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: convert VKB handling to
	device API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID 175b7e156bcb64aa22f7461659a2f9058687799e
# Parent  97a2a4c27d2335b9be435f982025d2a9562b9b89
libxl: convert VKB handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -1586,10 +1586,24 @@
 }
 
 /******************************************************************************/
-void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num)
+int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb)
 {
     memset(vkb, 0x00, sizeof(libxl_device_vkb));
-    vkb->devid = dev_num;
+    return 0;
+}
+
+static int libxl__device_from_vkb(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vkb *vkb,
+                                  libxl__device *device)
+{
+    device->backend_devid = vkb->devid;
+    device->backend_domid = vkb->backend_domid;
+    device->backend_kind = LIBXL__DEVICE_KIND_VKBD;
+    device->devid = vkb->devid;
+    device->domid = domid;
+    device->kind = LIBXL__DEVICE_KIND_VKBD;
+
+    return 0;
 }
 
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb)
@@ -1611,12 +1625,8 @@
         goto out_free;
     }
 
-    device.backend_devid = vkb->devid;
-    device.backend_domid = vkb->backend_domid;
-    device.backend_kind = LIBXL__DEVICE_KIND_VKBD;
-    device.devid = vkb->devid;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_VKBD;
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out_free;
 
     flexarray_append(back, "frontend-id");
     flexarray_append(back, libxl__sprintf(&gc, "%d", domid));
@@ -1644,14 +1654,36 @@
     return rc;
 }
 
-int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid)
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vkb *vkb)
 {
-    return ERROR_NI;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_remove(&gc, &device, 1);
+out:
+    libxl__free_all(&gc);
+    return rc;
 }
 
-int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid)
+int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_device_vkb *vkb)
 {
-    return ERROR_NI;
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vkb(&gc, domid, vkb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_destroy(&gc, &device);
+out:
+    libxl__free_all(&gc);
+    return rc;
 }
 
 static void libxl__device_disk_from_xs_be(libxl__gc *gc,
@@ -1939,16 +1971,6 @@
     return rc;
 }
 
-int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid)
-{
-    return ERROR_NI;
-}
-
-int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid)
-{
-    return ERROR_NI;
-}
-
 /******************************************************************************/
 
 int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
@@ -473,10 +473,11 @@
 int libxl_device_nic_getinfo(libxl_ctx *ctx, uint32_t domid,
                               libxl_device_nic *nic, libxl_nicinfo *nicinfo);
 
-void libxl_device_vkb_init(libxl_device_vkb *vkb, int dev_num);
+/* Keyboard */
+int libxl_device_vkb_init(libxl_ctx *ctx, libxl_device_vkb *vkb);
 int libxl_device_vkb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
-int libxl_device_vkb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
-int libxl_device_vkb_hard_shutdown(libxl_ctx *ctx, uint32_t domid);
+int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
+int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 
 void libxl_device_vfb_init(libxl_device_vfb *vfb, int dev_num);
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -857,7 +857,8 @@
 
             d_config->vkbs = (libxl_device_vkb *) realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1));
             vkb = d_config->vkbs + d_config->num_vkbs;
-            libxl_device_vkb_init(vkb, d_config->num_vkbs);
+            libxl_device_vkb_init(ctx, vkb);
+            vkb->devid = d_config->num_vkbs;
 
             p = strtok(buf2, ",");
             if (!p)
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
@@ -26,10 +26,7 @@
                         ("clean_shutdown", ["domid", "unit"]),
                         ("hard_shutdown",  ["domid", "unit"]),
                       ],
-    "device_vkb":     [ ("add",            ["t", "domid", "unit"]),
-                        ("clean_shutdown", ["domid", "unit"]),
-                        ("hard_shutdown",  ["domid", "unit"]),
-                      ],
+    "device_vkb":     DEVICE_FUNCTIONS,
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
     "device_pci":     [ ("add",            ["t", "domid", "unit"]),
diff -r 97a2a4c27d23 -r 175b7e156bcb tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
@@ -306,14 +306,17 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vkb_clean_shutdown(value domid)
+value stub_xl_device_vkb_remove(value info, value domid)
 {
 	CAMLparam1(domid);
+	libxl_device_vkb c_info;
 	int ret;
 	INIT_STRUCT();
 
+	device_vkb_val(&gc, &lg, &c_info, info);
+
 	INIT_CTX();
-	ret = libxl_device_vkb_clean_shutdown(ctx, Int_val(domid));
+	ret = libxl_device_vkb_remove(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("vkb_clean_shutdown", &lg);
 	FREE_CTX();
@@ -321,14 +324,17 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vkb_hard_shutdown(value domid)
+value stub_xl_device_vkb_destroy(value info, value domid)
 {
 	CAMLparam1(domid);
+	libxl_device_vkb c_info;
 	int ret;
 	INIT_STRUCT();
 
+	device_vkb_val(&gc, &lg, &c_info, info);
+
 	INIT_CTX();
-	ret = libxl_device_vkb_hard_shutdown(ctx, Int_val(domid));
+	ret = libxl_device_vkb_destroy(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("vkb_hard_shutdown", &lg);
 	FREE_CTX();

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 16:59:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 16:59:39 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOF0-0001lE-UJ; Tue, 01 Nov 2011 16:59:39 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAu-0000SW-9j
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:24 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1320191686!55176032!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16332 invoked from network); 1 Nov 2011 23:54:46 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:54:46 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAr-0007eM-7n
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:21 +0000
Message-Id: <E1RLOAr-0007eM-7n@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: convert VFB handling to
	device API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID 7919aa4b483541ec4a2dc4ed98ab6f82f2d2d494
# Parent  175b7e156bcb64aa22f7461659a2f9058687799e
libxl: convert VFB handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 175b7e156bcb -r 7919aa4b4835 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -1896,10 +1896,9 @@
 }
 
 /******************************************************************************/
-void libxl_device_vfb_init(libxl_device_vfb *vfb, int dev_num)
+int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb)
 {
     memset(vfb, 0x00, sizeof(libxl_device_vfb));
-    vfb->devid = dev_num;
     vfb->display = NULL;
     vfb->xauthority = NULL;
     vfb->vnc = 1;
@@ -1910,6 +1909,20 @@
     vfb->keymap = NULL;
     vfb->sdl = 0;
     vfb->opengl = 0;
+    return 0;
+}
+
+static int libxl__device_from_vfb(libxl__gc *gc, uint32_t domid,
+                                  libxl_device_vfb *vfb,
+                                  libxl__device *device)
+{
+    device->backend_devid = vfb->devid;
+    device->backend_domid = vfb->backend_domid;
+    device->backend_kind = LIBXL__DEVICE_KIND_VFB;
+    device->devid = vfb->devid;
+    device->domid = domid;
+    device->kind = LIBXL__DEVICE_KIND_VFB;
+    return 0;
 }
 
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb)
@@ -1931,12 +1944,8 @@
         goto out_free;
     }
 
-    device.backend_devid = vfb->devid;
-    device.backend_domid = vfb->backend_domid;
-    device.backend_kind = LIBXL__DEVICE_KIND_VFB;
-    device.devid = vfb->devid;
-    device.domid = domid;
-    device.kind = LIBXL__DEVICE_KIND_VFB;
+    rc = libxl__device_from_vfb(&gc, domid, vfb, &device);
+    if (rc != 0) goto out_free;
 
     flexarray_append_pair(back, "frontend-id", libxl__sprintf(&gc, "%d", domid));
     flexarray_append_pair(back, "online", "1");
@@ -1971,6 +1980,38 @@
     return rc;
 }
 
+int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid,
+                            libxl_device_vfb *vfb)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vfb(&gc, domid, vfb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_remove(&gc, &device, 1);
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
+int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_device_vfb *vfb)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl__device device;
+    int rc;
+
+    rc = libxl__device_from_vfb(&gc, domid, vfb, &device);
+    if (rc != 0) goto out;
+
+    rc = libxl__device_destroy(&gc, &device);
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
 /******************************************************************************/
 
 int libxl_domain_setmaxmem(libxl_ctx *ctx, uint32_t domid, uint32_t max_memkb)
diff -r 175b7e156bcb -r 7919aa4b4835 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
@@ -479,10 +479,11 @@
 int libxl_device_vkb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 int libxl_device_vkb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vkb *vkb);
 
-void libxl_device_vfb_init(libxl_device_vfb *vfb, int dev_num);
+/* Framebuffer */
+int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb);
 int libxl_device_vfb_add(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
-int libxl_device_vfb_clean_shutdown(libxl_ctx *ctx, uint32_t domid);
-int libxl_device_vfb_hard_shutdown(libxl_ctx *ctx, uint32_t domid);
+int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
+int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
 
 int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev);
 int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev, int force);
diff -r 175b7e156bcb -r 7919aa4b4835 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -853,7 +853,8 @@
 
             d_config->vfbs = (libxl_device_vfb *) realloc(d_config->vfbs, sizeof(libxl_device_vfb) * (d_config->num_vfbs + 1));
             vfb = d_config->vfbs + d_config->num_vfbs;
-            libxl_device_vfb_init(vfb, d_config->num_vfbs);
+            libxl_device_vfb_init(ctx, vfb);
+            vfb->devid = d_config->num_vfbs;
 
             d_config->vkbs = (libxl_device_vkb *) realloc(d_config->vkbs, sizeof(libxl_device_vkb) * (d_config->num_vkbs + 1));
             vkb = d_config->vkbs + d_config->num_vkbs;
diff -r 175b7e156bcb -r 7919aa4b4835 tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
@@ -22,10 +22,7 @@
                    ]
 
 functions = { # ( name , [type1,type2,....] )
-    "device_vfb":     [ ("add",            ["t", "domid", "unit"]),
-                        ("clean_shutdown", ["domid", "unit"]),
-                        ("hard_shutdown",  ["domid", "unit"]),
-                      ],
+    "device_vfb":     DEVICE_FUNCTIONS,
     "device_vkb":     DEVICE_FUNCTIONS,
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
diff -r 175b7e156bcb -r 7919aa4b4835 tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
@@ -360,14 +360,17 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vfb_clean_shutdown(value domid)
+value stub_xl_device_vfb_remove(value info, value domid)
 {
 	CAMLparam1(domid);
+	libxl_device_vfb c_info;
 	int ret;
 	INIT_STRUCT();
 
+	device_vfb_val(&gc, &lg, &c_info, info);
+
 	INIT_CTX();
-	ret = libxl_device_vfb_clean_shutdown(ctx, Int_val(domid));
+	ret = libxl_device_vfb_remove(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("vfb_clean_shutdown", &lg);
 	FREE_CTX();
@@ -375,14 +378,17 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_vfb_hard_shutdown(value domid)
+value stub_xl_device_vfb_destroy(value info, value domid)
 {
 	CAMLparam1(domid);
+	libxl_device_vfb c_info;
 	int ret;
 	INIT_STRUCT();
 
+	device_vfb_val(&gc, &lg, &c_info, info);
+
 	INIT_CTX();
-	ret = libxl_device_vfb_hard_shutdown(ctx, Int_val(domid));
+	ret = libxl_device_vfb_destroy(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("vfb_hard_shutdown", &lg);
 	FREE_CTX();

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:00:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:00:24 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOFj-0001px-MR; Tue, 01 Nov 2011 17:00:23 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAw-0000T9-8v
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1320191723!995804!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8960 invoked from network); 1 Nov 2011 23:55:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAs-0007f5-Rw
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:22 +0000
Message-Id: <E1RLOAs-0007f5-Rw@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add a flags argument to
	libxl_ctx_alloc.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID f60911281a1bb1e77ef257be629065102be21a80
# Parent  2866d4f9109c4722fceb61b0b05196b30122bec3
libxl: add a flags argument to libxl_ctx_alloc.

Currently unused but gives us scope for expansion in an ABI compatible manner
in the future.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 2866d4f9109c -r f60911281a1b tools/libxl/gentest.py
--- a/tools/libxl/gentest.py	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/gentest.py	Tue Oct 18 13:36:43 2011 +0100
@@ -239,7 +239,7 @@
     logger = xtl_createlogger_stdiostream(stderr, XTL_DETAIL, 0);
     if (!logger) exit(1);
 
-    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, (xentoollog_logger*)logger)) {
+    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
         fprintf(stderr, "cannot init xl context\\n");
         exit(1);
     }
diff -r 2866d4f9109c -r f60911281a1b tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -39,7 +39,8 @@
 #define PAGE_TO_MEMKB(pages) ((pages) * 4)
 #define BACKEND_STRING_SIZE 5
 
-int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger * lg)
+int libxl_ctx_alloc(libxl_ctx **pctx, int version,
+                    unsigned flags, xentoollog_logger * lg)
 {
     libxl_ctx *ctx;
     struct stat stat_buf;
diff -r 2866d4f9109c -r f60911281a1b tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
@@ -245,7 +245,9 @@
 } libxl_domain_config;
 
 /* context functions */
-int libxl_ctx_alloc(libxl_ctx **pctx, int version, xentoollog_logger *lg);
+int libxl_ctx_alloc(libxl_ctx **pctx, int version,
+                    unsigned flags /* none currently defined */,
+                    xentoollog_logger *lg);
 int libxl_ctx_free(libxl_ctx *ctx /* 0 is OK */);
 int libxl_ctx_postfork(libxl_ctx *ctx);
 
diff -r 2866d4f9109c -r f60911281a1b tools/libxl/xl.c
--- a/tools/libxl/xl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/xl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -116,7 +116,7 @@
     logger = xtl_createlogger_stdiostream(stderr, minmsglevel,  0);
     if (!logger) exit(1);
 
-    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, (xentoollog_logger*)logger)) {
+    if (libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (xentoollog_logger*)logger)) {
         fprintf(stderr, "cannot init xl context\n");
         exit(1);
     }
diff -r 2866d4f9109c -r f60911281a1b tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
@@ -59,7 +59,7 @@
 	lg.logger.destroy = log_destroy; \
 	lg.logger.progress = NULL; \
 	caml_enter_blocking_section(); \
-	ret = libxl_ctx_alloc(&ctx, LIBXL_VERSION, (struct xentoollog_logger *) &lg); \
+	ret = libxl_ctx_alloc(&ctx, LIBXL_VERSION, 0, (struct xentoollog_logger *) &lg); \
 	if (ret != 0) \
 		failwith_xl("cannot init context", &lg);
 
diff -r 2866d4f9109c -r f60911281a1b tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -687,7 +687,7 @@
         return -1;
     }
 
-    if ( libxl_ctx_alloc(&self->ctx, LIBXL_VERSION,
+    if ( libxl_ctx_alloc(&self->ctx, LIBXL_VERSION, 0,
                 (xentoollog_logger*)self->logger) ) {
         PyErr_SetString(xl_error_obj, "cannot init xl context");
         return -1;

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:01:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:01:04 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOGL-0001tf-Tr; Tue, 01 Nov 2011 17:01:02 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAv-0000T0-O3
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1320191722!2541884!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3092 invoked from network); 1 Nov 2011 23:55:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAs-0007eq-9v
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:22 +0000
Message-Id: <E1RLOAs-0007eq-9v@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: convert PCI device handling
	to device API
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID 2866d4f9109c4722fceb61b0b05196b30122bec3
# Parent  e81e7774564702b3f403ea7f74af220265c98cf4
libxl: convert PCI device handling to device API

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r e81e77745647 -r 2866d4f9109c tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -754,7 +754,7 @@
         goto out;
     }
 
-    if (libxl_device_pci_shutdown(ctx, domid) < 0)
+    if (libxl__device_pci_destroy_all(&gc, domid) < 0)
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "pci shutdown failed for domid %d", domid);
     rc = xc_domain_pause(ctx->xch, domid);
     if (rc < 0) {
diff -r e81e77745647 -r 2866d4f9109c tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.h	Tue Oct 18 13:36:43 2011 +0100
@@ -485,12 +485,28 @@
 int libxl_device_vfb_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
 int libxl_device_vfb_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_vfb *vfb);
 
+/* PCI Passthrough */
+int libxl_device_pci_init(libxl_ctx *ctx, libxl_device_pci *pci);
 int libxl_device_pci_add(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev);
-int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev, int force);
-int libxl_device_pci_shutdown(libxl_ctx *ctx, uint32_t domid);
-int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint32_t domid, int *num);
-int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, int *num);
-int libxl_device_pci_parse_bdf(libxl_ctx *ctx, libxl_device_pci *pcidev, const char *str);
+int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev);
+int libxl_device_pci_destroy(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev);
+libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num);
+
+/*
+ * Parse a PCI BDF into a PCI device structure.
+ */
+int libxl_device_pci_parse_bdf(libxl_ctx *ctx,
+                               libxl_device_pci *pcidev,
+                               const char *str);
+
+/*
+ * Similar to libxl_device_pci_list but returns all devices which
+ * could be assigned to a domain (i.e. are bound to the backend
+ * driver) but are not currently.
+ */
+libxl_device_pci *libxl_device_pci_list_assignable(libxl_ctx *ctx, int *num);
+
+/* CPUID handling */
 int libxl_cpuid_parse_config(libxl_cpuid_policy_list *cpuid, const char* str);
 int libxl_cpuid_parse_config_xend(libxl_cpuid_policy_list *cpuid,
                                   const char* str);
diff -r e81e77745647 -r 2866d4f9109c tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Tue Oct 18 13:36:43 2011 +0100
@@ -252,6 +252,7 @@
 _hidden int libxl__device_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting);
 _hidden int libxl__create_pci_backend(libxl__gc *gc, uint32_t domid,
                                       libxl_device_pci *pcidev, int num);
+_hidden int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid);
 
 /* xl_exec */
 
diff -r e81e77745647 -r 2866d4f9109c tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl_pci.c	Tue Oct 18 13:36:43 2011 +0100
@@ -486,7 +486,7 @@
     return 0;
 }
 
-int libxl_device_pci_list_assignable(libxl_ctx *ctx, libxl_device_pci **list, int *num)
+libxl_device_pci *libxl_device_pci_list_assignable(libxl_ctx *ctx, int *num)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
     libxl_device_pci *pcidevs = NULL, *new, *assigned;
@@ -495,13 +495,10 @@
     int rc, num_assigned;
 
     *num = 0;
-    *list = NULL;
 
     rc = get_all_assigned_devices(&gc, &assigned, &num_assigned);
-    if ( rc ) {
-        libxl__free_all(&gc);
-        return rc;
-    }
+    if ( rc )
+        goto out;
 
     dir = opendir(SYSFS_PCIBACK_DRIVER);
     if ( NULL == dir ) {
@@ -510,8 +507,7 @@
         }else{
             LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Couldn't open %s", SYSFS_PCIBACK_DRIVER);
         }
-        libxl__free_all(&gc);
-        return ERROR_FAIL;
+        goto out_closedir;
     }
 
     while( (de = readdir(dir)) ) {
@@ -534,10 +530,11 @@
         (*num)++;
     }
 
+out_closedir:
     closedir(dir);
-    *list = pcidevs;
+out:
     libxl__free_all(&gc);
-    return 0;
+    return pcidevs;
 }
 
 /*
@@ -846,21 +843,25 @@
     int hvm = 0, rc, num;
     int stubdomid = 0;
 
-    if ( !libxl_device_pci_list_assigned(ctx, &assigned, domid, &num) ) {
-        if ( !is_assigned(assigned, num, pcidev->domain,
-                         pcidev->bus, pcidev->dev, pcidev->func) ) {
-            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device not attached to this domain");
-            return ERROR_INVAL;
-        }
+    assigned = libxl_device_pci_list(ctx, domid, &num);
+    if ( assigned == NULL )
+        return ERROR_FAIL;
+
+    rc = ERROR_INVAL;
+    if ( !is_assigned(assigned, num, pcidev->domain,
+                      pcidev->bus, pcidev->dev, pcidev->func) ) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "PCI device not attached to this domain");
+        goto out_fail;
     }
 
+    rc = ERROR_FAIL;
     switch (libxl__domain_type(gc, domid)) {
     case LIBXL_DOMAIN_TYPE_HVM:
         hvm = 1;
         if (libxl__wait_for_device_model(gc, domid, "running",
-                                         NULL, NULL, NULL) < 0) {
-            return ERROR_FAIL;
-        }
+                                         NULL, NULL, NULL) < 0)
+            goto out_fail;
+
         path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
         state = libxl__xs_read(gc, XBT_NULL, path);
         path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
@@ -879,7 +880,7 @@
                  * SCI, if it doesn't respond in time then we may wish to
                  * force the removal.
                  */
-                return ERROR_FAIL;
+                goto out_fail;
             }
         }
         path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
@@ -955,25 +956,31 @@
     stubdomid = libxl_get_stubdom_id(ctx, domid);
     if (stubdomid != 0) {
         libxl_device_pci pcidev_s = *pcidev;
-        libxl_device_pci_remove(ctx, stubdomid, &pcidev_s, force);
+        if (force)
+                libxl_device_pci_destroy(ctx, stubdomid, &pcidev_s);
+        else
+                libxl_device_pci_remove(ctx, stubdomid, &pcidev_s);
     }
 
     libxl__device_pci_remove_xenstore(gc, domid, pcidev);
 
-    return 0;
+    rc = 0;
+out_fail:
+    free(assigned);
+    return rc;
+
 }
 
-int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid,
-                            libxl_device_pci *pcidev, int force)
+static int libxl__device_pci_remove_common(libxl__gc *gc, uint32_t domid,
+                                           libxl_device_pci *pcidev, int force)
 {
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
     unsigned int orig_vdev, pfunc_mask;
     int i, rc;
 
     orig_vdev = pcidev->vdevfn & ~7U;
 
     if ( pcidev->vfunc_mask == LIBXL_PCI_FUNC_ALL ) {
-        if ( pci_multifunction_check(&gc, pcidev, &pfunc_mask) ) {
+        if ( pci_multifunction_check(gc, pcidev, &pfunc_mask) ) {
             rc = ERROR_FAIL;
             goto out;
         }
@@ -990,81 +997,118 @@
             }else{
                 pcidev->vdevfn = orig_vdev;
             }
-            if ( do_pci_remove(&gc, domid, pcidev, force) )
+            if ( do_pci_remove(gc, domid, pcidev, force) )
                 rc = ERROR_FAIL;
         }
     }
 
 out:
+    return rc;
+}
+
+int libxl_device_pci_remove(libxl_ctx *ctx, uint32_t domid, libxl_device_pci *pcidev)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    int rc;
+
+    rc = libxl__device_pci_remove_common(&gc, domid, pcidev, 0);
+
     libxl__free_all(&gc);
     return rc;
 }
 
-int libxl_device_pci_list_assigned(libxl_ctx *ctx, libxl_device_pci **list, uint32_t domid, int *num)
+int libxl_device_pci_destroy(libxl_ctx *ctx, uint32_t domid,
+                                  libxl_device_pci *pcidev)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *be_path, *num_devs, *xsdev, *xsvdevfn, *xsopts;
+    int rc;
+
+    rc = libxl__device_pci_remove_common(&gc, domid, pcidev, 1);
+
+    libxl__free_all(&gc);
+    return rc;
+}
+
+static void libxl__device_pci_from_xs_be(libxl__gc *gc,
+                                         const char *be_path,
+                                         libxl_device_pci *pci,
+                                         int nr)
+{
+    char *s;
+    unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
+
+    s = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/dev-%d", be_path, nr));
+    sscanf(s, PCI_BDF, &domain, &bus, &dev, &func);
+
+    s = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/vdevfn-%d", be_path, nr));
+    if (s)
+        vdevfn = strtol(s, (char **) NULL, 16);
+
+    pcidev_init(pci, domain, bus, dev, func, vdevfn);
+
+    s = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/opts-%d", be_path, nr));
+    if (s) {
+        char *saveptr;
+        char *p = strtok_r(s, ",=", &saveptr);
+        do {
+            while (*p == ' ')
+                p++;
+            if (!strcmp(p, "msitranslate")) {
+                p = strtok_r(NULL, ",=", &saveptr);
+                pci->msitranslate = atoi(p);
+            } else if (!strcmp(p, "power_mgmt")) {
+                p = strtok_r(NULL, ",=", &saveptr);
+                pci->power_mgmt = atoi(p);
+            }
+        } while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
+    }
+}
+
+libxl_device_pci *libxl_device_pci_list(libxl_ctx *ctx, uint32_t domid, int *num)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *be_path, *num_devs;
     int n, i;
-    unsigned int domain = 0, bus = 0, dev = 0, func = 0, vdevfn = 0;
-    libxl_device_pci *pcidevs;
+    libxl_device_pci *pcidevs = NULL;
+
+    *num = 0;
 
     be_path = libxl__sprintf(&gc, "%s/backend/pci/%d/0", libxl__xs_get_dompath(&gc, 0), domid);
     num_devs = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/num_devs", be_path));
-    if (!num_devs) {
-        *num = 0;
-        *list = NULL;
-        libxl__free_all(&gc);
-        return 0;
-    }
+    if (!num_devs)
+        goto out;
+
     n = atoi(num_devs);
     pcidevs = calloc(n, sizeof(libxl_device_pci));
+
+    for (i = 0; i < n; i++)
+        libxl__device_pci_from_xs_be(&gc, be_path, pcidevs + i, i);
+
     *num = n;
-
-    for (i = 0; i < n; i++) {
-        xsdev = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/dev-%d", be_path, i));
-        sscanf(xsdev, PCI_BDF, &domain, &bus, &dev, &func);
-        xsvdevfn = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/vdevfn-%d", be_path, i));
-        if (xsvdevfn)
-            vdevfn = strtol(xsvdevfn, (char **) NULL, 16);
-        pcidev_init(pcidevs + i, domain, bus, dev, func, vdevfn);
-        xsopts = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/opts-%d", be_path, i));
-        if (xsopts) {
-            char *saveptr;
-            char *p = strtok_r(xsopts, ",=", &saveptr);
-            do {
-                while (*p == ' ')
-                    p++;
-                if (!strcmp(p, "msitranslate")) {
-                    p = strtok_r(NULL, ",=", &saveptr);
-                    pcidevs[i].msitranslate = atoi(p);
-                } else if (!strcmp(p, "power_mgmt")) {
-                    p = strtok_r(NULL, ",=", &saveptr);
-                    pcidevs[i].power_mgmt = atoi(p);
-                }
-            } while ((p = strtok_r(NULL, ",=", &saveptr)) != NULL);
-        }
-    }
-    *list = pcidevs;
+out:
     libxl__free_all(&gc);
-    return 0;
+    return pcidevs;
 }
 
-int libxl_device_pci_shutdown(libxl_ctx *ctx, uint32_t domid)
+int libxl__device_pci_destroy_all(libxl__gc *gc, uint32_t domid)
 {
+    libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl_device_pci *pcidevs;
-    int num, i, rc;
+    int num, i, rc = 0;
 
-    rc = libxl_device_pci_list_assigned(ctx, &pcidevs, domid, &num);
-    if ( rc )
-        return rc;
+    pcidevs = libxl_device_pci_list(ctx, domid, &num);
+    if ( pcidevs == NULL )
+        return ERROR_FAIL;
+
     for (i = 0; i < num; i++) {
         /* Force remove on shutdown since, on HVM, qemu will not always
          * respond to SCI interrupt because the guest kernel has shut down the
          * devices by the time we even get here!
          */
-        if (libxl_device_pci_remove(ctx, domid, pcidevs + i, 1) < 0)
-            return ERROR_FAIL;
+        if (libxl_device_pci_destroy(ctx, domid, pcidevs + i) < 0)
+            rc = ERROR_FAIL;
     }
+
     free(pcidevs);
     return 0;
 }
diff -r e81e77745647 -r 2866d4f9109c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -2018,11 +2018,14 @@
     libxl_device_pci *pcidevs;
     int num, i;
 
-    if ( libxl_device_pci_list_assignable(ctx, &pcidevs, &num) )
+    pcidevs = libxl_device_pci_list_assignable(ctx, &num);
+
+    if ( pcidevs == NULL )
         return;
     for (i = 0; i < num; i++) {
         printf("%04x:%02x:%02x.%01x\n",
-                pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func);
+               pcidevs[i].domain, pcidevs[i].bus, pcidevs[i].dev, pcidevs[i].func);
+        libxl_device_pci_dispose(&pcidevs[i]);
     }
     free(pcidevs);
 }
@@ -2045,7 +2048,8 @@
 
     find_domain(dom);
 
-    if (libxl_device_pci_list_assigned(ctx, &pcidevs, domid, &num))
+    pcidevs = libxl_device_pci_list(ctx, domid, &num);
+    if (pcidevs == NULL)
         return;
     printf("Vdev Device\n");
     for (i = 0; i < num; i++) {
@@ -2082,7 +2086,10 @@
         fprintf(stderr, "pci-detach: malformed BDF specification \"%s\"\n", bdf);
         exit(2);
     }
-    libxl_device_pci_remove(ctx, domid, &pcidev, force);
+    if (force)
+        libxl_device_pci_destroy(ctx, domid, &pcidev);
+    else
+        libxl_device_pci_remove(ctx, domid, &pcidev);
     libxl_device_pci_dispose(&pcidev);
 }
 
diff -r e81e77745647 -r 2866d4f9109c tools/ocaml/libs/xl/genwrap.py
--- a/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/genwrap.py	Tue Oct 18 13:36:43 2011 +0100
@@ -26,10 +26,7 @@
     "device_vkb":     DEVICE_FUNCTIONS,
     "device_disk":    DEVICE_FUNCTIONS,
     "device_nic":     DEVICE_FUNCTIONS,
-    "device_pci":     [ ("add",            ["t", "domid", "unit"]),
-                        ("remove",         ["t", "domid", "unit"]),
-                        ("shutdown",       ["domid", "unit"]),
-                      ],
+    "device_pci":     DEVICE_FUNCTIONS,
     "physinfo":       [ ("get",            ["unit", "t"]),
                       ],
     "sched_credit":   [ ("domain_get",     ["domid", "t"]),
diff -r e81e77745647 -r 2866d4f9109c tools/ocaml/libs/xl/xenlight_stubs.c
--- a/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/ocaml/libs/xl/xenlight_stubs.c	Tue Oct 18 13:36:43 2011 +0100
@@ -424,7 +424,7 @@
 	device_pci_val(&gc, &lg, &c_info, info);
 
 	INIT_CTX();
-	ret = libxl_device_pci_remove(ctx, Int_val(domid), &c_info, 0);
+	ret = libxl_device_pci_remove(ctx, Int_val(domid), &c_info);
 	if (ret != 0)
 		failwith_xl("pci_remove", &lg);
 	FREE_CTX();
@@ -432,21 +432,6 @@
 	CAMLreturn(Val_unit);
 }
 
-value stub_xl_device_pci_shutdown(value domid)
-{
-	CAMLparam1(domid);
-	int ret;
-	INIT_STRUCT();
-
-	INIT_CTX();
-	ret = libxl_device_pci_shutdown(ctx, Int_val(domid));
-	if (ret != 0)
-		failwith_xl("pci_shutdown", &lg);
-	FREE_CTX();
-
-	CAMLreturn(Val_unit);
-}
-
 value stub_xl_button_press(value domid, value button)
 {
 	CAMLparam2(domid, button);
diff -r e81e77745647 -r 2866d4f9109c tools/python/xen/lowlevel/xl/xl.c
--- a/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/python/xen/lowlevel/xl/xl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -521,9 +521,16 @@
         return NULL;
     }
     pci = (Py_device_pci *)obj;
-    if ( libxl_device_pci_remove(self->ctx, domid, &pci->obj, force) ) {
-        PyErr_SetString(xl_error_obj, "cannot remove pci device");
-        return NULL;
+    if ( force ) {
+        if ( libxl_device_pci_destroy(self->ctx, domid, &pci->obj) ) {
+            PyErr_SetString(xl_error_obj, "cannot remove pci device");
+            return NULL;
+        }
+    } else {
+        if ( libxl_device_pci_remove(self->ctx, domid, &pci->obj) ) {
+            PyErr_SetString(xl_error_obj, "cannot remove pci device");
+            return NULL;
+        }
     }
     Py_INCREF(Py_None);
     return Py_None;
@@ -558,7 +565,8 @@
     PyObject *list;
     int nr_dev, i;
 
-    if ( libxl_device_pci_list_assignable(self->ctx, &dev, &nr_dev) ) {
+    dev = libxl_device_pci_list_assignable(self->ctx, &nr_dev);
+    if ( dev == NULL ) {
         PyErr_SetString(xl_error_obj, "Cannot list assignable devices");
         return NULL;
     }
@@ -594,7 +602,8 @@
     if ( !PyArg_ParseTuple(args, "i", &domid) )
         return NULL;
 
-    if ( libxl_device_pci_list_assigned(self->ctx, &dev, domid, &nr_dev) ) {
+    dev = libxl_device_pci_list(self->ctx, domid, &nr_dev);
+    if ( dev == NULL ) {
         PyErr_SetString(xl_error_obj, "Cannot list assignable devices");
         return NULL;
     }

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:01:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:01:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOGj-0001xG-1u; Tue, 01 Nov 2011 17:01:25 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAv-0000Sz-61
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-21.messagelabs.com!1320191722!2577230!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1290 invoked from network); 1 Nov 2011 23:55:22 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:22 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAr-0007eb-OB
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:21 +0000
Message-Id: <E1RLOAr-0007eb-OB@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: reorder device functions to
	put functions for each device together.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1318941403 -3600
# Node ID e81e7774564702b3f403ea7f74af220265c98cf4
# Parent  7919aa4b483541ec4a2dc4ed98ab6f82f2d2d494
libxl: reorder device functions to put functions for each device together.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 7919aa4b4835 -r e81e77745647 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/libxl/libxl.c	Tue Oct 18 13:36:43 2011 +0100
@@ -1113,6 +1113,216 @@
     libxl__free_all(&gc);
     return rc;
 }
+
+static void libxl__device_disk_from_xs_be(libxl__gc *gc,
+                                          const char *be_path,
+                                          libxl_device_disk *disk)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    unsigned int len;
+    char *tmp;
+
+    libxl_device_disk_init(ctx, disk);
+
+    tmp = xs_read(ctx->xsh, XBT_NULL,
+                  libxl__sprintf(gc, "%s/params", be_path), &len);
+    if (tmp && strchr(tmp, ':')) {
+        disk->pdev_path = strdup(strchr(tmp, ':') + 1);
+        free(tmp);
+    } else {
+        disk->pdev_path = tmp;
+    }
+    libxl_string_to_backend(ctx,
+                        libxl__xs_read(gc, XBT_NULL,
+                                       libxl__sprintf(gc, "%s/type", be_path)),
+                        &(disk->backend));
+    disk->vdev = xs_read(ctx->xsh, XBT_NULL,
+                         libxl__sprintf(gc, "%s/dev", be_path), &len);
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf
+                         (gc, "%s/removable", be_path));
+
+    if (tmp)
+        disk->removable = atoi(tmp);
+    else
+        disk->removable = 0;
+
+    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/mode", be_path));
+    if (!strcmp(tmp, "w"))
+        disk->readwrite = 1;
+    else
+        disk->readwrite = 0;
+
+    tmp = libxl__xs_read(gc, XBT_NULL,
+                         libxl__sprintf(gc, "%s/device-type", be_path));
+    disk->is_cdrom = !strcmp(tmp, "cdrom");
+
+    disk->format = LIBXL_DISK_FORMAT_UNKNOWN;
+}
+
+int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
+                               int devid, libxl_device_disk *disk)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *dompath, *path;
+    int rc = ERROR_FAIL;
+
+    libxl_device_disk_init(ctx, disk);
+
+    dompath = libxl__xs_get_dompath(&gc, domid);
+    if (!dompath) {
+        goto out;
+    }
+    path = libxl__xs_read(&gc, XBT_NULL,
+                          libxl__sprintf(&gc, "%s/device/vbd/%d/backend",
+                                         dompath, devid));
+    if (!path)
+        goto out;
+
+    libxl__device_disk_from_xs_be(&gc, path, disk);
+
+    rc = 0;
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
+
+static int libxl__append_disk_list_of_type(libxl__gc *gc,
+                                           uint32_t domid,
+                                           const char *type,
+                                           libxl_device_disk **disks,
+                                           int *ndisks)
+{
+    char *be_path = NULL;
+    char **dir = NULL;
+    unsigned int n = 0;
+    libxl_device_disk *pdisk = NULL, *pdisk_end = NULL;
+
+    be_path = libxl__sprintf(gc, "%s/backend/%s/%d",
+                             libxl__xs_get_dompath(gc, 0), type, domid);
+    dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
+    if (dir) {
+        libxl_device_disk *tmp;
+        tmp = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
+        if (tmp == NULL)
+            return ERROR_NOMEM;
+        *disks = tmp;
+        pdisk = *disks + *ndisks;
+        *ndisks += n;
+        pdisk_end = *disks + *ndisks;
+        for (; pdisk < pdisk_end; pdisk++, dir++) {
+            const char *p;
+            p = libxl__sprintf(gc, "%s/%s", be_path, *dir);
+            libxl__device_disk_from_xs_be(gc, p, pdisk);
+            pdisk->backend_domid = 0;
+        }
+    }
+    return 0;
+}
+
+libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    libxl_device_disk *disks = NULL;
+    int rc;
+
+    *num = 0;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "vbd", &disks, num);
+    if (rc) goto out_err;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "tap", &disks, num);
+    if (rc) goto out_err;
+
+    rc = libxl__append_disk_list_of_type(&gc, domid, "qdisk", &disks, num);
+    if (rc) goto out_err;
+
+    libxl__free_all(&gc);
+    return disks;
+
+out_err:
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to list disks");
+    while (disks && *num) {
+        (*num)--;
+        libxl_device_disk_dispose(&disks[*num]);
+    }
+    free(disks);
+    return NULL;
+}
+
+int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
+                              libxl_device_disk *disk, libxl_diskinfo *diskinfo)
+{
+    libxl__gc gc = LIBXL_INIT_GC(ctx);
+    char *dompath, *diskpath;
+    char *val;
+
+    dompath = libxl__xs_get_dompath(&gc, domid);
+    diskinfo->devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
+
+    /* tap devices entries in xenstore are written as vbd devices. */
+    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
+    diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
+                                libxl__sprintf(&gc, "%s/backend", diskpath), NULL);
+    if (!diskinfo->backend) {
+        libxl__free_all(&gc);
+        return ERROR_FAIL;
+    }
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
+    diskinfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", diskpath));
+    diskinfo->state = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", diskpath));
+    diskinfo->evtch = val ? strtoul(val, NULL, 10) : -1;
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/ring-ref", diskpath));
+    diskinfo->rref = val ? strtoul(val, NULL, 10) : -1;
+    diskinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
+                                 libxl__sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
+    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", diskinfo->backend));
+    diskinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
+
+    libxl__free_all(&gc);
+    return 0;
+}
+
+int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk)
+{
+    int num, i;
+    uint32_t stubdomid;
+    libxl_device_disk *disks;
+    int ret = ERROR_FAIL;
+
+    if (!disk->pdev_path) {
+        disk->pdev_path = strdup("");
+        disk->format = LIBXL_DISK_FORMAT_EMPTY;
+    }
+    disks = libxl_device_disk_list(ctx, domid, &num);
+    for (i = 0; i < num; i++) {
+        if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev))
+            /* found */
+            break;
+    }
+    if (i == num) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
+        goto out;
+    }
+
+    ret = 0;
+
+    libxl_device_disk_remove(ctx, domid, disks + i);
+    libxl_device_disk_add(ctx, domid, disk);
+    stubdomid = libxl_get_stubdom_id(ctx, domid);
+    if (stubdomid) {
+        libxl_device_disk_remove(ctx, stubdomid, disks + i);
+        libxl_device_disk_add(ctx, stubdomid, disk);
+    }
+out:
+    for (i = 0; i < num; i++)
+        libxl_device_disk_dispose(&disks[i]);
+    free(disks);
+    return ret;
+}
+
 char * libxl_device_disk_local_attach(libxl_ctx *ctx, libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
@@ -1346,6 +1556,7 @@
     libxl__free_all(&gc);
     return rc;
 }
+
 static void libxl__device_nic_from_xs_be(libxl__gc *gc,
                                          const char *be_path,
                                          libxl_device_nic *nic)
@@ -1686,215 +1897,6 @@
     return rc;
 }
 
-static void libxl__device_disk_from_xs_be(libxl__gc *gc,
-                                          const char *be_path,
-                                          libxl_device_disk *disk)
-{
-    libxl_ctx *ctx = libxl__gc_owner(gc);
-    unsigned int len;
-    char *tmp;
-
-    libxl_device_disk_init(ctx, disk);
-
-    tmp = xs_read(ctx->xsh, XBT_NULL,
-                  libxl__sprintf(gc, "%s/params", be_path), &len);
-    if (tmp && strchr(tmp, ':')) {
-        disk->pdev_path = strdup(strchr(tmp, ':') + 1);
-        free(tmp);
-    } else {
-        disk->pdev_path = tmp;
-    }
-    libxl_string_to_backend(ctx,
-                        libxl__xs_read(gc, XBT_NULL,
-                                       libxl__sprintf(gc, "%s/type", be_path)),
-                        &(disk->backend));
-    disk->vdev = xs_read(ctx->xsh, XBT_NULL,
-                         libxl__sprintf(gc, "%s/dev", be_path), &len);
-    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf
-                         (gc, "%s/removable", be_path));
-
-    if (tmp)
-        disk->removable = atoi(tmp);
-    else
-        disk->removable = 0;
-
-    tmp = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/mode", be_path));
-    if (!strcmp(tmp, "w"))
-        disk->readwrite = 1;
-    else
-        disk->readwrite = 0;
-
-    tmp = libxl__xs_read(gc, XBT_NULL,
-                         libxl__sprintf(gc, "%s/device-type", be_path));
-    disk->is_cdrom = !strcmp(tmp, "cdrom");
-
-    disk->format = LIBXL_DISK_FORMAT_UNKNOWN;
-}
-
-int libxl_devid_to_device_disk(libxl_ctx *ctx, uint32_t domid,
-                               int devid, libxl_device_disk *disk)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *dompath, *path;
-    int rc = ERROR_FAIL;
-
-    libxl_device_disk_init(ctx, disk);
-
-    dompath = libxl__xs_get_dompath(&gc, domid);
-    if (!dompath) {
-        goto out;
-    }
-    path = libxl__xs_read(&gc, XBT_NULL,
-                          libxl__sprintf(&gc, "%s/device/vbd/%d/backend",
-                                         dompath, devid));
-    if (!path)
-        goto out;
-
-    libxl__device_disk_from_xs_be(&gc, path, disk);
-
-    rc = 0;
-out:
-    libxl__free_all(&gc);
-    return rc;
-}
-
-
-static int libxl__append_disk_list_of_type(libxl__gc *gc,
-                                           uint32_t domid,
-                                           const char *type,
-                                           libxl_device_disk **disks,
-                                           int *ndisks)
-{
-    char *be_path = NULL;
-    char **dir = NULL;
-    unsigned int n = 0;
-    libxl_device_disk *pdisk = NULL, *pdisk_end = NULL;
-
-    be_path = libxl__sprintf(gc, "%s/backend/%s/%d",
-                             libxl__xs_get_dompath(gc, 0), type, domid);
-    dir = libxl__xs_directory(gc, XBT_NULL, be_path, &n);
-    if (dir) {
-        libxl_device_disk *tmp;
-        tmp = realloc(*disks, sizeof (libxl_device_disk) * (*ndisks + n));
-        if (tmp == NULL)
-            return ERROR_NOMEM;
-        *disks = tmp;
-        pdisk = *disks + *ndisks;
-        *ndisks += n;
-        pdisk_end = *disks + *ndisks;
-        for (; pdisk < pdisk_end; pdisk++, dir++) {
-            const char *p;
-            p = libxl__sprintf(gc, "%s/%s", be_path, *dir);
-            libxl__device_disk_from_xs_be(gc, p, pdisk);
-            pdisk->backend_domid = 0;
-        }
-    }
-    return 0;
-}
-
-libxl_device_disk *libxl_device_disk_list(libxl_ctx *ctx, uint32_t domid, int *num)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    libxl_device_disk *disks = NULL;
-    int rc;
-
-    *num = 0;
-
-    rc = libxl__append_disk_list_of_type(&gc, domid, "vbd", &disks, num);
-    if (rc) goto out_err;
-
-    rc = libxl__append_disk_list_of_type(&gc, domid, "tap", &disks, num);
-    if (rc) goto out_err;
-
-    rc = libxl__append_disk_list_of_type(&gc, domid, "qdisk", &disks, num);
-    if (rc) goto out_err;
-
-    libxl__free_all(&gc);
-    return disks;
-
-out_err:
-    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to list disks");
-    while (disks && *num) {
-        (*num)--;
-        libxl_device_disk_dispose(&disks[*num]);
-    }
-    free(disks);
-    return NULL;
-}
-
-int libxl_device_disk_getinfo(libxl_ctx *ctx, uint32_t domid,
-                              libxl_device_disk *disk, libxl_diskinfo *diskinfo)
-{
-    libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *dompath, *diskpath;
-    char *val;
-
-    dompath = libxl__xs_get_dompath(&gc, domid);
-    diskinfo->devid = libxl__device_disk_dev_number(disk->vdev, NULL, NULL);
-
-    /* tap devices entries in xenstore are written as vbd devices. */
-    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, diskinfo->devid);
-    diskinfo->backend = xs_read(ctx->xsh, XBT_NULL,
-                                libxl__sprintf(&gc, "%s/backend", diskpath), NULL);
-    if (!diskinfo->backend) {
-        libxl__free_all(&gc);
-        return ERROR_FAIL;
-    }
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/backend-id", diskpath));
-    diskinfo->backend_id = val ? strtoul(val, NULL, 10) : -1;
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/state", diskpath));
-    diskinfo->state = val ? strtoul(val, NULL, 10) : -1;
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/event-channel", diskpath));
-    diskinfo->evtch = val ? strtoul(val, NULL, 10) : -1;
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/ring-ref", diskpath));
-    diskinfo->rref = val ? strtoul(val, NULL, 10) : -1;
-    diskinfo->frontend = xs_read(ctx->xsh, XBT_NULL,
-                                 libxl__sprintf(&gc, "%s/frontend", diskinfo->backend), NULL);
-    val = libxl__xs_read(&gc, XBT_NULL, libxl__sprintf(&gc, "%s/frontend-id", diskinfo->backend));
-    diskinfo->frontend_id = val ? strtoul(val, NULL, 10) : -1;
-
-    libxl__free_all(&gc);
-    return 0;
-}
-
-int libxl_cdrom_insert(libxl_ctx *ctx, uint32_t domid, libxl_device_disk *disk)
-{
-    int num, i;
-    uint32_t stubdomid;
-    libxl_device_disk *disks;
-    int ret = ERROR_FAIL;
-
-    if (!disk->pdev_path) {
-        disk->pdev_path = strdup("");
-        disk->format = LIBXL_DISK_FORMAT_EMPTY;
-    }
-    disks = libxl_device_disk_list(ctx, domid, &num);
-    for (i = 0; i < num; i++) {
-        if (disks[i].is_cdrom && !strcmp(disk->vdev, disks[i].vdev))
-            /* found */
-            break;
-    }
-    if (i == num) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Virtual device not found");
-        goto out;
-    }
-
-    ret = 0;
-
-    libxl_device_disk_remove(ctx, domid, disks + i);
-    libxl_device_disk_add(ctx, domid, disk);
-    stubdomid = libxl_get_stubdom_id(ctx, domid);
-    if (stubdomid) {
-        libxl_device_disk_remove(ctx, stubdomid, disks + i);
-        libxl_device_disk_add(ctx, stubdomid, disk);
-    }
-out:
-    for (i = 0; i < num; i++)
-        libxl_device_disk_dispose(&disks[i]);
-    free(disks);
-    return ret;
-}
-
 /******************************************************************************/
 int libxl_device_vfb_init(libxl_ctx *ctx, libxl_device_vfb *vfb)
 {

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:01:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:01:53 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOHA-00020N-Oq; Tue, 01 Nov 2011 17:01:52 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAw-0000TN-OO
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:27 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1320191723!2565514!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 19389 invoked from network); 1 Nov 2011 23:55:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAt-0007fM-Bb
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:23 +0000
Message-Id: <E1RLOAt-0007fM-Bb@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenstored: Fix processing of
	zero-length messages
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Daniel De Graaf <dgdegra@tycho.nsa.gov>
# Date 1320171917 0
# Node ID 45025966f7d1e556d1c9085279c392f50c92a71e
# Parent  f60911281a1bb1e77ef257be629065102be21a80
xenstored: Fix processing of zero-length messages

When a message with zero length is sent to xenstore, the body of the
message was not processed until the socket or ring had more data to
read; this will cause deadlocks if the requestor is waiting on a
response to continue.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r f60911281a1b -r 45025966f7d1 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c	Tue Oct 18 13:36:43 2011 +0100
+++ b/tools/xenstore/xenstored_core.c	Tue Nov 01 18:25:17 2011 +0000
@@ -1297,7 +1297,6 @@
 			goto bad_client;
 		in->used = 0;
 		in->inhdr = false;
-		return;
 	}
 
 	bytes = conn->read(conn, in->buffer + in->used,

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:02:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:02:14 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOHV-000242-IT; Tue, 01 Nov 2011 17:02:13 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAy-0000U5-8J
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1320191725!1938046!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23637 invoked from network); 1 Nov 2011 23:55:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAu-0007g5-R4
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:24 +0000
Message-Id: <E1RLOAu-0007g5-R4@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: add some scaffolding for
	building HTML docs from markdown
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319646217 -3600
# Node ID 3568883ebd550be6e26bf5d34dc0764c31918f09
# Parent  4c7c063631db44d3244710ef78bbc81b10fec050
docs: add some scaffolding for building HTML docs from markdown

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 4c7c063631db -r 3568883ebd55 docs/Docs.mk
--- a/docs/Docs.mk	Wed Oct 26 17:20:21 2011 +0100
+++ b/docs/Docs.mk	Wed Oct 26 17:23:37 2011 +0100
@@ -7,3 +7,4 @@
 POD2MAN		:= pod2man
 DOT		:= dot
 NEATO		:= neato
+MARKDOWN	:= markdown
diff -r 4c7c063631db -r 3568883ebd55 docs/Makefile
--- a/docs/Makefile	Wed Oct 26 17:20:21 2011 +0100
+++ b/docs/Makefile	Wed Oct 26 17:23:37 2011 +0100
@@ -11,10 +11,11 @@
 DOC_MAN1	:= $(patsubst man/%.pod.1,man1/%.1,$(DOC_MAN1SRC))
 DOC_MAN5	:= $(patsubst man/%.pod.5,man5/%.5,$(DOC_MAN5SRC))
 DOC_TEX		:= src/user.tex src/interface.tex
+DOC_MARKDOWN	:= $(wildcard misc/*.markdown)
 DOC_PS		:= $(patsubst src/%.tex,ps/%.ps,$(DOC_TEX))
 DOC_PDF		:= $(patsubst src/%.tex,pdf/%.pdf,$(DOC_TEX))
-DOC_HTML	:= $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX))
-
+DOC_HTML	:= $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX)) \
+		   $(patsubst %.markdown,html/%.html,$(DOC_MARKDOWN))
 GFX = $(patsubst %.fig, %.eps, $(wildcard figs/*.fig))
 
 .PHONY: all
@@ -37,9 +38,7 @@
 pdf: $(DOC_PDF)
 
 .PHONY: html
-html:
-	@if which $(LATEX2HTML) 1>/dev/null 2>/dev/null; then \
-	$(MAKE) $(DOC_HTML); fi
+html: $(DOC_HTML)
 
 .PHONY: python-dev-docs
 python-dev-docs:
@@ -110,7 +109,16 @@
 	$(FIG2DEV) -L eps $< $@
 
 html/%/index.html: src/%.tex
-	$(INSTALL_DIR) $(@D)
+	@$(INSTALL_DIR) $(@D)
+	@set -e ; if which $(LATEX2HTML) 1>/dev/null 2>/dev/null; then \
+        echo "Running latex2html to generate $*/index.html ... "; \
 	$(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \
 	-numbered_footnotes -local_icons -noinfo -math -dir $(@D) \
-	$< 1>/dev/null 2>/dev/null
+	$< 1>/dev/null 2>/dev/null ;fi
+
+html/%.html: %.markdown
+	@$(INSTALL_DIR) $(@D)
+	@set -e ; if which $(MARKDOWN) 1>/dev/null 2>/dev/null; then \
+	echo "Running markdown to generate $*.html ... "; \
+	$(MARKDOWN) $< > $@.tmp ; \
+	$(call move-if-changed,$@.tmp,$@) ; fi

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:02:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:02:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOI5-00027b-Af; Tue, 01 Nov 2011 17:02:49 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAx-0000Tj-F4
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1320191700!51110421!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32385 invoked from network); 1 Nov 2011 23:55:00 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:00 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAu-0007fq-B2
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:24 +0000
Message-Id: <E1RLOAu-0007fq-B2@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: import HVM emulated device
	unplug protocol spec
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319646021 -3600
# Node ID 4c7c063631db44d3244710ef78bbc81b10fec050
# Parent  a1e0b24a8728d82ac4dd8e7e767298932aaa8b77
docs: import HVM emulated device unplug protocol spec

Convert to markdown as I go.

Currently this lives in qemu-xen.git i386-dm/README.hvm-pv-magic-ioport-disable
and I can never find it when I want it. As we transition to upstream qemu this
location becomes less useful.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r a1e0b24a8728 -r 4c7c063631db docs/misc/hvm-emulated-unplug.markdown
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/misc/hvm-emulated-unplug.markdown	Wed Oct 26 17:20:21 2011 +0100
@@ -0,0 +1,68 @@
+#Xen HVM emulated device unplug protocol
+
+The protocol covers three basic things:
+
+ * Disconnecting emulated devices.
+ * Getting log messages out of the drivers and into dom0.
+ * Allowing dom0 to block the loading of specific drivers.  This is
+   intended as a backwards-compatibility thing: if we discover a bug
+   in some old version of the drivers, then rather than working around
+   it in Xen, we have the option of just making those drivers fall
+   back to emulated mode.
+
+The current protocol works like this (from the point of view of
+drivers):
+
+1. When the drivers first come up, they check whether the unplug logic
+   is available by reading a two-byte magic number from IO port `0x10`.
+   These should be `0x49d2`.  If the magic number doesn't match, the
+   drivers don't do anything.
+
+2. The drivers read a one-byte protocol version from IO port `0x12`.  If
+   this is 0, skip to 6.
+
+3. The drivers write a two-byte product number to IO port `0x12`.  At
+   the moment, the only drivers using this protocol are our
+   closed-source ones, which use product number 1.
+
+4. The drivers write a four-byte build number to IO port `0x10`.
+
+5. The drivers check the magic number by reading two bytes from `0x10`
+   again.  If it's changed from `0x49d2` to `0xd249`, the drivers are
+   blacklisted and should not load.
+
+6. The drivers write a two-byte bitmask of devices to unplug to IO
+   port `0x10`.  The defined fields are:
+
+  * `1` -- All IDE disks (not including CD drives)
+  * `2` -- All emulated NICs
+  * `4` -- All IDE disks except for the primary master (not including CD
+	   drives)
+
+   The relevant emulated devices then disappear from the relevant
+   buses.  For most guest operating systems, you want to do this
+   before device enumeration happens.
+
+Once the drivers have checked the magic number, they can send log
+messages to qemu which will be logged to wherever qemu's logs go
+(`/var/log/xen/qemu-dm.log` on normal Xen, dom0 syslog on XenServer).
+These messages are written to IO port `0x12` a byte at a time, and are
+terminated by newlines.  There's a fairly aggressive rate limiter on
+these messages, so they shouldn't be used for anything even vaguely
+high-volume, but they're rather useful for debugging and support.
+
+It is still permitted for a driver to use this logging feature if it
+is blacklisted, but *ONLY* if it has checked the magic number and found
+it to be `0x49d2` or `0xd249`.
+
+This isn't exactly a pretty protocol, but it does solve the problem.
+
+The blacklist is, from qemu's point of view, handled mostly through
+xenstore.  A driver version is considered to be blacklisted if
+`/mh/driver-blacklist/{product_name}/{build_number}` exists and is
+readable, where `{build_number}` is the build number from step 4 as a
+decimal number.  `{product_name}` is a string corresponding to the
+product number in step 3.
+
+The master registry of product names and numbers is in
+qemu-xen-unstable's xenstore.c.

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:03:52 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:03:52 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOJ4-0002CW-BV; Tue, 01 Nov 2011 17:03:50 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAx-0000Td-Ad
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:28 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1320191724!1839183!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32064 invoked from network); 1 Nov 2011 23:55:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAt-0007fb-Ra
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:23 +0000
Message-Id: <E1RLOAt-0007fb-Ra@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Add HowTo use QEMU upstream.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320172130 0
# Node ID a1e0b24a8728d82ac4dd8e7e767298932aaa8b77
# Parent  45025966f7d1e556d1c9085279c392f50c92a71e
docs: Add HowTo use QEMU upstream.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 45025966f7d1 -r a1e0b24a8728 docs/misc/qemu-upstream_howto_use_it.markdown
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/misc/qemu-upstream_howto_use_it.markdown	Tue Nov 01 18:28:50 2011 +0000
@@ -0,0 +1,129 @@
+Help to use QEMU (upstream version) with Xen
+============================================
+
+Note
+----
+
+All these steps will become unnecessary after the patches to integrate
+SeaBIOS/QEMU build will be applied.
+
+
+How to build it
+---------------
+
+### SeaBIOS
+
+The new device-model needs a different BIOS, SeaBIOS. Clone the repository from:
+
+  - git://git.qemu.org/seabios.git
+  - http://git.qemu.org/git/seabios.git
+
+Put the `.config` file in the appendix at the root of seabios.git and build SeaBIOS.
+
+In xen-unstable source tree, add the file `.config` with
+`SEABIOS_DIR = /path/to/seabios.git`.
+To build hvmloader with SeaBIOS, you propably need to `make -C tools/firmware
+clean` first and then `make tools`, to use the new SEABIOS_DIR parameter.
+
+
+### QEMU
+
+Get QEMU upstream source from:
+
+  - git://xenbits.xensource.com/qemu-upstream-unstable.git
+  - http://xenbits.xensource.com/git-http/qemu-upstream-unstable.git
+
+To configure build QEMU upstream with Xen
+
+    ./configure --enable-xen --target-list=i386-softmmu --extra-cflags="-I$path_to_xen_source/tools/include -I$path_to_xen_source/tools/libxc -I$path_to_xen_source/tools/xenstore" --extra-ldflags="-L$path_to_xen_source/tools/libxc -L$path_to_xen_source/tools/xenstore"
+
+You can also use other several options such as `--disable-kvm`.
+
+
+How to use QEMU upstream
+------------------------
+
+Only xl support QEMU upstream.
+
+To actually use it, add or change this in your VM configuration file:
+
+    device_model_version = 'qemu-xen'
+    device_model_override = '/path/to/qemu/i386-softmmu/qemu'
+
+NB: On qemu-upstream repository, the default binary name has been renamed to
+`qemu-system-i386`.
+
+
+Appendix
+------
+
+### `.config` file for SeaBIOS
+
+    #
+    # General Features
+    #
+    # CONFIG_COREBOOT is not set
+    CONFIG_XEN=y
+    CONFIG_THREADS=y
+    CONFIG_THREAD_OPTIONROMS=y
+    CONFIG_RELOCATE_INIT=y
+    CONFIG_BOOTMENU=y
+    CONFIG_BOOTMENU_WAIT=1000
+    # CONFIG_BOOTSPLASH is not set
+    CONFIG_BOOTORDER=y
+    #
+    # Hardware support
+    #
+    CONFIG_ATA=y
+    CONFIG_ATA_DMA=y
+    CONFIG_ATA_PIO32=y
+    CONFIG_AHCI=y
+    CONFIG_VIRTIO_BLK=y
+    CONFIG_FLOPPY=y
+    CONFIG_PS2PORT=y
+    CONFIG_USB=y
+    CONFIG_USB_UHCI=y
+    CONFIG_USB_OHCI=y
+    CONFIG_USB_EHCI=y
+    CONFIG_USB_MSC=y
+    CONFIG_USB_HUB=y
+    CONFIG_USB_KEYBOARD=y
+    CONFIG_USB_MOUSE=y
+    CONFIG_SERIAL=y
+    CONFIG_LPT=y
+    # CONFIG_EXTRA_PCI_ROOTS is not set
+    # CONFIG_USE_SMM is not set
+    CONFIG_MTRR_INIT=y
+    #
+    # BIOS interfaces
+    #
+    CONFIG_DRIVES=y
+    # CONFIG_CDROM_BOOT is not set
+    CONFIG_PCIBIOS=y
+    CONFIG_APMBIOS=y
+    CONFIG_PNPBIOS=y
+    CONFIG_OPTIONROMS=y
+    # CONFIG_OPTIONROMS_DEPLOYED is not set
+    CONFIG_OPTIONROMS_CHECKSUM=y
+    CONFIG_PMM=y
+    CONFIG_BOOT=y
+    CONFIG_KEYBOARD=y
+    CONFIG_KBD_CALL_INT15_4F=y
+    CONFIG_MOUSE=y
+    CONFIG_S3_RESUME=y
+    # CONFIG_S3_RESUME_VGA_INIT is not set
+    # CONFIG_DISABLE_A20 is not set
+    #
+    # BIOS Tables
+    #
+    CONFIG_PIRTABLE=y
+    CONFIG_MPTABLE=y
+    CONFIG_SMBIOS=y
+    CONFIG_ACPI=y
+    #
+    # Debugging
+    #
+    CONFIG_DEBUG_LEVEL=3
+    CONFIG_DEBUG_SERIAL=y
+    CONFIG_DEBUG_SERIAL_PORT=0x3f8
+    # CONFIG_SCREEN_AND_DEBUG is not set

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:08:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:08:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLONN-0002Mz-L1; Tue, 01 Nov 2011 17:08:17 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAy-0000U6-OD
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1320191725!2454517!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31358 invoked from network); 1 Nov 2011 23:55:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAv-0007gK-AY
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:25 +0000
Message-Id: <E1RLOAv-0007gK-AY@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] unmodified_drivers: update README
	from http://wiki.xen.org/xenwiki/UnmodifiedDrivers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319647443 -3600
# Node ID 4ed766d703968e2340bb7289990d2f1f6bc91557
# Parent  3568883ebd550be6e26bf5d34dc0764c31918f09
unmodified_drivers: update README from http://wiki.xen.org/xenwiki/UnmodifiedDrivers

Add reference to the fact that these drivers are for "classic-Xen" kernels only
and do not work with PVops but point towards the PVHVM functionality in
mainstream.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 3568883ebd55 -r 4ed766d70396 unmodified_drivers/linux-2.6/README
--- a/unmodified_drivers/linux-2.6/README	Wed Oct 26 17:23:37 2011 +0100
+++ b/unmodified_drivers/linux-2.6/README	Wed Oct 26 17:44:03 2011 +0100
@@ -1,10 +1,19 @@
-To build:
+These drivers provide paravirtualised drivers for pre-PVops Linux
+kernels which have the classic-Xen patches applied. They do not work
+with kernels which are not patched with the classic-Xen patches. In
+particular this includes all PVops kernels.
 
-1. ./mkbuildtree [<arch>]
+For 2.6.36 and newer you should use the "PVHVM" functionality which is
+available in the mainline kernel.
+
+To build do one of:
+
+   ./mkbuildtree [<arch>]
    NB. You can override paths to Xen sources and a (stub) XenLinux
        build tree via the XEN and XL environment variable.
 
-2. make -C /path/to/kernel/build M=$PWD modules
+- or -
+   make -C /path/to/kernel/build M=$PWD modules
    NB. This is your native kernel build tree (or a distro provided
        stub), not the XenLinux sources referred to in step 1.
    NB. If you are cross compiling, you need to set ARCH and

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:08:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:08:43 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLONm-0002QP-H2; Tue, 01 Nov 2011 17:08:43 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAz-0000UI-7t
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1320191726!1053216!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23137 invoked from network); 1 Nov 2011 23:55:26 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:26 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAv-0007gZ-QI
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:25 +0000
Message-Id: <E1RLOAv-0007gZ-QI@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: add a document describing the
	xl vif syntax
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319705668 -3600
# Node ID 4900950d16bbbb63925fadd4cdabdfde01195c37
# Parent  4ed766d703968e2340bb7289990d2f1f6bc91557
docs: add a document describing the xl vif syntax

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 4ed766d70396 -r 4900950d16bb docs/misc/xl-network-configuration.markdown
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/misc/xl-network-configuration.markdown	Thu Oct 27 09:54:28 2011 +0100
@@ -0,0 +1,126 @@
+# XL Network Configuration
+
+## Syntax Overview
+
+This document specifies the xl config file format vif configuration
+option.  It has the following form:
+
+        vif = [ '<vifspec>', '<vifspec>', ... ]
+
+where each vifspec is in this form:
+    
+        [<key>=<value>|<flag>,]
+
+For example:
+
+        'mac=00:16:3E:74:3d:76,model=rtl8139,bridge=xenbr0'
+        'mac=00:16:3E:74:34:32'
+        '' # The empty string
+
+These might be specified in the domain config file like this:
+
+        vif = [ 'mac=00:16:3E:74:34:32', 'mac=00:16:3e:5f:48:e4,bridge=xenbr1' ]
+
+More formally, the string is a series of comma-separated keyword/value
+pairs. All keywords are optional.
+
+Each device has a `DEVID` which is its index within the vif list, starting from 0.
+
+## Keywords
+
+### mac
+
+If specified then this option specifies the MAC address inside the
+guest of this VIF device. The value is a 48-bit number represented as
+six groups of two hexadecimal digits, separated by colons (:).
+
+The default if this keyword is not specified is to be automatically
+generate a MAC address inside the space assigned to Xen's
+[Organizationally Unique Identifier][oui] (00:16:3e).
+
+If you are choosing a MAC address then it is strongly recommend to
+follow one of the following strategies:
+
+  * Generate a random sequence of 6 byte, set the locally administered
+    bit (bit 2 of the first byte) and clear the multicast bit (bit 1
+    of the first byte). In other words the first byte should have the
+    bit pattern xxxxxx10 (where x is a randomly generated bit) and the
+    remaining 5 bytes are randomly generated See
+    [http://en.wikipedia.org/wiki/MAC_address] for more details the
+    structure of a MAC address.
+  * Allocate an address from within the space defined by your
+    organization's OUI (if you have one) following your organization's
+    procedures for doing so.
+  * Allocate an address from within the space defined by Xen's OUI
+    (00:16:3e). Taking care not to clash with other users of the
+    physical network segment where this VIF will reside.
+
+If you have an OUI for your own use then that is the preferred
+strategy. Otherwise in general you should prefer to generate a random
+MAC and set the locally administered bit since this allows for more
+bits of randomness than using the Xen OUI.
+
+### bridge
+
+Specifies the name of the network bridge which this VIF should be
+added to. The default is `xenbr0`. The bridge must be configured using
+your distribution's network configuration tools. See the [wiki][net]
+for guidance and examples.
+
+### type
+
+This keyword is valid for HVM guests only.
+
+Specifies the type of device to valid values are:
+
+  * `ioemu` (default) -- this device will be provided as an emulate
+    device to the guest and also as a paravirtualised device which the
+    guest may choose to use instead if it has suitable drivers
+    available.
+  * `vif` -- this device will be provided as a paravirtualised device
+    only.
+
+### model
+
+This keyword is valid for HVM guest devices with `type=ioemu` only.
+
+Specifies the type device to emulated for this guest. Valid values
+are:
+
+  * `rtl8139` (default) -- Realtek RTL8139
+  * `e1000` -- Intel E1000 
+  * in principal any device supported by your device model
+
+### vifname
+
+This keyword is valid for HVM guest devices with `type=ioemu` only.
+
+Specifies the backend device name for an emulated device. The default
+is `tapDOMID.DEVID` where `DOMID` is the guest domain ID and `DEVID`
+is the device number.
+
+### script
+
+Specifies the hotplug script to run to configure this device (e.g. to
+add it to the relevant bridge). Defaults to
+`XEN_SCRIPT_DIR/vif-bridge` but can be set to any script. Some example
+scripts are installed in `XEN_SCRIPT_DIR`.
+
+### ip
+
+Specifies the IP address for the device, the default is not to
+specify an IP address.
+
+What, if any, effect this has depends on the hotplug script which is
+configured. A typically behaviour (exhibited by the example hotplug
+scripts) if set might be to configure firewall rules to allow only the
+specified IP address to be used by the guest (blocking all others).
+
+### backend
+
+Specifies the backend domain which this device should attach to. This
+defaults to domain 0. Specifying another domain requires setting up a
+driver domain which is outside the scope of this document.
+
+[oui]: http://en.wikipedia.org/wiki/Organizationally_Unique_Identifier
+[net]: http://wiki.xen.org/xenwiki/HostConfiguration/Networking

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:08:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:08:59 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOO2-0002Tn-QI; Tue, 01 Nov 2011 17:08:59 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOB0-0000Un-6K
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:30 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320191727!1941252!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5749 invoked from network); 1 Nov 2011 23:55:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAw-0007h3-Pc
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:26 +0000
Message-Id: <E1RLOAw-0007h3-Pc@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: install text documentation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319705722 -3600
# Node ID 7648496d4ff12d41a8445c2b125173906d25bce7
# Parent  e3bd1c4184e513ca19e1f2e11803004015ed0d15
docs: install text documentation

Including markdown docs.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r e3bd1c4184e5 -r 7648496d4ff1 .hgignore
--- a/.hgignore	Thu Oct 27 09:55:14 2011 +0100
+++ b/.hgignore	Thu Oct 27 09:55:22 2011 +0100
@@ -57,6 +57,7 @@
 ^docs/user/labels\.pl$
 ^docs/user/user\.css$
 ^docs/user/user\.html$
+^docs/txt/.*$
 ^docs/xen-api/vm_lifecycle.eps$
 ^docs/xen-api/xenapi-datamodel-graph.eps$
 ^docs/xen-api/xenapi.out$
diff -r e3bd1c4184e5 -r 7648496d4ff1 docs/Makefile
--- a/docs/Makefile	Thu Oct 27 09:55:14 2011 +0100
+++ b/docs/Makefile	Thu Oct 27 09:55:22 2011 +0100
@@ -16,13 +16,16 @@
 DOC_PDF		:= $(patsubst src/%.tex,pdf/%.pdf,$(DOC_TEX))
 DOC_HTML	:= $(patsubst src/%.tex,html/%/index.html,$(DOC_TEX)) \
 		   $(patsubst %.markdown,html/%.html,$(DOC_MARKDOWN))
+DOC_TXT         := $(patsubst %.txt,txt/%.txt,$(wildcard misc/*.txt)) \
+		   $(patsubst %.markdown,txt/%.txt,$(DOC_MARKDOWN))
+
 GFX = $(patsubst %.fig, %.eps, $(wildcard figs/*.fig))
 
 .PHONY: all
 all: build
 
 .PHONY: build
-build: ps pdf html man-pages
+build: ps pdf html txt man-pages
 	@if which $(DOT) 1>/dev/null 2>/dev/null ; then              \
 	$(MAKE) -C xen-api build ; else                              \
         echo "Graphviz (dot) not installed; skipping xen-api." ; fi
@@ -40,6 +43,9 @@
 .PHONY: html
 html: $(DOC_HTML)
 
+.PHONY: txt
+txt: $(DOC_TXT)
+
 .PHONY: python-dev-docs
 python-dev-docs:
 	@mkdir -v -p api/tools/python
@@ -122,3 +128,13 @@
 	echo "Running markdown to generate $*.html ... "; \
 	$(MARKDOWN) $< > $@.tmp ; \
 	$(call move-if-changed,$@.tmp,$@) ; fi
+
+txt/%.txt: %.txt
+	$(INSTALL_DIR) $(@D)
+	cp $< $@.tmp
+	$(call move-if-changed,$@.tmp,$@)
+
+txt/%.txt: %.markdown
+	$(INSTALL_DIR) $(@D)
+	cp $< $@.tmp
+	$(call move-if-changed,$@.tmp,$@)

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:09:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:09:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOOL-0002XQ-If; Tue, 01 Nov 2011 17:09:19 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOAz-0000UZ-MA
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:30 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-216.messagelabs.com!1320191726!1938047!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 23645 invoked from network); 1 Nov 2011 23:55:26 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:26 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAw-0007go-9l
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:26 +0000
Message-Id: <E1RLOAw-0007go-9l@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xl: add some example configuration
	files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1319705714 -3600
# Node ID e3bd1c4184e513ca19e1f2e11803004015ed0d15
# Parent  4900950d16bbbb63925fadd4cdabdfde01195c37
xl: add some example configuration files

These are much more minimal than the equivalent xmexamples but should
eventually reference a more complete document describing the available options.

These are based on the guest configuration files that I actually use day-to-day.

There is an unresolved reference to a document describing the complete syntax.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 4900950d16bb -r e3bd1c4184e5 tools/examples/xlexample.hvm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/examples/xlexample.hvm	Thu Oct 27 09:55:14 2011 +0100
@@ -0,0 +1,39 @@
+# =====================================================================
+# Example HVM guest configuration
+# =====================================================================
+#
+# This is a fairly minimal example of what is required for an
+# HVM guest. For a more complete guide see <XXX Document TBD>
+
+# Guest name
+name = "example.hvm"
+
+# 128-bit UUID for the domain as a hexadecimal number.
+# Use "uuidgen" to generate one if required.
+# The default behavior is to generate a new UUID each time the guest is started.
+#uuid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
+
+# Initial memory allocation (MB)
+memory = 128
+
+# Maximum memory (MB)
+# If this is greater than `memory' then the slack will start ballooned
+# (this assumes guest kernel support for ballooning)
+#maxmem = 512
+
+# Number of VCPUS
+vcpus = 2
+
+# Network devices
+# A list of 'vifspec' entries as described in
+# docs/misc/xl-network-configuration.markdown
+vif = [ '' ]
+
+# Disk Devices
+# A list of `diskspec' entries as described in
+# docs/misc/xl-disk-configuration.txt
+disk = [ '/dev/vg/guest-volume,raw,xvda,rw' ]
+
+# Guest VGA console configuration, either SDL or VNC
+sdl = 1
+#vnc = 1
diff -r 4900950d16bb -r e3bd1c4184e5 tools/examples/xlexample.pvlinux
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/examples/xlexample.pvlinux	Thu Oct 27 09:55:14 2011 +0100
@@ -0,0 +1,44 @@
+# =====================================================================
+# Example PV Linux guest configuration
+# =====================================================================
+#
+# This is a fairly minimal example of what is required for a
+# Paravirtualised Linux guest. For a more complete guide see <XXX Document TBD>
+
+# Guest name
+name = "example.pvlinux"
+
+# 128-bit UUID for the domain as a hexadecimal number.
+# Use "uuidgen" to generate one if required.
+# The default behavior is to generate a new UUID each time the guest is started.
+#uuid = "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
+
+# Kernel image to boot
+kernel = "/boot/vmlinuz"
+
+# Ramdisk (optional)
+#ramdisk = "/boot/initrd.gz"
+
+# Kernel command line options
+extra = "root=/dev/xvda1"
+
+# Initial memory allocation (MB)
+memory = 128
+
+# Maximum memory (MB)
+# If this is greater than `memory' then the slack will start ballooned
+# (this assumes guest kernel support for ballooning)
+#maxmem = 512
+
+# Number of VCPUS
+vcpus = 2
+
+# Network devices
+# A list of 'vifspec' entries as described in
+# docs/misc/xl-network-configuration.markdown
+vif = [ '' ]
+
+# Disk Devices
+# A list of `diskspec' entries as described in
+# docs/misc/xl-disk-configuration.txt
+disk = [ '/dev/vg/guest-volume,raw,xvda,rw' ]

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:09:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:09:41 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOOj-0002ac-IK; Tue, 01 Nov 2011 17:09:41 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOB0-0000Uo-UG
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-216.messagelabs.com!1320191727!1839188!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32150 invoked from network); 1 Nov 2011 23:55:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAx-0007hJ-9K
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:27 +0000
Message-Id: <E1RLOAx-0007hJ-9K@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: introduce an xl man page in
	pod format
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1320173074 0
# Node ID 386f078de0ea55c1ff982ab045c4f8c2efe74d01
# Parent  7648496d4ff12d41a8445c2b125173906d25bce7
docs: introduce an xl man page in pod format

This is the initial version of an xl man page, based on the old xm man
page.  Almost every command implemented in xl should be present, a
notable exception are the tmem commands that are currently missing.
Further improvements and clarifications to this man page are very
welcome.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 7648496d4ff1 -r 386f078de0ea docs/man/xl.pod.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/man/xl.pod.1	Tue Nov 01 18:44:34 2011 +0000
@@ -0,0 +1,805 @@
+=head1 NAME
+
+XL - Xen management tool, based on LibXenlight
+
+=head1 SYNOPSIS
+
+B<xl> I<subcommand> [I<args>]
+
+=head1 DESCRIPTION
+
+The B<xl> program is the new tool for managing Xen guest
+domains. The program can be used to create, pause, and shutdown
+domains. It can also be used to list current domains, enable or pin
+VCPUs, and attach or detach virtual block devices.
+The old B<xm> tool is deprecated and should not be used.
+
+The basic structure of every B<xl> command is almost always:
+
+=over 2
+
+B<xl> I<subcommand> [I<OPTIONS>] I<domain-id>
+
+=back
+
+Where I<subcommand> is one of the subcommands listed below, I<domain-id>
+is the numeric domain id, or the domain name (which will be internally
+translated to domain id), and I<OPTIONS> are subcommand specific
+options.  There are a few exceptions to this rule in the cases where
+the subcommand in question acts on all domains, the entire machine,
+or directly on the Xen hypervisor.  Those exceptions will be clear for
+each of those subcommands.
+
+=head1 NOTES
+
+Most B<xl> operations rely upon B<xenstored> and B<xenconsoled>: make
+sure you start the script B</etc/init.d/xencommons> at boot time to
+initialize all the daemons needed by B<xl>.
+
+In the most common network configuration, you need to setup a bridge in dom0
+named B<xenbr0> in order to have a working network in the guest domains.
+Please refer to the documentation of your Linux distribution to know how to
+setup the bridge.
+
+Most B<xl> commands require root privileges to run due to the
+communications channels used to talk to the hypervisor.  Running as
+non root will return an error.
+
+=head1 DOMAIN SUBCOMMANDS
+
+The following subcommands manipulate domains directly.  As stated
+previously, most commands take I<domain-id> as the first parameter.
+
+=over 4
+
+=item B<create> [I<OPTIONS>] I<configfile>
+
+The create subcommand requires a config file: see L<xldomain.cfg> for
+full details of that file format and possible options.
+
+I<configfile> can either be an absolute path to a file, or a relative
+path to a file located in /etc/xen.
+
+Create will return B<as soon> as the domain is started.  This B<does
+not> mean the guest OS in the domain has actually booted, or is
+available for input.
+
+B<OPTIONS>
+
+=over 4 
+
+=item B<-q>, B<--quiet>
+
+No console output.
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+Use the given configuration file.
+
+=item B<-n>, B<--dryrun>
+
+Dry run - prints the resulting configuration in SXP but does not create
+the domain.
+
+=item B<-p>
+
+Leave the domain paused after it is created.
+
+=item B<-c>
+
+Attach console to the domain as soon as it has started.  This is
+useful for determining issues with crashing domains.
+
+=back
+
+B<EXAMPLES>
+
+=over 4
+
+=item I<with config file>
+
+  xl create DebianLenny
+
+This creates a domain with the file /etc/xen/DebianLenny, and returns as
+soon as it is run.
+
+=back
+
+=item B<console> I<domain-id>
+
+Attach to domain I<domain-id>'s console.  If you've set up your domains to
+have a traditional log in console this will look much like a normal
+text log in screen.
+
+Use the key combination Ctrl+] to detach the domain console.
+
+=item B<vncviewer> [I<OPTIONS>] I<domain-id>
+
+Attach to domain's VNC server, forking a vncviewer process.
+
+B<OPTIONS>
+
+=over 4
+
+=item I<--autopass>
+
+Pass VNC password to vncviewer via stdin.
+
+=back
+
+=item B<destroy> I<domain-id>
+
+Immediately terminate the domain I<domain-id>.  This doesn't give the
+domain OS any chance to react, and is the equivalent of ripping the
+power cord out on a physical machine.  In most cases you will want to
+use the B<shutdown> command instead.
+
+=item B<domid> I<domain-name>
+
+Converts a domain name to a domain id.
+
+=item B<domname> I<domain-id>
+
+Converts a domain id to a domain name.
+
+=item B<rename> I<domain-id> I<new-name>
+
+Change the domain name of I<domain-id> to I<new-name>.
+
+=item B<dump-core> I<domain-id> [I<filename>]
+
+Dumps the virtual machine's memory for the specified domain to the
+I<filename> specified, without pausing the domain.  The dump file will
+be written to a distribution specific directory for dump files.  Such
+as: /var/lib/xen/dump or /var/xen/dump.
+
+=item B<help> [I<--long>]
+
+Displays the short help message (i.e. common commands).
+
+The I<--long> option prints out the complete set of B<xl> subcommands,
+grouped by function.
+
+=item B<list> [I<OPTIONS>] [I<domain-id> ...]
+
+Prints information about one or more domains.  If no domains are
+specified it prints out information about all domains.
+
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-l>, B<--long>
+
+The output for B<xl list> is not the table view shown below, but 
+instead presents the data in SXP compatible format.
+
+=item B<-Z>, B<--context>
+Also prints the security labels.
+
+=item B<-v>, B<--verbose>
+
+Also prints the domain UUIDs, the shutdown reason and security labels.
+
+=back
+
+B<EXAMPLE>
+
+An example format for the list is as follows:
+
+    Name                                        ID   Mem VCPUs      State   Time(s)
+    Domain-0                                     0   750     4     r-----   11794.3
+    win                                          1  1019     1     r-----       0.3
+    linux                                        2  2048     2     r-----    5624.2
+
+Name is the name of the domain.  ID the numeric domain id.  Mem is the
+desired amount of memory to allocate to the domain (although it may
+not be the currently allocated amount).  VCPUs is the number of
+virtual CPUs allocated to the domain.  State is the run state (see
+below).  Time is the total run time of the domain as accounted for by
+Xen.
+
+B<STATES>
+
+The State field lists 6 states for a Xen domain, and which ones the
+current domain is in.
+
+=over 4
+
+=item B<r - running>
+
+The domain is currently running on a CPU.
+
+=item B<b - blocked>
+
+The domain is blocked, and not running or runnable.  This can be caused
+because the domain is waiting on IO (a traditional wait state) or has
+gone to sleep because there was nothing else for it to do.
+
+=item B<p - paused>
+
+The domain has been paused, usually occurring through the administrator
+running B<xl pause>.  When in a paused state the domain will still
+consume allocated resources like memory, but will not be eligible for
+scheduling by the Xen hypervisor.
+
+=item B<s - shutdown>
+
+FIXME: Why would you ever see this state?
+
+=item B<c - crashed>
+
+The domain has crashed, which is always a violent ending.  Usually
+this state can only occur if the domain has been configured not to
+restart on crash.  See L<xldomain.cfg> for more info.
+
+=item B<d - dying>
+
+The domain is in process of dying, but hasn't completely shutdown or
+crashed.
+
+FIXME: Is this right?
+
+=back
+
+B<NOTES>
+
+=over 4
+
+The Time column is deceptive.  Virtual IO (network and block devices)
+used by domains requires coordination by Domain0, which means that
+Domain0 is actually charged for much of the time that a DomainU is
+doing IO.  Use of this time value to determine relative utilizations
+by domains is thus very suspect, as a high IO workload may show as
+less utilized than a high CPU workload.  Consider yourself warned.
+
+=back
+
+=item B<mem-max> I<domain-id> I<mem>
+
+Specify the maximum amount of memory the domain is able to use, appending 't'
+for terabytes, 'g' for gigabytes, 'm' for megabytes, 'k' for kilobytes and 'b'
+for bytes.
+
+The mem-max value may not correspond to the actual memory used in the
+domain, as it may balloon down its memory to give more back to the OS.
+
+=item B<mem-set> I<domain-id> I<mem>
+
+Set the domain's used memory using the balloon driver; append 't' for
+terabytes, 'g' for gigabytes, 'm' for megabytes, 'k' for kilobytes and 'b' for
+bytes.
+
+Because this operation requires cooperation from the domain operating
+system, there is no guarantee that it will succeed.  This command will
+definitely not work unless the domain has the required paravirt
+driver.
+
+B<Warning:> There is no good way to know in advance how small of a
+mem-set will make a domain unstable and cause it to crash.  Be very
+careful when using this command on running domains.
+
+=item B<migrate> [I<OPTIONS>] I<domain-id> I<host>
+
+Migrate a domain to another host machine. By default B<xl> relies on ssh as a
+transport mechanism between the two hosts.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-s> I<sshcommand>
+
+Use <sshcommand> instead of ssh.  String will be passed to sh. If empty, run
+<host> instead of ssh <host> xl migrate-receive [-d -e].
+
+=item B<-e>
+
+On the new host, do not wait in the background (on <host>) for the death of the
+domain.
+
+=item B<-C> I<config>
+
+Send <config> instead of config file from creation.
+
+=back
+
+=item B<pause> I<domain-id>
+
+Pause a domain.  When in a paused state the domain will still consume
+allocated resources such as memory, but will not be eligible for
+scheduling by the Xen hypervisor.
+
+=item B<reboot> [I<OPTIONS>] I<domain-id>
+
+Reboot a domain.  This acts just as if the domain had the B<reboot>
+command run from the console.  The command returns as soon as it has
+executed the reboot action, which may be significantly before the
+domain actually reboots.
+
+The behavior of what happens to a domain when it reboots is set by the
+B<on_reboot> parameter of the xldomain.cfg file when the domain was
+created.
+
+=item B<restore> [I<OPTIONS>] [I<ConfigFile>] I<CheckpointFile>
+
+Build a domain from an B<xl save> state file.  See B<save> for more info.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-p>
+
+Do not unpause domain after restoring it.
+
+=item B<-e>
+
+Do not wait in the background for the death of the domain on the new host.
+
+=item B<-d>
+
+Enable debug messages.
+
+=back
+
+=item B<save> [I<OPTIONS>] I<domain-id> I<CheckpointFile> [I<ConfigFile>]
+
+Saves a running domain to a state file so that it can be restored
+later.  Once saved, the domain will no longer be running on the
+system, unless the -c option is used.
+B<xl restore> restores from this checkpoint file.
+Passing a config file argument allows the user to manually select the VM config
+file used to create the domain.
+
+
+=over 4
+
+=item B<-c>
+
+Leave domain running after creating the snapshot.
+
+=back
+
+
+=item B<shutdown> [I<OPTIONS>] I<domain-id>
+
+Gracefully shuts down a domain.  This coordinates with the domain OS
+to perform graceful shutdown, so there is no guarantee that it will
+succeed, and may take a variable length of time depending on what
+services must be shutdown in the domain.  The command returns
+immediately after signally the domain unless that B<-w> flag is used.
+
+The behavior of what happens to a domain when it reboots is set by the
+B<on_shutdown> parameter of the xldomain.cfg file when the domain was
+created.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-w>
+
+Wait for the domain to complete shutdown before returning.
+
+=back
+
+=item B<sysrq> I<domain-id> I<letter>
+
+Send a I<Magic System Request> signal to the domain.  For more
+information on available magic sys req operations, see sysrq.txt in
+your Linux Kernel sources.
+
+=item B<unpause> I<domain-id>
+
+Moves a domain out of the paused state.  This will allow a previously
+paused domain to now be eligible for scheduling by the Xen hypervisor.
+
+=item B<vcpu-set> I<domain-id> I<vcpu-count>
+
+Enables the I<vcpu-count> virtual CPUs for the domain in question.
+Like mem-set, this command can only allocate up to the maximum virtual
+CPU count configured at boot for the domain.
+
+If the I<vcpu-count> is smaller than the current number of active
+VCPUs, the highest number VCPUs will be hotplug removed.  This may be
+important for pinning purposes.
+
+Attempting to set the VCPUs to a number larger than the initially
+configured VCPU count is an error.  Trying to set VCPUs to < 1 will be
+quietly ignored.
+
+Because this operation requires cooperation from the domain operating
+system, there is no guarantee that it will succeed.  This command will
+not work with a full virt domain.
+
+=item B<vcpu-list> [I<domain-id>]
+
+Lists VCPU information for a specific domain.  If no domain is
+specified, VCPU information for all domains will be provided.
+
+=item B<vcpu-pin> I<domain-id> I<vcpu> I<cpus>
+
+Pins the VCPU to only run on the specific CPUs.  The keyword
+B<all> can be used to apply the I<cpus> list to all VCPUs in the
+domain.
+
+Normally VCPUs can float between available CPUs whenever Xen deems a
+different run state is appropriate.  Pinning can be used to restrict
+this, by ensuring certain VCPUs can only run on certain physical
+CPUs.
+
+=item B<button-press> I<domain-id> I<button>
+
+Indicate an ACPI button press to the domain. I<button> is may be 'power' or
+'sleep'.
+
+=item B<trigger> I<domain-id> I<nmi|reset|init|power|sleep> [I<VCPU>]
+
+Send a trigger to a domain, where the trigger can be: nmi, reset, init, power
+or sleep.  Optionally a specific vcpu number can be passed as an argument.
+
+=item B<getenforce>
+
+Returns the current enforcing mode of the Flask Xen security module.
+
+=item B<setenforce> I<1|0|Enforcing|Permissive>
+
+Sets the current enforcing mode of the Flask Xen security module
+
+=item B<loadpolicy> I<policyfile>
+
+Loads a new policy int the Flask Xen security module.
+
+=back
+
+=head1 XEN HOST SUBCOMMANDS
+
+=over 4
+
+=item B<debug-keys> I<keys>
+
+Send debug I<keys> to Xen.
+
+=item B<dmesg> [B<-c>]
+
+Reads the Xen message buffer, similar to dmesg on a Linux system.  The
+buffer contains informational, warning, and error messages created
+during Xen's boot process.  If you are having problems with Xen, this
+is one of the first places to look as part of problem determination.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-c>, B<--clear>
+
+Clears Xen's message buffer.
+
+=back
+
+=item B<info> [B<-n>, B<--numa>]
+
+Print information about the Xen host in I<name : value> format.  When
+reporting a Xen bug, please provide this information as part of the
+bug report.
+
+Sample output looks as follows (lines wrapped manually to make the man
+page more readable):
+
+ host                   : talon
+ release                : 2.6.12.6-xen0
+ version                : #1 Mon Nov 14 14:26:26 EST 2005
+ machine                : i686
+ nr_cpus                : 2
+ nr_nodes               : 1
+ cores_per_socket       : 1
+ threads_per_core       : 1
+ cpu_mhz                : 696
+ hw_caps                : 0383fbff:00000000:00000000:00000040
+ total_memory           : 767
+ free_memory            : 37
+ xen_major              : 3
+ xen_minor              : 0
+ xen_extra              : -devel
+ xen_caps               : xen-3.0-x86_32
+ xen_scheduler          : credit
+ xen_pagesize           : 4096
+ platform_params        : virt_start=0xfc000000
+ xen_changeset          : Mon Nov 14 18:13:38 2005 +0100 
+                          7793:090e44133d40
+ cc_compiler            : gcc version 3.4.3 (Mandrakelinux 
+                          10.2 3.4.3-7mdk)
+ cc_compile_by          : sdague
+ cc_compile_domain      : (none)
+ cc_compile_date        : Mon Nov 14 14:16:48 EST 2005
+ xend_config_format     : 4
+
+B<FIELDS>
+
+Not all fields will be explained here, but some of the less obvious
+ones deserve explanation:
+
+=over 4
+
+=item B<hw_caps>
+
+A vector showing what hardware capabilities are supported by your
+processor.  This is equivalent to, though more cryptic, the flags
+field in /proc/cpuinfo on a normal Linux machine.
+
+=item B<free_memory>
+
+Available memory (in MB) not allocated to Xen, or any other domains.
+
+=item B<xen_caps>
+
+The Xen version and architecture.  Architecture values can be one of:
+x86_32, x86_32p (i.e. PAE enabled), x86_64, ia64.
+
+=item B<xen_changeset>
+
+The Xen mercurial changeset id.  Very useful for determining exactly
+what version of code your Xen system was built from.
+
+=back
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-n>, B<--numa>
+
+List host NUMA topology information
+
+=back
+
+=item B<top>
+
+Executes the B<xentop> command, which provides real time monitoring of
+domains.  Xentop is a curses interface, and reasonably self
+explanatory.
+
+=item B<uptime>
+
+Prints the current uptime of the domains running.
+
+=item B<pci-list-assignable-devices>
+
+List all the assignable PCI devices.
+
+=back
+
+=head1 SCHEDULER SUBCOMMANDS
+
+Xen ships with a number of domain schedulers, which can be set at boot
+time with the B<sched=> parameter on the Xen command line.  By
+default B<credit> is used for scheduling.
+
+=over 4
+
+=item B<sched-credit> [ B<-d> I<domain-id> [ B<-w>[B<=>I<WEIGHT>] | B<-c>[B<=>I<CAP>] ] ]
+
+Set credit scheduler parameters.  The credit scheduler is a
+proportional fair share CPU scheduler built from the ground up to be
+work conserving on SMP hosts.
+
+Each domain (including Domain0) is assigned a weight and a cap.
+
+B<PARAMETERS>
+
+=over 4
+
+=item I<WEIGHT>
+
+A domain with a weight of 512 will get twice as much CPU as a domain
+with a weight of 256 on a contended host. Legal weights range from 1
+to 65535 and the default is 256.
+
+=item I<CAP>
+
+The cap optionally fixes the maximum amount of CPU a domain will be
+able to consume, even if the host system has idle CPU cycles. The cap
+is expressed in percentage of one physical CPU: 100 is 1 physical CPU,
+50 is half a CPU, 400 is 4 CPUs, etc. The default, 0, means there is
+no upper cap.
+
+=back
+
+=back
+
+=head1 CPUPOOLS COMMANDS
+
+Xen can group the physical cpus of a server in cpu-pools. Each physical CPU is
+assigned at most to one cpu-pool. Domains are each restricted to a single
+cpu-pool. Scheduling does not cross cpu-pool boundaries, so each cpu-pool has
+an own scheduler.
+Physical cpus and domains can be moved from one pool to another only by an
+explicit command.
+
+=over 4
+
+=item B<cpupool-create> [I<OPTIONS>] I<ConfigFile>
+
+Create a cpu pool based an I<ConfigFile>.
+
+B<OPTIONS>
+
+=over 4
+
+=item B<-f=FILE>, B<--defconfig=FILE>
+
+Use the given configuration file.
+
+=item B<-n>, B<--dryrun>
+
+Dry run - prints the resulting configuration.
+
+=back
+
+=item B<cpupool-list> [I<-c|--cpus> I<cpu-pool>]
+
+List CPU pools on the host.
+If I<-c> is specified, B<xl> prints a list of CPUs used by I<cpu-pool>.
+
+=item B<cpupool-destroy> I<cpu-pool>
+
+Deactivates a cpu pool.
+
+=item B<cpupool-rename> I<cpu-pool> <newname>
+
+Renames a cpu pool to I<newname>.
+
+=item B<cpupool-cpu-add> I<cpu-pool> I<cpu-nr|node-nr>
+
+Adds a cpu or a numa node to a cpu pool.
+
+=item B<cpupool-cpu-remove> I<cpu-nr|node-nr>
+
+Removes a cpu or a numa node from a cpu pool.
+
+=item B<cpupool-migrate> I<domain-id> I<cpu-pool>
+
+Moves a domain into a cpu pool.
+
+=item B<cpupool-numa-split>
+
+Splits up the machine into one cpu pool per numa node.
+
+=back
+
+=head1 VIRTUAL DEVICE COMMANDS
+
+Most virtual devices can be added and removed while guests are
+running.  The effect to the guest OS is much the same as any hotplug
+event.
+
+=head2 BLOCK DEVICES
+
+=over 4
+
+=item B<block-attach> I<domain-id> I<disc-spec-component(s)> ...
+
+Create a new virtual block device.  This will trigger a hotplug event
+for the guest.
+
+B<OPTIONS>
+
+=over 4
+
+=item I<domain-id>
+
+The domain id of the guest domain that the device will be attached to.
+
+=item I<disc-spec-component>
+
+A disc specification in the same format used for the B<disk> variable in
+the domain config file. See L<xldomain.cfg>.
+
+=back
+
+=item B<block-detach> I<domain-id> I<devid> [B<--force>]
+
+Detach a domain's virtual block device. I<devid> may be the symbolic
+name or the numeric device id given to the device by domain 0.  You
+will need to run B<xl block-list> to determine that number.
+
+Detaching the device requires the cooperation of the domain.  If the
+domain fails to release the device (perhaps because the domain is hung
+or is still using the device), the detach will fail.  The B<--force>
+parameter will forcefully detach the device, but may cause IO errors
+in the domain.
+
+=item B<block-list> I<domain-id>
+
+List virtual block devices for a domain.
+
+=item B<cd-insert> I<domain-id> I<VirtualDevice> I<be-dev>
+
+Insert a cdrom into a guest domain's cd drive. Only works with HVM domains.
+
+B<OPTIONS>
+
+=over 4
+
+=item I<VirtualDevice>
+
+How the device should be presented to the guest domain; for example /dev/hdc.
+
+=item I<be-dev>
+
+the device in the backend domain (usually domain 0) to be exported; it can be a
+path to a file (file://path/to/file.iso). See B<disk> in L<xldomain.cfg> for the
+details.
+
+=back
+
+=item B<cd-eject> I<domain-id> I<VirtualDevice>
+
+Eject a cdrom from a guest's cd drive. Only works with HVM domains.
+I<VirtualDevice> is the cdrom device in the guest to eject.
+
+=back
+
+=head2 NETWORK DEVICES
+
+=over 4
+
+=item B<network-attach> I<domain-id> I<network-device>
+
+Creates a new network device in the domain specified by I<domain-id>.
+I<network-device> describes the device to attach, using the same format as the
+B<vif> string in the domain config file. See L<xldomain.cfg> for the
+description.
+
+=item B<network-detach> I<domain-id> I<devid|mac>
+
+Removes the network device from the domain specified by I<domain-id>.
+I<devid> is the virtual interface device number within the domain
+(i.e. the 3 in vif22.3). Alternatively the I<mac> address can be used to
+select the virtual interface to detach.
+
+=item B<network-list> I<domain-id>
+
+List virtual network interfaces for a domain.
+
+=back
+
+=head2 PCI PASS-THROUGH
+
+=over 4
+
+=item B<pci-attach> I<domain-id> I<BDF>
+
+Hot-plug a new pass-through pci device to the specified domain.
+B<BDF> is the PCI Bus/Device/Function of the physical device to pass-through.
+
+=item B<pci-detach> [I<-f>] I<domain-id> I<BDF>
+
+Hot-unplug a previously assigned pci device from a domain. B<BDF> is the PCI
+Bus/Device/Function of the physical device to be removed from the guest domain.
+
+If B<-f> is specified, B<xl> is going to forcefully remove the device even
+without guest's collaboration.
+
+=item B<pci-list> I<domain-id>
+
+List pass-through pci devices for a domain.
+
+=back
+
+=head1 SEE ALSO
+
+B<xldomain.cfg>(5), B<xentop>(1)
+
+=head1 AUTHOR
+
+  Stefano Stabellini <stefano.stabellini@eu.citrix.com>
+  Vincent Hanquez <vincent.hanquez@eu.citrix.com>
+  Ian Jackson <ian.jackson@eu.citrix.com>
+  Ian Campbell <Ian.Campbell@citrix.com>
+
+=head1 BUGS
+
+Send bugs to xen-devel@lists.xensource.com.

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 01 17:10:00 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 01 Nov 2011 17:10:00 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLOP1-0002dV-Dz; Tue, 01 Nov 2011 17:09:59 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLOB1-0000V2-7f
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 16:55:31 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-182.messagelabs.com!1320191728!1597175!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2252 invoked from network); 1 Nov 2011 23:55:28 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	1 Nov 2011 23:55:28 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLOAx-0007hZ-PD
	for xen-changelog@lists.xensource.com; Tue, 01 Nov 2011 23:55:27 +0000
Message-Id: <E1RLOAx-0007hZ-PD@xenbits.xen.org>
Date: Tue, 01 Nov 2011 23:55:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/ocaml: unify build process
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1320174218 0
# Node ID 068d3d55ce6e0862e83b443d4e1c83c84b26754d
# Parent  386f078de0ea55c1ff982ab045c4f8c2efe74d01
tools/ocaml: unify build process

Unify ocaml build process for different platforms.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 386f078de0ea -r 068d3d55ce6e tools/ocaml/common.make
--- a/tools/ocaml/common.make	Tue Nov 01 18:44:34 2011 +0000
+++ b/tools/ocaml/common.make	Tue Nov 01 19:03:38 2011 +0000
@@ -8,9 +8,7 @@
 OCAMLLEX ?= ocamllex
 OCAMLYACC ?= ocamlyacc
 
-CFLAGS += -fPIC -Werror
-CFLAGS-$(CONFIG_Linux) += -I$(shell ocamlc -where)
-CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
+CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 09:13:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 09:13:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLdR7-0001sZ-Ov; Wed, 02 Nov 2011 09:13:10 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLdPC-0001j4-5M
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 09:11:12 -0700
X-Env-Sender: ian.jackson@eu.citrix.com
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320250266!2056152!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1388 invoked from network); 2 Nov 2011 16:11:07 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 16:11:07 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <ian.jackson@eu.citrix.com>) id 1RLdP8-0002rd-GI
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 16:11:06 +0000
Date: Wed, 02 Nov 2011 16:11:06 +0000
Message-Id: <E1RLdP8-0002rd-GI@xenbits.xen.org>
From: patchbot@xen.org
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [qemu-xen-unstable] qemu-xen: remove
	i386-dm/README.hvm-pv-magic-ioport-disable
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

commit 52834188eedfbbca5636fd869d4c86b3b3044439
Author: Ian Campbell <ian.campbell@citrix.com>
Date:   Tue Nov 1 18:42:55 2011 +0000

    qemu-xen: remove i386-dm/README.hvm-pv-magic-ioport-disable
    
    I have just proposed a patch to add this to xen-unstable.hg as
    docs/misc/hvm-emulated-unplug.markdown. This repo is not a place where people
    look for docs, plus we are transitioning to upstream qemu.
    
    Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 i386-dm/README.hvm-pv-magic-ioport-disable |   70 ----------------------------
 1 files changed, 0 insertions(+), 70 deletions(-)

diff --git a/i386-dm/README.hvm-pv-magic-ioport-disable b/i386-dm/README.hvm-pv-magic-ioport-disable
deleted file mode 100644
index 142394a..0000000
--- a/i386-dm/README.hvm-pv-magic-ioport-disable
+++ /dev/null
@@ -1,70 +0,0 @@
-MAGIC IOPORT 0x10 PROTOCOL
-
-The protocol covers three basic things:
-
--- Disconnecting emulated devices.
--- Getting log messages out of the drivers and into dom0.
--- Allowing dom0 to block the loading of specific drivers.  This is
-   intended as a backwards-compatibility thing: if we discover a bug
-   in some old version of the drivers, then rather than working around
-   it in Xen, we have the option of just making those drivers fall
-   back to emulated mode.
-
-The current protocol works like this (from the point of view of
-drivers):
-
-1) When the drivers first come up, they check whether the unplug logic
-   is available by reading a two-byte magic number from IO port 0x10.
-   These should be 0x49d2.  If the magic number doesn't match, the
-   drivers don't do anything.
-
-2) The drivers read a one-byte protocol version from IO port 0x12.  If
-   this is 0, skip to 6.
-
-3) The drivers write a two-byte product number to IO port 0x12.  At
-   the moment, the only drivers using this protocol are our
-   closed-source ones, which use product number 1.
-
-4) The drivers write a four-byte build number to IO port 0x10.
-
-5) The drivers check the magic number by reading two bytes from 0x10
-   again.  If it's changed from 0x49d2 to 0xd249, the drivers are
-   blacklisted and should not load.
-
-6) The drivers write a two-byte bitmask of devices to unplug to IO
-   port 0x10.  The defined fields are:
-
-   1 -- All IDE disks (not including CD drives)
-   2 -- All emulated NICs
-   4 -- All IDE disks except for the primary master (not including CD
-	drives)
-
-   The relevant emulated devices then disappear from the relevant
-   buses.  For most guest operating systems, you want to do this
-   before device enumeration happens.
-
-...) Once the drivers have checked the magic number, they can send log
-     messages to qemu which will be logged to wherever qemu's logs go
-     (/var/log/xen/qemu-dm.log on normal Xen, dom0 syslog on
-     XenServer).  These messages are written to IO port 0x12 a byte at
-     a time, and are terminated by newlines.  There's a fairly
-     aggressive rate limiter on these messages, so they shouldn't be
-     used for anything even vaguely high-volume, but they're rather
-     useful for debugging and support.
-
-     It is still permitted for a driver to use this logging feature if
-     it is blacklisted, but ONLY if it has checked the magic number
-     and found it to be 0x49d2 or 0xd249.
-
-This isn't exactly a pretty protocol, but it does solve the problem.
-
-
-The blacklist is, from qemu's point of view, handled mostly through
-xenstore.  A driver version is considered to be blacklisted if
-/mh/driver-blacklist/{product_name}/{build_number} exists and is
-readable, where {build_number} is the build number from step 4 as a
-decimal number.  {product_name} is a string corresponding to the
-product number in step 3.
-
-The master registry of product names and numbers is in
-qemu-xen-unstable's xenstore.c.
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 13:33:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 13:33:23 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLhUw-0005KX-SW; Wed, 02 Nov 2011 13:33:22 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLhUu-0005Jv-Ln
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 13:33:21 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-216.messagelabs.com!1320265997!2073529!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2382 invoked from network); 2 Nov 2011 20:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 20:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLhUr-0002YW-3V
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 20:33:17 +0000
Message-Id: <E1RLhUr-0002YW-3V@xenbits.xen.org>
Date: Wed, 02 Nov 2011 20:33:16 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] tools/ocaml: unify build process
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1320246138 0
# Node ID 8c2d76193eafe78c2e846462fb41f1308df09088
# Parent  c33e15835e33a6ba4fde0c1d853cd2a7e3c0664e
tools/ocaml: unify build process

Unify ocaml build process for different platforms.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>

[ Backport had a conflict; fixed up in the obvious way. -iwj ]

xen-unstable.hg changeset: 24050:068d3d55ce6e
Backport-requested-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r c33e15835e33 -r 8c2d76193eaf tools/ocaml/common.make
--- a/tools/ocaml/common.make	Thu Oct 27 16:24:01 2011 +0100
+++ b/tools/ocaml/common.make	Wed Nov 02 15:02:18 2011 +0000
@@ -10,8 +10,7 @@
 
 CFLAGS += -fPIC -Werror
 CFLAGS += -I$(TOPLEVEL)/../include -I$(TOPLEVEL)/../libxc -I$(TOPLEVEL)/../xenstore -I$(TOPLEVEL)/../libxl
-CFLAGS-$(CONFIG_Linux) += -I$(shell ocamlc -where)
-CFLAGS-$(CONFIG_NetBSD) += -I/usr/pkg/lib/ocaml -fPIC
+CFLAGS += -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:00:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:00:21 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLir5-00083K-4Z; Wed, 02 Nov 2011 15:00:19 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir1-00082P-I5
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1320271212!86123!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 32567 invoked from network); 2 Nov 2011 22:00:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLiqx-00026b-Li
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:11 +0000
Message-Id: <E1RLiqx-00026b-Li@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VT-d/ATS: cleanup
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320238288 -3600
# Node ID 6da8953b7a902f9ea186bffdc169b9e0e97c277d
# Parent  068d3d55ce6e0862e83b443d4e1c83c84b26754d
VT-d/ATS: cleanup

- make acpi_find_matched_atsr_unit() consistent with
  acpi_find_matched_drhd_unit() (and constify their parameter)
- make ats_device() take a struct pci_dev * instead of seg:bus:devfn
  and additionally the matching DRHD (as its callers already worked
  that out)
- remove a stale prototype

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
---


diff -r 068d3d55ce6e -r 6da8953b7a90 xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Tue Nov 01 19:03:38 2011 +0000
+++ b/xen/drivers/passthrough/vtd/dmar.c	Wed Nov 02 13:51:28 2011 +0100
@@ -160,7 +160,7 @@
     return 0;
 }
 
-struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *pdev)
+struct acpi_drhd_unit *acpi_find_matched_drhd_unit(const struct pci_dev *pdev)
 {
     u8 bus, devfn;
     struct acpi_drhd_unit *drhd;
@@ -204,17 +204,17 @@
     return include_all;
 }
 
-struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u16 seg, u8 bus, u8 devfn)
+struct acpi_atsr_unit *acpi_find_matched_atsr_unit(const struct pci_dev *pdev)
 {
     struct acpi_atsr_unit *atsr;
     struct acpi_atsr_unit *all_ports = NULL;
 
     list_for_each_entry ( atsr, &acpi_atsr_units, list )
     {
-        if ( atsr->segment != seg )
+        if ( atsr->segment != pdev->seg )
             continue;
 
-        if ( test_bit(bus, atsr->scope.buses) )
+        if ( test_bit(pdev->bus, atsr->scope.buses) )
             return atsr;
 
         if ( atsr->all_ports )
diff -r 068d3d55ce6e -r 6da8953b7a90 xen/drivers/passthrough/vtd/dmar.h
--- a/xen/drivers/passthrough/vtd/dmar.h	Tue Nov 01 19:03:38 2011 +0000
+++ b/xen/drivers/passthrough/vtd/dmar.h	Wed Nov 02 13:51:28 2011 +0100
@@ -86,8 +86,8 @@
         for (idx = 0; (bdf = rmrr->scope.devices[idx]) && \
                  idx < rmrr->scope.devices_cnt; idx++)
 
-struct acpi_drhd_unit * acpi_find_matched_drhd_unit(struct pci_dev *pdev);
-struct acpi_atsr_unit * acpi_find_matched_atsr_unit(u16 seg, u8 bus, u8 devfn);
+struct acpi_drhd_unit *acpi_find_matched_drhd_unit(const struct pci_dev *);
+struct acpi_atsr_unit *acpi_find_matched_atsr_unit(const struct pci_dev *);
 
 #define DMAR_TYPE 1
 #define RMRR_TYPE 2
diff -r 068d3d55ce6e -r 6da8953b7a90 xen/drivers/passthrough/vtd/extern.h
--- a/xen/drivers/passthrough/vtd/extern.h	Tue Nov 01 19:03:38 2011 +0000
+++ b/xen/drivers/passthrough/vtd/extern.h	Wed Nov 02 13:51:28 2011 +0100
@@ -61,10 +61,9 @@
 
 struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu);
 
-int ats_device(int seg, int bus, int devfn);
+int ats_device(const struct pci_dev *, const struct acpi_drhd_unit *);
 int enable_ats_device(int seg, int bus, int devfn);
 void disable_ats_device(int seg, int bus, int devfn);
-int invalidate_ats_tcs(struct iommu *iommu);
 
 int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
                          u64 addr, unsigned int size_order, u64 type);
@@ -76,7 +75,8 @@
     return NULL;
 }
 
-static inline int ats_device(int seg, int bus, int devfn)
+static inline int ats_device(const struct pci_dev *pdev,
+                             const struct acpi_drhd_unit *drhd)
 {
     return 0;
 }
diff -r 068d3d55ce6e -r 6da8953b7a90 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 01 19:03:38 2011 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Nov 02 13:51:28 2011 +0100
@@ -1410,7 +1410,7 @@
                     domain->domain_id, seg, bus,
                     PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_mapping_one(domain, drhd->iommu, bus, devfn);
-        if ( !ret && ats_device(seg, bus, devfn) )
+        if ( !ret && ats_device(pdev, drhd) > 0 )
             enable_ats_device(seg, bus, devfn);
 
         break;
@@ -1541,7 +1541,7 @@
                     domain->domain_id, seg, bus,
                     PCI_SLOT(devfn), PCI_FUNC(devfn));
         ret = domain_context_unmap_one(domain, iommu, bus, devfn);
-        if ( !ret && ats_device(seg, bus, devfn) )
+        if ( !ret && ats_device(pdev, drhd) > 0 )
             disable_ats_device(seg, bus, devfn);
 
         break;
diff -r 068d3d55ce6e -r 6da8953b7a90 xen/drivers/passthrough/vtd/x86/ats.c
--- a/xen/drivers/passthrough/vtd/x86/ats.c	Tue Nov 01 19:03:38 2011 +0000
+++ b/xen/drivers/passthrough/vtd/x86/ats.c	Wed Nov 02 13:51:28 2011 +0100
@@ -83,40 +83,32 @@
     return NULL;
 }
 
-int ats_device(int seg, int bus, int devfn)
+int ats_device(const struct pci_dev *pdev, const struct acpi_drhd_unit *drhd)
 {
-    struct acpi_drhd_unit *drhd, *ats_drhd, *new_drhd;
-    struct pci_dev *pdev;
-    int pos = 0;
+    struct acpi_drhd_unit *ats_drhd;
+    int pos;
 
     if ( !ats_enabled || !iommu_qinval )
         return 0;
 
-    pdev = pci_get_pdev(seg, bus, devfn);
-    if ( !pdev )
-        return 0;
-
-    drhd = acpi_find_matched_drhd_unit(pdev);
-    if ( !drhd )
-        return 0;
-
     if ( !ecap_queued_inval(drhd->iommu->ecap) ||
          !ecap_dev_iotlb(drhd->iommu->ecap) )
         return 0;
 
-    if ( !acpi_find_matched_atsr_unit(seg, bus, devfn) )
+    if ( !acpi_find_matched_atsr_unit(pdev) )
         return 0;
 
     ats_drhd = find_ats_dev_drhd(drhd->iommu);
-    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    pos = pci_find_ext_capability(pdev->seg, pdev->bus, pdev->devfn,
+                                  PCI_EXT_CAP_ID_ATS);
 
     if ( pos && (ats_drhd == NULL) )
     {
-        new_drhd = xmalloc(struct acpi_drhd_unit);
-        if ( !new_drhd )
-            return 0;
-        memcpy(new_drhd, drhd, sizeof(struct acpi_drhd_unit));
-        list_add_tail(&new_drhd->list, &ats_dev_drhd_units);
+        ats_drhd = xmalloc(struct acpi_drhd_unit);
+        if ( !ats_drhd )
+            return -ENOMEM;
+        *ats_drhd = *drhd;
+        list_add_tail(&ats_drhd->list, &ats_dev_drhd_units);
     }
     return pos;
 }

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:00:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:00:38 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLirO-00087W-94; Wed, 02 Nov 2011 15:00:38 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir2-00082Q-Bz
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:16 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1320271213!1141328!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2532 invoked from network); 2 Nov 2011 22:00:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLiqy-00027x-RC
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:12 +0000
Message-Id: <E1RLiqy-00027x-RC@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: rename
	libxl__device_model_starting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319707156 -7200
# Node ID acfe774a0c9848e59962a797631c941f32fd4b4d
# Parent  119bccb1cc5eee1364bbbd3bd1a30f22e9db703a
libxl: rename libxl__device_model_starting

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 119bccb1cc5e -r acfe774a0c98 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Wed Nov 02 13:53:05 2011 +0100
+++ b/tools/libxl/libxl_create.c	Thu Oct 27 11:19:16 2011 +0200
@@ -434,7 +434,7 @@
                             uint32_t *domid_out, int restore_fd)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    libxl__device_model_starting *dm_starting = 0;
+    libxl__spawner_starting *dm_starting = 0;
     libxl_device_model_info *dm_info = &d_config->dm_info;
     libxl__domain_build_state state;
     uint32_t domid;
diff -r 119bccb1cc5e -r acfe774a0c98 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Wed Nov 02 13:53:05 2011 +0100
+++ b/tools/libxl/libxl_dm.c	Thu Oct 27 11:19:16 2011 +0200
@@ -518,7 +518,7 @@
 
 static void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
 {
-    libxl__device_model_starting *starting = for_spawn;
+    libxl__spawner_starting *starting = for_spawn;
     struct xs_handle *xsh;
     char *path = NULL, *pid = NULL;
     int len;
@@ -619,7 +619,7 @@
                                  libxl_device_nic *vifs, int num_vifs,
                                  libxl_device_vfb *vfb,
                                  libxl_device_vkb *vkb,
-                                 libxl__device_model_starting **starting_r)
+                                 libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     int i, num_console = STUBDOM_SPECIAL_CONSOLES, ret;
@@ -631,7 +631,7 @@
     char **args;
     struct xs_permissions perm[2];
     xs_transaction_t t;
-    libxl__device_model_starting *dm_starting = 0;
+    libxl__spawner_starting *dm_starting = 0;
     libxl_device_model_info xenpv_dm_info;
 
     if (info->device_model_version != LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL) {
@@ -784,7 +784,7 @@
     libxl_domain_unpause(ctx, domid);
 
     if (starting_r) {
-        *starting_r = calloc(1, sizeof(libxl__device_model_starting));
+        *starting_r = calloc(1, sizeof(libxl__spawner_starting));
         (*starting_r)->domid = info->domid;
         (*starting_r)->dom_path = libxl__xs_get_dompath(gc, info->domid);
         (*starting_r)->for_spawn = NULL;
@@ -802,14 +802,14 @@
                               libxl_device_model_info *info,
                               libxl_device_disk *disks, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
-                              libxl__device_model_starting **starting_r)
+                              libxl__spawner_starting **starting_r)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path, *logfile;
     int logfile_w, null;
     int rc;
     char **args;
-    libxl__device_model_starting buf_starting, *p;
+    libxl__spawner_starting buf_starting, *p;
     xs_transaction_t t;
     char *vm_path;
     char **pass_stuff;
@@ -861,7 +861,7 @@
 
     if (starting_r) {
         rc = ERROR_NOMEM;
-        *starting_r = calloc(1, sizeof(libxl__device_model_starting));
+        *starting_r = calloc(1, sizeof(libxl__spawner_starting));
         if (!*starting_r)
             goto out_close;
         p = *starting_r;
@@ -915,7 +915,7 @@
 }
 
 static int detach_device_model(libxl__gc *gc,
-                               libxl__device_model_starting *starting)
+                               libxl__spawner_starting *starting)
 {
     int rc;
     rc = libxl__spawn_detach(gc, starting->for_spawn);
@@ -926,7 +926,7 @@
 }
 
 int libxl__confirm_device_model_startup(libxl__gc *gc,
-                                       libxl__device_model_starting *starting)
+                                       libxl__spawner_starting *starting)
 {
     int detach;
     int problem = libxl__wait_for_device_model(gc, starting->domid, "running",
@@ -1041,7 +1041,7 @@
 int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                              libxl_device_model_info *info,
                              libxl_device_vfb *vfb,
-                             libxl__device_model_starting **starting_r)
+                             libxl__spawner_starting **starting_r)
 {
     libxl__build_xenpv_qemu_args(gc, domid, vfb, info);
     libxl__create_device_model(gc, info, NULL, 0, NULL, 0, starting_r);
diff -r 119bccb1cc5e -r acfe774a0c98 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Wed Nov 02 13:53:05 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:19:16 2011 +0200
@@ -270,7 +270,7 @@
     char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */
     int domid;
     libxl__spawn_starting *for_spawn;
-} libxl__device_model_starting;
+} libxl__spawner_starting;
 
 /* from xl_create */
 _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid);
@@ -287,11 +287,11 @@
                               libxl_device_model_info *info,
                               libxl_device_disk *disk, int num_disks,
                               libxl_device_nic *vifs, int num_vifs,
-                              libxl__device_model_starting **starting_r);
+                              libxl__spawner_starting **starting_r);
 _hidden int libxl__create_xenpv_qemu(libxl__gc *gc, uint32_t domid,
                               libxl_device_model_info *dm_info,
                               libxl_device_vfb *vfb,
-                              libxl__device_model_starting **starting_r);
+                              libxl__spawner_starting **starting_r);
 _hidden int libxl__need_xenpv_qemu(libxl__gc *gc,
         int nr_consoles, libxl_device_console *consoles,
         int nr_vfbs, libxl_device_vfb *vfbs,
@@ -300,8 +300,8 @@
    * return pass *starting_r (which will be non-0) to
    * libxl_confirm_device_model or libxl_detach_device_model. */
 _hidden int libxl__confirm_device_model_startup(libxl__gc *gc,
-                              libxl__device_model_starting *starting);
-_hidden int libxl__detach_device_model(libxl__gc *gc, libxl__device_model_starting *starting);
+                              libxl__spawner_starting *starting);
+_hidden int libxl__detach_device_model(libxl__gc *gc, libxl__spawner_starting *starting);
 _hidden int libxl__wait_for_device_model(libxl__gc *gc,
                                 uint32_t domid, char *state,
                                 libxl__spawn_starting *spawning,

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:00:48 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:00:48 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLirY-0008AT-7S; Wed, 02 Nov 2011 15:00:48 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir3-00082S-4t
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:17 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320271213!2084271!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10384 invoked from network); 2 Nov 2011 22:00:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLiqz-00028d-C8
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:13 +0000
Message-Id: <E1RLiqz-00028d-C8@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: rename dm_xenstore_record_pid
	to libxl_spawner_record_pid
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319707162 -7200
# Node ID d577f5ae4986a2c1f3c4fd89162284c72b52573c
# Parent  acfe774a0c9848e59962a797631c941f32fd4b4d
libxl: rename dm_xenstore_record_pid to libxl_spawner_record_pid

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r acfe774a0c98 -r d577f5ae4986 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Oct 27 11:19:16 2011 +0200
+++ b/tools/libxl/libxl_dm.c	Thu Oct 27 11:19:22 2011 +0200
@@ -516,31 +516,6 @@
     }
 }
 
-static void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
-{
-    libxl__spawner_starting *starting = for_spawn;
-    struct xs_handle *xsh;
-    char *path = NULL, *pid = NULL;
-    int len;
-
-    if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0)
-        goto out;
-
-    len = asprintf(&pid, "%d", innerchild);
-    if (len < 0)
-        goto out;
-
-    /* we mustn't use the parent's handle in the child */
-    xsh = xs_daemon_open();
-
-    xs_write(xsh, XBT_NULL, path, pid, len);
-
-    xs_daemon_close(xsh);
-out:
-    free(path);
-    free(pid);
-}
-
 static int libxl__vfb_and_vkb_from_device_model_info(libxl__gc *gc,
                                                      libxl_device_model_info *info,
                                                      libxl_device_vfb *vfb,
@@ -896,7 +871,7 @@
     }
 
     rc = libxl__spawn_spawn(gc, p->for_spawn, "device model",
-                            dm_xenstore_record_pid, p);
+                            libxl_spawner_record_pid, p);
     if (rc < 0)
         goto out_close;
     if (!rc) { /* inner child */
diff -r acfe774a0c98 -r d577f5ae4986 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Thu Oct 27 11:19:16 2011 +0200
+++ b/tools/libxl/libxl_exec.c	Thu Oct 27 11:19:22 2011 +0200
@@ -144,6 +144,31 @@
     }
 }
 
+void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild)
+{
+    libxl__spawner_starting *starting = for_spawn;
+    struct xs_handle *xsh;
+    char *path = NULL, *pid = NULL;
+    int len;
+
+    if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0)
+        goto out;
+
+    len = asprintf(&pid, "%d", innerchild);
+    if (len < 0)
+        goto out;
+
+    /* we mustn't use the parent's handle in the child */
+    xsh = xs_daemon_open();
+
+    xs_write(xsh, XBT_NULL, path, pid, len);
+
+    xs_daemon_close(xsh);
+out:
+    free(path);
+    free(pid);
+}
+
 static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag)
 {
     int flags;
diff -r acfe774a0c98 -r d577f5ae4986 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:19:16 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:19:22 2011 +0200
@@ -267,7 +267,7 @@
 } libxl__spawn_starting;
 
 typedef struct {
-    char *dom_path; /* from libxl_malloc, only for dm_xenstore_record_pid */
+    char *dom_path; /* from libxl_malloc, only for libxl_spawner_record_pid */
     int domid;
     libxl__spawn_starting *for_spawn;
 } libxl__spawner_starting;
@@ -318,6 +318,8 @@
                       void *hook_data);
 _hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid);
 
+_hidden void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild);
+
   /* Logs errors.  A copy of "what" is taken.  Return values:
    *  < 0   error, for_spawn need not be detached
    *   +1   caller is the parent, must call detach on *for_spawn eventually

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:00:56 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:00:56 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLirg-0008Da-Ly; Wed, 02 Nov 2011 15:00:56 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir3-00082U-OE
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-216.messagelabs.com!1320271214!2082884!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6325 invoked from network); 2 Nov 2011 22:00:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir0-00029t-Et
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:14 +0000
Message-Id: <E1RLir0-00029t-Et@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add libxl__wait_for_offspring
	function
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319707404 -7200
# Node ID 62360c6aff9f7676eeea42ccd9b0e8e248cd8305
# Parent  3235ee6505cd79287cff69fda6b2aed60c31b58a
libxl: add libxl__wait_for_offspring function

libxl__wait_for_offspring() is a generic version of
libxl__wait_for_device_model().

Use libxl__wait_for_offspring for device model.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 3235ee6505cd -r 62360c6aff9f tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Thu Oct 27 11:20:25 2011 +0200
+++ b/tools/libxl/libxl_device.c	Thu Oct 27 11:23:24 2011 +0200
@@ -562,88 +562,12 @@
                                                        void *userdata),
                                  void *check_callback_userdata)
 {
-    libxl_ctx *ctx = libxl__gc_owner(gc);
     char *path;
-    char *p;
-    unsigned int len;
-    int rc = 0;
-    struct xs_handle *xsh;
-    int nfds;
-    fd_set rfds;
-    struct timeval tv;
-    unsigned int num;
-    char **l = NULL;
-
-    xsh = xs_daemon_open();
-    if (xsh == NULL) {
-        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to open xenstore connection");
-        goto err;
-    }
-
     path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
-    xs_watch(xsh, path, path);
-    tv.tv_sec = LIBXL_DEVICE_MODEL_START_TIMEOUT;
-    tv.tv_usec = 0;
-    nfds = xs_fileno(xsh) + 1;
-    if (spawning && spawning->fd > xs_fileno(xsh))
-        nfds = spawning->fd + 1;
-
-    while (rc > 0 || (!rc && tv.tv_sec > 0)) {
-        if ( spawning ) {
-            rc = libxl__spawn_check(gc, spawning);
-            if ( rc ) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
-                           "Device Model died during startup");
-                rc = -1;
-                goto err_died;
-            }
-        }
-        p = xs_read(xsh, XBT_NULL, path, &len);
-        if ( NULL == p )
-            goto again;
-
-        if ( NULL != state && strcmp(p, state) )
-            goto again;
-
-        if ( NULL != check_callback ) {
-            rc = (*check_callback)(gc, domid, p, check_callback_userdata);
-            if ( rc > 0 )
-                goto again;
-        }
-
-        free(p);
-        xs_unwatch(xsh, path, path);
-        xs_daemon_close(xsh);
-        return rc;
-again:
-        free(p);
-        FD_ZERO(&rfds);
-        FD_SET(xs_fileno(xsh), &rfds);
-        if (spawning)
-            FD_SET(spawning->fd, &rfds);
-        rc = select(nfds, &rfds, NULL, NULL, &tv);
-        if (rc > 0) {
-            if (FD_ISSET(xs_fileno(xsh), &rfds)) {
-                l = xs_read_watch(xsh, &num);
-                if (l != NULL)
-                    free(l);
-                else
-                    goto again;
-            }
-            if (spawning && FD_ISSET(spawning->fd, &rfds)) {
-                unsigned char dummy;
-                if (read(spawning->fd, &dummy, sizeof(dummy)) != 1)
-                    LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_DEBUG,
-                                     "failed to read spawn status pipe");
-            }
-        }
-    }
-    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model not ready");
-err_died:
-    xs_unwatch(xsh, path, path);
-    xs_daemon_close(xsh);
-err:
-    return -1;
+    return libxl__wait_for_offspring(gc, domid,
+                                     LIBXL_DEVICE_MODEL_START_TIMEOUT,
+                                     "Device Model", path, state, spawning,
+                                     check_callback, check_callback_userdata);
 }
 
 int libxl__wait_for_backend(libxl__gc *gc, char *be_path, char *state)
diff -r 3235ee6505cd -r 62360c6aff9f tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Thu Oct 27 11:20:25 2011 +0200
+++ b/tools/libxl/libxl_exec.c	Thu Oct 27 11:23:24 2011 +0200
@@ -169,6 +169,99 @@
     free(pid);
 }
 
+int libxl__wait_for_offspring(libxl__gc *gc,
+                                 uint32_t domid,
+                                 uint32_t timeout, char *what,
+                                 char *path, char *state,
+                                 libxl__spawn_starting *spawning,
+                                 int (*check_callback)(libxl__gc *gc,
+                                                       uint32_t domid,
+                                                       const char *state,
+                                                       void *userdata),
+                                 void *check_callback_userdata)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *p;
+    unsigned int len;
+    int rc = 0;
+    struct xs_handle *xsh;
+    int nfds;
+    fd_set rfds;
+    struct timeval tv;
+    unsigned int num;
+    char **l = NULL;
+
+    xsh = xs_daemon_open();
+    if (xsh == NULL) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Unable to open xenstore connection");
+        goto err;
+    }
+
+    xs_watch(xsh, path, path);
+    tv.tv_sec = timeout;
+    tv.tv_usec = 0;
+    nfds = xs_fileno(xsh) + 1;
+    if (spawning && spawning->fd > xs_fileno(xsh))
+        nfds = spawning->fd + 1;
+
+    while (rc > 0 || (!rc && tv.tv_sec > 0)) {
+        if ( spawning ) {
+            rc = libxl__spawn_check(gc, spawning);
+            if ( rc ) {
+                LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                           "%s died during startup", what);
+                rc = -1;
+                goto err_died;
+            }
+        }
+        p = xs_read(xsh, XBT_NULL, path, &len);
+        if ( NULL == p )
+            goto again;
+
+        if ( NULL != state && strcmp(p, state) )
+            goto again;
+
+        if ( NULL != check_callback ) {
+            rc = (*check_callback)(gc, domid, p, check_callback_userdata);
+            if ( rc > 0 )
+                goto again;
+        }
+
+        free(p);
+        xs_unwatch(xsh, path, path);
+        xs_daemon_close(xsh);
+        return rc;
+again:
+        free(p);
+        FD_ZERO(&rfds);
+        FD_SET(xs_fileno(xsh), &rfds);
+        if (spawning)
+            FD_SET(spawning->fd, &rfds);
+        rc = select(nfds, &rfds, NULL, NULL, &tv);
+        if (rc > 0) {
+            if (FD_ISSET(xs_fileno(xsh), &rfds)) {
+                l = xs_read_watch(xsh, &num);
+                if (l != NULL)
+                    free(l);
+                else
+                    goto again;
+            }
+            if (spawning && FD_ISSET(spawning->fd, &rfds)) {
+                unsigned char dummy;
+                if (read(spawning->fd, &dummy, sizeof(dummy)) != 1)
+                    LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_DEBUG,
+                                     "failed to read spawn status pipe");
+            }
+        }
+    }
+    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "%s not ready", what);
+err_died:
+    xs_unwatch(xsh, path, path);
+    xs_daemon_close(xsh);
+err:
+    return -1;
+}
+
 static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag)
 {
     int flags;
diff -r 3235ee6505cd -r 62360c6aff9f tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:20:25 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:23:24 2011 +0200
@@ -321,6 +321,16 @@
 
 _hidden void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild);
 
+_hidden int libxl__wait_for_offspring(libxl__gc *gc,
+                                 uint32_t domid,
+                                 uint32_t timeout, char *what,
+                                 char *path, char *state,
+                                 libxl__spawn_starting *spawning,
+                                 int (*check_callback)(libxl__gc *gc,
+                                                       uint32_t domid,
+                                                       const char *state,
+                                                       void *userdata),
+                                 void *check_callback_userdata);
   /* Logs errors.  A copy of "what" is taken.  Return values:
    *  < 0   error, for_spawn need not be detached
    *   +1   caller is the parent, must call detach on *for_spawn eventually
@@ -336,7 +346,7 @@
   /* Logs errors but also returns them.
    * for_spawn must actually be a  libxl__spawn_starting*  but
    * we take void* so you can pass this function directly to
-   * libxl__wait_for_device_model.  Caller must still call detach. */
+   * libxl__wait_for_offspring.  Caller must still call detach. */
 
  /* low-level stuff, for synchronous subprocesses etc. */
 

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:05 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLiro-0008HB-U2; Wed, 02 Nov 2011 15:01:05 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir4-00082V-7g
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:18 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1320271215!3416671!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8577 invoked from network); 2 Nov 2011 22:00:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir1-0002AX-0q
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:15 +0000
Message-Id: <E1RLir1-0002AX-0q@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add
	libxl__spawn_confirm_offspring_startup
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319707409 -7200
# Node ID feee3cb40887d43e3de301324655c7655311cfbd
# Parent  62360c6aff9f7676eeea42ccd9b0e8e248cd8305
libxl: add libxl__spawn_confirm_offspring_startup

libxl__spawn_confirm_offspring_startup() is a generic version of
libxl__confirm_device_model_startup().

Use libxl__spawn_confirm_offspring_startup for device model.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_dm.c	Thu Oct 27 11:23:29 2011 +0200
@@ -890,25 +890,16 @@
     return rc;
 }
 
-static int detach_device_model(libxl__gc *gc,
-                               libxl__spawner_starting *starting)
-{
-    int rc;
-    rc = libxl__spawn_detach(gc, starting->for_spawn);
-    if (starting->for_spawn)
-        free(starting->for_spawn);
-    free(starting);
-    return rc;
-}
 
 int libxl__confirm_device_model_startup(libxl__gc *gc,
                                        libxl__spawner_starting *starting)
 {
-    int detach;
-    int problem = libxl__wait_for_device_model(gc, starting->domid, "running",
-                                               starting->for_spawn, NULL, NULL);
-    detach = detach_device_model(gc, starting);
-    return problem ? problem : detach;
+    char *path;
+    int domid = starting->domid;
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+    return libxl__spawn_confirm_offspring_startup(gc,
+                                     LIBXL_DEVICE_MODEL_START_TIMEOUT,
+                                     "Device Model", path, "running", starting);
 }
 
 int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_exec.c	Thu Oct 27 11:23:29 2011 +0200
@@ -262,6 +262,30 @@
     return -1;
 }
 
+static int detach_offspring(libxl__gc *gc,
+                               libxl__spawner_starting *starting)
+{
+    int rc;
+    rc = libxl__spawn_detach(gc, starting->for_spawn);
+    if (starting->for_spawn)
+        free(starting->for_spawn);
+    free(starting);
+    return rc;
+}
+
+int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
+                                       uint32_t timeout, char *what,
+                                       char *path, char *state,
+                                       libxl__spawner_starting *starting)
+{
+    int detach;
+    int problem = libxl__wait_for_offspring(gc, starting->domid, timeout, what,
+                                               path, state,
+                                               starting->for_spawn, NULL, NULL);
+    detach = detach_offspring(gc, starting);
+    return problem ? problem : detach;
+}
+
 static int libxl__set_fd_flag(libxl__gc *gc, int fd, int flag)
 {
     int flags;
diff -r 62360c6aff9f -r feee3cb40887 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:23:24 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:23:29 2011 +0200
@@ -331,6 +331,12 @@
                                                        const char *state,
                                                        void *userdata),
                                  void *check_callback_userdata);
+
+_hidden int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
+                                       uint32_t timeout, char *what,
+                                       char *path, char *state,
+                                       libxl__spawner_starting *starting);
+
   /* Logs errors.  A copy of "what" is taken.  Return values:
    *  < 0   error, for_spawn need not be detached
    *   +1   caller is the parent, must call detach on *for_spawn eventually

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLis2-0008Kw-Db; Wed, 02 Nov 2011 15:01:18 -0700
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir5-00082b-2w
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:19 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1320271215!88102!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20068 invoked from network); 2 Nov 2011 22:00:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir1-0002B6-I1
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:15 +0000
Message-Id: <E1RLir1-0002B6-I1@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: document spawn related
	functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319708351 -7200
# Node ID a3000b1c0fab28d663ebc7fc7533109bd69766d2
# Parent  feee3cb40887d43e3de301324655c7655311cfbd
libxl: document spawn related functions

Group spawn related prototypes and add some documentation.
Remove unused prototype for libxl__log_child_exitstatus

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r feee3cb40887 -r a3000b1c0fab tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:23:29 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:39:11 2011 +0200
@@ -273,6 +273,121 @@
     libxl__spawn_starting *for_spawn;
 } libxl__spawner_starting;
 
+/*
+ * libxl__spawn_spawn - Create a new process
+ * gc: allocation pool
+ * for_spawn: malloc'd pointer to libxl__spawn_starting (optional)
+ * what: string describing the spawned process
+ * intermediate_hook: helper to record pid, such as libxl_spawner_record_pid
+ * hook_data: data to pass to the hook function
+ *
+ * Logs errors.  A copy of "what" is taken. 
+ * Return values:
+ *  < 0   error, for_spawn need not be detached
+ *   +1   caller is the parent, must call detach on *for_spawn eventually
+ *    0   caller is now the inner child, should probably call libxl__exec
+ * Caller, may pass 0 for for_spawn, in which case no need to detach.
+ */
+_hidden int libxl__spawn_spawn(libxl__gc *gc,
+                      libxl__spawn_starting *for_spawn,
+                      const char *what,
+                      void (*intermediate_hook)(void *for_spawn, pid_t innerchild),
+                      void *hook_data);
+
+/*
+ * libxl_spawner_record_pid - Record given pid in xenstore
+ * for_spawn: malloc'd pointer to libxl__spawn_starting (optional)
+ * innerchild: pid of the child
+ *
+ * This function is passed as intermediate_hook to libxl__spawn_spawn.
+ */
+_hidden void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild);
+
+/*
+ * libxl__spawn_confirm_offspring_startup - Wait for child state
+ * gc: allocation pool
+ * timeout: how many seconds to wait for the child
+ * what: string describing the spawned process
+ * path: path to the state file in xenstore
+ * state: expected string to wait for in path (optional)
+ * starting: malloc'd pointer to libxl__spawner_starting
+ *
+ * Returns 0 on success, and < 0 on error.
+ *
+ * This function waits the given timeout for the given path to appear
+ * in xenstore, and optionally for state in path.
+ * The intermediate process created in libxl__spawn_spawn is killed.
+ * The memory referenced by starting->for_spawn and starting is free'd.
+ */
+_hidden int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
+                                       uint32_t timeout, char *what,
+                                       char *path, char *state,
+                                       libxl__spawner_starting *starting);
+
+/*
+ * libxl__wait_for_offspring - Wait for child state
+ * gc: allocation pool
+ * domid: guest to work with
+ * timeout: how many seconds to wait for the state to appear
+ * what: string describing the spawned process
+ * path: path to the state file in xenstore
+ * state: expected string to wait for in path (optional)
+ * spawning: malloc'd pointer to libxl__spawn_starting (optional)
+ * check_callback: (optional)
+ * check_callback_userdata: data to pass to the callback function
+ *
+ * Returns 0 on success, and < 0 on error.
+ *
+ * This function waits the given timeout for the given path to appear
+ * in xenstore, and optionally for state in path.
+ * If path appears and state matches, check_callback is called.
+ * If check_callback returns > 0, waiting for path or state continues.
+ * Otherwise libxl__wait_for_offspring returns.
+ */
+_hidden int libxl__wait_for_offspring(libxl__gc *gc,
+                                 uint32_t domid,
+                                 uint32_t timeout, char *what,
+                                 char *path, char *state,
+                                 libxl__spawn_starting *spawning,
+                                 int (*check_callback)(libxl__gc *gc,
+                                                       uint32_t domid,
+                                                       const char *state,
+                                                       void *userdata),
+                                 void *check_callback_userdata);
+
+/*
+ * libxl__spawn_detach - Kill intermediate process from spawn_spawn
+ * gc: allocation pool
+ * for_spawn: malloc'd pointer to libxl__spawn_starting (optional)
+ *
+ * Returns 0 on success, and < 0 on error.
+ *
+ * Logs errors.  Idempotent, but only permitted after successful
+ * call to libxl__spawn_spawn, and no point calling it again if it fails.
+ */
+_hidden int libxl__spawn_detach(libxl__gc *gc,
+                       libxl__spawn_starting *for_spawn);
+
+/*
+ * libxl__spawn_check - Check intermediate child process
+ * gc: allocation pool
+ * for_spawn: malloc'd pointer to libxl__spawn_starting (optional)
+ *
+ * Returns 0 on success, and < 0 on error.
+ *
+ * Logs errors but also returns them.
+ * for_spawn must actually be a  libxl__spawn_starting*  but
+ * we take void* so you can pass this function directly to
+ * libxl__wait_for_offspring.  Caller must still call detach.
+ */
+_hidden int libxl__spawn_check(libxl__gc *gc,
+                      void *for_spawn);
+
+ /* low-level stuff, for synchronous subprocesses etc. */
+
+_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd,
+               const char *arg0, char **args); // logs errors, never returns
+
 /* from xl_create */
 _hidden int libxl__domain_make(libxl__gc *gc, libxl_domain_create_info *info, uint32_t *domid);
 _hidden int libxl__domain_build(libxl__gc *gc,
@@ -299,7 +414,7 @@
         int nr_disks, libxl_device_disk *disks);
   /* Caller must either: pass starting_r==0, or on successful
    * return pass *starting_r (which will be non-0) to
-   * libxl_confirm_device_model or libxl_detach_device_model. */
+   * libxl__confirm_device_model_startup or libxl__detach_device_model. */
 _hidden int libxl__confirm_device_model_startup(libxl__gc *gc,
                               libxl__spawner_starting *starting);
 _hidden int libxl__detach_device_model(libxl__gc *gc, libxl__spawner_starting *starting);
@@ -312,55 +427,8 @@
                                                       void *userdata),
                                 void *check_callback_userdata);
 
-_hidden int libxl__spawn_spawn(libxl__gc *gc,
-                      libxl__spawn_starting *starting,
-                      const char *what,
-                      void (*intermediate_hook)(void *for_spawn, pid_t innerchild),
-                      void *hook_data);
 _hidden int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid);
 
-_hidden void libxl_spawner_record_pid(void *for_spawn, pid_t innerchild);
-
-_hidden int libxl__wait_for_offspring(libxl__gc *gc,
-                                 uint32_t domid,
-                                 uint32_t timeout, char *what,
-                                 char *path, char *state,
-                                 libxl__spawn_starting *spawning,
-                                 int (*check_callback)(libxl__gc *gc,
-                                                       uint32_t domid,
-                                                       const char *state,
-                                                       void *userdata),
-                                 void *check_callback_userdata);
-
-_hidden int libxl__spawn_confirm_offspring_startup(libxl__gc *gc,
-                                       uint32_t timeout, char *what,
-                                       char *path, char *state,
-                                       libxl__spawner_starting *starting);
-
-  /* Logs errors.  A copy of "what" is taken.  Return values:
-   *  < 0   error, for_spawn need not be detached
-   *   +1   caller is the parent, must call detach on *for_spawn eventually
-   *    0   caller is now the inner child, should probably call libxl__exec
-   * Caller, may pass 0 for for_spawn, in which case no need to detach.
-   */
-_hidden int libxl__spawn_detach(libxl__gc *gc,
-                       libxl__spawn_starting *for_spawn);
-  /* Logs errors.  Idempotent, but only permitted after successful
-   * call to libxl__spawn_spawn, and no point calling it again if it fails. */
-_hidden int libxl__spawn_check(libxl__gc *gc,
-                      void *for_spawn);
-  /* Logs errors but also returns them.
-   * for_spawn must actually be a  libxl__spawn_starting*  but
-   * we take void* so you can pass this function directly to
-   * libxl__wait_for_offspring.  Caller must still call detach. */
-
- /* low-level stuff, for synchronous subprocesses etc. */
-
-_hidden void libxl__exec(int stdinfd, int stdoutfd, int stderrfd,
-               const char *arg0, char **args); // logs errors, never returns
-_hidden void libxl__log_child_exitstatus(libxl__gc *gc,
-                                const char *what, pid_t pid, int status);
-
 _hidden char *libxl__abs_path(libxl__gc *gc, const char *s, const char *path);
 
 #define LIBXL__LOG_DEBUG   XTL_DEBUG

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:26 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:26 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLisA-0008O1-QZ; Wed, 02 Nov 2011 15:01:26 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir6-00082z-Qw
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1320271201!46783467!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16906 invoked from network); 2 Nov 2011 22:00:01 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:01 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir3-0002Df-Mg
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:17 +0000
Message-Id: <E1RLir3-0002Df-Mg@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: allow to enable/disable cpuid
	bits
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Christoph Egger <Christoph.Egger@amd.com>
# Date 1320251003 0
# Node ID a6aa8ddce35a48315d0a43b7bedb1f95394c9dc9
# Parent  205b89ad2d660dab2768f74c6c1a9ea64de228eb
libxl: allow to enable/disable cpuid bits

Allow to enable/disable SVM specific cpuid bits in the guest config
file via cpuid config option.  Also allow to enable/disable the
hypervisor cpuid bit in the guest config file. We need to disable the
hypervisor cpuid bit to get Hyper-V going.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 205b89ad2d66 -r a6aa8ddce35a tools/libxl/libxl_cpuid.c
--- a/tools/libxl/libxl_cpuid.c	Wed Nov 02 16:21:37 2011 +0000
+++ b/tools/libxl/libxl_cpuid.c	Wed Nov 02 16:23:23 2011 +0000
@@ -92,6 +92,7 @@
         {"proccount",    0x00000001, NA, CPUID_REG_EBX, 16,  8},
         {"clflush",      0x00000001, NA, CPUID_REG_EBX,  8,  8},
         {"brandid",      0x00000001, NA, CPUID_REG_EBX,  0,  8},
+        {"hypervisor",   0x00000001, NA, CPUID_REG_ECX, 31,  1},
         {"f16c",         0x00000001, NA, CPUID_REG_ECX, 29,  1},
         {"avx",          0x00000001, NA, CPUID_REG_ECX, 28,  1},
         {"osxsave",      0x00000001, NA, CPUID_REG_ECX, 27,  1},
@@ -178,6 +179,13 @@
         {"procpkg",      0x00000004,  0, CPUID_REG_EAX, 26,  6},
         {"apicidsize",   0x80000008, NA, CPUID_REG_ECX, 12,  4},
         {"nc",           0x80000008, NA, CPUID_REG_ECX,  0,  8},
+        {"svm_npt",      0x8000000a, NA, CPUID_REG_EDX,  0,  1},
+        {"svm_lbrv",     0x8000000a, NA, CPUID_REG_EDX,  1,  1},
+        {"svm_nrips",    0x8000000a, NA, CPUID_REG_EDX,  3,  1},
+        {"svm_tscrate",  0x8000000a, NA, CPUID_REG_EDX,  4,  1},
+        {"svm_vmcbclean",0x8000000a, NA, CPUID_REG_EDX,  5,  1},
+        {"svm_decode",   0x8000000a, NA, CPUID_REG_EDX,  7,  1},
+        {"svm_pausefilt",0x8000000a, NA, CPUID_REG_EDX, 10,  1},
 
         {NULL, 0, CPUID_REG_INV, 0, 0}
     };

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:34 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLisI-0008Qq-4A; Wed, 02 Nov 2011 15:01:34 -0700
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir6-00082t-Is
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-216.messagelabs.com!1320271217!2082870!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16898 invoked from network); 2 Nov 2011 22:00:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir3-0002D3-66
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:17 +0000
Message-Id: <E1RLir3-0002D3-66@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Update QEMU_TAG
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Jackson <Ian.Jackson@eu.citrix.com>
# Date 1320250897 0
# Node ID 205b89ad2d660dab2768f74c6c1a9ea64de228eb
# Parent  f6f7506c5efb250102038e202cf2b836c8b0c550
Update QEMU_TAG
---


diff -r f6f7506c5efb -r 205b89ad2d66 Config.mk
--- a/Config.mk	Wed Nov 02 15:46:54 2011 +0000
+++ b/Config.mk	Wed Nov 02 16:21:37 2011 +0000
@@ -201,9 +201,9 @@
 # CONFIG_QEMU ?= `pwd`/$(XEN_ROOT)/../qemu-xen.git
 CONFIG_QEMU ?= $(QEMU_REMOTE)
 
-QEMU_TAG ?= 25378e0a76b282127e9ab8933a4defbc91db3862
-# Thu Oct 6 18:38:08 2011 +0100
-# remove blktap when building for NetBSD
+QEMU_TAG ?= 52834188eedfbbca5636fd869d4c86b3b3044439
+# Tue Nov 1 18:42:55 2011 +0000
+# qemu-xen: remove i386-dm/README.hvm-pv-magic-ioport-disable
 
 # Short answer -- do not enable this unless you know what you are
 # doing and are prepared for some pain.

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:44 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:44 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLisR-0008UB-Vf; Wed, 02 Nov 2011 15:01:44 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir8-00083X-0R
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-27.messagelabs.com!1320271202!46783468!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16984 invoked from network); 2 Nov 2011 22:00:02 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:02 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir4-0002F3-St
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:18 +0000
Message-Id: <E1RLir4-0002F3-St@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] pygrub: Add HybridISO support for
	PyGrub2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Philipp Hahn <hahn@univention.de>
# Date 1320251337 0
# Node ID 2d741388060df5bd2545f38a25278fb9a7fbb127
# Parent  6868855b6651639f02004a7e313fe7aaba522821
pygrub: Add HybridISO support for PyGrub2

grub-mkrescue internally uses xorriso, which generates a so-called
"Hybrid ISO": The ISO images also contains a DOS partition table,
which allows the identical ISO file to be stored on an USB stick for
booting from it. This breaks PyGrub, since it (wrongly) detects only
the DOS partition table and uses the first partition instead of the
complete ISO file.

Add a check to detect HybridISO files and use offset 0 in addition to
partition table parsing.

Signed-off-by: Philipp Hahn <hahn@univention.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 6868855b6651 -r 2d741388060d tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub	Wed Nov 02 16:25:18 2011 +0000
+++ b/tools/pygrub/src/pygrub	Wed Nov 02 16:28:57 2011 +0000
@@ -40,15 +40,20 @@
     except _curses.error:
         pass
 
-def is_disk_image(file):
+DISK_TYPE_RAW, DISK_TYPE_HYBRIDISO, DISK_TYPE_DOS = range(3)
+def identify_disk_image(file):
+    """Detect DOS partition table or HybridISO format."""
     fd = os.open(file, os.O_RDONLY)
-    buf = os.read(fd, 512)
+    buf = os.read(fd, 0x8006)
     os.close(fd)
 
     if len(buf) >= 512 and \
            struct.unpack("H", buf[0x1fe: 0x200]) == (0xaa55,):
-        return True
-    return False
+        # HybridISO contains a DOS partition table for booting from USB devices, but really is an ISO image
+        if len(buf) >= 0x8006 and buf[0x8001:0x8006] == 'CD001':
+            return DISK_TYPE_HYBRIDISO
+        return DISK_TYPE_DOS
+    return DISK_TYPE_RAW
 
 SECTOR_SIZE=512
 DK_LABEL_LOC=1
@@ -94,12 +99,19 @@
 FDISK_PART_GPT=0xee
 
 def get_partition_offsets(file):
-    if not is_disk_image(file):
+    image_type = identify_disk_image(file)
+    if image_type == DISK_TYPE_RAW:
         # No MBR: assume whole disk filesystem, which is like a 
         # single partition starting at 0
         return [0]
-
-    part_offs = []
+    elif image_type == DISK_TYPE_HYBRIDISO:
+        # A HybridISO contains an ISO filesystem at 0 in addition
+        # to the DOS partition table
+        part_offs = [0]
+    elif image_type == DISK_TYPE_DOS:
+        part_offs = []
+    else:
+        raise ValueError('Unhandled image type returnd by identify_disk_image(): %d' % (image_type,))
 
     fd = os.open(file, os.O_RDONLY)
     buf = os.read(fd, 512)

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:50 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLisY-00005N-A3; Wed, 02 Nov 2011 15:01:50 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir8-00083e-Bz
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1320271218!2691024!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17576 invoked from network); 2 Nov 2011 22:00:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir4-0002EI-7N
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:18 +0000
Message-Id: <E1RLir4-0002EI-7N@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl__device_pci_destroy_all
	should succeed if there is no PCI bus
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1320251118 0
# Node ID 6868855b6651639f02004a7e313fe7aaba522821
# Parent  a6aa8ddce35a48315d0a43b7bedb1f95394c9dc9
libxl: libxl__device_pci_destroy_all should succeed if there is no PCI bus

Since 23915:4c4b72c94bac "" it is possible that no bus exists and this is not
an error. Removes the following spurious warning when destroying a PV domain
with no PCI devices:
    libxl: error: libxl.c:759:libxl_domain_destroy: pci shutdown failed
for domid 1005

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a6aa8ddce35a -r 6868855b6651 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Wed Nov 02 16:23:23 2011 +0000
+++ b/tools/libxl/libxl_pci.c	Wed Nov 02 16:25:18 2011 +0000
@@ -1098,7 +1098,7 @@
 
     pcidevs = libxl_device_pci_list(ctx, domid, &num);
     if ( pcidevs == NULL )
-        return ERROR_FAIL;
+        return 0;
 
     for (i = 0; i < num; i++) {
         /* Force remove on shutdown since, on HVM, qemu will not always

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:01:56 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:01:56 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLise-00008N-Da; Wed, 02 Nov 2011 15:01:56 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir7-00083A-6C
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:22 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1320271214!1731518!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13339 invoked from network); 2 Nov 2011 22:00:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLiqz-00029D-TF
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:13 +0000
Message-Id: <E1RLiqz-00029D-TF@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: add pid path to
	libxl__spawner_starting
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319707225 -7200
# Node ID 3235ee6505cd79287cff69fda6b2aed60c31b58a
# Parent  d577f5ae4986a2c1f3c4fd89162284c72b52573c
libxl: add pid path to libxl__spawner_starting

libxl_spawner_record_pid() should be able to write the pid to arbitrary paths.

v2:
 - use const char* for ->pid_path, and update comment

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r d577f5ae4986 -r 3235ee6505cd tools/libxl/libxl_dm.c
--- a/tools/libxl/libxl_dm.c	Thu Oct 27 11:19:22 2011 +0200
+++ b/tools/libxl/libxl_dm.c	Thu Oct 27 11:20:25 2011 +0200
@@ -848,6 +848,7 @@
 
     p->domid = info->domid;
     p->dom_path = libxl__xs_get_dompath(gc, info->domid);
+    p->pid_path = "image/device-model-pid";
     if (!p->dom_path) {
         rc = ERROR_FAIL;
         goto out_close;
diff -r d577f5ae4986 -r 3235ee6505cd tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Thu Oct 27 11:19:22 2011 +0200
+++ b/tools/libxl/libxl_exec.c	Thu Oct 27 11:20:25 2011 +0200
@@ -151,7 +151,7 @@
     char *path = NULL, *pid = NULL;
     int len;
 
-    if (asprintf(&path, "%s/%s", starting->dom_path, "image/device-model-pid") < 0)
+    if (asprintf(&path, "%s/%s", starting->dom_path, starting->pid_path) < 0)
         goto out;
 
     len = asprintf(&pid, "%d", innerchild);
diff -r d577f5ae4986 -r 3235ee6505cd tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:19:22 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:20:25 2011 +0200
@@ -268,6 +268,7 @@
 
 typedef struct {
     char *dom_path; /* from libxl_malloc, only for libxl_spawner_record_pid */
+    const char *pid_path; /* only for libxl_spawner_record_pid */
     int domid;
     libxl__spawn_starting *for_spawn;
 } libxl__spawner_starting;

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:02:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:02:04 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLism-0000Cg-4Z; Wed, 02 Nov 2011 15:02:04 -0700
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLirA-00082c-7R
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1320271191!46995788!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6585 invoked from network); 2 Nov 2011 21:59:51 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 21:59:51 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir2-0002Bk-2k
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:16 +0000
Message-Id: <E1RLir2-0002Bk-2k@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: update prototype of
	libxl__spawn_check
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1319709256 -7200
# Node ID 698693ac8bca009470c1044f917882824546a893
# Parent  a3000b1c0fab28d663ebc7fc7533109bd69766d2
libxl: update prototype of libxl__spawn_check

libxl__spawn_check expects a malloc'd libxl__spawn_starting. The
currently only user of libxl__spawn_check gets a libxl__spawn_starting
and passes it on. Update prototype to not take a void pointer, and also
update comment in header file.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Jackson <ian.jackson.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r a3000b1c0fab -r 698693ac8bca tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c	Thu Oct 27 11:39:11 2011 +0200
+++ b/tools/libxl/libxl_exec.c	Thu Oct 27 11:54:16 2011 +0200
@@ -431,10 +431,9 @@
     return rc;
 }
 
-int libxl__spawn_check(libxl__gc *gc, void *for_spawn_void)
+int libxl__spawn_check(libxl__gc *gc, libxl__spawn_starting *for_spawn)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    libxl__spawn_starting *for_spawn = for_spawn_void;
     pid_t got;
     int status;
 
diff -r a3000b1c0fab -r 698693ac8bca tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Thu Oct 27 11:39:11 2011 +0200
+++ b/tools/libxl/libxl_internal.h	Thu Oct 27 11:54:16 2011 +0200
@@ -376,12 +376,10 @@
  * Returns 0 on success, and < 0 on error.
  *
  * Logs errors but also returns them.
- * for_spawn must actually be a  libxl__spawn_starting*  but
- * we take void* so you can pass this function directly to
- * libxl__wait_for_offspring.  Caller must still call detach.
+ * Caller must still call detach.
  */
 _hidden int libxl__spawn_check(libxl__gc *gc,
-                      void *for_spawn);
+                       libxl__spawn_starting *for_spawn);
 
  /* low-level stuff, for synchronous subprocesses etc. */
 

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:02:11 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:02:11 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLiss-0000Fa-Tj; Wed, 02 Nov 2011 15:02:11 -0700
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLir9-00083x-Ny
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1320271220!2602777!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6149 invoked from network); 2 Nov 2011 22:00:20 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:20 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir5-0002GH-W6
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:20 +0000
Message-Id: <E1RLir5-0002GH-W6@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: Correct man page of xl
	regarding cpu-pools
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1320253749 0
# Node ID 54a5e994a241a506900ee0e197bb42e5f1d8e759
# Parent  ac47cafe6776a364b92a15432b4016f37fce44ea
docs: Correct man page of xl regarding cpu-pools

Signed-off-by: juergen.gross@ts.fujitsu.com
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r ac47cafe6776 -r 54a5e994a241 docs/man/xl.pod.1
--- a/docs/man/xl.pod.1	Wed Nov 02 17:06:04 2011 +0000
+++ b/docs/man/xl.pod.1	Wed Nov 02 17:09:09 2011 +0000
@@ -615,14 +615,17 @@
 assigned at most to one cpu-pool. Domains are each restricted to a single
 cpu-pool. Scheduling does not cross cpu-pool boundaries, so each cpu-pool has
 an own scheduler.
-Physical cpus and domains can be moved from one pool to another only by an
+Physical cpus and domains can be moved from one cpu-pool to another only by an
 explicit command.
+Cpu-pools can be specified either by name or by id.
 
 =over 4
 
-=item B<cpupool-create> [I<OPTIONS>] I<ConfigFile>
+=item B<cpupool-create> [I<OPTIONS>] I<ConfigFile> [I<Variable=Value> ...]
 
 Create a cpu pool based an I<ConfigFile>.
+Variable settings from the I<ConfigFile> may be altered by specifying new
+or additional assignments on the command line.
 
 B<OPTIONS>
 
@@ -638,7 +641,7 @@
 
 =back
 
-=item B<cpupool-list> [I<-c|--cpus> I<cpu-pool>]
+=item B<cpupool-list> [I<-c|--cpus>] [I<cpu-pool>]
 
 List CPU pools on the host.
 If I<-c> is specified, B<xl> prints a list of CPUs used by I<cpu-pool>.
@@ -646,26 +649,27 @@
 =item B<cpupool-destroy> I<cpu-pool>
 
 Deactivates a cpu pool.
+This is possible only if no domain is active in the cpu-pool.
 
 =item B<cpupool-rename> I<cpu-pool> <newname>
 
-Renames a cpu pool to I<newname>.
+Renames a cpu-pool to I<newname>.
 
-=item B<cpupool-cpu-add> I<cpu-pool> I<cpu-nr|node-nr>
+=item B<cpupool-cpu-add> I<cpu-pool> I<cpu-nr|node:node-nr>
 
-Adds a cpu or a numa node to a cpu pool.
+Adds a cpu or all cpus of a numa node to a cpu-pool.
 
-=item B<cpupool-cpu-remove> I<cpu-nr|node-nr>
+=item B<cpupool-cpu-remove> I<cpu-nr|node:node-nr>
 
-Removes a cpu or a numa node from a cpu pool.
+Removes a cpu or all cpus of a numa node from a cpu-pool.
 
-=item B<cpupool-migrate> I<domain-id> I<cpu-pool>
+=item B<cpupool-migrate> I<domain> I<cpu-pool>
 
-Moves a domain into a cpu pool.
+Moves a domain specified by domain-id or domain-name into a cpu-pool.
 
 =item B<cpupool-numa-split>
 
-Splits up the machine into one cpu pool per numa node.
+Splits up the machine into one cpu-pool per numa node.
 
 =back
 
@@ -791,7 +795,7 @@
 
 =head1 SEE ALSO
 
-B<xldomain.cfg>(5), B<xentop>(1)
+B<xldomain.cfg>(5), B<xlcpupool.cfg>(5), B<xentop>(1)
 
 =head1 AUTHOR
 

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:02:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:02:19 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLit1-0000J5-0M; Wed, 02 Nov 2011 15:02:19 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLirA-000846-VH
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1320271219!1733079!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8306 invoked from network); 2 Nov 2011 22:00:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir5-0002Fh-EZ
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:19 +0000
Message-Id: <E1RLir5-0002Fh-EZ@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: handle the return value of
	wait_for_dev_destroy select
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1320253564 0
# Node ID ac47cafe6776a364b92a15432b4016f37fce44ea
# Parent  2d741388060df5bd2545f38a25278fb9a7fbb127
libxl: handle the return value of wait_for_dev_destroy select

Handle the return value of the select call inside wait_for_dev_destroy
properly, and return 0 if a device is removed, or ERROR_* if a timeout
or error happened. Use the return value of wait_for_dev_destroy inside
libxl__device_remove to properly return from that function.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 2d741388060d -r ac47cafe6776 tools/libxl/libxl.h
--- a/tools/libxl/libxl.h	Wed Nov 02 16:28:57 2011 +0000
+++ b/tools/libxl/libxl.h	Wed Nov 02 17:06:04 2011 +0000
@@ -221,6 +221,7 @@
     ERROR_INVAL = -6,
     ERROR_BADFAIL = -7,
     ERROR_GUEST_TIMEDOUT = -8,
+    ERROR_TIMEDOUT = -9,
 };
 
 #define LIBXL_VERSION 0
diff -r 2d741388060d -r ac47cafe6776 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c	Wed Nov 02 16:28:57 2011 +0000
+++ b/tools/libxl/libxl_device.c	Wed Nov 02 17:06:04 2011 +0000
@@ -367,6 +367,10 @@
     return -1;
 }
 
+/*
+ * Returns 0 if a device is removed, ERROR_* if an error
+ * or timeout occurred.
+ */
 static int wait_for_dev_destroy(libxl__gc *gc, struct timeval *tv)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
@@ -375,22 +379,41 @@
     fd_set rfds;
     char **l1 = NULL;
 
+start:
     rc = 1;
     nfds = xs_fileno(ctx->xsh) + 1;
     FD_ZERO(&rfds);
     FD_SET(xs_fileno(ctx->xsh), &rfds);
-    if (select(nfds, &rfds, NULL, NULL, tv) > 0) {
-        l1 = xs_read_watch(ctx->xsh, &n);
-        if (l1 != NULL) {
-            char *state = libxl__xs_read(gc, XBT_NULL, l1[XS_WATCH_PATH]);
-            if (!state || atoi(state) == 6) {
-                xs_unwatch(ctx->xsh, l1[0], l1[1]);
-                xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
-                LIBXL__LOG(ctx, LIBXL__LOG_DEBUG, "Destroyed device backend at %s", l1[XS_WATCH_TOKEN]);
-                rc = 0;
+    switch (select(nfds, &rfds, NULL, NULL, tv)) {
+        case -1:
+            if (errno == EINTR)
+                goto start;
+            rc = ERROR_FAIL;
+            break;
+        case 0:
+            rc = ERROR_TIMEDOUT;
+            break;
+        default:
+            l1 = xs_read_watch(ctx->xsh, &n);
+            if (l1 != NULL) {
+                char *state = libxl__xs_read(gc, XBT_NULL,
+                                             l1[XS_WATCH_PATH]);
+                if (!state || atoi(state) == 6) {
+                    xs_unwatch(ctx->xsh, l1[0], l1[1]);
+                    xs_rm(ctx->xsh, XBT_NULL, l1[XS_WATCH_TOKEN]);
+                    LIBXL__LOG(ctx, LIBXL__LOG_DEBUG,
+                               "Destroyed device backend at %s",
+                               l1[XS_WATCH_TOKEN]);
+                    rc = 0;
+                } else {
+                    /* State is not "disconnected", continue waiting... */
+                    goto start;
+                }
+                free(l1);
+            } else {
+                rc = ERROR_FAIL;
             }
-            free(l1);
-        }
+            break;
     }
     return rc;
 }
@@ -436,7 +459,9 @@
         struct timeval tv;
         tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
         tv.tv_usec = 0;
-        (void)wait_for_dev_destroy(gc, &tv);
+        rc = wait_for_dev_destroy(gc, &tv);
+        if (rc < 0) /* an error or timeout occurred, clear watches */
+            xs_unwatch(ctx->xsh, state_path, be_path);
         xs_rm(ctx->xsh, XBT_NULL, libxl__device_frontend_path(gc, dev));
     } else {
         rc = 1; /* Caller must wait_for_dev_destroy */
@@ -542,7 +567,8 @@
         tv.tv_sec = LIBXL_DESTROY_TIMEOUT;
         tv.tv_usec = 0;
         while (n_watches > 0) {
-            if (wait_for_dev_destroy(gc, &tv)) {
+            if (wait_for_dev_destroy(gc, &tv) < 0) {
+                /* function returned ERROR_* */
                 break;
             } else {
                 n_watches--;

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:02:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:02:25 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLit7-0000Lv-2x; Wed, 02 Nov 2011 15:02:25 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLirB-00084B-1M
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:26 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1320271221!1731527!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13383 invoked from network); 2 Nov 2011 22:00:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLiqy-00027R-9P
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:12 +0000
Message-Id: <E1RLiqy-00027R-9P@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] passthrough: re-attempt ACS and ATS
	enabling when devices get reported by Dom0
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320238385 -3600
# Node ID 119bccb1cc5eee1364bbbd3bd1a30f22e9db703a
# Parent  6da8953b7a902f9ea186bffdc169b9e0e97c277d
passthrough: re-attempt ACS and ATS enabling when devices get reported by Dom0

Since extended config space accesses may not be possible when
scan_pci_devices() runs (due to MMCFG resources not being reserved in
the E820 table, which the specification allows to be the case),
functionality enabling of which requires such must be re-attempted
when it is known whether MMCFG is safe to use.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Kay, Allen M" <allen.m.kay@intel.com>
---


diff -r 6da8953b7a90 -r 119bccb1cc5e xen/drivers/passthrough/iommu.c
--- a/xen/drivers/passthrough/iommu.c	Wed Nov 02 13:51:28 2011 +0100
+++ b/xen/drivers/passthrough/iommu.c	Wed Nov 02 13:53:05 2011 +0100
@@ -150,6 +150,23 @@
     return hd->platform_ops->add_device(pdev);
 }
 
+int iommu_enable_device(struct pci_dev *pdev)
+{
+    struct hvm_iommu *hd;
+
+    if ( !pdev->domain )
+        return -EINVAL;
+
+    ASSERT(spin_is_locked(&pcidevs_lock));
+
+    hd = domain_hvm_iommu(pdev->domain);
+    if ( !iommu_enabled || !hd->platform_ops ||
+         !hd->platform_ops->enable_device )
+        return 0;
+
+    return hd->platform_ops->enable_device(pdev);
+}
+
 int iommu_remove_device(struct pci_dev *pdev)
 {
     struct hvm_iommu *hd;
diff -r 6da8953b7a90 -r 119bccb1cc5e xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Wed Nov 02 13:51:28 2011 +0100
+++ b/xen/drivers/passthrough/pci.c	Wed Nov 02 13:53:05 2011 +0100
@@ -258,7 +258,7 @@
  * pci_enable_acs - enable ACS if hardware support it
  * @dev: the PCI device
  */
-void pci_enable_acs(struct pci_dev *pdev)
+static void pci_enable_acs(struct pci_dev *pdev)
 {
     int pos;
     u16 cap, ctrl, seg = pdev->seg;
@@ -409,8 +409,11 @@
         }
 
         list_add(&pdev->domain_list, &dom0->arch.pdev_list);
-        pci_enable_acs(pdev);
     }
+    else
+        iommu_enable_device(pdev);
+
+    pci_enable_acs(pdev);
 
 out:
     spin_unlock(&pcidevs_lock);
diff -r 6da8953b7a90 -r 119bccb1cc5e xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Wed Nov 02 13:51:28 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Nov 02 13:53:05 2011 +0100
@@ -1900,6 +1900,19 @@
     return ret;
 }
 
+static int intel_iommu_enable_device(struct pci_dev *pdev)
+{
+    struct acpi_drhd_unit *drhd = acpi_find_matched_drhd_unit(pdev);
+    int ret = drhd ? ats_device(pdev, drhd) : -ENODEV;
+
+    if ( ret <= 0 )
+        return ret;
+
+    ret = enable_ats_device(pdev->seg, pdev->bus, pdev->devfn);
+
+    return ret >= 0 ? 0 : ret;
+}
+
 static int intel_iommu_remove_device(struct pci_dev *pdev)
 {
     struct acpi_rmrr_unit *rmrr;
@@ -1930,7 +1943,6 @@
 static void __init setup_dom0_device(struct pci_dev *pdev)
 {
     domain_context_mapping(pdev->domain, pdev->seg, pdev->bus, pdev->devfn);
-    pci_enable_acs(pdev);
     pci_vtd_quirk(pdev);
 }
 
@@ -2301,6 +2313,7 @@
     .init = intel_iommu_domain_init,
     .dom0_init = intel_iommu_dom0_init,
     .add_device = intel_iommu_add_device,
+    .enable_device = intel_iommu_enable_device,
     .remove_device = intel_iommu_remove_device,
     .assign_device  = intel_iommu_assign_device,
     .teardown = iommu_domain_teardown,
diff -r 6da8953b7a90 -r 119bccb1cc5e xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Wed Nov 02 13:51:28 2011 +0100
+++ b/xen/include/xen/iommu.h	Wed Nov 02 13:53:05 2011 +0100
@@ -70,6 +70,7 @@
 void iommu_disable_x2apic_IR(void);
 
 int iommu_add_device(struct pci_dev *pdev);
+int iommu_enable_device(struct pci_dev *pdev);
 int iommu_remove_device(struct pci_dev *pdev);
 int iommu_domain_init(struct domain *d);
 void iommu_dom0_init(struct domain *d);
@@ -120,6 +121,7 @@
     int (*init)(struct domain *d);
     void (*dom0_init)(struct domain *d);
     int (*add_device)(struct pci_dev *pdev);
+    int (*enable_device)(struct pci_dev *pdev);
     int (*remove_device)(struct pci_dev *pdev);
     int (*assign_device)(struct domain *d, u16 seg, u8 bus, u8 devfn);
     void (*teardown)(struct domain *d);
diff -r 6da8953b7a90 -r 119bccb1cc5e xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Wed Nov 02 13:51:28 2011 +0100
+++ b/xen/include/xen/pci.h	Wed Nov 02 13:53:05 2011 +0100
@@ -134,6 +134,5 @@
 int msixtbl_pt_register(struct domain *, struct pirq *, uint64_t gtable);
 void msixtbl_pt_unregister(struct domain *, struct pirq *);
 void msixtbl_pt_cleanup(struct domain *d);
-void pci_enable_acs(struct pci_dev *pdev);
 
 #endif /* __XEN_PCI_H__ */

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 02 15:03:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 02 Nov 2011 15:03:40 -0700
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RLiuJ-0000mm-Jm; Wed, 02 Nov 2011 15:03:39 -0700
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RLirE-00085F-T4
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 15:00:29 -0700
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1320271225!1748502!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21616 invoked from network); 2 Nov 2011 22:00:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	2 Nov 2011 22:00:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RLir2-0002CP-La
	for xen-changelog@lists.xensource.com; Wed, 02 Nov 2011 22:00:16 +0000
Message-Id: <E1RLir2-0002CP-La@xenbits.xen.org>
Date: Wed, 02 Nov 2011 22:00:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: reimplement buffer for
	bootloading and drop data if buffer is full.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1320248814 0
# Node ID f6f7506c5efb250102038e202cf2b836c8b0c550
# Parent  698693ac8bca009470c1044f917882824546a893
libxl: reimplement buffer for bootloading and drop data if buffer is full.

Implement a buffer for the bootloading process that appends data to
the end until it's full. Drop the whole buffer if a timeout has
occurred and the buffer is full. Prevents the bootloader from getting
stuck when using ptys with small buffers.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 698693ac8bca -r f6f7506c5efb tools/libxl/libxl_bootloader.c
--- a/tools/libxl/libxl_bootloader.c	Thu Oct 27 11:54:16 2011 +0200
+++ b/tools/libxl/libxl_bootloader.c	Wed Nov 02 15:46:54 2011 +0000
@@ -28,7 +28,8 @@
 #include "flexarray.h"
 
 #define XENCONSOLED_BUF_SIZE 16
-#define BOOTLOADER_BUF_SIZE 1024
+#define BOOTLOADER_BUF_SIZE 4096
+#define BOOTLOADER_TIMEOUT 1
 
 static char **make_bootloader_args(libxl__gc *gc,
                                    libxl_domain_build_info *info,
@@ -169,6 +170,7 @@
 
     size_t nr_out = 0, size_out = 0;
     char *output = NULL;
+    struct timeval wait;
 
     /* input from xenconsole. read on xenconsoled_fd write to bootloader_fd */
     int xenconsoled_prod = 0, xenconsoled_cons = 0;
@@ -181,39 +183,67 @@
         fd_set wsel, rsel;
         int nfds;
 
-        if (xenconsoled_prod == xenconsoled_cons)
-            xenconsoled_prod = xenconsoled_cons = 0;
-        if (bootloader_prod == bootloader_cons)
-            bootloader_prod = bootloader_cons = 0;
+        /* Set timeout to 1s before starting to discard data */
+        wait.tv_sec = BOOTLOADER_TIMEOUT;
+        wait.tv_usec = 0;
+
+        /* Move buffers around to drop already consumed data */
+        if (xenconsoled_cons > 0) {
+            xenconsoled_prod -= xenconsoled_cons;
+            memmove(xenconsoled_buf, &xenconsoled_buf[xenconsoled_cons],
+                    xenconsoled_prod);
+            xenconsoled_cons = 0;
+        }
+        if (bootloader_cons > 0) {
+            bootloader_prod -= bootloader_cons;
+            memmove(bootloader_buf, &bootloader_buf[bootloader_cons],
+                    bootloader_prod);
+            bootloader_cons = 0;
+        }
 
         FD_ZERO(&rsel);
         FD_SET(fifo_fd, &rsel);
         nfds = fifo_fd + 1;
-        if (xenconsoled_prod == 0 || (xenconsoled_prod < BOOTLOADER_BUF_SIZE && xenconsoled_cons == 0)) {
+        if (xenconsoled_prod < XENCONSOLED_BUF_SIZE) {
+            /* The buffer is not full, try to read more data */
             FD_SET(xenconsoled_fd, &rsel);
             nfds = xenconsoled_fd + 1 > nfds ? xenconsoled_fd + 1 : nfds;
-        }
-        if (bootloader_prod == 0 || (bootloader_prod < BOOTLOADER_BUF_SIZE && bootloader_cons == 0)) {
+        } 
+        if (bootloader_prod < BOOTLOADER_BUF_SIZE) {
+            /* The buffer is not full, try to read more data */
             FD_SET(bootloader_fd, &rsel);
             nfds = bootloader_fd + 1 > nfds ? bootloader_fd + 1 : nfds;
         }
 
         FD_ZERO(&wsel);
-        if (bootloader_prod != bootloader_cons) {
+        if (bootloader_prod > 0) {
+            /* The buffer has data to consume */
             FD_SET(xenconsoled_fd, &wsel);
             nfds = xenconsoled_fd + 1 > nfds ? xenconsoled_fd + 1 : nfds;
         }
-        if (xenconsoled_prod != xenconsoled_cons) {
+        if (xenconsoled_prod > 0) {
+            /* The buffer has data to consume */
             FD_SET(bootloader_fd, &wsel);
             nfds = bootloader_fd + 1 > nfds ? bootloader_fd + 1 : nfds;
         }
 
-        ret = select(nfds, &rsel, &wsel, NULL, NULL);
-        if (ret < 0)
+        if (xenconsoled_prod == XENCONSOLED_BUF_SIZE ||
+            bootloader_prod == BOOTLOADER_BUF_SIZE)
+            ret = select(nfds, &rsel, &wsel, NULL, &wait);
+        else
+            ret = select(nfds, &rsel, &wsel, NULL, NULL);
+        if (ret < 0) {
+            if (errno == EINTR)
+                continue;
             goto out_err;
+        }
 
         /* Input from xenconsole, read xenconsoled_fd, write bootloader_fd */
-        if (FD_ISSET(xenconsoled_fd, &rsel)) {
+        if (ret == 0 && xenconsoled_prod == XENCONSOLED_BUF_SIZE) {
+            /* Drop the buffer */
+            xenconsoled_prod = 0;
+            xenconsoled_cons = 0;
+        } else if (FD_ISSET(xenconsoled_fd, &rsel)) {
             ret = read(xenconsoled_fd, &xenconsoled_buf[xenconsoled_prod], XENCONSOLED_BUF_SIZE - xenconsoled_prod);
             if (ret < 0 && errno != EIO && errno != EAGAIN)
                 goto out_err;
@@ -229,7 +259,11 @@
         }
 
         /* Input from bootloader, read bootloader_fd, write xenconsoled_fd */
-        if (FD_ISSET(bootloader_fd, &rsel)) {
+        if (ret == 0 && bootloader_prod == BOOTLOADER_BUF_SIZE) {
+            /* Drop the buffer */
+            bootloader_prod = 0;
+            bootloader_cons = 0;
+        } else if (FD_ISSET(bootloader_fd, &rsel)) {
             ret = read(bootloader_fd, &bootloader_buf[bootloader_prod], BOOTLOADER_BUF_SIZE - bootloader_prod);
             if (ret < 0 && errno != EIO && errno != EAGAIN)
                 goto out_err;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:33:22 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:33:22 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROinn-000485-KU; Thu, 10 Nov 2011 20:33:20 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinj-000478-IU
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:15 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1320985961!43484936!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18324 invoked from network); 11 Nov 2011 04:32:42 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:42 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinf-000132-CD
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:11 +0000
Message-Id: <E1ROinf-000132-CD@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: provide pse36 cpuid bit
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1320322763 0
# Node ID 17ee4c213438a4d35cd2e4efe494ad3321cf6c32
# Parent  54a5e994a241a506900ee0e197bb42e5f1d8e759
xen: provide pse36 cpuid bit

Provide pse36 cpuid bit if guest runs in 32bit PAE
or in long mode. Hyper-V refuses to start as
the "cpu does not provide required hw features"
if it does not find the pse36 cpuid bits.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 54a5e994a241 -r 17ee4c213438 tools/libxc/xc_cpuid_x86.c
--- a/tools/libxc/xc_cpuid_x86.c	Wed Nov 02 17:09:09 2011 +0000
+++ b/tools/libxc/xc_cpuid_x86.c	Thu Nov 03 12:19:23 2011 +0000
@@ -98,7 +98,6 @@
 
         if ( !is_pae )
             clear_bit(X86_FEATURE_PAE, regs[3]);
-        clear_bit(X86_FEATURE_PSE36, regs[3]);
 
         /* Filter all other features according to a whitelist. */
         regs[2] &= ((is_64bit ? bitmaskof(X86_FEATURE_LAHF_LM) : 0) |
@@ -340,6 +339,7 @@
                     bitmaskof(X86_FEATURE_CMOV) |
                     bitmaskof(X86_FEATURE_PAT) |
                     bitmaskof(X86_FEATURE_CLFLSH) |
+                    bitmaskof(X86_FEATURE_PSE36) |
                     bitmaskof(X86_FEATURE_MMX) |
                     bitmaskof(X86_FEATURE_FXSR) |
                     bitmaskof(X86_FEATURE_XMM) |
@@ -349,8 +349,10 @@
         /* We always support MTRR MSRs. */
         regs[3] |= bitmaskof(X86_FEATURE_MTRR);
 
-        if ( !is_pae )
+        if ( !is_pae ) {
             clear_bit(X86_FEATURE_PAE, regs[3]);
+            clear_bit(X86_FEATURE_PSE36, regs[3]);
+        }
         break;
 
     case 0x00000007: /* Intel-defined CPU features */
@@ -372,8 +374,10 @@
         break;
 
     case 0x80000001:
-        if ( !is_pae )
+        if ( !is_pae ) {
             clear_bit(X86_FEATURE_NX, regs[3]);
+            clear_bit(X86_FEATURE_PSE36, regs[3]);
+        }
         break;
 
     case 0x80000007:
diff -r 54a5e994a241 -r 17ee4c213438 xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Wed Nov 02 17:09:09 2011 +0000
+++ b/xen/arch/x86/hvm/hvm.c	Thu Nov 03 12:19:23 2011 +0000
@@ -2409,6 +2409,10 @@
         if ( xsave_enabled(v) )
             *ecx |= (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_OSXSAVE) ?
                      cpufeat_mask(X86_FEATURE_OSXSAVE) : 0;
+
+        /* Only provide PSE36 when guest runs in 32bit PAE or in long mode */
+        if ( !(hvm_pae_enabled(v) || hvm_long_mode_enabled(v)) )
+            *edx &= ~cpufeat_mask(X86_FEATURE_PSE36);
         break;
     case 0x7:
         if ( (count == 0) && !cpu_has_smep )
@@ -2447,6 +2451,9 @@
         /* Hide 1GB-superpage feature if we can't emulate it. */
         if (!hvm_pse1gb_supported(d))
             *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
+        /* Only provide PSE36 when guest runs in 32bit PAE or in long mode */
+        if ( !(hvm_pae_enabled(v) || hvm_long_mode_enabled(v)) )
+            *edx &= ~cpufeat_mask(X86_FEATURE_PSE36);
         break;
     }
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:33:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:33:45 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROioC-0004Ea-JL; Thu, 10 Nov 2011 20:33:45 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROink-000479-SB
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1320985993!3100630!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13399 invoked from network); 11 Nov 2011 04:33:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinh-00014l-BP
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:13 +0000
Message-Id: <E1ROinh-00014l-BP@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IRQ: consolidate IRQ disabling
	when acquiring vector lock
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320337721 -3600
# Node ID 801ca6c0fbfa07e12c10c3079fc60cfb47dd0e3b
# Parent  6928172f7ded3c417ecba396b764ce322ecb4b92
x86/IRQ: consolidate IRQ disabling when acquiring vector lock

__assign_irq_vector() doesn't need to disable interrupts (its callers
are required to when acquiring the lock), and set_desc_affinity() can
use the normal spin lock primitives.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 6928172f7ded -r 801ca6c0fbfa xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Nov 03 17:27:38 2011 +0100
+++ b/xen/arch/x86/irq.c	Thu Nov 03 17:28:41 2011 +0100
@@ -429,7 +429,6 @@
     static int current_vector = FIRST_DYNAMIC_VECTOR, current_offset = 0;
     unsigned int old_vector;
     int cpu, err;
-    unsigned long flags;
     cpumask_t tmp_mask;
     vmask_t *irq_used_vectors = NULL;
 
@@ -493,7 +492,6 @@
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
-        local_irq_save(flags);
         if (old_vector) {
             desc->arch.move_in_progress = 1;
             cpumask_copy(desc->arch.old_cpu_mask, desc->arch.cpu_mask);
@@ -521,7 +519,6 @@
         }
 
         err = 0;
-        local_irq_restore(flags);
         break;
     }
     return err;
@@ -720,11 +717,9 @@
 
     irq = desc->irq;
 
-    local_irq_save(flags);
-    lock_vector_lock();
+    spin_lock_irqsave(&vector_lock, flags);
     ret = __assign_irq_vector(irq, desc, mask);
-    unlock_vector_lock();
-    local_irq_restore(flags);
+    spin_unlock_irqrestore(&vector_lock, flags);
 
     if (ret < 0)
         return BAD_APICID;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:33:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:33:55 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROioM-0004Hd-Fq; Thu, 10 Nov 2011 20:33:54 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROink-00047A-Uy
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-27.messagelabs.com!1320985963!43484938!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18348 invoked from network); 11 Nov 2011 04:32:43 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:43 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinh-00015I-TQ
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:13 +0000
Message-Id: <E1ROinh-00015I-TQ@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Fix return check
	of fcntl
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410302 0
# Node ID e0b6b0e68e90c6e09c893b2905d736b0500e5e79
# Parent  801ca6c0fbfa07e12c10c3079fc60cfb47dd0e3b
libxl: libxl_qmp: Fix return check of fcntl

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 801ca6c0fbfa -r e0b6b0e68e90 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Thu Nov 03 17:28:41 2011 +0100
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:22 2011 +0000
@@ -296,7 +296,7 @@
     if (qmp->qmp_fd < 0) {
         return -1;
     }
-    if ((flags = fcntl(qmp->qmp_fd, F_GETFL)) == 1) {
+    if ((flags = fcntl(qmp->qmp_fd, F_GETFL)) == -1) {
         flags = 0;
     }
     if (fcntl(qmp->qmp_fd, F_SETFL, flags | O_NONBLOCK) == -1) {

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:06 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:06 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROioY-0004LK-Fv; Thu, 10 Nov 2011 20:34:06 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinl-00047B-Af
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1320985993!2148926!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9743 invoked from network); 11 Nov 2011 04:33:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROing-000148-Oq
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:12 +0000
Message-Id: <E1ROing-000148-Oq@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: allocate CPU masks dynamically
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320337658 -3600
# Node ID 6928172f7ded3c417ecba396b764ce322ecb4b92
# Parent  17ee4c213438a4d35cd2e4efe494ad3321cf6c32
IRQ: allocate CPU masks dynamically

This includes delaying the initialization of dynamically created IRQs
until their actual first use and some further elimination of uses of
struct irq_cfg.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 17ee4c213438 -r 6928172f7ded xen/arch/ia64/linux-xen/irq_ia64.c
--- a/xen/arch/ia64/linux-xen/irq_ia64.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/ia64/linux-xen/irq_ia64.c	Thu Nov 03 17:27:38 2011 +0100
@@ -303,6 +303,9 @@
 void __init
 init_IRQ (void)
 {
+#ifdef XEN
+	BUG_ON(init_irq_data());
+#endif
 	register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL);
 #ifdef CONFIG_SMP
 	register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction);
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/ia64/xen/irq.c	Thu Nov 03 17:27:38 2011 +0100
@@ -74,17 +74,30 @@
 /*
  * Controller mappings for all interrupt sources:
  */
-irq_desc_t irq_desc[NR_IRQS] = {
-	[0 ... NR_IRQS-1] = {
-		.status = IRQ_DISABLED,
-		.handler = &no_irq_type,
-		.lock = SPIN_LOCK_UNLOCKED
-		.arch = {
-		        .vector = -1,
-		        .cpu_mask = CPU_MASK_ALL,
-		}
+irq_desc_t irq_desc[NR_IRQS];
+
+int __init arch_init_one_irq_desc(struct irq_desc *desc)
+{
+	if (!alloc_cpumask_var(&desc->arch.cpu_mask))
+		return -ENOMEM;
+
+	desc->arch.vector = -1;
+	cpumask_setall(desc->arch.cpu_mask);
+
+	return 0;
+}
+
+int __init init_irq_data(void)
+{
+	unsigned int irq;
+
+	for (irq = 0; irq < NR_IRQS; irq++) {
+		struct irq_desc *desc = irq_to_desc(irq);
+
+		desc->irq = irq;
+		init_one_irq_desc(desc);
 	}
-};
+}
 
 void __do_IRQ_guest(int irq);
 
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/x86/i8259.c
--- a/xen/arch/x86/i8259.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/x86/i8259.c	Thu Nov 03 17:27:38 2011 +0100
@@ -398,7 +398,7 @@
         
         desc->handler = &i8259A_irq_type;
         per_cpu(vector_irq, cpu)[FIRST_LEGACY_VECTOR + irq] = irq;
-        cpumask_copy(&desc->arch.cpu_mask, cpumask_of(cpu));
+        cpumask_copy(desc->arch.cpu_mask, cpumask_of(cpu));
         desc->arch.vector = FIRST_LEGACY_VECTOR + irq;
     }
     
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/x86/io_apic.c	Thu Nov 03 17:27:38 2011 +0100
@@ -648,20 +648,21 @@
 void /*__init*/ setup_ioapic_dest(void)
 {
     int pin, ioapic, irq, irq_entry;
-    struct irq_cfg *cfg;
 
     if (skip_ioapic_setup)
         return;
 
     for (ioapic = 0; ioapic < nr_ioapics; ioapic++) {
         for (pin = 0; pin < nr_ioapic_entries[ioapic]; pin++) {
+            struct irq_desc *desc;
+
             irq_entry = find_irq_entry(ioapic, pin, mp_INT);
             if (irq_entry == -1)
                 continue;
             irq = pin_2_irq(irq_entry, ioapic, pin);
-            cfg = irq_cfg(irq);
-            BUG_ON(cpus_empty(cfg->cpu_mask));
-            set_ioapic_affinity_irq(irq_to_desc(irq), &cfg->cpu_mask);
+            desc = irq_to_desc(irq);
+            BUG_ON(cpumask_empty(desc->arch.cpu_mask));
+            set_ioapic_affinity_irq(desc, desc->arch.cpu_mask);
         }
 
     }
@@ -956,12 +957,12 @@
     struct IO_APIC_route_entry entry;
     int apic, pin, idx, irq, first_notcon = 1, vector;
     unsigned long flags;
-    struct irq_cfg *cfg;
 
     apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
 
     for (apic = 0; apic < nr_ioapics; apic++) {
         for (pin = 0; pin < nr_ioapic_entries[apic]; pin++) {
+            struct irq_desc *desc;
 
             /*
              * add it to the IO-APIC irq-routing table:
@@ -1016,9 +1017,9 @@
                 if (!apic && platform_legacy_irq(irq))
                     disable_8259A_irq(irq_to_desc(irq));
             }
-            cfg = irq_cfg(irq);
+            desc = irq_to_desc(irq);
             SET_DEST(entry.dest.dest32, entry.dest.logical.logical_dest,
-                     cpu_mask_to_apicid(&cfg->cpu_mask));
+                     cpu_mask_to_apicid(desc->arch.cpu_mask));
             spin_lock_irqsave(&ioapic_lock, flags);
             __ioapic_write_entry(apic, pin, 0, entry);
             set_native_irq_info(irq, TARGET_CPUS);
@@ -2372,7 +2373,7 @@
     rte.vector = cfg->vector;
 
     SET_DEST(rte.dest.dest32, rte.dest.logical.logical_dest,
-             cpu_mask_to_apicid(&cfg->cpu_mask));
+             cpu_mask_to_apicid(desc->arch.cpu_mask));
 
     io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&rte) + 0));
     io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&rte) + 1));
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/x86/irq.c	Thu Nov 03 17:27:38 2011 +0100
@@ -25,6 +25,7 @@
 #include <public/physdev.h>
 
 static void parse_irq_vector_map_param(char *s);
+static int __assign_irq_vector(int irq, struct irq_desc *, const cpumask_t *);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
 bool_t __read_mostly opt_noirqbalance = 0;
@@ -110,7 +111,7 @@
 {
     cpumask_t online_mask;
     int cpu;
-    struct irq_cfg *cfg = irq_cfg(irq);
+    struct irq_desc *desc = irq_to_desc(irq);
 
     BUG_ON((unsigned)irq >= nr_irqs);
     BUG_ON((unsigned)vector >= NR_VECTORS);
@@ -118,21 +119,22 @@
     cpumask_and(&online_mask, cpu_mask, &cpu_online_map);
     if (cpumask_empty(&online_mask))
         return -EINVAL;
-    if ((cfg->vector == vector) && cpumask_equal(&cfg->cpu_mask, &online_mask))
+    if ( (desc->arch.vector == vector) &&
+         cpumask_equal(desc->arch.cpu_mask, &online_mask) )
         return 0;
-    if (cfg->vector != IRQ_VECTOR_UNASSIGNED) 
+    if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
         return -EBUSY;
     trace_irq_mask(TRC_HW_IRQ_BIND_VECTOR, irq, vector, &online_mask);
     for_each_cpu_mask(cpu, online_mask)
         per_cpu(vector_irq, cpu)[vector] = irq;
-    cfg->vector = vector;
-    cpumask_copy(&cfg->cpu_mask, &online_mask);
-    if ( cfg->used_vectors )
+    desc->arch.vector = vector;
+    cpumask_copy(desc->arch.cpu_mask, &online_mask);
+    if ( desc->arch.used_vectors )
     {
-        ASSERT(!test_bit(vector, cfg->used_vectors));
-        set_bit(vector, cfg->used_vectors);
+        ASSERT(!test_bit(vector, desc->arch.used_vectors));
+        set_bit(vector, desc->arch.used_vectors);
     }
-    cfg->used = IRQ_USED;
+    desc->arch.used = IRQ_USED;
     if (IO_APIC_IRQ(irq))
         irq_vector[irq] = vector;
     return 0;
@@ -166,14 +168,17 @@
 {
     unsigned long flags;
     int irq, ret;
-    irq = -ENOSPC;
+    struct irq_desc *desc;
 
     spin_lock_irqsave(&vector_lock, flags);
 
     irq = find_unassigned_irq();
     if (irq < 0)
          goto out;
-    ret = __assign_irq_vector(irq, irq_cfg(irq), TARGET_CPUS);
+    desc = irq_to_desc(irq);
+    ret = init_one_irq_desc(desc);
+    if (!ret)
+        ret = __assign_irq_vector(irq, desc, TARGET_CPUS);
     if (ret < 0)
         irq = ret;
 out:
@@ -197,7 +202,7 @@
     desc->msi_desc = NULL;
     desc->handler = &no_irq_type;
     desc->arch.used_vectors = NULL;
-    cpumask_setall(&desc->affinity);
+    cpumask_setall(desc->affinity);
     spin_unlock_irqrestore(&desc->lock, flags);
 
     /* Wait to make sure it's not being used on another CPU */
@@ -211,38 +216,38 @@
 {
     int cpu, vector, old_vector;
     cpumask_t tmp_mask;
-    struct irq_cfg *cfg = irq_cfg(irq);
+    struct irq_desc *desc = irq_to_desc(irq);
 
-    BUG_ON(!cfg->vector);
+    BUG_ON(!desc->arch.vector);
 
-    /* Always clear cfg->vector */
-    vector = cfg->vector;
-    cpumask_and(&tmp_mask, &cfg->cpu_mask, &cpu_online_map);
+    /* Always clear desc->arch.vector */
+    vector = desc->arch.vector;
+    cpumask_and(&tmp_mask, desc->arch.cpu_mask, &cpu_online_map);
 
     for_each_cpu_mask(cpu, tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[vector] == irq );
         per_cpu(vector_irq, cpu)[vector] = -1;
     }
 
-    cfg->vector = IRQ_VECTOR_UNASSIGNED;
-    cpumask_clear(&cfg->cpu_mask);
+    desc->arch.vector = IRQ_VECTOR_UNASSIGNED;
+    cpumask_clear(desc->arch.cpu_mask);
 
-    if ( cfg->used_vectors )
+    if ( desc->arch.used_vectors )
     {
-        ASSERT(test_bit(vector, cfg->used_vectors));
-        clear_bit(vector, cfg->used_vectors);
+        ASSERT(test_bit(vector, desc->arch.used_vectors));
+        clear_bit(vector, desc->arch.used_vectors);
     }
 
-    cfg->used = IRQ_UNUSED;
+    desc->arch.used = IRQ_UNUSED;
 
     trace_irq_mask(TRC_HW_IRQ_CLEAR_VECTOR, irq, vector, &tmp_mask);
 
-    if (likely(!cfg->move_in_progress))
+    if ( likely(!desc->arch.move_in_progress) )
         return;
 
-    /* If we were in motion, also clear cfg->old_vector */
-    old_vector = cfg->old_vector;
-    cpumask_and(&tmp_mask, &cfg->old_cpu_mask, &cpu_online_map);
+    /* If we were in motion, also clear desc->arch.old_vector */
+    old_vector = desc->arch.old_vector;
+    cpumask_and(&tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
 
     for_each_cpu_mask(cpu, tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[old_vector] == irq );
@@ -250,16 +255,16 @@
         per_cpu(vector_irq, cpu)[old_vector] = -1;
      }
 
-    cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
-    cpumask_clear(&cfg->old_cpu_mask);
+    desc->arch.old_vector = IRQ_VECTOR_UNASSIGNED;
+    cpumask_clear(desc->arch.old_cpu_mask);
 
-    if ( cfg->used_vectors )
+    if ( desc->arch.used_vectors )
     {
-        ASSERT(test_bit(old_vector, cfg->used_vectors));
-        clear_bit(old_vector, cfg->used_vectors);
+        ASSERT(test_bit(old_vector, desc->arch.used_vectors));
+        clear_bit(old_vector, desc->arch.used_vectors);
     }
 
-    cfg->move_in_progress = 0;
+    desc->arch.move_in_progress = 0;
 }
 
 void clear_irq_vector(int irq)
@@ -296,25 +301,28 @@
     return vector;
 }
 
-static void __init init_one_irq_desc(struct irq_desc *desc)
+int arch_init_one_irq_desc(struct irq_desc *desc)
 {
-    desc->status  = IRQ_DISABLED;
-    desc->handler = &no_irq_type;
-    desc->action  = NULL;
-    desc->msi_desc = NULL;
-    spin_lock_init(&desc->lock);
-    cpumask_setall(&desc->affinity);
-    INIT_LIST_HEAD(&desc->rl_link);
-}
+    if ( !zalloc_cpumask_var(&desc->arch.cpu_mask) )
+        return -ENOMEM;
 
-static void __init init_one_irq_cfg(struct irq_cfg *cfg)
-{
-    cfg->vector = IRQ_VECTOR_UNASSIGNED;
-    cfg->old_vector = IRQ_VECTOR_UNASSIGNED;
-    cpumask_clear(&cfg->cpu_mask);
-    cpumask_clear(&cfg->old_cpu_mask);
-    cfg->used_vectors = NULL;
-    cfg->used = IRQ_UNUSED;
+    if ( !alloc_cpumask_var(&desc->arch.old_cpu_mask) )
+    {
+        free_cpumask_var(desc->arch.cpu_mask);
+        return -ENOMEM;
+    }
+
+    if ( !alloc_cpumask_var(&desc->arch.pending_mask) )
+    {
+        free_cpumask_var(desc->arch.old_cpu_mask);
+        free_cpumask_var(desc->arch.cpu_mask);
+        return -ENOMEM;
+    }
+
+    desc->arch.vector = IRQ_VECTOR_UNASSIGNED;
+    desc->arch.old_vector = IRQ_VECTOR_UNASSIGNED;
+
+    return 0;
 }
 
 int __init init_irq_data(void)
@@ -331,12 +339,13 @@
     if ( !irq_desc || !irq_vector )
         return -ENOMEM;
 
-    for (irq = 0; irq < nr_irqs; irq++) {
+    for (irq = 0; irq < nr_irqs_gsi; irq++) {
         desc = irq_to_desc(irq);
         desc->irq = irq;
         init_one_irq_desc(desc);
-        init_one_irq_cfg(&desc->arch);
     }
+    for (; irq < nr_irqs; irq++)
+        irq_to_desc(irq)->irq = irq;
 
     /* Never allocate the hypercall vector or Linux/BSD fast-trap vector. */
     set_bit(LEGACY_SYSCALL_VECTOR, used_vectors);
@@ -403,7 +412,8 @@
     return ret;
 }
 
-int __assign_irq_vector(int irq, struct irq_cfg *cfg, const cpumask_t *mask)
+static int __assign_irq_vector(
+    int irq, struct irq_desc *desc, const cpumask_t *mask)
 {
     /*
      * NOTE! The local APIC isn't very good at handling
@@ -426,13 +436,13 @@
     old_vector = irq_to_vector(irq);
     if (old_vector) {
         cpumask_and(&tmp_mask, mask, &cpu_online_map);
-        if (cpumask_intersects(&tmp_mask, &cfg->cpu_mask)) {
-            cfg->vector = old_vector;
+        if (cpumask_intersects(&tmp_mask, desc->arch.cpu_mask)) {
+            desc->arch.vector = old_vector;
             return 0;
         }
     }
 
-    if ((cfg->move_in_progress) || cfg->move_cleanup_count)
+    if ( desc->arch.move_in_progress || desc->arch.move_cleanup_count )
         return -EAGAIN;
 
     err = -ENOSPC;
@@ -440,9 +450,9 @@
     /* This is the only place normal IRQs are ever marked
      * as "in use".  If they're not in use yet, check to see
      * if we need to assign a global vector mask. */
-    if ( cfg->used == IRQ_USED )
+    if ( desc->arch.used == IRQ_USED )
     {
-        irq_used_vectors = cfg->used_vectors;
+        irq_used_vectors = desc->arch.used_vectors;
     }
     else
         irq_used_vectors = irq_get_used_vector_mask(irq);
@@ -485,29 +495,29 @@
         current_offset = offset;
         local_irq_save(flags);
         if (old_vector) {
-            cfg->move_in_progress = 1;
-            cpumask_copy(&cfg->old_cpu_mask, &cfg->cpu_mask);
-            cfg->old_vector = cfg->vector;
+            desc->arch.move_in_progress = 1;
+            cpumask_copy(desc->arch.old_cpu_mask, desc->arch.cpu_mask);
+            desc->arch.old_vector = desc->arch.vector;
         }
         trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, &tmp_mask);
         for_each_cpu_mask(new_cpu, tmp_mask)
             per_cpu(vector_irq, new_cpu)[vector] = irq;
-        cfg->vector = vector;
-        cpumask_copy(&cfg->cpu_mask, &tmp_mask);
+        desc->arch.vector = vector;
+        cpumask_copy(desc->arch.cpu_mask, &tmp_mask);
 
-        cfg->used = IRQ_USED;
-        ASSERT((cfg->used_vectors == NULL)
-               || (cfg->used_vectors == irq_used_vectors));
-        cfg->used_vectors = irq_used_vectors;
+        desc->arch.used = IRQ_USED;
+        ASSERT((desc->arch.used_vectors == NULL)
+               || (desc->arch.used_vectors == irq_used_vectors));
+        desc->arch.used_vectors = irq_used_vectors;
 
         if (IO_APIC_IRQ(irq))
             irq_vector[irq] = vector;
 
-        if ( cfg->used_vectors )
+        if ( desc->arch.used_vectors )
         {
-            ASSERT(!test_bit(vector, cfg->used_vectors));
+            ASSERT(!test_bit(vector, desc->arch.used_vectors));
 
-            set_bit(vector, cfg->used_vectors);
+            set_bit(vector, desc->arch.used_vectors);
         }
 
         err = 0;
@@ -521,16 +531,15 @@
 {
     int ret;
     unsigned long flags;
-    struct irq_cfg *cfg = irq_cfg(irq);
     struct irq_desc *desc = irq_to_desc(irq);
     
     BUG_ON(irq >= nr_irqs || irq <0);
 
     spin_lock_irqsave(&vector_lock, flags);
-    ret = __assign_irq_vector(irq, cfg, TARGET_CPUS);
+    ret = __assign_irq_vector(irq, desc, TARGET_CPUS);
     if (!ret) {
-        ret = cfg->vector;
-        cpumask_copy(&desc->affinity, &cfg->cpu_mask);
+        ret = desc->arch.vector;
+        cpumask_copy(desc->affinity, desc->arch.cpu_mask);
     }
     spin_unlock_irqrestore(&vector_lock, flags);
     return ret;
@@ -543,15 +552,16 @@
 void __setup_vector_irq(int cpu)
 {
     int irq, vector;
-    struct irq_cfg *cfg;
 
     /* Clear vector_irq */
     for (vector = 0; vector < NR_VECTORS; ++vector)
         per_cpu(vector_irq, cpu)[vector] = -1;
     /* Mark the inuse vectors */
     for (irq = 0; irq < nr_irqs; ++irq) {
-        cfg = irq_cfg(irq);
-        if (!cpu_isset(cpu, cfg->cpu_mask))
+        struct irq_desc *desc = irq_to_desc(irq);
+
+        if (!irq_desc_initialized(desc) ||
+            !cpumask_test_cpu(cpu, desc->arch.cpu_mask))
             continue;
         vector = irq_to_vector(irq);
         per_cpu(vector_irq, cpu)[vector] = irq;
@@ -560,12 +570,14 @@
 
 void move_masked_irq(struct irq_desc *desc)
 {
+    cpumask_t *pending_mask = desc->arch.pending_mask;
+
     if (likely(!(desc->status & IRQ_MOVE_PENDING)))
         return;
     
     desc->status &= ~IRQ_MOVE_PENDING;
 
-    if (unlikely(cpus_empty(desc->pending_mask)))
+    if (unlikely(cpumask_empty(pending_mask)))
         return;
 
     if (!desc->handler->set_affinity)
@@ -580,10 +592,10 @@
      *
      * For correct operation this depends on the caller masking the irqs.
      */
-    if (likely(cpus_intersects(desc->pending_mask, cpu_online_map)))
-        desc->handler->set_affinity(desc, &desc->pending_mask);
+    if ( likely(cpumask_intersects(pending_mask, &cpu_online_map)) )
+        desc->handler->set_affinity(desc, pending_mask);
 
-    cpumask_clear(&desc->pending_mask);
+    cpumask_clear(pending_mask);
 }
 
 void move_native_irq(struct irq_desc *desc)
@@ -626,7 +638,8 @@
         if (!desc->arch.move_cleanup_count)
             goto unlock;
 
-        if (vector == desc->arch.vector && cpumask_test_cpu(me, &desc->arch.cpu_mask))
+        if ( vector == desc->arch.vector &&
+             cpumask_test_cpu(me, desc->arch.cpu_mask) )
             goto unlock;
 
         irr = apic_read(APIC_IRR + (vector / 32 * 0x10));
@@ -653,7 +666,7 @@
         if ( desc->arch.move_cleanup_count == 0 )
         {
             desc->arch.old_vector = IRQ_VECTOR_UNASSIGNED;
-            cpumask_clear(&desc->arch.old_cpu_mask);
+            cpumask_clear(desc->arch.old_cpu_mask);
 
             if ( desc->arch.used_vectors )
             {
@@ -673,7 +686,7 @@
 {
     cpumask_t cleanup_mask;
 
-    cpumask_and(&cleanup_mask, &desc->arch.old_cpu_mask, &cpu_online_map);
+    cpumask_and(&cleanup_mask, desc->arch.old_cpu_mask, &cpu_online_map);
     desc->arch.move_cleanup_count = cpumask_weight(&cleanup_mask);
     genapic->send_IPI_mask(&cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 
@@ -690,7 +703,8 @@
     vector = get_irq_regs()->entry_vector;
     me = smp_processor_id();
 
-    if (vector == desc->arch.vector && cpumask_test_cpu(me, &desc->arch.cpu_mask))
+    if ( vector == desc->arch.vector &&
+         cpumask_test_cpu(me, desc->arch.cpu_mask) )
         send_cleanup_vector(desc);
 }
 
@@ -708,15 +722,15 @@
 
     local_irq_save(flags);
     lock_vector_lock();
-    ret = __assign_irq_vector(irq, &desc->arch, mask);
+    ret = __assign_irq_vector(irq, desc, mask);
     unlock_vector_lock();
     local_irq_restore(flags);
 
     if (ret < 0)
         return BAD_APICID;
 
-    cpumask_copy(&desc->affinity, mask);
-    cpumask_and(&dest_mask, mask, &desc->arch.cpu_mask);
+    cpumask_copy(desc->affinity, mask);
+    cpumask_and(&dest_mask, mask, desc->arch.cpu_mask);
 
     return cpu_mask_to_apicid(&dest_mask);
 }
@@ -730,7 +744,7 @@
     ASSERT(spin_is_locked(&desc->lock));
     desc->status &= ~IRQ_MOVE_PENDING;
     wmb();
-    cpumask_copy(&desc->pending_mask, mask);
+    cpumask_copy(desc->arch.pending_mask, mask);
     wmb();
     desc->status |= IRQ_MOVE_PENDING;
 }
@@ -1992,13 +2006,13 @@
 
         desc = irq_to_desc(irq);
 
-        if ( !desc->handler || desc->handler == &no_irq_type )
+        if ( !irq_desc_initialized(desc) || desc->handler == &no_irq_type )
             continue;
 
         spin_lock_irqsave(&desc->lock, flags);
 
         cpumask_scnprintf(keyhandler_scratch, sizeof(keyhandler_scratch),
-                          &desc->affinity);
+                          desc->affinity);
         printk("   IRQ:%4d affinity:%s vec:%02x type=%-15s"
                " status=%08x ",
                irq, keyhandler_scratch, desc->arch.vector,
@@ -2073,10 +2087,12 @@
             continue;
 
         desc = irq_to_desc(irq);
+        if ( !irq_desc_initialized(desc) )
+            continue;
 
         spin_lock(&desc->lock);
 
-        cpumask_copy(&affinity, &desc->affinity);
+        cpumask_copy(&affinity, desc->affinity);
         if ( !desc->action || cpumask_subset(&affinity, &cpu_online_map) )
         {
             spin_unlock(&desc->lock);
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/x86/msi.c	Thu Nov 03 17:27:38 2011 +0100
@@ -125,13 +125,13 @@
     unsigned dest;
     int vector = desc->arch.vector;
 
-    if ( cpumask_empty(&desc->arch.cpu_mask) ) {
+    if ( cpumask_empty(desc->arch.cpu_mask) ) {
         dprintk(XENLOG_ERR,"%s, compose msi message error!!\n", __func__);
         return;
     }
 
     if ( vector ) {
-        dest = cpu_mask_to_apicid(&desc->arch.cpu_mask);
+        dest = cpu_mask_to_apicid(desc->arch.cpu_mask);
 
         msg->address_hi = MSI_ADDR_BASE_HI;
         msg->address_lo =
diff -r 17ee4c213438 -r 6928172f7ded xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/arch/x86/smpboot.c	Thu Nov 03 17:27:38 2011 +0100
@@ -1011,7 +1011,7 @@
         irq_vector[irq] = FIRST_HIPRIORITY_VECTOR + seridx + 1;
         per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR + seridx + 1] = irq;
         irq_to_desc(irq)->arch.vector = FIRST_HIPRIORITY_VECTOR + seridx + 1;
-        cpumask_copy(&irq_to_desc(irq)->arch.cpu_mask, &cpu_online_map);
+        cpumask_copy(irq_to_desc(irq)->arch.cpu_mask, &cpu_online_map);
     }
 
     /* IPI for cleanuping vectors after irq move */
diff -r 17ee4c213438 -r 6928172f7ded xen/common/Makefile
--- a/xen/common/Makefile	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/common/Makefile	Thu Nov 03 17:27:38 2011 +0100
@@ -5,6 +5,7 @@
 obj-y += domain.o
 obj-y += event_channel.o
 obj-y += grant_table.o
+obj-y += irq.o
 obj-y += kernel.o
 obj-y += keyhandler.o
 obj-y += kexec.o
diff -r 17ee4c213438 -r 6928172f7ded xen/common/irq.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/common/irq.c	Thu Nov 03 17:27:38 2011 +0100
@@ -0,0 +1,28 @@
+#include <xen/config.h>
+#include <xen/irq.h>
+
+int init_one_irq_desc(struct irq_desc *desc)
+{
+    int err;
+
+    if (irq_desc_initialized(desc))
+        return 0;
+
+    if ( !alloc_cpumask_var(&desc->affinity) )
+        return -ENOMEM;
+
+    desc->status = IRQ_DISABLED;
+    desc->handler = &no_irq_type;
+    spin_lock_init(&desc->lock);
+    cpumask_setall(desc->affinity);
+    INIT_LIST_HEAD(&desc->rl_link);
+
+    err = arch_init_one_irq_desc(desc);
+    if ( err )
+    {
+        free_cpumask_var(desc->affinity);
+        desc->handler = NULL;
+    }
+
+    return err;
+}
diff -r 17ee4c213438 -r 6928172f7ded xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/drivers/passthrough/vtd/iommu.c	Thu Nov 03 17:27:38 2011 +0100
@@ -1965,17 +1965,18 @@
     struct iommu_flush *flush = NULL;
     int ret;
     unsigned long flags;
-    struct irq_cfg *cfg;
 
     /*
      * Basic VT-d HW init: set VT-d interrupt, clear VT-d faults.  
      */
     for_each_drhd_unit ( drhd )
     {
+        struct irq_desc *desc;
+
         iommu = drhd->iommu;
 
-        cfg = irq_cfg(iommu->irq);
-        dma_msi_set_affinity(irq_to_desc(iommu->irq), &cfg->cpu_mask);
+        desc = irq_to_desc(iommu->irq);
+        dma_msi_set_affinity(desc, desc->arch.cpu_mask);
 
         clear_fault_bits(iommu);
 
diff -r 17ee4c213438 -r 6928172f7ded xen/include/asm-ia64/linux-xen/asm/irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/irq.h	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Thu Nov 03 17:27:38 2011 +0100
@@ -18,8 +18,10 @@
 struct irq_cfg {
 #define arch_irq_desc irq_cfg
         int  vector;
-        cpumask_t cpu_mask;
+        cpumask_var_t cpu_mask;
 };
+
+int init_irq_data(void);
 #endif
 
 static __inline__ int
diff -r 17ee4c213438 -r 6928172f7ded xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/include/asm-x86/irq.h	Thu Nov 03 17:27:38 2011 +0100
@@ -33,8 +33,9 @@
 #define arch_irq_desc irq_cfg
         s16 vector;                  /* vector itself is only 8 bits, */
         s16 old_vector;              /* but we use -1 for unassigned  */
-        cpumask_t cpu_mask;
-        cpumask_t old_cpu_mask;
+        cpumask_var_t cpu_mask;
+        cpumask_var_t old_cpu_mask;
+        cpumask_var_t pending_mask;
         unsigned move_cleanup_count;
         vmask_t *used_vectors;
         u8 move_in_progress : 1;
@@ -174,8 +175,6 @@
 void move_native_irq(struct irq_desc *);
 void move_masked_irq(struct irq_desc *);
 
-int __assign_irq_vector(int irq, struct irq_cfg *, const cpumask_t *);
-
 int bind_irq_vector(int irq, int vector, const cpumask_t *);
 
 void irq_set_affinity(struct irq_desc *, const cpumask_t *mask);
diff -r 17ee4c213438 -r 6928172f7ded xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Thu Nov 03 12:19:23 2011 +0000
+++ b/xen/include/xen/irq.h	Thu Nov 03 17:27:38 2011 +0100
@@ -76,8 +76,7 @@
     int irq;
     spinlock_t lock;
     struct arch_irq_desc arch;
-    cpumask_t affinity;
-    cpumask_t pending_mask;  /* IRQ migration pending mask */
+    cpumask_var_t affinity;
 
     /* irq ratelimit */
     s_time_t rl_quantum_start;
@@ -85,6 +84,11 @@
     struct list_head rl_link;
 } __cacheline_aligned irq_desc_t;
 
+int init_one_irq_desc(struct irq_desc *);
+int arch_init_one_irq_desc(struct irq_desc *);
+
+#define irq_desc_initialized(desc) ((desc)->handler != NULL)
+
 #if defined(__ia64__)
 extern irq_desc_t irq_desc[NR_VECTORS];
 
@@ -153,7 +157,7 @@
 
 static inline void set_native_irq_info(unsigned int irq, const cpumask_t *mask)
 {
-    cpumask_copy(&irq_desc[irq].affinity, mask);
+    cpumask_copy(irq_to_desc(irq)->affinity, mask);
 }
 
 unsigned int set_desc_affinity(struct irq_desc *, const cpumask_t *);

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:14 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiog-0004OI-IK; Thu, 10 Nov 2011 20:34:14 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinm-00047L-Rv
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1320985994!1105340!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 5649 invoked from network); 11 Nov 2011 04:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROini-00015r-Dy
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:14 +0000
Message-Id: <E1ROini-00015r-Dy@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_json: Check the parser
	status before to call parse_complete
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410302 0
# Node ID bdbd100b28ae011fd9db40ac6fae7fc8fe2dc345
# Parent  e0b6b0e68e90c6e09c893b2905d736b0500e5e79
libxl: libxl_json: Check the parser status before to call parse_complete

Also, use goto to handle an error.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r e0b6b0e68e90 -r bdbd100b28ae tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_json.c	Fri Nov 04 12:38:22 2011 +0000
@@ -730,6 +730,8 @@
 {
     yajl_status status;
     libxl__yajl_ctx yajl_ctx;
+    libxl__json_object *o = NULL;
+    unsigned char *str = NULL;
 
     memset(&yajl_ctx, 0, sizeof (yajl_ctx));
     yajl_ctx.gc = gc;
@@ -744,30 +746,31 @@
         yajl_ctx.hand = yajl_alloc(&callbacks, &cfg, NULL, &yajl_ctx);
     }
     status = yajl_parse(yajl_ctx.hand, (const unsigned char *)s, strlen(s));
+    if (status != yajl_status_ok)
+        goto out;
+
     status = yajl_parse_complete(yajl_ctx.hand);
+    if (status != yajl_status_ok)
+        goto out;
 
-    if (status == yajl_status_ok) {
-        libxl__json_object *o = yajl_ctx.head;
+    o = yajl_ctx.head;
 
-        DEBUG_GEN_REPORT(&yajl_ctx);
+    DEBUG_GEN_REPORT(&yajl_ctx);
 
-        yajl_ctx.head = NULL;
+    yajl_ctx.head = NULL;
 
-        yajl_ctx_free(&yajl_ctx);
-        return o;
-    } else {
-        unsigned char *str = yajl_get_error(yajl_ctx.hand, 1,
-                                            (const unsigned char *)s,
-                                            strlen(s));
+    yajl_ctx_free(&yajl_ctx);
+    return o;
 
-        LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR,
-                   "yajl error: %s", str);
-        yajl_free_error(yajl_ctx.hand, str);
+out:
+    str = yajl_get_error(yajl_ctx.hand, 1, (const unsigned char*)s, strlen(s));
 
-        libxl__json_object_free(gc, yajl_ctx.head);
-        yajl_ctx_free(&yajl_ctx);
-        return NULL;
-    }
+    LIBXL__LOG(libxl__gc_owner(gc), LIBXL__LOG_ERROR, "yajl error: %s", str);
+    yajl_free_error(yajl_ctx.hand, str);
+
+    libxl__json_object_free(gc, yajl_ctx.head);
+    yajl_ctx_free(&yajl_ctx);
+    return NULL;
 }
 
 static const char *yajl_gen_status_to_string(yajl_gen_status s)

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:24 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiop-0004RU-Ib; Thu, 10 Nov 2011 20:34:23 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinm-00047K-Rx
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1320985995!1110265!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20376 invoked from network); 11 Nov 2011 04:33:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROini-00016O-VT
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:14 +0000
Message-Id: <E1ROini-00016O-VT@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Better error
	message after a parse error.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410302 0
# Node ID cf8924724b61cc3a22f19e338926795121438349
# Parent  bdbd100b28ae011fd9db40ac6fae7fc8fe2dc345
libxl: libxl_qmp: Better error message after a parse error.

By setting the next string to parse after having printed any error messages.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r bdbd100b28ae -r cf8924724b61 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:22 2011 +0000
@@ -403,7 +403,6 @@
                 *end = '\0';
 
                 o = libxl__json_parse(gc, s);
-                s = end + 2;
 
                 if (o) {
                     qmp_handle_response(qmp, o);
@@ -413,6 +412,8 @@
                                "Parse error of : %s\n", s);
                     return -1;
                 }
+
+                s = end + 2;
             } else {
                 break;
             }

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROioy-0004UY-IE; Thu, 10 Nov 2011 20:34:32 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinn-00047R-Sj
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:20 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1320985996!1117612!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20198 invoked from network); 11 Nov 2011 04:33:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROink-00017Z-6p
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:16 +0000
Message-Id: <E1ROink-00017Z-6p@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Introduce an
	opaque argument to the callbacks.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410303 0
# Node ID 9641b7594ed692e8370d6b9ad10ea5a5649ac1b6
# Parent  7b22d2f9830269b941c51f1367340fd6c485953b
libxl: libxl_qmp: Introduce an opaque argument to the callbacks.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 7b22d2f98302 -r 9641b7594ed6 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:23 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:23 2011 +0000
@@ -43,11 +43,13 @@
 #define QMP_RECEIVE_BUFFER_SIZE 4096
 
 typedef int (*qmp_callback_t)(libxl__qmp_handler *qmp,
-                              const libxl__json_object *tree);
+                              const libxl__json_object *tree,
+                              void *opaque);
 
 typedef struct callback_id_pair {
     int id;
     qmp_callback_t callback;
+    void *opaque;
     SIMPLEQ_ENTRY(callback_id_pair) next;
 } callback_id_pair;
 
@@ -70,7 +72,8 @@
 };
 
 static int qmp_send(libxl__qmp_handler *qmp,
-                    const char *cmd, qmp_callback_t callback);
+                    const char *cmd,
+                    qmp_callback_t callback, void *opaque);
 
 static const int QMP_SOCKET_CONNECT_TIMEOUT = 5;
 
@@ -100,7 +103,8 @@
 }
 
 static int register_serials_chardev_callback(libxl__qmp_handler *qmp,
-                                             const libxl__json_object *o)
+                                             const libxl__json_object *o,
+                                             void *unused)
 {
     const libxl__json_object *obj = NULL;
     const libxl__json_object *label = NULL;
@@ -144,7 +148,7 @@
 }
 
 static int qmp_capabilities_callback(libxl__qmp_handler *qmp,
-                                     const libxl__json_object *o)
+                                     const libxl__json_object *o, void *unused)
 {
     qmp->connected = true;
 
@@ -157,7 +161,7 @@
 
 static int enable_qmp_capabilities(libxl__qmp_handler *qmp)
 {
-    return qmp_send(qmp, "qmp_capabilities", qmp_capabilities_callback);
+    return qmp_send(qmp, "qmp_capabilities", qmp_capabilities_callback, NULL);
 }
 
 /*
@@ -208,7 +212,7 @@
     resp = libxl__json_map_get("desc", resp, JSON_STRING);
 
     if (pp) {
-        pp->callback(qmp, NULL);
+        pp->callback(qmp, NULL, pp->opaque);
         if (pp->id == qmp->wait_for_id) {
             /* tell that the id have been processed */
             qmp->wait_for_id = 0;
@@ -241,7 +245,8 @@
 
         if (pp) {
             pp->callback(qmp,
-                         libxl__json_map_get("return", resp, JSON_ANY));
+                         libxl__json_map_get("return", resp, JSON_ANY),
+                         pp->opaque);
             if (pp->id == qmp->wait_for_id) {
                 /* tell that the id have been processed */
                 qmp->wait_for_id = 0;
@@ -424,7 +429,8 @@
 }
 
 static int qmp_send(libxl__qmp_handler *qmp,
-                    const char *cmd, qmp_callback_t callback)
+                    const char *cmd,
+                    qmp_callback_t callback, void *opaque)
 {
     yajl_gen_config conf = { 0, NULL };
     const unsigned char *buf;
@@ -462,6 +468,7 @@
         }
         elm->id = qmp->last_id_used;
         elm->callback = callback;
+        elm->opaque = opaque;
         SIMPLEQ_INSERT_TAIL(&qmp->callback_list, elm, next);
     }
 
@@ -484,13 +491,14 @@
 }
 
 static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd,
-                                qmp_callback_t callback, int ask_timeout)
+                                qmp_callback_t callback, void *opaque,
+                                int ask_timeout)
 {
     int id = 0;
     int ret = 0;
     libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
 
-    id = qmp_send(qmp, cmd, callback);
+    id = qmp_send(qmp, cmd, callback, opaque);
     if (id <= 0) {
         return -1;
     }
@@ -580,7 +588,7 @@
 {
     return qmp_synchronous_send(qmp, "query-chardev",
                                 register_serials_chardev_callback,
-                                qmp->timeout);
+                                NULL, qmp->timeout);
 }
 
 int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:39 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:39 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROip4-0004Xd-Ml; Thu, 10 Nov 2011 20:34:38 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinn-00047M-CW
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:20 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1320985996!1114507!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3626 invoked from network); 11 Nov 2011 04:33:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinj-000171-MV
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:15 +0000
Message-Id: <E1ROinj-000171-MV@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl: Introduce dm-version
	xenstore key.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410303 0
# Node ID 7b22d2f9830269b941c51f1367340fd6c485953b
# Parent  cf8924724b61cc3a22f19e338926795121438349
libxl: libxl: Introduce dm-version xenstore key.

The all key is /libxl/$domid/dm-version.

The /libxl/$domid dir is created with the domain and should be only accessible
by the toolstack domain. The function libxl__xs_libxl_path() give this path.

This come with libxl__device_model_version_running() helper function.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r cf8924724b61 -r 7b22d2f98302 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl.c	Fri Nov 04 12:38:23 2011 +0000
@@ -778,6 +778,8 @@
     if (!xs_rm(ctx->xsh, XBT_NULL, dom_path))
         LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "xs_rm failed for %s", dom_path);
 
+    xs_rm(ctx->xsh, XBT_NULL, libxl__xs_libxl_path(&gc, domid));
+
     libxl__userdata_destroyall(&gc, domid);
 
     rc = xc_domain_destroy(ctx->xch, domid);
diff -r cf8924724b61 -r 7b22d2f98302 tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_create.c	Fri Nov 04 12:38:23 2011 +0000
@@ -316,12 +316,14 @@
     char *rw_paths[] = { "control/shutdown", "device", "device/suspend/event-channel" , "data"};
     char *ro_paths[] = { "cpu", "memory", "device", "error", "drivers",
                          "control", "attr", "messages" };
-    char *dom_path, *vm_path;
+    char *dom_path, *vm_path, *libxl_path;
     struct xs_permissions roperm[2];
     struct xs_permissions rwperm[1];
+    struct xs_permissions noperm[1];
     xs_transaction_t t = 0;
     xen_domain_handle_t handle;
 
+
     assert(!libxl_domid_valid_guest(*domid));
 
     uuid_string = libxl__uuid2string(gc, info->uuid);
@@ -368,6 +370,14 @@
         goto out;
     }
 
+    libxl_path = libxl__xs_libxl_path(gc, *domid);
+    if (!libxl_path) {
+        rc = ERROR_FAIL;
+        goto out;
+    }
+    noperm[0].id = 0;
+    noperm[0].perms = XS_PERM_NONE;
+
     roperm[0].id = 0;
     roperm[0].perms = XS_PERM_NONE;
     roperm[1].id = *domid;
@@ -386,6 +396,10 @@
     xs_mkdir(ctx->xsh, t, vm_path);
     xs_set_permissions(ctx->xsh, t, vm_path, roperm, ARRAY_SIZE(roperm));
 
+    xs_rm(ctx->xsh, t, libxl_path);
+    xs_mkdir(ctx->xsh, t, libxl_path);
+    xs_set_permissions(ctx->xsh, t, libxl_path, noperm, ARRAY_SIZE(noperm));
+
     xs_write(ctx->xsh, t, libxl__sprintf(gc, "%s/vm", dom_path), vm_path, strlen(vm_path));
     rc = libxl__domain_rename(gc, *domid, 0, info->name, t);
     if (rc)
@@ -429,6 +443,17 @@
     return rc;
 }
 
+static int store_libxl_entry(libxl__gc *gc, uint32_t domid,
+                             libxl_device_model_info *dm_info)
+{
+    char *path = NULL;
+
+    path = libxl__xs_libxl_path(gc, domid);
+    path = libxl__sprintf(gc, "%s/dm-version", path);
+    return libxl__xs_write(gc, XBT_NULL, path, libxl__strdup(gc,
+        libxl_device_model_version_to_string(dm_info->device_model_version)));
+}
+
 static int do_domain_create(libxl__gc *gc, libxl_domain_config *d_config,
                             libxl_console_ready cb, void *priv,
                             uint32_t *domid_out, int restore_fd)
@@ -485,6 +510,8 @@
         goto error_out;
     }
 
+    store_libxl_entry(gc, domid, dm_info);
+
     for (i = 0; i < d_config->num_disks; i++) {
         ret = libxl_device_disk_add(ctx, domid, &d_config->disks[i]);
         if (ret) {
diff -r cf8924724b61 -r 7b22d2f98302 tools/libxl/libxl_internal.c
--- a/tools/libxl/libxl_internal.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_internal.c	Fri Nov 04 12:38:23 2011 +0000
@@ -319,6 +319,29 @@
     return fcntl(fd, F_SETFD, flags | FD_CLOEXEC);
 }
 
+libxl_device_model_version libxl__device_model_version_running(libxl__gc *gc,
+                                                               uint32_t domid)
+{
+    char *path = NULL;
+    char *dm_version = NULL;
+    libxl_device_model_version value;
+
+    path = libxl__xs_libxl_path(gc, domid);
+    path = libxl__sprintf(gc, "%s/dm-version", path);
+    dm_version = libxl__xs_read(gc, XBT_NULL, path);
+    if (!dm_version) {
+        return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL;
+    }
+
+    if (libxl_device_model_version_from_string(dm_version, &value) < 0) {
+        libxl_ctx *ctx = libxl__gc_owner(gc);
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                   "fatal: %s contain a wrong value (%s)", path, dm_version);
+        return -1;
+    }
+    return value;
+}
+
 /*
  * Local variables:
  * mode: C
diff -r cf8924724b61 -r 7b22d2f98302 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Nov 04 12:38:23 2011 +0000
@@ -183,6 +183,8 @@
                                    char *path, unsigned int *nb);
    /* On error: returns NULL, sets errno (no logging) */
 
+_hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
+
 /* from xl_dom */
 _hidden libxl_domain_type libxl__domain_type(libxl__gc *gc, uint32_t domid);
 _hidden int libxl__domain_shutdown_reason(libxl__gc *gc, uint32_t domid);
@@ -630,6 +632,11 @@
 
 _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc, const char *s);
 
+  /* Based on /local/domain/$domid/dm-version xenstore key
+   * default is qemu xen traditional */
+_hidden libxl_device_model_version
+libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
+
 #endif
 
 /*
diff -r cf8924724b61 -r 7b22d2f98302 tools/libxl/libxl_xshelp.c
--- a/tools/libxl/libxl_xshelp.c	Fri Nov 04 12:38:22 2011 +0000
+++ b/tools/libxl/libxl_xshelp.c	Fri Nov 04 12:38:23 2011 +0000
@@ -122,6 +122,15 @@
     return ret;
 }
 
+char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *s = libxl__sprintf(gc, "/libxl/%i", domid);
+    if (!s)
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot allocate create paths");
+    return s;
+}
+
 /*
  * Local variables:
  * mode: C

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:46 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipC-0004am-GN; Thu, 10 Nov 2011 20:34:46 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinp-00047x-Gn
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:22 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1320985998!1120041!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31550 invoked from network); 11 Nov 2011 04:33:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinl-000196-Pv
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:17 +0000
Message-Id: <E1ROinl-000196-Pv@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Introduce
	qmp_request_context.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410305 0
# Node ID 8d06378f148709fcc5d4861cbc50b40934c5b273
# Parent  0406f6783c65f246c10ee946d9646538a1e7fc31
libxl: libxl_qmp: Introduce qmp_request_context.

This structure helps to track the return code of a callback. It's only used
between qmp_synchronous_send and qmp_send.

Now, qmp_synchronous_send will return the rc of the callback if there is no
error.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 0406f6783c65 -r 8d06378f1487 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:24 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:25 2011 +0000
@@ -46,10 +46,15 @@
                               const libxl__json_object *tree,
                               void *opaque);
 
+typedef struct qmp_request_context {
+    int rc;
+} qmp_request_context;
+
 typedef struct callback_id_pair {
     int id;
     qmp_callback_t callback;
     void *opaque;
+    qmp_request_context *context;
     SIMPLEQ_ENTRY(callback_id_pair) next;
 } callback_id_pair;
 
@@ -73,7 +78,8 @@
 
 static int qmp_send(libxl__qmp_handler *qmp,
                     const char *cmd, libxl_key_value_list *args,
-                    qmp_callback_t callback, void *opaque);
+                    qmp_callback_t callback, void *opaque,
+                    qmp_request_context *context);
 
 static const int QMP_SOCKET_CONNECT_TIMEOUT = 5;
 
@@ -162,7 +168,7 @@
 static int enable_qmp_capabilities(libxl__qmp_handler *qmp)
 {
     return qmp_send(qmp, "qmp_capabilities", NULL,
-                    qmp_capabilities_callback, NULL);
+                    qmp_capabilities_callback, NULL, NULL);
 }
 
 /*
@@ -214,7 +220,10 @@
 
     if (pp) {
         if (pp->callback) {
-            pp->callback(qmp, NULL, pp->opaque);
+            int rc = pp->callback(qmp, NULL, pp->opaque);
+            if (pp->context) {
+                pp->context->rc = rc;
+            }
         }
         if (pp->id == qmp->wait_for_id) {
             /* tell that the id have been processed */
@@ -241,16 +250,18 @@
     switch (type) {
     case LIBXL__QMP_MESSAGE_TYPE_QMP:
         /* On the greeting message from the server, enable QMP capabilities */
-        enable_qmp_capabilities(qmp);
-        break;
+        return enable_qmp_capabilities(qmp);
     case LIBXL__QMP_MESSAGE_TYPE_RETURN: {
         callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp);
 
         if (pp) {
             if (pp->callback) {
-                pp->callback(qmp,
+                int rc = pp->callback(qmp,
                              libxl__json_map_get("return", resp, JSON_ANY),
                              pp->opaque);
+                if (pp->context) {
+                    pp->context->rc = rc;
+                }
             }
             if (pp->id == qmp->wait_for_id) {
                 /* tell that the id have been processed */
@@ -259,13 +270,13 @@
             SIMPLEQ_REMOVE(&qmp->callback_list, pp, callback_id_pair, next);
             free(pp);
         }
-        break;
+        return 0;
     }
     case LIBXL__QMP_MESSAGE_TYPE_ERROR:
         qmp_handle_error_response(qmp, resp);
-        break;
+        return -1;
     case LIBXL__QMP_MESSAGE_TYPE_EVENT:
-        break;
+        return 0;
     case LIBXL__QMP_MESSAGE_TYPE_INVALID:
         return -1;
     }
@@ -358,6 +369,7 @@
 
     char *incomplete = NULL;
     size_t incomplete_size = 0;
+    int rc = 0;
 
     do {
         fd_set rfds;
@@ -415,7 +427,7 @@
                 o = libxl__json_parse(gc, s);
 
                 if (o) {
-                    qmp_handle_response(qmp, o);
+                    rc = qmp_handle_response(qmp, o);
                     libxl__json_object_free(gc, o);
                 } else {
                     LIBXL__LOG(qmp->ctx, LIBXL__LOG_ERROR,
@@ -430,12 +442,13 @@
         } while (s < s_end);
    } while (s < s_end);
 
-    return 1;
+    return rc;
 }
 
 static int qmp_send(libxl__qmp_handler *qmp,
                     const char *cmd, libxl_key_value_list *args,
-                    qmp_callback_t callback, void *opaque)
+                    qmp_callback_t callback, void *opaque,
+                    qmp_request_context *context)
 {
     yajl_gen_config conf = { 0, NULL };
     const unsigned char *buf;
@@ -477,6 +490,7 @@
     elm->id = qmp->last_id_used;
     elm->callback = callback;
     elm->opaque = opaque;
+    elm->context = context;
     SIMPLEQ_INSERT_TAIL(&qmp->callback_list, elm, next);
 
     LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "next qmp command: '%s'", buf);
@@ -505,8 +519,9 @@
     int id = 0;
     int ret = 0;
     libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
+    qmp_request_context context = { .rc = 0 };
 
-    id = qmp_send(qmp, cmd, args, callback, opaque);
+    id = qmp_send(qmp, cmd, args, callback, opaque, &context);
     if (id <= 0) {
         return -1;
     }
@@ -514,13 +529,17 @@
 
     while (qmp->wait_for_id == id) {
         if ((ret = qmp_next(&gc, qmp)) < 0) {
-            return ret;
+            break;
         }
     }
 
+    if (qmp->wait_for_id != id && ret == 0) {
+        ret = context.rc;
+    }
+
     libxl__free_all(&gc);
 
-    return 0;
+    return ret;
 }
 
 static void qmp_free_handler(libxl__qmp_handler *qmp)

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:34:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:34:55 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipL-0004dt-Df; Thu, 10 Nov 2011 20:34:55 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROino-00047W-Dz
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:21 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1320985997!1112346!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27759 invoked from network); 11 Nov 2011 04:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROink-000183-O2
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:16 +0000
Message-Id: <E1ROink-000183-O2@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Introduce list of
	arguments to qmp_send
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410304 0
# Node ID 918a2091c181b547bc5ff45d9085c18381907b9c
# Parent  9641b7594ed692e8370d6b9ad10ea5a5649ac1b6
libxl: libxl_qmp: Introduce list of arguments to qmp_send

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 9641b7594ed6 -r 918a2091c181 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:23 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:24 2011 +0000
@@ -72,7 +72,7 @@
 };
 
 static int qmp_send(libxl__qmp_handler *qmp,
-                    const char *cmd,
+                    const char *cmd, libxl_key_value_list *args,
                     qmp_callback_t callback, void *opaque);
 
 static const int QMP_SOCKET_CONNECT_TIMEOUT = 5;
@@ -161,7 +161,8 @@
 
 static int enable_qmp_capabilities(libxl__qmp_handler *qmp)
 {
-    return qmp_send(qmp, "qmp_capabilities", qmp_capabilities_callback, NULL);
+    return qmp_send(qmp, "qmp_capabilities", NULL,
+                    qmp_capabilities_callback, NULL);
 }
 
 /*
@@ -429,7 +430,7 @@
 }
 
 static int qmp_send(libxl__qmp_handler *qmp,
-                    const char *cmd,
+                    const char *cmd, libxl_key_value_list *args,
                     qmp_callback_t callback, void *opaque)
 {
     yajl_gen_config conf = { 0, NULL };
@@ -448,6 +449,10 @@
     libxl__yajl_gen_asciiz(hand, cmd);
     libxl__yajl_gen_asciiz(hand, "id");
     yajl_gen_integer(hand, ++qmp->last_id_used);
+    if (args) {
+        libxl__yajl_gen_asciiz(hand, "arguments");
+        libxl_key_value_list_gen_json(hand, args);
+    }
     yajl_gen_map_close(hand);
 
     s = yajl_gen_get_buf(hand, &buf, &len);
@@ -491,6 +496,7 @@
 }
 
 static int qmp_synchronous_send(libxl__qmp_handler *qmp, const char *cmd,
+                                libxl_key_value_list *args,
                                 qmp_callback_t callback, void *opaque,
                                 int ask_timeout)
 {
@@ -498,7 +504,7 @@
     int ret = 0;
     libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
 
-    id = qmp_send(qmp, cmd, callback, opaque);
+    id = qmp_send(qmp, cmd, args, callback, opaque);
     if (id <= 0) {
         return -1;
     }
@@ -586,7 +592,7 @@
 
 int libxl__qmp_query_serial(libxl__qmp_handler *qmp)
 {
-    return qmp_synchronous_send(qmp, "query-chardev",
+    return qmp_synchronous_send(qmp, "query-chardev", NULL,
                                 register_serials_chardev_callback,
                                 NULL, qmp->timeout);
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:05 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipV-0004hn-S7; Thu, 10 Nov 2011 20:35:05 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinp-00047h-0f
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:22 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1320985997!1105616!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20411 invoked from network); 11 Nov 2011 04:33:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinl-00018Z-8d
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:17 +0000
Message-Id: <E1ROinl-00018Z-8d@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Always insert a
	command id in the callback_list.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410304 0
# Node ID 0406f6783c65f246c10ee946d9646538a1e7fc31
# Parent  918a2091c181b547bc5ff45d9085c18381907b9c
libxl: libxl_qmp: Always insert a command id in the callback_list.

Because the function qmp_synchronous_send rely on the presence of the id
in the callback_list.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---


diff -r 918a2091c181 -r 0406f6783c65 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:24 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:24 2011 +0000
@@ -213,7 +213,9 @@
     resp = libxl__json_map_get("desc", resp, JSON_STRING);
 
     if (pp) {
-        pp->callback(qmp, NULL, pp->opaque);
+        if (pp->callback) {
+            pp->callback(qmp, NULL, pp->opaque);
+        }
         if (pp->id == qmp->wait_for_id) {
             /* tell that the id have been processed */
             qmp->wait_for_id = 0;
@@ -245,9 +247,11 @@
         callback_id_pair *pp = qmp_get_callback_from_id(qmp, resp);
 
         if (pp) {
-            pp->callback(qmp,
-                         libxl__json_map_get("return", resp, JSON_ANY),
-                         pp->opaque);
+            if (pp->callback) {
+                pp->callback(qmp,
+                             libxl__json_map_get("return", resp, JSON_ANY),
+                             pp->opaque);
+            }
             if (pp->id == qmp->wait_for_id) {
                 /* tell that the id have been processed */
                 qmp->wait_for_id = 0;
@@ -438,6 +442,7 @@
     unsigned int len = 0;
     yajl_gen_status s;
     yajl_gen hand;
+    callback_id_pair *elm = NULL;
 
     hand = yajl_gen_alloc(&conf, NULL);
     if (!hand) {
@@ -463,19 +468,16 @@
         return -1;
     }
 
-    if (callback) {
-        callback_id_pair *elm = malloc(sizeof (callback_id_pair));
-        if (elm == NULL) {
-            LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR,
-                             "Failed to allocate a QMP callback");
-            yajl_gen_free(hand);
-            return -1;
-        }
-        elm->id = qmp->last_id_used;
-        elm->callback = callback;
-        elm->opaque = opaque;
-        SIMPLEQ_INSERT_TAIL(&qmp->callback_list, elm, next);
+    elm = malloc(sizeof (callback_id_pair));
+    if (elm == NULL) {
+        LIBXL__LOG_ERRNO(qmp->ctx, LIBXL__LOG_ERROR,
+                         "Failed to allocate a QMP callback");
+        goto error;
     }
+    elm->id = qmp->last_id_used;
+    elm->callback = callback;
+    elm->opaque = opaque;
+    SIMPLEQ_INSERT_TAIL(&qmp->callback_list, elm, next);
 
     LIBXL__LOG(qmp->ctx, LIBXL__LOG_DEBUG, "next qmp command: '%s'", buf);
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:13 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipd-0004kz-Nr; Thu, 10 Nov 2011 20:35:13 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinq-00048M-0e
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:23 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1320985965!45464649!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28405 invoked from network); 11 Nov 2011 04:32:45 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:45 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinm-0001AA-To
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:18 +0000
Message-Id: <E1ROinm-0001AA-To@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Introduce
	libxl__qmp_pci_add.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320416647 0
# Node ID a67944b1adfb67193817de02e6d143e39bfbbe17
# Parent  c5fe74068253a21325ab880370db4c93b7017998
libxl: libxl_qmp: Introduce libxl__qmp_pci_add.

This function insert a PCI passthrough device in qemu.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r c5fe74068253 -r a67944b1adfb tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Nov 04 12:38:25 2011 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Nov 04 14:24:07 2011 +0000
@@ -107,6 +107,9 @@
 } libxl__device;
 
 #define XC_PCI_BDF             "0x%x, 0x%x, 0x%x, 0x%x"
+#define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
+#define PCI_SLOT(devfn)         (((devfn) >> 3) & 0x1f)
+#define PCI_FUNC(devfn)         ((devfn) & 0x07)
 #define AUTO_PHP_SLOT          0x100
 #define SYSFS_PCI_DEV          "/sys/bus/pci/devices"
 #define SYSFS_PCIBACK_DRIVER   "/sys/bus/pci/drivers/pciback"
@@ -522,6 +525,7 @@
                                                   uint32_t domid);
 /* ask to QEMU the serial port information and store it in xenstore. */
 _hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp);
+_hidden int libxl__qmp_pci_add(libxl__gc *gc, int d, libxl_device_pci *pcidev);
 /* close and free the QMP handler */
 _hidden void libxl__qmp_close(libxl__qmp_handler *qmp);
 /* remove the socket file, if the file has already been removed,
diff -r c5fe74068253 -r a67944b1adfb tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 12:38:25 2011 +0000
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 14:24:07 2011 +0000
@@ -41,6 +41,7 @@
  */
 
 #define QMP_RECEIVE_BUFFER_SIZE 4096
+#define PCI_PT_QDEV_ID "pci-pt-%02x_%02x.%01x"
 
 typedef int (*qmp_callback_t)(libxl__qmp_handler *qmp,
                               const libxl__json_object *tree,
@@ -618,6 +619,100 @@
                                 NULL, qmp->timeout);
 }
 
+static int pci_add_callback(libxl__qmp_handler *qmp,
+                            const libxl__json_object *response, void *opaque)
+{
+    libxl_device_pci *pcidev = opaque;
+    const libxl__json_object *bus = NULL;
+    libxl__gc gc = LIBXL_INIT_GC(qmp->ctx);
+    int i, j, rc = -1;
+    char *asked_id = libxl__sprintf(&gc, PCI_PT_QDEV_ID,
+                                    pcidev->bus, pcidev->dev, pcidev->func);
+
+    for (i = 0; (bus = libxl__json_array_get(response, i)); i++) {
+        const libxl__json_object *devices = NULL;
+        const libxl__json_object *device = NULL;
+        const libxl__json_object *o = NULL;
+        const char *id = NULL;
+
+        devices = libxl__json_map_get("devices", bus, JSON_ARRAY);
+
+        for (j = 0; (device = libxl__json_array_get(devices, j)); j++) {
+             o = libxl__json_map_get("qdev_id", device, JSON_STRING);
+             id = libxl__json_object_get_string(o);
+
+             if (id && strcmp(asked_id, id) == 0) {
+                 int dev_slot, dev_func;
+
+                 o = libxl__json_map_get("slot", device, JSON_INTEGER);
+                 if (!o)
+                     goto out;
+                 dev_slot = libxl__json_object_get_integer(o);
+                 o = libxl__json_map_get("function", device, JSON_INTEGER);
+                 if (!o)
+                     goto out;
+                 dev_func = libxl__json_object_get_integer(o);
+
+                 pcidev->vdevfn = PCI_DEVFN(dev_slot, dev_func);
+
+                 rc = 0;
+                 goto out;
+             }
+        }
+    }
+
+
+out:
+    libxl__free_all(&gc);
+    return rc;
+}
+
+int libxl__qmp_pci_add(libxl__gc *gc, int domid, libxl_device_pci *pcidev)
+{
+    libxl__qmp_handler *qmp = NULL;
+    flexarray_t *parameters = NULL;
+    libxl_key_value_list args = NULL;
+    char *hostaddr = NULL;
+    int rc = 0;
+
+    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    if (!qmp)
+        return -1;
+
+    hostaddr = libxl__sprintf(gc, "%04x:%02x:%02x.%01x", pcidev->domain,
+                              pcidev->bus, pcidev->dev, pcidev->func);
+    if (!hostaddr)
+        return -1;
+
+    parameters = flexarray_make(6, 1);
+    flexarray_append_pair(parameters, "driver", "xen-pci-passthrough");
+    flexarray_append_pair(parameters, "id",
+                          libxl__sprintf(gc, PCI_PT_QDEV_ID,
+                                         pcidev->bus, pcidev->dev,
+                                         pcidev->func));
+    flexarray_append_pair(parameters, "hostaddr", hostaddr);
+    if (pcidev->vdevfn) {
+        flexarray_append_pair(parameters, "addr",
+                              libxl__sprintf(gc, "%x.%x",
+                                             PCI_SLOT(pcidev->vdevfn),
+                                             PCI_FUNC(pcidev->vdevfn)));
+    }
+    args = libxl__xs_kvs_of_flexarray(gc, parameters, parameters->count);
+    if (!args)
+        return -1;
+
+    rc = qmp_synchronous_send(qmp, "device_add", &args,
+                              NULL, NULL, qmp->timeout);
+    if (rc == 0) {
+        rc = qmp_synchronous_send(qmp, "query-pci", NULL,
+                                  pci_add_callback, pcidev, qmp->timeout);
+    }
+
+    flexarray_free(parameters);
+    libxl__qmp_close(qmp);
+    return rc;
+}
+
 int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:20 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipk-0004oA-7u; Thu, 10 Nov 2011 20:35:20 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinr-00048h-4E
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:23 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-27.messagelabs.com!1320985977!44145541!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18414 invoked from network); 11 Nov 2011 04:32:57 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:57 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROino-0001BE-1m
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:20 +0000
Message-Id: <E1ROino-0001BE-1m@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:19 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IRQ: fix create_irq() after c/s
	24068:6928172f7ded
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320418550 -3600
# Node ID 659c800d7edf433c188917bf6faff177dd118c07
# Parent  974b00c7c2d070bcd3b107623f7cb3dff78cd79e
x86/IRQ: fix create_irq() after c/s 24068:6928172f7ded

init_one_irq_desc() must be called with interrupts enabled (as it may
call functions from the xmalloc() group). Rather than mis-using
vector_lock to also protect the finding of an unused IRQ, make this
lockless through using cmpxchg(), and obtain the lock only around the
actual assignment of the vector.

Also fold find_unassigned_irq() into its only caller.

It is, btw, questionable whether create_irq() calling
__assign_irq_vector() (rather than assign_irq_vector()) is actually
correct - desc->affinity appears to not get initialized properly in
this case.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 974b00c7c2d0 -r 659c800d7edf xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Fri Nov 04 14:24:07 2011 +0000
+++ b/xen/arch/x86/irq.c	Fri Nov 04 15:55:50 2011 +0100
@@ -151,16 +151,6 @@
     return ret;
 }
 
-static inline int find_unassigned_irq(void)
-{
-    int irq;
-
-    for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
-        if (irq_to_desc(irq)->arch.used == IRQ_UNUSED)
-            return irq;
-    return -ENOSPC;
-}
-
 /*
  * Dynamic irq allocate and deallocation for MSI
  */
@@ -170,19 +160,28 @@
     int irq, ret;
     struct irq_desc *desc;
 
-    spin_lock_irqsave(&vector_lock, flags);
+    for (irq = nr_irqs_gsi; irq < nr_irqs; irq++)
+    {
+        desc = irq_to_desc(irq);
+        if (cmpxchg(&desc->arch.used, IRQ_UNUSED, IRQ_RESERVED) == IRQ_UNUSED)
+           break;
+    }
 
-    irq = find_unassigned_irq();
-    if (irq < 0)
-         goto out;
-    desc = irq_to_desc(irq);
+    if (irq >= nr_irqs)
+         return -ENOSPC;
+
     ret = init_one_irq_desc(desc);
     if (!ret)
+    {
+        spin_lock_irqsave(&vector_lock, flags);
         ret = __assign_irq_vector(irq, desc, TARGET_CPUS);
+        spin_unlock_irqrestore(&vector_lock, flags);
+    }
     if (ret < 0)
+    {
+        desc->arch.used = IRQ_UNUSED;
         irq = ret;
-out:
-     spin_unlock_irqrestore(&vector_lock, flags);
+    }
 
     return irq;
 }
diff -r 974b00c7c2d0 -r 659c800d7edf xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Fri Nov 04 14:24:07 2011 +0000
+++ b/xen/include/asm-x86/irq.h	Fri Nov 04 15:55:50 2011 +0100
@@ -39,12 +39,13 @@
         unsigned move_cleanup_count;
         vmask_t *used_vectors;
         u8 move_in_progress : 1;
-        u8 used: 1;
+        s8 used;
 };
 
 /* For use with irq_cfg.used */
 #define IRQ_UNUSED      (0)
 #define IRQ_USED        (1)
+#define IRQ_RESERVED    (-1)
 
 #define IRQ_VECTOR_UNASSIGNED (-1)
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:28 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipr-0004rU-Qx; Thu, 10 Nov 2011 20:35:27 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinq-00048U-IS
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:23 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1320985962!62749624!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11308 invoked from network); 11 Nov 2011 04:32:42 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:42 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinn-0001Af-GC
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:19 +0000
Message-Id: <E1ROinn-0001Af-GC@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:18 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Use QMP to insert a
	passthrough device when using upstream QEMU
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320416647 0
# Node ID 974b00c7c2d070bcd3b107623f7cb3dff78cd79e
# Parent  a67944b1adfb67193817de02e6d143e39bfbbe17
libxl: Use QMP to insert a passthrough device when using upstream QEMU

Also move the xenstore specific code to a new function and add a
message if sscanf fails.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r a67944b1adfb -r 974b00c7c2d0 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Fri Nov 04 14:24:07 2011 +0000
+++ b/tools/libxl/libxl_pci.c	Fri Nov 04 14:24:07 2011 +0000
@@ -601,11 +601,52 @@
     return 1;
 }
 
+static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid,
+                                 libxl_device_pci *pcidev)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    int rc = 0;
+    char *path;
+    char *state, *vdevfn;
+
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+    state = libxl__xs_read(gc, XBT_NULL, path);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter",
+                          domid);
+    if (pcidev->vdevfn) {
+        libxl__xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN,
+                        pcidev->domain, pcidev->bus, pcidev->dev,
+                        pcidev->func, pcidev->vdevfn);
+    } else {
+        libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
+                        pcidev->bus, pcidev->dev, pcidev->func);
+    }
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command",
+                          domid);
+    xs_write(ctx->xsh, XBT_NULL, path, "pci-ins", strlen("pci-ins"));
+    rc = libxl__wait_for_device_model(gc, domid, NULL, NULL,
+                                      pci_ins_check, state);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter",
+                          domid);
+    vdevfn = libxl__xs_read(gc, XBT_NULL, path);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state",
+                          domid);
+    if ( rc < 0 )
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                   "qemu refused to add device: %s", vdevfn);
+    else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 ) {
+        LIBXL__LOG(ctx, LIBXL__LOG_ERROR,
+                   "wrong format for the vdevfn: '%s'", vdevfn);
+        rc = -1;
+    }
+    xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
+
+    return rc;
+}
+
 static int do_pci_add(libxl__gc *gc, uint32_t domid, libxl_device_pci *pcidev, int starting)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
-    char *path;
-    char *state, *vdevfn;
     int rc, hvm = 0;
 
     switch (libxl__domain_type(gc, domid)) {
@@ -615,27 +656,16 @@
                                          NULL, NULL, NULL) < 0) {
             return ERROR_FAIL;
         }
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
-        state = libxl__xs_read(gc, XBT_NULL, path);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
-        if (pcidev->vdevfn)
-            libxl__xs_write(gc, XBT_NULL, path, PCI_BDF_VDEVFN, pcidev->domain,
-                           pcidev->bus, pcidev->dev, pcidev->func, pcidev->vdevfn);
-        else
-            libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
-                           pcidev->bus, pcidev->dev, pcidev->func);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
-        xs_write(ctx->xsh, XBT_NULL, path, "pci-ins", strlen("pci-ins"));
-        rc = libxl__wait_for_device_model(gc, domid, NULL, NULL,
-                                          pci_ins_check, state);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
-        vdevfn = libxl__xs_read(gc, XBT_NULL, path);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
-        if ( rc < 0 )
-            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu refused to add device: %s", vdevfn);
-        else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 )
-            rc = -1;
-        xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
+        switch (libxl__device_model_version_running(gc, domid)) {
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+                rc = qemu_pci_add_xenstore(gc, domid, pcidev);
+                break;
+            case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+                rc = libxl__qmp_pci_add(gc, domid, pcidev);
+                break;
+            default:
+                return ERROR_INVAL;
+        }
         if ( rc )
             return ERROR_FAIL;
         break;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:33 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:33 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROipx-0004uM-PF; Thu, 10 Nov 2011 20:35:33 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinp-00048A-OM
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:22 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-21.messagelabs.com!1320985998!3790683!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 29908 invoked from network); 11 Nov 2011 04:33:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinm-00019d-Ae
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:18 +0000
Message-Id: <E1ROinm-00019d-Ae@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_json: Handle number
	above LONG_MAX.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320410305 0
# Node ID c5fe74068253a21325ab880370db4c93b7017998
# Parent  8d06378f148709fcc5d4861cbc50b40934c5b273
libxl: libxl_json: Handle number above LONG_MAX.

The integers are now "long long" in the json_object.

If a number (decimal or integer) is too big (or too low), it is stored as it in
a string. So for that, we introduce a new type JSON_NUMBER.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 8d06378f1487 -r c5fe74068253 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Nov 04 12:38:25 2011 +0000
+++ b/tools/libxl/libxl_internal.h	Fri Nov 04 12:38:25 2011 +0000
@@ -544,6 +544,8 @@
     JSON_FALSE,
     JSON_INTEGER,
     JSON_DOUBLE,
+    /* number is store in string, it's too big to be a long long or a double */
+    JSON_NUMBER,
     JSON_STRING,
     JSON_MAP,
     JSON_ARRAY,
@@ -553,7 +555,7 @@
 typedef struct libxl__json_object {
     libxl__json_node_type type;
     union {
-        long i;
+        long long i;
         double d;
         char *string;
         /* List of libxl__json_object */
@@ -612,7 +614,7 @@
     else
         return NULL;
 }
-static inline long libxl__json_object_get_integer(const libxl__json_object *o)
+static inline long long libxl__json_object_get_integer(const libxl__json_object *o)
 {
     if (libxl__json_object_is_integer(o))
         return o->u.i;
diff -r 8d06378f1487 -r c5fe74068253 tools/libxl/libxl_json.c
--- a/tools/libxl/libxl_json.c	Fri Nov 04 12:38:25 2011 +0000
+++ b/tools/libxl/libxl_json.c	Fri Nov 04 12:38:25 2011 +0000
@@ -14,6 +14,7 @@
 
 #include <assert.h>
 #include <string.h>
+#include <math.h>
 
 #include <yajl/yajl_parse.h>
 #include <yajl/yajl_gen.h>
@@ -44,6 +45,7 @@
 #  define DEBUG_GEN(ctx, type)              yajl_gen_##type(ctx->g)
 #  define DEBUG_GEN_VALUE(ctx, type, value) yajl_gen_##type(ctx->g, value)
 #  define DEBUG_GEN_STRING(ctx, str, n)     yajl_gen_string(ctx->g, str, n)
+#  define DEBUG_GEN_NUMBER(ctx, str, n)     yajl_gen_number(ctx->g, str, n)
 #  define DEBUG_GEN_REPORT(yajl_ctx) \
     do { \
         const unsigned char *buf = NULL; \
@@ -60,6 +62,7 @@
 #  define DEBUG_GEN(ctx, type)                  ((void)0)
 #  define DEBUG_GEN_VALUE(ctx, type, value)     ((void)0)
 #  define DEBUG_GEN_STRING(ctx, value, lenght)  ((void)0)
+#  define DEBUG_GEN_NUMBER(ctx, value, lenght)  ((void)0)
 #  define DEBUG_GEN_REPORT(ctx)                 ((void)0)
 #endif
 
@@ -363,6 +366,7 @@
         return;
     switch (obj->type) {
     case JSON_STRING:
+    case JSON_NUMBER:
         free(obj->u.string);
         break;
     case JSON_MAP: {
@@ -504,36 +508,64 @@
     return 1;
 }
 
-static int json_callback_integer(void *opaque, long value)
+static bool is_decimal(const char *s, unsigned len)
+{
+    const char *end = s + len;
+    for (; s < end; s++) {
+        if (*s == '.')
+            return true;
+    }
+    return false;
+}
+
+static int json_callback_number(void *opaque, const char *s, unsigned int len)
 {
     libxl__yajl_ctx *ctx = opaque;
-    libxl__json_object *obj;
+    libxl__json_object *obj = NULL;
+    char *t = NULL;
 
-    DEBUG_GEN_VALUE(ctx, integer, value);
+    DEBUG_GEN_NUMBER(ctx, s, len);
 
-    if ((obj = json_object_alloc(ctx->gc, JSON_INTEGER)) == NULL)
+    if (is_decimal(s, len)) {
+        double d = strtod(s, NULL);
+
+        if ((d == HUGE_VAL || d == HUGE_VAL) && errno == ERANGE) {
+            goto error;
+        }
+
+        if ((obj = json_object_alloc(ctx->gc, JSON_DOUBLE)) == NULL)
+            return 0;
+        obj->u.d = d;
+    } else {
+        long long i = strtoll(s, NULL, 10);
+
+        if ((i == LLONG_MIN || i == LLONG_MAX) && errno == ERANGE) {
+            goto error;
+        }
+
+        if ((obj = json_object_alloc(ctx->gc, JSON_INTEGER)) == NULL)
+            return 0;
+        obj->u.i = i;
+    }
+    goto out;
+
+error:
+    /* If the conversion fail, we just store the original string. */
+    if ((obj = json_object_alloc(ctx->gc, JSON_NUMBER)) == NULL)
         return 0;
-    obj->u.i = value;
 
-    if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
-        libxl__json_object_free(ctx->gc, obj);
+    t = malloc(len + 1);
+    if (t == NULL) {
+        LIBXL__LOG_ERRNO(libxl__gc_owner(ctx->gc), LIBXL__LOG_ERROR,
+                         "Failed to allocate");
         return 0;
     }
+    strncpy(t, s, len);
+    t[len] = 0;
 
-    return 1;
-}
+    obj->u.string = t;
 
-static int json_callback_double(void *opaque, double value)
-{
-    libxl__yajl_ctx *ctx = opaque;
-    libxl__json_object *obj;
-
-    DEBUG_GEN_VALUE(ctx, double, value);
-
-    if ((obj = json_object_alloc(ctx->gc, JSON_DOUBLE)) == NULL)
-        return 0;
-    obj->u.d = value;
-
+out:
     if (json_object_append_to(ctx->gc, obj, ctx->current) == -1) {
         libxl__json_object_free(ctx->gc, obj);
         return 0;
@@ -706,9 +738,9 @@
 static yajl_callbacks callbacks = {
     json_callback_null,
     json_callback_boolean,
-    json_callback_integer,
-    json_callback_double,
     NULL,
+    NULL,
+    json_callback_number,
     json_callback_string,
     json_callback_start_map,
     json_callback_map_key,

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:41 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiq4-0004xM-V8; Thu, 10 Nov 2011 20:35:40 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinr-00048j-MO
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:24 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1320985963!62749627!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11322 invoked from network); 11 Nov 2011 04:32:44 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:44 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROino-0001Bm-Is
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:20 +0000
Message-Id: <E1ROino-0001Bm-Is@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: libxl_qmp: Introduce
	libxl__qmp_pci_del
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320420890 0
# Node ID e22e108e1c57e10b2eec3697a5f60eff601272f1
# Parent  659c800d7edf433c188917bf6faff177dd118c07
libxl: libxl_qmp: Introduce libxl__qmp_pci_del

To remove a pci passthough device from QEMU (upstream).

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 659c800d7edf -r e22e108e1c57 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h	Fri Nov 04 15:55:50 2011 +0100
+++ b/tools/libxl/libxl_internal.h	Fri Nov 04 15:34:50 2011 +0000
@@ -526,6 +526,8 @@
 /* ask to QEMU the serial port information and store it in xenstore. */
 _hidden int libxl__qmp_query_serial(libxl__qmp_handler *qmp);
 _hidden int libxl__qmp_pci_add(libxl__gc *gc, int d, libxl_device_pci *pcidev);
+_hidden int libxl__qmp_pci_del(libxl__gc *gc, int domid,
+                               libxl_device_pci *pcidev);
 /* close and free the QMP handler */
 _hidden void libxl__qmp_close(libxl__qmp_handler *qmp);
 /* remove the socket file, if the file has already been removed,
diff -r 659c800d7edf -r e22e108e1c57 tools/libxl/libxl_qmp.c
--- a/tools/libxl/libxl_qmp.c	Fri Nov 04 15:55:50 2011 +0100
+++ b/tools/libxl/libxl_qmp.c	Fri Nov 04 15:34:50 2011 +0000
@@ -713,6 +713,41 @@
     return rc;
 }
 
+static int qmp_device_del(libxl__gc *gc, int domid, char *id)
+{
+    libxl__qmp_handler *qmp = NULL;
+    flexarray_t *parameters = NULL;
+    libxl_key_value_list args = NULL;
+    int rc = 0;
+
+    qmp = libxl__qmp_initialize(libxl__gc_owner(gc), domid);
+    if (!qmp)
+        return ERROR_FAIL;
+
+    parameters = flexarray_make(2, 1);
+    flexarray_append_pair(parameters, "id", id);
+    args = libxl__xs_kvs_of_flexarray(gc, parameters, parameters->count);
+    if (!args)
+        return ERROR_NOMEM;
+
+    rc = qmp_synchronous_send(qmp, "device_del", &args,
+                              NULL, NULL, qmp->timeout);
+
+    flexarray_free(parameters);
+    libxl__qmp_close(qmp);
+    return rc;
+}
+
+int libxl__qmp_pci_del(libxl__gc *gc, int domid, libxl_device_pci *pcidev)
+{
+    char *id = NULL;
+
+    id = libxl__sprintf(gc, PCI_PT_QDEV_ID,
+                        pcidev->bus, pcidev->dev, pcidev->func);
+
+    return qmp_device_del(gc, domid, id);
+}
+
 int libxl__qmp_initializations(libxl_ctx *ctx, uint32_t domid)
 {
     libxl__qmp_handler *qmp = NULL;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:47 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiqB-000510-BG; Thu, 10 Nov 2011 20:35:47 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROins-00048m-84
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:24 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1320985975!52299801!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26817 invoked from network); 11 Nov 2011 04:32:55 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:55 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinp-0001CL-45
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:21 +0000
Message-Id: <E1ROinp-0001CL-45@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:20 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] libxl: Remove a passthrough device
	through QMP.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Anthony PERARD <anthony.perard@citrix.com>
# Date 1320420890 0
# Node ID 604a90b803d34faa083988771c858dee1efe1a53
# Parent  e22e108e1c57e10b2eec3697a5f60eff601272f1
libxl: Remove a passthrough device through QMP.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r e22e108e1c57 -r 604a90b803d3 tools/libxl/libxl_pci.c
--- a/tools/libxl/libxl_pci.c	Fri Nov 04 15:34:50 2011 +0000
+++ b/tools/libxl/libxl_pci.c	Fri Nov 04 15:34:50 2011 +0000
@@ -863,13 +863,45 @@
     return rc;
 }
 
+static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid,
+                                    libxl_device_pci *pcidev, int force)
+{
+    libxl_ctx *ctx = libxl__gc_owner(gc);
+    char *state;
+    char *path;
+
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+    state = libxl__xs_read(gc, XBT_NULL, path);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
+    libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
+                    pcidev->bus, pcidev->dev, pcidev->func);
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
+
+    /* Remove all functions at once atomically by only signalling
+     * device-model for function 0 */
+    if ( !force && (pcidev->vdevfn & 0x7) == 0 ) {
+        xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem"));
+        if (libxl__wait_for_device_model(gc, domid, "pci-removed",
+                                         NULL, NULL, NULL) < 0) {
+            LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time");
+            /* This depends on guest operating system acknowledging the
+             * SCI, if it doesn't respond in time then we may wish to
+             * force the removal.
+             */
+            return ERROR_FAIL;
+        }
+    }
+    path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
+    xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
+
+    return 0;
+}
+
 static int do_pci_remove(libxl__gc *gc, uint32_t domid,
                          libxl_device_pci *pcidev, int force)
 {
     libxl_ctx *ctx = libxl__gc_owner(gc);
     libxl_device_pci *assigned;
-    char *path;
-    char *state;
     int hvm = 0, rc, num;
     int stubdomid = 0;
 
@@ -892,29 +924,21 @@
                                          NULL, NULL, NULL) < 0)
             goto out_fail;
 
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
-        state = libxl__xs_read(gc, XBT_NULL, path);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/parameter", domid);
-        libxl__xs_write(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
-                       pcidev->bus, pcidev->dev, pcidev->func);
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/command", domid);
-
-        /* Remove all functions at once atomically by only signalling
-         * device-model for function 0 */
-        if ( !force && (pcidev->vdevfn & 0x7) == 0 ) {
-            xs_write(ctx->xsh, XBT_NULL, path, "pci-rem", strlen("pci-rem"));
-            if (libxl__wait_for_device_model(gc, domid, "pci-removed",
-                                             NULL, NULL, NULL) < 0) {
-                LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "Device Model didn't respond in time");
-                /* This depends on guest operating system acknowledging the
-                 * SCI, if it doesn't respond in time then we may wish to
-                 * force the removal.
-                 */
-                goto out_fail;
-            }
+        switch (libxl__device_model_version_running(gc, domid)) {
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
+            rc = qemu_pci_remove_xenstore(gc, domid, pcidev, force);
+            break;
+        case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
+            rc = libxl__qmp_pci_del(gc, domid, pcidev);
+            break;
+        default:
+            rc = ERROR_INVAL;
+            goto out_fail;
         }
-        path = libxl__sprintf(gc, "/local/domain/0/device-model/%d/state", domid);
-        xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
+        if (rc) {
+            rc = ERROR_FAIL;
+            goto out_fail;
+        }
         break;
     case LIBXL_DOMAIN_TYPE_PV:
     {

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:35:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:35:54 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiqI-00054G-E3; Thu, 10 Nov 2011 20:35:54 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROins-00048x-Q7
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:25 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-27.messagelabs.com!1320985968!45464651!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28518 invoked from network); 11 Nov 2011 04:32:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinp-0001Cr-OT
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:21 +0000
Message-Id: <E1ROinp-0001Cr-OT@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] powernow: don't read never
	initialized structure member
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320657983 -3600
# Node ID 721a87728b6bc4eaf7c1d1c8b66c6aa90e042011
# Parent  604a90b803d34faa083988771c858dee1efe1a53
powernow: don't read never initialized structure member

c/s 20361:51b031b0737e removed the writing of struct
processor_performance's shared_cpu_map member, but the powernow driver
still has code to read it (though presumably that code path can't be
taken on actual hardware supported by the powernow driver). Remove the
use of the field along with the field itself.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 604a90b803d3 -r 721a87728b6b xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c	Fri Nov 04 15:34:50 2011 +0000
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Nov 07 10:26:23 2011 +0100
@@ -200,15 +200,17 @@
     perf = data->acpi_data;
     policy->shared_type = perf->shared_type;
 
-    /*
-     * Will let policy->cpus know about dependency only when software
-     * coordination is required.
-     */
     if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
         policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
-        policy->cpus = perf->shared_cpu_map;
+        cpumask_set_cpu(cpu, &policy->cpus);
+        if (cpumask_weight(&policy->cpus) != 1) {
+            printk(XENLOG_WARNING "Unsupported sharing type %d (%u CPUs)\n",
+                   policy->shared_type, cpumask_weight(&policy->cpus));
+            result = -ENODEV;
+            goto err_unreg;
+        }
     } else {
-        policy->cpus = cpumask_of_cpu(cpu);    
+        cpumask_copy(&policy->cpus, cpumask_of(cpu));
     }
 
     /* capability check */
diff -r 604a90b803d3 -r 721a87728b6b xen/include/acpi/cpufreq/processor_perf.h
--- a/xen/include/acpi/cpufreq/processor_perf.h	Fri Nov 04 15:34:50 2011 +0000
+++ b/xen/include/acpi/cpufreq/processor_perf.h	Mon Nov 07 10:26:23 2011 +0100
@@ -29,7 +29,6 @@
     uint32_t state_count;
     struct xen_processor_px *states;
     struct xen_psd_package domain_info;
-    cpumask_t shared_cpu_map;
     uint32_t shared_type;
 
     uint32_t init;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:05 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiqS-0005AM-JC; Thu, 10 Nov 2011 20:36:04 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROint-000499-Ex
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:26 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-27.messagelabs.com!1320985976!52299803!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26874 invoked from network); 11 Nov 2011 04:32:56 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:56 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinq-0001DV-Cf
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:22 +0000
Message-Id: <E1ROinq-0001DV-Cf@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:21 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] cpufreq: allocate CPU masks
	dynamically
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320658154 -3600
# Node ID c0702424afc5f7b972c26c6110f6489305844635
# Parent  721a87728b6bc4eaf7c1d1c8b66c6aa90e042011
cpufreq: allocate CPU masks dynamically

struct cpufreq_policy, including a cpumask_t member, gets copied in
cpufreq_limit_change(), cpufreq_add_cpu(), set_cpufreq_gov(), and
set_cpufreq_para(). Make the member a cpumask_var_t, thus reducing the
amount of data needing copying (particularly with large NR_CPUS).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 721a87728b6b -r c0702424afc5 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Mon Nov 07 10:29:14 2011 +0100
@@ -446,7 +446,7 @@
     if (unlikely(result))
         return -ENODEV;
 
-    cpumask_and(&online_policy_cpus, &cpu_online_map, &policy->cpus);
+    cpumask_and(&online_policy_cpus, &cpu_online_map, policy->cpus);
 
     next_perf_state = data->freq_table[next_state].index;
     if (perf->state == next_perf_state) {
diff -r 721a87728b6b -r c0702424afc5 xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Mon Nov 07 10:29:14 2011 +0100
@@ -107,7 +107,7 @@
     if (unlikely(result))
         return -ENODEV;
 
-    cpumask_and(&online_policy_cpus, &policy->cpus, &cpu_online_map);
+    cpumask_and(&online_policy_cpus, policy->cpus, &cpu_online_map);
 
     next_perf_state = data->freq_table[next_state].index;
     if (perf->state == next_perf_state) {
@@ -202,15 +202,15 @@
 
     if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
         policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
-        cpumask_set_cpu(cpu, &policy->cpus);
-        if (cpumask_weight(&policy->cpus) != 1) {
+        cpumask_set_cpu(cpu, policy->cpus);
+        if (cpumask_weight(policy->cpus) != 1) {
             printk(XENLOG_WARNING "Unsupported sharing type %d (%u CPUs)\n",
-                   policy->shared_type, cpumask_weight(&policy->cpus));
+                   policy->shared_type, cpumask_weight(policy->cpus));
             result = -ENODEV;
             goto err_unreg;
         }
     } else {
-        cpumask_copy(&policy->cpus, cpumask_of(cpu));
+        cpumask_copy(policy->cpus, cpumask_of(cpu));
     }
 
     /* capability check */
diff -r 721a87728b6b -r c0702424afc5 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/drivers/acpi/pmstat.c	Mon Nov 07 10:29:14 2011 +0100
@@ -211,11 +211,11 @@
     list_for_each(pos, &cpufreq_governor_list)
         gov_num++;
 
-    if ( (op->u.get_para.cpu_num  != cpus_weight(policy->cpus)) ||
+    if ( (op->u.get_para.cpu_num  != cpumask_weight(policy->cpus)) ||
          (op->u.get_para.freq_num != pmpt->perf.state_count)    ||
          (op->u.get_para.gov_num  != gov_num) )
     {
-        op->u.get_para.cpu_num =  cpus_weight(policy->cpus);
+        op->u.get_para.cpu_num =  cpumask_weight(policy->cpus);
         op->u.get_para.freq_num = pmpt->perf.state_count;
         op->u.get_para.gov_num  = gov_num;
         return -EAGAIN;
@@ -223,7 +223,7 @@
 
     if ( !(affected_cpus = xzalloc_array(uint32_t, op->u.get_para.cpu_num)) )
         return -ENOMEM;
-    for_each_cpu_mask(cpu, policy->cpus)
+    for_each_cpu_mask(cpu, *policy->cpus)
         affected_cpus[j++] = cpu;
     ret = copy_to_guest(op->u.get_para.affected_cpus,
                        affected_cpus, op->u.get_para.cpu_num);
diff -r 721a87728b6b -r c0702424afc5 xen/drivers/cpufreq/cpufreq.c
--- a/xen/drivers/cpufreq/cpufreq.c	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq.c	Mon Nov 07 10:29:14 2011 +0100
@@ -53,7 +53,7 @@
 
 struct cpufreq_dom {
     unsigned int	dom;
-    cpumask_t		map;
+    cpumask_var_t	map;
     struct list_head	node;
 };
 static LIST_HEAD_READ_MOSTLY(cpufreq_dom_list_head);
@@ -152,11 +152,16 @@
         if (!cpufreq_dom)
             return -ENOMEM;
 
+        if (!zalloc_cpumask_var(&cpufreq_dom->map)) {
+            xfree(cpufreq_dom);
+            return -ENOMEM;
+        }
+
         cpufreq_dom->dom = dom;
         list_add(&cpufreq_dom->node, &cpufreq_dom_list_head);
     } else {
         /* domain sanity check under whatever coordination type */
-        firstcpu = first_cpu(cpufreq_dom->map);
+        firstcpu = cpumask_first(cpufreq_dom->map);
         if ((perf->domain_info.coord_type !=
             processor_pminfo[firstcpu]->perf.domain_info.coord_type) ||
             (perf->domain_info.num_processors !=
@@ -181,11 +186,18 @@
             goto err0;
         }
 
+        if (!zalloc_cpumask_var(&policy->cpus)) {
+            xfree(policy);
+            ret = -ENOMEM;
+            goto err0;
+        }
+
         policy->cpu = cpu;
         per_cpu(cpufreq_cpu_policy, cpu) = policy;
 
         ret = cpufreq_driver->init(policy);
         if (ret) {
+            free_cpumask_var(policy->cpus);
             xfree(policy);
             per_cpu(cpufreq_cpu_policy, cpu) = NULL;
             goto err0;
@@ -193,7 +205,7 @@
         if (cpufreq_verbose)
             printk("CPU %u initialization completed\n", cpu);
     } else {
-        firstcpu = first_cpu(cpufreq_dom->map);
+        firstcpu = cpumask_first(cpufreq_dom->map);
         policy = per_cpu(cpufreq_cpu_policy, firstcpu);
 
         per_cpu(cpufreq_cpu_policy, cpu) = policy;
@@ -201,15 +213,15 @@
             printk("adding CPU %u\n", cpu);
     }
 
-    cpu_set(cpu, policy->cpus);
-    cpu_set(cpu, cpufreq_dom->map);
+    cpumask_set_cpu(cpu, policy->cpus);
+    cpumask_set_cpu(cpu, cpufreq_dom->map);
 
     ret = cpufreq_statistic_init(cpu);
     if (ret)
         goto err1;
 
-    if (hw_all ||
-        (cpus_weight(cpufreq_dom->map) == perf->domain_info.num_processors)) {
+    if (hw_all || (cpumask_weight(cpufreq_dom->map) ==
+                   perf->domain_info.num_processors)) {
         memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
         policy->governor = NULL;
 
@@ -238,16 +250,18 @@
     cpufreq_statistic_exit(cpu);
 err1:
     per_cpu(cpufreq_cpu_policy, cpu) = NULL;
-    cpu_clear(cpu, policy->cpus);
-    cpu_clear(cpu, cpufreq_dom->map);
+    cpumask_clear_cpu(cpu, policy->cpus);
+    cpumask_clear_cpu(cpu, cpufreq_dom->map);
 
-    if (cpus_empty(policy->cpus)) {
+    if (cpumask_empty(policy->cpus)) {
         cpufreq_driver->exit(policy);
+        free_cpumask_var(policy->cpus);
         xfree(policy);
     }
 err0:
-    if (cpus_empty(cpufreq_dom->map)) {
+    if (cpumask_empty(cpufreq_dom->map)) {
         list_del(&cpufreq_dom->node);
+        free_cpumask_var(cpufreq_dom->map);
         xfree(cpufreq_dom);
     }
 
@@ -291,24 +305,26 @@
 
     /* for HW_ALL, stop gov for each core of the _PSD domain */
     /* for SW_ALL & SW_ANY, stop gov for the 1st core of the _PSD domain */
-    if (hw_all ||
-        (cpus_weight(cpufreq_dom->map) == perf->domain_info.num_processors))
+    if (hw_all || (cpumask_weight(cpufreq_dom->map) ==
+                   perf->domain_info.num_processors))
         __cpufreq_governor(policy, CPUFREQ_GOV_STOP);
 
     cpufreq_statistic_exit(cpu);
     per_cpu(cpufreq_cpu_policy, cpu) = NULL;
-    cpu_clear(cpu, policy->cpus);
-    cpu_clear(cpu, cpufreq_dom->map);
+    cpumask_clear_cpu(cpu, policy->cpus);
+    cpumask_clear_cpu(cpu, cpufreq_dom->map);
 
-    if (cpus_empty(policy->cpus)) {
+    if (cpumask_empty(policy->cpus)) {
         cpufreq_driver->exit(policy);
+        free_cpumask_var(policy->cpus);
         xfree(policy);
     }
 
     /* for the last cpu of the domain, clean room */
     /* It's safe here to free freq_table, drv_data and policy */
-    if (cpus_empty(cpufreq_dom->map)) {
+    if (cpumask_empty(cpufreq_dom->map)) {
         list_del(&cpufreq_dom->node);
+        free_cpumask_var(cpufreq_dom->map);
         xfree(cpufreq_dom);
     }
 
diff -r 721a87728b6b -r c0702424afc5 xen/drivers/cpufreq/cpufreq_ondemand.c
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c	Mon Nov 07 10:29:14 2011 +0100
@@ -122,7 +122,7 @@
         return;
 
     /* Get Idle Time */
-    for_each_cpu_mask(j, policy->cpus) {
+    for_each_cpu_mask(j, *policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
         uint64_t load, load_freq, freq_avg;
         struct cpu_dbs_info_s *j_dbs_info;
@@ -233,7 +233,7 @@
 
         dbs_enable++;
 
-        for_each_cpu_mask(j, policy->cpus) {
+        for_each_cpu_mask(j, *policy->cpus) {
             struct cpu_dbs_info_s *j_dbs_info;
             j_dbs_info = &per_cpu(cpu_dbs_info, j);
             j_dbs_info->cur_policy = policy;
diff -r 721a87728b6b -r c0702424afc5 xen/include/acpi/cpufreq/cpufreq.h
--- a/xen/include/acpi/cpufreq/cpufreq.h	Mon Nov 07 10:26:23 2011 +0100
+++ b/xen/include/acpi/cpufreq/cpufreq.h	Mon Nov 07 10:29:14 2011 +0100
@@ -42,7 +42,7 @@
 };
 
 struct cpufreq_policy {
-    cpumask_t           cpus;          /* affected CPUs */
+    cpumask_var_t       cpus;          /* affected CPUs */
     unsigned int        shared_type;   /* ANY or ALL affected CPUs
                                           should set cpufreq */
     unsigned int        cpu;           /* cpu nr of registered CPU */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:18 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiqg-0005Gb-K0; Thu, 10 Nov 2011 20:36:18 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinv-00049Z-6k
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:27 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1320986003!1120049!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 31635 invoked from network); 11 Nov 2011 04:33:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinr-0001Ee-GV
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:23 +0000
Message-Id: <E1ROinr-0001Ee-GV@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] avoid hypervisor panic when printing
	lock profiling information
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1320676671 0
# Node ID b0e140037c597be54a5f28a9f776844bf25f8a8b
# Parent  10ddd98dcc62b0fb4238794144b180c604f1696b
avoid hypervisor panic when printing lock profiling information

When printing lock profiling information via keyhandler in the
hypervisor the system will panic. This patch corrects the problem.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 10ddd98dcc62 -r b0e140037c59 xen/common/spinlock.c
--- a/xen/common/spinlock.c	Mon Nov 07 14:36:44 2011 +0000
+++ b/xen/common/spinlock.c	Mon Nov 07 14:37:51 2011 +0000
@@ -458,9 +458,9 @@
     int32_t type, int32_t idx, void *par)
 {
     if ( type == LOCKPROF_TYPE_GLOBAL )
-        printk("%s %s:\n", lock_profile_ancs[idx].name, data->name);
+        printk("%s %s:\n", lock_profile_ancs[type].name, data->name);
     else
-        printk("%s %d %s:\n", lock_profile_ancs[idx].name, idx, data->name);
+        printk("%s %d %s:\n", lock_profile_ancs[type].name, idx, data->name);
     printk("  lock:%12"PRId64"(%08X:%08X), block:%12"PRId64"(%08X:%08X)\n",
            data->lock_cnt, (u32)(data->time_hold >> 32), (u32)data->time_hold,
            data->block_cnt, (u32)(data->time_block >> 32),

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:23 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiql-0005JK-Oj; Thu, 10 Nov 2011 20:36:23 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinu-00049O-Lo
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:27 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1320986003!1119825!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8452 invoked from network); 11 Nov 2011 04:33:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinq-0001E6-VJ
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:22 +0000
Message-Id: <E1ROinq-0001E6-VJ@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:22 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Make lock profiling usable again
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Juergen Gross <juergen.gross@ts.fujitsu.com>
# Date 1320676604 0
# Node ID 10ddd98dcc62b0fb4238794144b180c604f1696b
# Parent  c0702424afc5f7b972c26c6110f6489305844635
Make lock profiling usable again

Using lock profiling (option lock_profile in xen/Rules.mk) resulted in
build errors.
Changes:
- Include public/sysctl.h in spinlock.h when using lock profiling.
- Allocate profile data in an own structure to avoid struct domain
  becoming larger then one page

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r c0702424afc5 -r 10ddd98dcc62 xen/common/spinlock.c
--- a/xen/common/spinlock.c	Mon Nov 07 10:29:14 2011 +0100
+++ b/xen/common/spinlock.c	Mon Nov 07 14:36:44 2011 +0000
@@ -86,17 +86,23 @@
 
 #ifdef LOCK_PROFILE
 
-#define LOCK_PROFILE_REL                                               \
-    lock->profile.time_hold += NOW() - lock->profile.time_locked;      \
-    lock->profile.lock_cnt++;
+#define LOCK_PROFILE_REL                                                     \
+    if (lock->profile)                                                       \
+    {                                                                        \
+        lock->profile->time_hold += NOW() - lock->profile->time_locked;      \
+        lock->profile->lock_cnt++;                                           \
+    }
 #define LOCK_PROFILE_VAR    s_time_t block = 0
 #define LOCK_PROFILE_BLOCK  block = block ? : NOW();
-#define LOCK_PROFILE_GOT                                               \
-    lock->profile.time_locked = NOW();                                 \
-    if (block)                                                         \
-    {                                                                  \
-        lock->profile.time_block += lock->profile.time_locked - block; \
-        lock->profile.block_cnt++;                                     \
+#define LOCK_PROFILE_GOT                                                     \
+    if (lock->profile)                                                       \
+    {                                                                        \
+        lock->profile->time_locked = NOW();                                  \
+        if (block)                                                           \
+        {                                                                    \
+            lock->profile->time_block += lock->profile->time_locked - block; \
+            lock->profile->block_cnt++;                                      \
+        }                                                                    \
     }
 
 #else
@@ -197,7 +203,8 @@
     if ( !_raw_spin_trylock(&lock->raw) )
         return 0;
 #ifdef LOCK_PROFILE
-    lock->profile.time_locked = NOW();
+    if (lock->profile)
+        lock->profile->time_locked = NOW();
 #endif
     preempt_disable();
     return 1;
@@ -211,10 +218,10 @@
 
     check_barrier(&lock->debug);
     do { mb(); loop++;} while ( _raw_spin_is_locked(&lock->raw) );
-    if (loop > 1)
+    if ((loop > 1) && lock->profile)
     {
-        lock->profile.time_block += NOW() - block;
-        lock->profile.block_cnt++;
+        lock->profile->time_block += NOW() - block;
+        lock->profile->block_cnt++;
     }
 #else
     check_barrier(&lock->debug);
@@ -586,6 +593,7 @@
     {
         (*q)->next = lock_profile_glb_q.elem_q;
         lock_profile_glb_q.elem_q = *q;
+        (*q)->lock->profile = *q;
     }
 
     _lock_profile_register_struct(
diff -r c0702424afc5 -r 10ddd98dcc62 xen/include/xen/spinlock.h
--- a/xen/include/xen/spinlock.h	Mon Nov 07 10:29:14 2011 +0100
+++ b/xen/include/xen/spinlock.h	Mon Nov 07 14:36:44 2011 +0000
@@ -20,6 +20,9 @@
 #endif
 
 #ifdef LOCK_PROFILE
+
+#include <public/sysctl.h>
+
 /*
     lock profiling on:
 
@@ -54,9 +57,12 @@
       lock_profile_deregister_struct(type, ptr);
 */
 
+struct spinlock;
+
 struct lock_profile {
     struct lock_profile *next;       /* forward link */
     char                *name;       /* lock name */
+    struct spinlock     *lock;       /* the lock itself */
     u64                 lock_cnt;    /* # of complete locking ops */
     u64                 block_cnt;   /* # of complete wait for lock */
     s64                 time_hold;   /* cumulated lock time */
@@ -70,23 +76,29 @@
     int32_t                   idx;     /* index for printout */
 };
 
-#define _LOCK_PROFILE(name) { 0, name, 0, 0, 0, 0, 0 }
-#define _LOCK_NO_PROFILE _LOCK_PROFILE(NULL)
+#define _LOCK_PROFILE(name) { 0, #name, &name, 0, 0, 0, 0, 0 }
 #define _LOCK_PROFILE_PTR(name)                                               \
     static struct lock_profile *__lock_profile_##name __attribute_used__      \
-    __attribute__ ((__section__(".lockprofile.data"))) = &name.profile
+    __attribute__ ((__section__(".lockprofile.data"))) =                      \
+    &__lock_profile_data_##name
 #define _SPIN_LOCK_UNLOCKED(x) { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0,          \
                                  _LOCK_DEBUG, x }
-#define SPIN_LOCK_UNLOCKED _SPIN_LOCK_UNLOCKED(_LOCK_NO_PROFILE)
+#define SPIN_LOCK_UNLOCKED _SPIN_LOCK_UNLOCKED(NULL)
 #define DEFINE_SPINLOCK(l)                                                    \
-    spinlock_t l = _SPIN_LOCK_UNLOCKED(_LOCK_PROFILE(#l));                    \
+    spinlock_t l = _SPIN_LOCK_UNLOCKED(NULL);                                 \
+    static struct lock_profile __lock_profile_data_##l = _LOCK_PROFILE(l);    \
     _LOCK_PROFILE_PTR(l)
 
 #define spin_lock_init_prof(s, l)                                             \
     do {                                                                      \
-        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(_LOCK_PROFILE(#l));          \
-        (s)->l.profile.next = (s)->profile_head.elem_q;                       \
-        (s)->profile_head.elem_q = &((s)->l.profile);                         \
+        struct lock_profile *prof;                                            \
+        prof = xzalloc(struct lock_profile);                                  \
+        if (!prof) break;                                                     \
+        prof->name = #l;                                                      \
+        prof->lock = &(s)->l;                                                 \
+        (s)->l = (spinlock_t)_SPIN_LOCK_UNLOCKED(prof);                       \
+        prof->next = (s)->profile_head.elem_q;                                \
+        (s)->profile_head.elem_q = prof;                                      \
     } while(0)
 
 void _lock_profile_register_struct(
@@ -108,7 +120,7 @@
 struct lock_profile_qhead { };
 
 #define SPIN_LOCK_UNLOCKED                                                    \
-    { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0, _LOCK_DEBUG, { } }
+    { _RAW_SPIN_LOCK_UNLOCKED, 0xfffu, 0, _LOCK_DEBUG, NULL }
 #define DEFINE_SPINLOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
 
 #define spin_lock_init_prof(s, l) spin_lock_init(&((s)->l))
@@ -117,12 +129,12 @@
 
 #endif
 
-typedef struct {
+typedef struct spinlock {
     raw_spinlock_t raw;
     u16 recurse_cpu:12;
     u16 recurse_cnt:4;
     struct lock_debug debug;
-    struct lock_profile profile;
+    struct lock_profile *profile;
 } spinlock_t;
 
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:30 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiqr-0005MO-R5; Thu, 10 Nov 2011 20:36:29 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinv-00049s-Od
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:28 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1320986004!1115120!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1818 invoked from network); 11 Nov 2011 04:33:24 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:24 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROins-0001FB-1q
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:24 +0000
Message-Id: <E1ROins-0001FB-1q@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:23 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] IRQ: move a few more bits into
	common code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320679706 -3600
# Node ID 4e13729a0adf61f31dcb4e2614a7bc9cac56605c
# Parent  b0e140037c597be54a5f28a9f776844bf25f8a8b
IRQ: move a few more bits into common code

... as they're not really arch-specific.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r b0e140037c59 -r 4e13729a0adf xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c	Mon Nov 07 14:37:51 2011 +0000
+++ b/xen/arch/ia64/xen/irq.c	Mon Nov 07 16:28:26 2011 +0100
@@ -105,15 +105,6 @@
  * Special irq handlers.
  */
 
-void no_action(int cpl, void *dev_id, struct pt_regs *regs) { }
-
-/*
- * Generic no controller code
- */
-
-static void enable_none(unsigned int irq) { }
-static unsigned int startup_none(unsigned int irq) { return 0; }
-static void disable_none(unsigned int irq) { }
 static void ack_none(unsigned int irq)
 {
 /*
@@ -124,18 +115,14 @@
 	printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", irq, smp_processor_id());
 }
 
-/* startup is the same as "enable", shutdown is same as "disable" */
-#define shutdown_none	disable_none
-#define end_none	enable_none
-
 hw_irq_controller no_irq_type = {
-	"none",
-	startup_none,
-	shutdown_none,
-	enable_none,
-	disable_none,
-	ack_none,
-	end_none
+	.typename = "none",
+	.startup = irq_startup_none,
+	.shutdown = irq_shutdown_none,
+	.enable = irq_enable_none,
+	.disable = irq_disable_none,
+	.ack = ack_none,
+	.end = irq_actor_none
 };
 
 /*
diff -r b0e140037c59 -r 4e13729a0adf xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Nov 07 14:37:51 2011 +0000
+++ b/xen/arch/x86/irq.c	Mon Nov 07 16:28:26 2011 +0100
@@ -358,10 +358,6 @@
 
 static void __do_IRQ_guest(int vector);
 
-void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs) { }
-
-void irq_actor_none(struct irq_desc *desc) { }
-unsigned int irq_startup_none(struct irq_desc *desc) { return 0; }
 static void ack_none(struct irq_desc *desc)
 {
     ack_bad_irq(desc->irq);
diff -r b0e140037c59 -r 4e13729a0adf xen/common/irq.c
--- a/xen/common/irq.c	Mon Nov 07 14:37:51 2011 +0000
+++ b/xen/common/irq.c	Mon Nov 07 16:28:26 2011 +0100
@@ -26,3 +26,16 @@
 
     return err;
 }
+
+void no_action(int cpl, void *dev_id, struct cpu_user_regs *regs)
+{
+}
+
+void irq_actor_none(struct irq_desc *desc)
+{
+}
+
+unsigned int irq_startup_none(struct irq_desc *desc)
+{
+    return 0;
+}

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:38 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROir0-0005Pn-AR; Thu, 10 Nov 2011 20:36:38 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinw-0004AD-Uw
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:30 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-174.messagelabs.com!1320986005!1117621!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20273 invoked from network); 11 Nov 2011 04:33:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROint-0001G4-6y
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:25 +0000
Message-Id: <E1ROint-0001G4-6y@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:24 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate cpus_xyz()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320744707 -3600
# Node ID 67defeb4baa649f70883bcfbb642db0488a4727c
# Parent  4e13729a0adf61f31dcb4e2614a7bc9cac56605c
eliminate cpus_xyz()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 08 10:31:47 2011 +0100
@@ -709,7 +709,7 @@
 				cpu_clear(numa_cpu, cpu_mask);
 		}
 
-		num_cpus = cpus_weight(cpu_mask);
+		num_cpus = cpumask_weight(&cpu_mask);
 
 		if (!num_cpus)
 			goto skip_numa_setup;
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/ia64/linux-xen/smp.c
--- a/xen/arch/ia64/linux-xen/smp.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:31:47 2011 +0100
@@ -62,7 +62,7 @@
     int cpu;
 
     /*  Not for me.  */
-    if (cpus_subset(*mask, *cpumask_of(smp_processor_id())))
+    if (cpumask_subset(mask, cpumask_of(smp_processor_id())))
         return;
 
     //printf("smp_send_event_check_mask called\n");
@@ -444,7 +444,7 @@
                  void *info, int wait)
 {
 	struct call_data_struct data;
-	unsigned int cpu, nr_cpus = cpus_weight(*selected);
+	unsigned int cpu, nr_cpus = cpumask_weight(selected);
 
 	ASSERT(local_irq_is_enabled());
 
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/ia64/xen/mm.c	Tue Nov 08 10:31:47 2011 +0100
@@ -3196,7 +3196,7 @@
                 cpumask_copy(&mask, page_get_owner(page)->domain_dirty_cpumask);
                 tlbflush_filter(mask, page->tlbflush_timestamp);
 
-                if ( unlikely(!cpus_empty(mask)) )
+                if ( unlikely(!cpumask_empty(&mask)) )
                 {
                     perfc_incr(need_flush_tlb_flush);
                     flush_tlb_mask(&mask);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/ia64/xen/vhpt.c	Tue Nov 08 10:31:47 2011 +0100
@@ -556,7 +556,7 @@
     if (cpu_isset(cpu, *mask))
         flush_tlb_vhpt_all (NULL);
 
-    if (cpus_subset(*mask, *cpumask_of(cpu)))
+    if (cpumask_subset(mask, cpumask_of(cpu)))
         return;
 
     for_each_cpu_mask (cpu, *mask)
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Tue Nov 08 10:31:47 2011 +0100
@@ -863,7 +863,7 @@
          */
         if (atomic_read(&found_error) == 0)
             mc_panic("MCE: No CPU found valid MCE, need reset\n");
-        if (!cpus_empty(mce_fatal_cpus))
+        if (!cpumask_empty(&mce_fatal_cpus))
         {
             char *ebufp, ebuf[96] = "MCE: Fatal error happened on CPUs ";
             ebufp = ebuf + strlen(ebuf);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/domain.c	Tue Nov 08 10:31:47 2011 +0100
@@ -1611,8 +1611,9 @@
 
     cpumask_copy(&dirty_mask, next->vcpu_dirty_cpumask);
     /* Allow at most one CPU at a time to be dirty. */
-    ASSERT(cpus_weight(dirty_mask) <= 1);
-    if ( unlikely(!cpu_isset(cpu, dirty_mask) && !cpus_empty(dirty_mask)) )
+    ASSERT(cpumask_weight(&dirty_mask) <= 1);
+    if ( unlikely(!cpumask_test_cpu(cpu, &dirty_mask) &&
+                  !cpumask_empty(&dirty_mask)) )
     {
         /* Other cpus call __sync_local_execstate from flush ipi handler. */
         flush_tlb_mask(&dirty_mask);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/genapic/delivery.c
--- a/xen/arch/x86/genapic/delivery.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/genapic/delivery.c	Tue Nov 08 10:31:47 2011 +0100
@@ -38,7 +38,7 @@
 
 unsigned int cpu_mask_to_apicid_flat(const cpumask_t *cpumask)
 {
-	return cpus_addr(*cpumask)[0]&0xFF;
+	return cpumask_bits(cpumask)[0]&0xFF;
 }
 
 /*
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/irq.c	Tue Nov 08 10:31:47 2011 +0100
@@ -707,7 +707,7 @@
     unsigned long flags;
     cpumask_t dest_mask;
 
-    if (!cpus_intersects(*mask, cpu_online_map))
+    if (!cpumask_intersects(mask, &cpu_online_map))
         return BAD_APICID;
 
     irq = desc->irq;
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/mm.c	Tue Nov 08 10:31:47 2011 +0100
@@ -2436,7 +2436,7 @@
                 /* Don't flush if the timestamp is old enough */
                 tlbflush_filter(mask, page->tlbflush_timestamp);
 
-                if ( unlikely(!cpus_empty(mask)) &&
+                if ( unlikely(!cpumask_empty(&mask)) &&
                      /* Shadow mode: track only writable pages. */
                      (!shadow_mode_enabled(page_get_owner(page)) ||
                       ((nx & PGT_type_mask) == PGT_writable_page)) )
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/mm/shadow/common.c	Tue Nov 08 10:31:47 2011 +0100
@@ -1524,7 +1524,7 @@
          * we need to be sure that no TLB holds a pointer to it. */
         cpumask_copy(&mask, d->domain_dirty_cpumask);
         tlbflush_filter(mask, sp->tlbflush_timestamp);
-        if ( unlikely(!cpus_empty(mask)) )
+        if ( unlikely(!cpumask_empty(&mask)) )
         {
             perfc_incr(shadow_alloc_tlbflush);
             flush_tlb_mask(&mask);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/arch/x86/smp.c	Tue Nov 08 10:31:47 2011 +0100
@@ -140,11 +140,11 @@
 
 void send_IPI_mask_flat(const cpumask_t *cpumask, int vector)
 {
-    unsigned long mask = cpus_addr(*cpumask)[0];
+    unsigned long mask = cpumask_bits(cpumask)[0];
     unsigned long cfg;
     unsigned long flags;
 
-    mask &= cpus_addr(cpu_online_map)[0];
+    mask &= cpumask_bits(&cpu_online_map)[0];
     mask &= ~(1UL << smp_processor_id());
     if ( mask == 0 )
         return;
@@ -237,7 +237,7 @@
     if ( cpu_isset(smp_processor_id(), *mask) )
         flush_area_local(va, flags);
 
-    if ( !cpus_subset(*mask, *cpumask_of(smp_processor_id())) )
+    if ( !cpumask_subset(mask, cpumask_of(smp_processor_id())) )
     {
         spin_lock(&flush_lock);
         cpumask_and(&flush_cpumask, mask, &cpu_online_map);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/domain.c
--- a/xen/common/domain.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/domain.c	Tue Nov 08 10:31:47 2011 +0100
@@ -371,7 +371,7 @@
         cpumask_or(&cpumask, &cpumask, v->cpu_affinity);
 
     for_each_online_node ( node )
-        if ( cpus_intersects(node_to_cpumask(node), cpumask) )
+        if ( cpumask_intersects(&node_to_cpumask(node), &cpumask) )
             node_set(node, nodemask);
 
     d->node_affinity = nodemask;
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/perfc.c
--- a/xen/common/perfc.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/perfc.c	Tue Nov 08 10:31:47 2011 +0100
@@ -163,11 +163,11 @@
     unsigned int i, j, v;
 
     /* We only copy the name and array-size information once. */
-    if ( !cpus_equal(cpu_online_map, perfc_cpumap) )
+    if ( !cpumask_equal(&cpu_online_map, &perfc_cpumap) )
     {
         unsigned int nr_cpus;
         perfc_cpumap = cpu_online_map;
-        nr_cpus = cpus_weight(perfc_cpumap);
+        nr_cpus = cpumask_weight(&perfc_cpumap);
 
         perfc_nbr_vals = 0;
 
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/rcupdate.c
--- a/xen/common/rcupdate.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/rcupdate.c	Tue Nov 08 10:31:47 2011 +0100
@@ -121,7 +121,7 @@
      */
     call_rcu(&data.head, rcu_barrier_callback);
 
-    while ( atomic_read(data.cpu_count) != cpus_weight(cpu_online_map) )
+    while ( atomic_read(data.cpu_count) != num_online_cpus() )
     {
         process_pending_softirqs();
         cpu_relax();
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/sched_credit.c
--- a/xen/common/sched_credit.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/sched_credit.c	Tue Nov 08 10:31:47 2011 +0100
@@ -1246,7 +1246,7 @@
     cpumask_clear_cpu(cpu, &workers);
     peer_cpu = cpu;
 
-    while ( !cpus_empty(workers) )
+    while ( !cpumask_empty(&workers) )
     {
         peer_cpu = cpumask_cycle(peer_cpu, &workers);
         cpumask_clear_cpu(peer_cpu, &workers);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/sched_credit2.c	Tue Nov 08 10:31:47 2011 +0100
@@ -1009,7 +1009,7 @@
     struct csched_vcpu *svc = CSCHED_VCPU(vc);
     s_time_t min_avgload;
 
-    BUG_ON(cpus_empty(prv->active_queues));
+    BUG_ON(cpumask_empty(&prv->active_queues));
 
     /* Locking:
      * - vc->processor is already locked
@@ -1098,7 +1098,7 @@
         new_cpu = vc->processor;
     else
     {
-        BUG_ON(cpus_empty(prv->rqd[min_rqi].active));
+        BUG_ON(cpumask_empty(&prv->rqd[min_rqi].active));
         new_cpu = first_cpu(prv->rqd[min_rqi].active);
     }
 
@@ -1258,9 +1258,9 @@
         if ( st.orqd->b_avgload > load_max )
             load_max = st.orqd->b_avgload;
 
-        cpus_max=cpus_weight(st.lrqd->active);
-        if ( cpus_weight(st.orqd->active) > cpus_max )
-            cpus_max = cpus_weight(st.orqd->active);
+        cpus_max = cpumask_weight(&st.lrqd->active);
+        if ( cpumask_weight(&st.orqd->active) > cpus_max )
+            cpus_max = cpumask_weight(&st.orqd->active);
 
         /* If we're under 100% capacaty, only shift if load difference
          * is > 1.  otherwise, shift if under 12.5% */
@@ -1801,7 +1801,7 @@
 
     printk("Active queues: %d\n"
            "\tdefault-weight     = %d\n",
-           cpus_weight(prv->active_queues),
+           cpumask_weight(&prv->active_queues),
            CSCHED_DEFAULT_WEIGHT);
     for_each_cpu_mask(i, prv->active_queues)
     {
@@ -1815,7 +1815,7 @@
                "\tinstload           = %d\n"
                "\taveload            = %3"PRI_stime"\n",
                i,
-               cpus_weight(prv->rqd[i].active),
+               cpumask_weight(&prv->rqd[i].active),
                prv->rqd[i].max_weight,
                prv->rqd[i].load,
                fraction);
@@ -1852,7 +1852,7 @@
 
     rqd = prv->rqd + rqi;
 
-    BUG_ON(!cpus_empty(rqd->active));
+    BUG_ON(!cpumask_empty(&rqd->active));
 
     rqd->max_weight = 1;
     rqd->id = rqi;
@@ -1869,7 +1869,7 @@
 
     rqd = prv->rqd + rqi;
 
-    BUG_ON(!cpus_empty(rqd->active));
+    BUG_ON(!cpumask_empty(&rqd->active));
     
     rqd->id = -1;
 
@@ -1980,7 +1980,7 @@
     cpu_clear(cpu, rqd->idle);
     cpu_clear(cpu, rqd->active);
 
-    if ( cpus_empty(rqd->active) )
+    if ( cpumask_empty(&rqd->active) )
     {
         printk(" No cpus left on runqueue, disabling\n");
         deactivate_runqueue(prv, rqi);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/common/schedule.c
--- a/xen/common/schedule.c	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/common/schedule.c	Tue Nov 08 10:31:47 2011 +0100
@@ -550,7 +550,7 @@
             vcpu_schedule_lock_irq(v);
 
             cpumask_and(&online_affinity, v->cpu_affinity, c->cpu_valid);
-            if ( cpus_empty(online_affinity) &&
+            if ( cpumask_empty(&online_affinity) &&
                  cpumask_test_cpu(cpu, v->cpu_affinity) )
             {
                 printk("Breaking vcpu affinity for domain %d vcpu %d\n",
diff -r 4e13729a0adf -r 67defeb4baa6 xen/include/asm-ia64/linux-xen/asm/acpi.h
--- a/xen/include/asm-ia64/linux-xen/asm/acpi.h	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/acpi.h	Tue Nov 08 10:31:47 2011 +0100
@@ -147,7 +147,7 @@
 	int cpu;
 	int next_nid = 0;
 
-	low_cpu = cpus_weight(early_cpu_possible_map);
+	low_cpu = cpumask_weight(&early_cpu_possible_map);
 
 	high_cpu = max(low_cpu, min_cpus);
 	high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
diff -r 4e13729a0adf -r 67defeb4baa6 xen/include/asm-ia64/linux/topology.h
--- a/xen/include/asm-ia64/linux/topology.h	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/include/asm-ia64/linux/topology.h	Tue Nov 08 10:31:47 2011 +0100
@@ -42,7 +42,7 @@
 	({									\
 		cpumask_t __tmp__;						\
 		__tmp__ = node_to_cpumask(node);				\
-		cpus_weight(__tmp__);						\
+		cpumask_weight(&__tmp__);					\
 	})
 #endif
 
diff -r 4e13729a0adf -r 67defeb4baa6 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Mon Nov 07 16:28:26 2011 +0100
+++ b/xen/include/xen/cpumask.h	Tue Nov 08 10:31:47 2011 +0100
@@ -26,12 +26,12 @@
  * void cpumask_andnot(dst, src1, src2)	dst = src1 & ~src2
  * void cpumask_complement(dst, src)	dst = ~src
  *
- * int cpus_equal(mask1, mask2)		Does mask1 == mask2?
- * int cpus_intersects(mask1, mask2)	Do mask1 and mask2 intersect?
- * int cpus_subset(mask1, mask2)	Is mask1 a subset of mask2?
- * int cpus_empty(mask)			Is mask empty (no bits sets)?
- * int cpus_full(mask)			Is mask full (all bits sets)?
- * int cpus_weight(mask)		Hamming weigh - number of set bits
+ * int cpumask_equal(mask1, mask2)	Does mask1 == mask2?
+ * int cpumask_intersects(mask1, mask2)	Do mask1 and mask2 intersect?
+ * int cpumask_subset(mask1, mask2)	Is mask1 a subset of mask2?
+ * int cpumask_empty(mask)		Is mask empty (no bits sets)?
+ * int cpumask_full(mask)		Is mask full (all bits sets)?
+ * int cpumask_weight(mask)		Hamming weigh - number of set bits
  *
  * void cpumask_shift_right(dst, src, n) Shift right
  * void cpumask_shift_left(dst, src, n)	Shift left
@@ -42,9 +42,7 @@
  * int cycle_cpu(cpu, mask)		Next cpu cycling from 'cpu', or NR_CPUS
  *
  * cpumask_t cpumask_of_cpu(cpu)	Return cpumask with bit 'cpu' set
- * CPU_MASK_ALL				Initializer - all bits set
- * CPU_MASK_NONE			Initializer - no bits set
- * unsigned long *cpus_addr(mask)	Array of unsigned long's in mask
+ * unsigned long *cpumask_bits(mask)	Array of unsigned long's in mask
  *
  * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
  * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
@@ -168,51 +166,37 @@
 	bitmap_complement(dstp->bits, srcp->bits, nr_cpumask_bits);
 }
 
-#define cpumask_equal(src1, src2) __cpus_equal(src1, src2, nr_cpu_ids)
-#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), nr_cpu_ids)
-static inline int __cpus_equal(const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline int cpumask_equal(const cpumask_t *src1p,
+				const cpumask_t *src2p)
 {
-	return bitmap_equal(src1p->bits, src2p->bits, nbits);
+	return bitmap_equal(src1p->bits, src2p->bits, nr_cpu_ids);
 }
 
-#define cpumask_intersects(src1, src2) \
-	__cpus_intersects(src1, src2, nr_cpu_ids)
-#define cpus_intersects(src1, src2) \
-	__cpus_intersects(&(src1), &(src2), nr_cpu_ids)
-static inline int __cpus_intersects(const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline int cpumask_intersects(const cpumask_t *src1p,
+				     const cpumask_t *src2p)
 {
-	return bitmap_intersects(src1p->bits, src2p->bits, nbits);
+	return bitmap_intersects(src1p->bits, src2p->bits, nr_cpu_ids);
 }
 
-#define cpumask_subset(src1, src2) __cpus_subset(src1, src2, nr_cpu_ids)
-#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), nr_cpu_ids)
-static inline int __cpus_subset(const cpumask_t *src1p,
-					const cpumask_t *src2p, int nbits)
+static inline int cpumask_subset(const cpumask_t *src1p,
+				 const cpumask_t *src2p)
 {
-	return bitmap_subset(src1p->bits, src2p->bits, nbits);
+	return bitmap_subset(src1p->bits, src2p->bits, nr_cpu_ids);
 }
 
-#define cpumask_empty(src) __cpus_empty(src, nr_cpu_ids)
-#define cpus_empty(src) __cpus_empty(&(src), nr_cpu_ids)
-static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
+static inline int cpumask_empty(const cpumask_t *srcp)
 {
-	return bitmap_empty(srcp->bits, nbits);
+	return bitmap_empty(srcp->bits, nr_cpu_ids);
 }
 
-#define cpumask_full(cpumask) __cpus_full(cpumask, nr_cpu_ids)
-#define cpus_full(cpumask) __cpus_full(&(cpumask), nr_cpu_ids)
-static inline int __cpus_full(const cpumask_t *srcp, int nbits)
+static inline int cpumask_full(const cpumask_t *srcp)
 {
-	return bitmap_full(srcp->bits, nbits);
+	return bitmap_full(srcp->bits, nr_cpu_ids);
 }
 
-#define cpumask_weight(cpumask) __cpus_weight(cpumask, nr_cpu_ids)
-#define cpus_weight(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
-static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
+static inline int cpumask_weight(const cpumask_t *srcp)
 {
-	return bitmap_weight(srcp->bits, nbits);
+	return bitmap_weight(srcp->bits, nr_cpu_ids);
 }
 
 static inline void cpumask_copy(cpumask_t *dstp, const cpumask_t *srcp)
@@ -317,7 +301,6 @@
 } }
 #endif /* __ia64__ */
 
-#define cpus_addr(src) ((src).bits)
 #define cpumask_bits(maskp) ((maskp)->bits)
 
 static inline int cpumask_scnprintf(char *buf, int len,
@@ -458,9 +441,9 @@
 extern cpumask_t cpu_present_map;
 
 #if NR_CPUS > 1
-#define num_online_cpus()	cpus_weight(cpu_online_map)
-#define num_possible_cpus()	cpus_weight(cpu_possible_map)
-#define num_present_cpus()	cpus_weight(cpu_present_map)
+#define num_online_cpus()	cpumask_weight(&cpu_online_map)
+#define num_possible_cpus()	cpumask_weight(&cpu_possible_map)
+#define num_present_cpus()	cpumask_weight(&cpu_present_map)
 #define cpu_online(cpu)		cpu_isset((cpu), cpu_online_map)
 #define cpu_possible(cpu)	cpu_isset((cpu), cpu_possible_map)
 #define cpu_present(cpu)	cpu_isset((cpu), cpu_present_map)

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:47 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROir9-0005So-2u; Thu, 10 Nov 2011 20:36:47 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinx-0004AE-5U
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:30 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-27.messagelabs.com!1320985968!56361456!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1039 invoked from network); 11 Nov 2011 04:32:48 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:32:48 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinu-0001Gn-1e
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:26 +0000
Message-Id: <E1ROinu-0001Gn-1e@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:25 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate cpu_test_xyz()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320744782 -3600
# Node ID f9c4494e77c812e9da1d0576a486dfdca5919904
# Parent  67defeb4baa649f70883bcfbb642db0488a4727c
eliminate cpu_test_xyz()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/ia64/linux-xen/smp.c
--- a/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:33:02 2011 +0100
@@ -68,7 +68,7 @@
     //printf("smp_send_event_check_mask called\n");
 
     for (cpu = 0; cpu < NR_CPUS; ++cpu)
-        if (cpu_isset(cpu, *mask) && cpu != smp_processor_id())
+        if (cpumask_test_cpu(cpu, mask) && cpu != smp_processor_id())
 	    platform_send_ipi(cpu, IA64_IPI_RESCHEDULE, IA64_IPI_DM_INT, 0);
 }
 #endif
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:33:02 2011 +0100
@@ -548,13 +548,13 @@
 	 */
 	Dprintk("Waiting on callin_map ...");
 	for (timeout = 0; timeout < 100000; timeout++) {
-		if (cpu_isset(cpu, cpu_callin_map))
+		if (cpumask_test_cpu(cpu, &cpu_callin_map))
 			break;  /* It has booted */
 		udelay(100);
 	}
 	Dprintk("\n");
 
-	if (!cpu_isset(cpu, cpu_callin_map)) {
+	if (!cpumask_test_cpu(cpu, &cpu_callin_map)) {
 		printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
 		ia64_cpu_to_sapicid[cpu] = -1;
 		cpu_clear(cpu, cpu_online_map);  /* was set in smp_callin() */
@@ -818,7 +818,7 @@
 	 * Already booted cpu? not valid anymore since we dont
 	 * do idle loop tightspin anymore.
 	 */
-	if (cpu_isset(cpu, cpu_callin_map))
+	if (cpumask_test_cpu(cpu, &cpu_callin_map))
 		return -EINVAL;
 
 	if (!per_cpu(cpu_sibling_mask, cpu) &&
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/ia64/xen/domain.c	Tue Nov 08 10:33:02 2011 +0100
@@ -140,7 +140,7 @@
 
 	if (is_idle_vcpu(next) ||
 	    __test_and_clear_bit(cpu, &next->arch.cache_coherent_map)) {
-		if (cpu_test_and_clear(cpu, cpu_cache_coherent_map)) {
+		if (cpumask_test_and_clear_cpu(cpu, &cpu_cache_coherent_map)) {
 			unsigned long flags;
 			u64 progress = 0;
 			s64 status;
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/ia64/xen/regionreg.c
--- a/xen/arch/ia64/xen/regionreg.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/ia64/xen/regionreg.c	Tue Nov 08 10:33:02 2011 +0100
@@ -320,8 +320,8 @@
 	else {
 		if (current && VMX_DOMAIN(current))
 			vpd = __get_cpu_var(inserted_vpd);
-		ia64_new_rr7_efi(val, cpu_isset(smp_processor_id(),
-				 percpu_set), vpd);
+		ia64_new_rr7_efi(val, cpumask_test_cpu(smp_processor_id(),
+						       &percpu_set), vpd);
 	}
 
 	return 1;
@@ -342,8 +342,8 @@
 		   and strcut domain are initialized. */
 		if (unlikely(current == NULL || current->domain == NULL ||
 			     is_idle_vcpu(current)))
-			ia64_new_rr7_efi(val, cpu_isset(smp_processor_id(),
-							percpu_set),
+			ia64_new_rr7_efi(val, cpumask_test_cpu(smp_processor_id(),
+							       &percpu_set),
 					 0UL);
 		else if (VMX_DOMAIN(current))
 			__vmx_switch_rr7_vcpu(current, val);
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/ia64/xen/vhpt.c	Tue Nov 08 10:33:02 2011 +0100
@@ -553,7 +553,7 @@
     int cpu;
 
     cpu = smp_processor_id();
-    if (cpu_isset(cpu, *mask))
+    if (cpumask_test_cpu(cpu, mask))
         flush_tlb_vhpt_all (NULL);
 
     if (cpumask_subset(mask, cpumask_of(cpu)))
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/x86/cpu/common.c	Tue Nov 08 10:33:02 2011 +0100
@@ -624,7 +624,7 @@
 		.limit = LAST_RESERVED_GDT_BYTE
 	};
 
-	if (cpu_test_and_set(cpu, cpu_initialized)) {
+	if (cpumask_test_and_set_cpu(cpu, &cpu_initialized)) {
 		printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
 		for (;;) local_irq_enable();
 	}
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/x86/smp.c	Tue Nov 08 10:33:02 2011 +0100
@@ -234,7 +234,7 @@
 {
     ASSERT(local_irq_is_enabled());
 
-    if ( cpu_isset(smp_processor_id(), *mask) )
+    if ( cpumask_test_cpu(smp_processor_id(), mask) )
         flush_area_local(va, flags);
 
     if ( !cpumask_subset(mask, cpumask_of(smp_processor_id())) )
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Tue Nov 08 10:33:02 2011 +0100
@@ -138,7 +138,7 @@
         return;
 
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) &&
-         !cpu_isset(slave, tsc_sync_cpu_mask) )
+         !cpumask_test_cpu(slave, &tsc_sync_cpu_mask) )
         return;
 
     for ( i = 1; i <= 5; i++ )
@@ -162,7 +162,7 @@
         return;
 
     if ( boot_cpu_has(X86_FEATURE_TSC_RELIABLE) &&
-         !cpu_isset(slave, tsc_sync_cpu_mask) )
+         !cpumask_test_cpu(slave, &tsc_sync_cpu_mask) )
         return;
 
     for ( i = 1; i <= 5; i++ )
@@ -956,7 +956,7 @@
         return ret;
 
     set_cpu_state(CPU_STATE_ONLINE);
-    while ( !cpu_isset(cpu, cpu_online_map) )
+    while ( !cpu_online(cpu) )
     {
         cpu_relax();
         process_pending_softirqs();
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 08 10:33:02 2011 +0100
@@ -1580,7 +1580,7 @@
 {
     int cpu = smp_processor_id();
 
-    if ( cpu_test_and_clear(cpu, pit_broadcast_mask) )
+    if ( cpumask_test_and_clear_cpu(cpu, &pit_broadcast_mask) )
         reprogram_timer(this_cpu(timer_deadline));
 }
 
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/common/cpupool.c	Tue Nov 08 10:33:02 2011 +0100
@@ -299,7 +299,7 @@
     ret = -EBUSY;
     if ( (cpupool_moving_cpu != -1) && (cpu != cpupool_moving_cpu) )
         goto out;
-    if ( cpu_isset(cpu, cpupool_locked_cpus) )
+    if ( cpumask_test_cpu(cpu, &cpupool_locked_cpus) )
         goto out;
 
     ret = 0;
@@ -499,7 +499,7 @@
         if ( cpu >= nr_cpu_ids )
             goto addcpu_out;
         ret = -EBUSY;
-        if ( !cpu_isset(cpu, cpupool_free_cpus) )
+        if ( !cpumask_test_cpu(cpu, &cpupool_free_cpus) )
             goto addcpu_out;
         c = cpupool_find_by_id(op->cpupool_id);
         ret = -ENOENT;
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/common/kexec.c
--- a/xen/common/kexec.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/common/kexec.c	Tue Nov 08 10:33:02 2011 +0100
@@ -169,7 +169,7 @@
     ELF_Prstatus *prstatus;
     crash_xen_core_t *xencore;
 
-    if ( cpu_test_and_set(cpu, crash_saved_cpus) )
+    if ( cpumask_test_and_set_cpu(cpu, &crash_saved_cpus) )
         return;
 
     prstatus = (ELF_Prstatus *)ELFNOTE_DESC(note);
@@ -187,7 +187,7 @@
     crash_xen_info_t info;
     crash_xen_info_t *out = (crash_xen_info_t *)ELFNOTE_DESC(xen_crash_note);
 
-    BUG_ON(!cpu_test_and_set(cpu, crash_saved_cpus));
+    BUG_ON(!cpumask_test_and_set_cpu(cpu, &crash_saved_cpus));
 
     memset(&info, 0, sizeof(info));
     info.xen_major_version = xen_major_version();
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/common/sched_credit2.c	Tue Nov 08 10:33:02 2011 +0100
@@ -1366,7 +1366,7 @@
     struct csched_runqueue_data *trqd;
 
     /* Check if new_cpu is valid */
-    BUG_ON(!cpu_isset(new_cpu, CSCHED_PRIV(ops)->initialized));
+    BUG_ON(!cpumask_test_cpu(new_cpu, &CSCHED_PRIV(ops)->initialized));
 
     trqd = RQD(ops, new_cpu);
 
@@ -1602,10 +1602,10 @@
              scurr->vcpu->vcpu_id,
              now);
 
-    BUG_ON(!cpu_isset(cpu, CSCHED_PRIV(ops)->initialized));
+    BUG_ON(!cpumask_test_cpu(cpu, &CSCHED_PRIV(ops)->initialized));
 
     rqd = RQD(ops, cpu);
-    BUG_ON(!cpu_isset(cpu, rqd->active));
+    BUG_ON(!cpumask_test_cpu(cpu, &rqd->active));
 
     /* Protected by runqueue lock */        
 
@@ -1637,7 +1637,7 @@
     BUG_ON(!is_idle_vcpu(scurr->vcpu) && scurr->rqd != rqd);
 
     /* Clear "tickled" bit now that we've been scheduled */
-    if ( cpu_isset(cpu, rqd->tickled) )
+    if ( cpumask_test_cpu(cpu, &rqd->tickled) )
         cpu_clear(cpu, rqd->tickled);
 
     /* Update credits */
@@ -1708,7 +1708,7 @@
         }
 
         /* Clear the idle mask if necessary */
-        if ( cpu_isset(cpu, rqd->idle) )
+        if ( cpumask_test_cpu(cpu, &rqd->idle) )
             cpu_clear(cpu, rqd->idle);
 
         snext->start_time = now;
@@ -1724,7 +1724,7 @@
     else
     {
         /* Update the idle mask if necessary */
-        if ( !cpu_isset(cpu, rqd->idle) )
+        if ( !cpumask_test_cpu(cpu, &rqd->idle) )
             cpu_set(cpu, rqd->idle);
         /* Make sure avgload gets updated periodically even
          * if there's no activity */
@@ -1885,7 +1885,7 @@
 
     spin_lock_irqsave(&prv->lock, flags);
 
-    if ( cpu_isset(cpu, prv->initialized) )
+    if ( cpumask_test_cpu(cpu, &prv->initialized) )
     {
         printk("%s: Strange, cpu %d already initialized!\n", __func__, cpu);
         spin_unlock_irqrestore(&prv->lock, flags);
@@ -1912,7 +1912,7 @@
     rqd=prv->rqd + rqi;
 
     printk("Adding cpu %d to runqueue %d\n", cpu, rqi);
-    if ( ! cpu_isset(rqi, prv->active_queues) )
+    if ( ! cpumask_test_cpu(rqi, &prv->active_queues) )
     {
         printk(" First cpu on runqueue, activating\n");
         activate_runqueue(prv, rqi);
@@ -1963,7 +1963,7 @@
 
     spin_lock_irqsave(&prv->lock, flags);
 
-    BUG_ON( !cpu_isset(cpu, prv->initialized));
+    BUG_ON(!cpumask_test_cpu(cpu, &prv->initialized));
     
     /* Find the old runqueue and remove this cpu from it */
     rqi = prv->runq_map[cpu];
@@ -1973,7 +1973,7 @@
     /* No need to save IRQs here, they're already disabled */
     spin_lock(&rqd->lock);
 
-    BUG_ON(!cpu_isset(cpu, rqd->idle));
+    BUG_ON(!cpumask_test_cpu(cpu, &rqd->idle));
 
     printk("Removing cpu %d from runqueue %d\n", cpu, rqi);
 
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/common/sched_sedf.c	Tue Nov 08 10:33:02 2011 +0100
@@ -820,7 +820,7 @@
     /* Tasklet work (which runs in idle VCPU context) overrides all else. */
     if ( tasklet_work_scheduled ||
          (list_empty(runq) && list_empty(waitq)) ||
-         unlikely(!cpu_isset(cpu, *SEDF_CPUONLINE(per_cpu(cpupool, cpu)))) )
+         unlikely(!cpumask_test_cpu(cpu, SEDF_CPUONLINE(per_cpu(cpupool, cpu)))) )
     {
         ret.task = IDLETASK(cpu);
         ret.time = SECONDS(1);
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/common/trace.c
--- a/xen/common/trace.c	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/common/trace.c	Tue Nov 08 10:33:02 2011 +0100
@@ -323,7 +323,7 @@
                 & ((event >> TRC_SUBCLS_SHIFT) & 0xf )) == 0 )
         return 0;
 
-    if ( !cpu_isset(smp_processor_id(), tb_cpu_mask) )
+    if ( !cpumask_test_cpu(smp_processor_id(), &tb_cpu_mask) )
         return 0;
 
     return 1;
@@ -711,7 +711,7 @@
                 & ((event >> TRC_SUBCLS_SHIFT) & 0xf )) == 0 )
         return;
 
-    if ( !cpu_isset(smp_processor_id(), tb_cpu_mask) )
+    if ( !cpumask_test_cpu(smp_processor_id(), &tb_cpu_mask) )
         return;
 
     /* Read tb_init_done /before/ t_bufs. */
diff -r 67defeb4baa6 -r f9c4494e77c8 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Tue Nov 08 10:31:47 2011 +0100
+++ b/xen/include/xen/cpumask.h	Tue Nov 08 10:33:02 2011 +0100
@@ -19,6 +19,7 @@
  * void cpumask_clear(mask)		clear all bits
  * int cpumask_test_cpu(cpu, mask)	true iff bit 'cpu' set in mask
  * int cpumask_test_and_set_cpu(cpu, mask) test and set bit 'cpu' in mask
+ * int cpumask_test_and_clear_cpu(cpu, mask) test and clear bit 'cpu' in mask
  *
  * void cpumask_and(dst, src1, src2)	dst = src1 & src2  [intersection]
  * void cpumask_or(dst, src1, src2)	dst = src1 | src2  [union]
@@ -64,12 +65,12 @@
  * for_each_present_cpu(cpu)		for-loop cpu over cpu_present_map
  *
  * Subtlety:
- * 1) The 'type-checked' form of cpu_isset() causes gcc (3.3.2, anyway)
+ * 1) The 'type-checked' form of cpumask_test_cpu() causes gcc (3.3.2, anyway)
  *    to generate slightly worse code.  Note for example the additional
  *    40 lines of assembly code compiling the "for each possible cpu"
  *    loops buried in the disk_stat_read() macros calls when compiling
  *    drivers/block/genhd.c (arch i386, CONFIG_SMP=y).  So use a simple
- *    one-line #define for cpu_isset(), instead of wrapping an inline
+ *    one-line #define for cpumask_test_cpu(), instead of wrapping an inline
  *    inside a macro, the way we do the other calls.
  */
 
@@ -121,17 +122,12 @@
 /* No static inline type checking - see Subtlety (1) above. */
 #define cpumask_test_cpu(cpu, cpumask) \
 	test_bit(cpumask_check(cpu), (cpumask)->bits)
-#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
 
-#define cpu_test_and_set(cpu, cpumask) \
-	cpumask_test_and_set_cpu(cpu, &(cpumask))
 static inline int cpumask_test_and_set_cpu(int cpu, cpumask_t *addr)
 {
 	return test_and_set_bit(cpumask_check(cpu), addr->bits);
 }
 
-#define cpu_test_and_clear(cpu, cpumask) \
-	cpumask_test_and_clear_cpu(cpu, &(cpumask))
 static inline int cpumask_test_and_clear_cpu(int cpu, cpumask_t *addr)
 {
 	return test_and_clear_bit(cpumask_check(cpu), addr->bits);
@@ -444,9 +440,9 @@
 #define num_online_cpus()	cpumask_weight(&cpu_online_map)
 #define num_possible_cpus()	cpumask_weight(&cpu_possible_map)
 #define num_present_cpus()	cpumask_weight(&cpu_present_map)
-#define cpu_online(cpu)		cpu_isset((cpu), cpu_online_map)
-#define cpu_possible(cpu)	cpu_isset((cpu), cpu_possible_map)
-#define cpu_present(cpu)	cpu_isset((cpu), cpu_present_map)
+#define cpu_online(cpu)		cpumask_test_cpu(cpu, &cpu_online_map)
+#define cpu_possible(cpu)	cpumask_test_cpu(cpu, &cpu_possible_map)
+#define cpu_present(cpu)	cpumask_test_cpu(cpu, &cpu_present_map)
 #else
 #define num_online_cpus()	1
 #define num_possible_cpus()	1

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:36:55 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:36:55 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROirH-0005W4-82; Thu, 10 Nov 2011 20:36:55 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROiny-0004AW-Ld
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:31 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1320986007!1114519!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3728 invoked from network); 11 Nov 2011 04:33:27 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:27 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinu-0001HQ-SY
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:26 +0000
Message-Id: <E1ROinu-0001HQ-SY@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate cpu_set()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320744873 -3600
# Node ID 1f3056be6c8399b6b20157d40a45ecb02a35bfcc
# Parent  f9c4494e77c812e9da1d0576a486dfdca5919904
eliminate cpu_set()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/linux-xen/acpi.c
--- a/xen/arch/ia64/linux-xen/acpi.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/linux-xen/acpi.c	Tue Nov 08 10:34:33 2011 +0100
@@ -557,7 +557,7 @@
 	    (pa->apic_id << 8) | (pa->local_sapic_eid);
 	/* nid should be overridden as logical node id later */
 	node_cpuid[srat_num_cpus].nid = pxm;
-	cpu_set(srat_num_cpus, early_cpu_possible_map);
+	cpumask_set_cpu(srat_num_cpus, &early_cpu_possible_map);
 	srat_num_cpus++;
 }
 
@@ -917,7 +917,7 @@
 		possible, max((possible - available_cpus), 0));
 
 	for (i = 0; i < possible; i++)
-		cpu_set(i, cpu_possible_map);
+		cpumask_set_cpu(i, &cpu_possible_map);
 }
 
 #ifndef XEN
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/linux-xen/setup.c	Tue Nov 08 10:34:33 2011 +0100
@@ -463,7 +463,7 @@
 {
 #ifdef CONFIG_SMP
 	/* If we register an early console, allow CPU 0 to printk */
-	cpu_set(smp_processor_id(), cpu_online_map);
+	cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
 #endif
 }
 
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:34:33 2011 +0100
@@ -392,7 +392,7 @@
 #else
 	lock_ipi_calllock();
 #endif
-	cpu_set(cpuid, cpu_online_map);
+	cpumask_set_cpu(cpuid, &cpu_online_map);
 #ifdef XEN
 	unlock_ipi_calllock(flags);
 #else
@@ -437,7 +437,7 @@
 	/*
 	 * Allow the master to continue.
 	 */
-	cpu_set(cpuid, cpu_callin_map);
+	cpumask_set_cpu(cpuid, &cpu_callin_map);
 	Dprintk("Stack on CPU %d at about %p\n",cpuid, &cpuid);
 }
 
@@ -625,8 +625,8 @@
 	/*
 	 * We have the boot CPU online for sure.
 	 */
-	cpu_set(0, cpu_online_map);
-	cpu_set(0, cpu_callin_map);
+	cpumask_set_cpu(0, &cpu_online_map);
+	cpumask_set_cpu(0, &cpu_callin_map);
 
 	local_cpu_data->loops_per_jiffy = loops_per_jiffy;
 	ia64_cpu_to_sapicid[0] = boot_cpu_id;
@@ -652,8 +652,8 @@
 
 void __devinit smp_prepare_boot_cpu(void)
 {
-	cpu_set(smp_processor_id(), cpu_online_map);
-	cpu_set(smp_processor_id(), cpu_callin_map);
+	cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
+	cpumask_set_cpu(smp_processor_id(), &cpu_callin_map);
 	per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
 }
 
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c
--- a/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Tue Nov 08 10:34:33 2011 +0100
@@ -214,7 +214,7 @@
 	for_each_possible_cpu(cpu) {
 		cnode = cpu_to_node(cpu);
 		if (!node_isset(cnode, nodes_flushed)) {
-			cpu_set(cpu, selected_cpus);
+			cpumask_set_cpu(cpu, &selected_cpus);
 			i++;
 		}
 		node_set(cnode, nodes_flushed);
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/xen/mm_init.c
--- a/xen/arch/ia64/xen/mm_init.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/xen/mm_init.c	Tue Nov 08 10:34:33 2011 +0100
@@ -38,7 +38,7 @@
 	ia64_set_psr(psr);
 	ia64_srlz_i();
 #ifdef XEN
-	cpu_set(cpu, percpu_set);
+	cpumask_set_cpu(cpu, &percpu_set);
 #endif
 
 	/*
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/ia64/xen/tlb_track.c
--- a/xen/arch/ia64/xen/tlb_track.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/ia64/xen/tlb_track.c	Tue Nov 08 10:34:33 2011 +0100
@@ -389,7 +389,7 @@
 
  found:
     BUG_ON(v->processor >= NR_CPUS);
-    cpu_set(v->processor, entry->pcpu_dirty_mask);
+    cpumask_set_cpu(v->processor, &entry->pcpu_dirty_mask);
     BUG_ON(v->vcpu_id >= NR_CPUS);
     vcpu_set(v->vcpu_id, entry->vcpu_dirty_mask);
     perfc_incr(tlb_track_iod_dirtied);
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 10:34:33 2011 +0100
@@ -271,9 +271,9 @@
      */
     if ( expires > NOW() || expires == 0 )
     {
-        cpu_set(cpu, cpuidle_mwait_flags);
+        cpumask_set_cpu(cpu, &cpuidle_mwait_flags);
         __mwait(eax, ecx);
-        cpu_clear(cpu, cpuidle_mwait_flags);
+        cpumask_clear_cpu(cpu, &cpuidle_mwait_flags);
     }
 
     if ( expires <= NOW() && expires > 0 )
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/cpu/mcheck/mce_intel.c
--- a/xen/arch/x86/cpu/mcheck/mce_intel.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/mce_intel.c	Tue Nov 08 10:34:33 2011 +0100
@@ -828,7 +828,7 @@
              * (the MSRs are sticky)
              */
             if (bs.pcc || !bs.recoverable)
-                cpu_set(smp_processor_id(), mce_fatal_cpus);
+                cpumask_set_cpu(smp_processor_id(), &mce_fatal_cpus);
         } else {
             if (mctc != NULL)
                 mctelem_commit(mctc);
@@ -849,7 +849,7 @@
 
     mce_barrier_enter(&mce_trap_bar);
     if ( mctc != NULL && mce_urgent_action(regs, mctc))
-        cpu_set(smp_processor_id(), mce_fatal_cpus);
+        cpumask_set_cpu(smp_processor_id(), &mce_fatal_cpus);
     mce_barrier_exit(&mce_trap_bar);
     /*
      * Wait until everybody has processed the trap.
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/mpparse.c	Tue Nov 08 10:34:33 2011 +0100
@@ -161,7 +161,7 @@
 			return cpu;
 		}
 		x86_cpu_to_apicid[cpu] = apicid;
-		cpu_set(cpu, cpu_present_map);
+		cpumask_set_cpu(cpu, &cpu_present_map);
 	}
 
 	if (++num_processors > 8) {
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/numa.c	Tue Nov 08 10:34:33 2011 +0100
@@ -288,7 +288,7 @@
 
 __cpuinit void numa_add_cpu(int cpu)
 {
-	cpu_set(cpu, node_to_cpumask[cpu_to_node(cpu)]);
+	cpumask_set_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
 } 
 
 void __cpuinit numa_set_node(int cpu, int node)
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Tue Nov 08 10:34:33 2011 +0100
@@ -244,7 +244,7 @@
     int i;
     struct cpuinfo_x86 *c = cpu_data;
 
-    cpu_set(cpu, cpu_sibling_setup_map);
+    cpumask_set_cpu(cpu, &cpu_sibling_setup_map);
 
     if ( c[cpu].x86_num_siblings > 1 )
     {
@@ -380,7 +380,7 @@
      */
     lock_vector_lock();
     __setup_vector_irq(cpu);
-    cpu_set(cpu, cpu_online_map);
+    cpumask_set_cpu(cpu, &cpu_online_map);
     unlock_vector_lock();
 
     init_percpu_time();
@@ -804,8 +804,8 @@
 
 void __init smp_prepare_boot_cpu(void)
 {
-    cpu_set(smp_processor_id(), cpu_online_map);
-    cpu_set(smp_processor_id(), cpu_present_map);
+    cpumask_set_cpu(smp_processor_id(), &cpu_online_map);
+    cpumask_set_cpu(smp_processor_id(), &cpu_present_map);
 }
 
 static void
@@ -933,7 +933,7 @@
                    "break assumed cross-CPU TSC coherency.\n"
                    " ** Consider using boot parameter \"tsc=skewed\" "
                    "which forces TSC emulation where appropriate.\n", cpu);
-        cpu_set(cpu, tsc_sync_cpu_mask);
+        cpumask_set_cpu(cpu, &tsc_sync_cpu_mask);
     }
 
     srat_detect_node(cpu);
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/arch/x86/time.c	Tue Nov 08 10:34:33 2011 +0100
@@ -1573,7 +1573,7 @@
 
 void pit_broadcast_enter(void)
 {
-    cpu_set(smp_processor_id(), pit_broadcast_mask);
+    cpumask_set_cpu(smp_processor_id(), &pit_broadcast_mask);
 }
 
 void pit_broadcast_exit(void)
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/common/cpupool.c	Tue Nov 08 10:34:33 2011 +0100
@@ -253,7 +253,7 @@
 
     spin_lock(&cpupool_lock);
     ret = cpu_disable_scheduler(cpu);
-    cpu_set(cpu, cpupool_free_cpus);
+    cpumask_set_cpu(cpu, &cpupool_free_cpus);
     if ( !ret )
     {
         ret = schedule_cpu_switch(cpu, NULL);
@@ -409,8 +409,8 @@
 static void cpupool_cpu_add(unsigned int cpu)
 {
     spin_lock(&cpupool_lock);
-    cpu_clear(cpu, cpupool_locked_cpus);
-    cpu_set(cpu, cpupool_free_cpus);
+    cpumask_clear_cpu(cpu, &cpupool_locked_cpus);
+    cpumask_set_cpu(cpu, &cpupool_free_cpus);
     cpupool_assign_cpu_locked(cpupool0, cpu);
     spin_unlock(&cpupool_lock);
 }
@@ -428,7 +428,7 @@
     if ( !cpumask_test_cpu(cpu, cpupool0->cpu_valid))
         ret = -EBUSY;
     else
-        cpu_set(cpu, cpupool_locked_cpus);
+        cpumask_set_cpu(cpu, &cpupool_locked_cpus);
     spin_unlock(&cpupool_lock);
 
     return ret;
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/common/sched_credit2.c	Tue Nov 08 10:34:33 2011 +0100
@@ -1725,7 +1725,7 @@
     {
         /* Update the idle mask if necessary */
         if ( !cpumask_test_cpu(cpu, &rqd->idle) )
-            cpu_set(cpu, rqd->idle);
+            cpumask_set_cpu(cpu, &rqd->idle);
         /* Make sure avgload gets updated periodically even
          * if there's no activity */
         update_load(ops, rqd, NULL, 0, now);
@@ -1860,7 +1860,7 @@
     INIT_LIST_HEAD(&rqd->runq);
     spin_lock_init(&rqd->lock);
 
-    cpu_set(rqi, prv->active_queues);
+    cpumask_set_cpu(rqi, &prv->active_queues);
 }
 
 static void deactivate_runqueue(struct csched_private *prv, int rqi)
@@ -1927,12 +1927,12 @@
     /* Set the runqueue map */
     prv->runq_map[cpu]=rqi;
     
-    cpu_set(cpu, rqd->idle);
-    cpu_set(cpu, rqd->active);
+    cpumask_set_cpu(cpu, &rqd->idle);
+    cpumask_set_cpu(cpu, &rqd->active);
 
     spin_unlock(old_lock);
 
-    cpu_set(cpu, prv->initialized);
+    cpumask_set_cpu(cpu, &prv->initialized);
 
     spin_unlock_irqrestore(&prv->lock, flags);
 
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/include/asm-ia64/linux-xen/asm/acpi.h
--- a/xen/include/asm-ia64/linux-xen/asm/acpi.h	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/acpi.h	Tue Nov 08 10:34:33 2011 +0100
@@ -153,7 +153,7 @@
 	high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
 
 	for (cpu = low_cpu; cpu < high_cpu; cpu++) {
-		cpu_set(cpu, early_cpu_possible_map);
+		cpumask_set_cpu(cpu, &early_cpu_possible_map);
 		if (node_cpuid[cpu].nid == NUMA_NO_NODE) {
 			node_cpuid[cpu].nid = next_nid;
 			next_nid++;
diff -r f9c4494e77c8 -r 1f3056be6c83 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Tue Nov 08 10:33:02 2011 +0100
+++ b/xen/include/xen/cpumask.h	Tue Nov 08 10:34:33 2011 +0100
@@ -97,7 +97,6 @@
 	return cpu;
 }
 
-#define cpu_set(cpu, dst) cpumask_set_cpu(cpu, &(dst))
 static inline void cpumask_set_cpu(int cpu, volatile cpumask_t *dstp)
 {
 	set_bit(cpumask_check(cpu), dstp->bits);

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:37:01 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:37:01 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROirN-0005ZK-Ro; Thu, 10 Nov 2011 20:37:01 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROinz-0004Ar-7O
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:32 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-174.messagelabs.com!1320986007!1112003!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10365 invoked from network); 11 Nov 2011 04:33:28 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:28 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinv-0001I2-Fs
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:27 +0000
Message-Id: <E1ROinv-0001I2-Fs@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:26 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate cpu_clear()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320744912 -3600
# Node ID 52d242adc94edea36049fa93f668222f93d8518f
# Parent  1f3056be6c8399b6b20157d40a45ecb02a35bfcc
eliminate cpu_clear()

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/ia64/linux-xen/acpi.c
--- a/xen/arch/ia64/linux-xen/acpi.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/ia64/linux-xen/acpi.c	Tue Nov 08 10:35:12 2011 +0100
@@ -976,7 +976,7 @@
 int acpi_unmap_lsapic(int cpu)
 {
 	ia64_cpu_to_sapicid[cpu] = -1;
-	cpu_clear(cpu, cpu_present_map);
+	cpumask_clear_cpu(cpu, &cpu_present_map);
 
 #ifdef CONFIG_ACPI_NUMA
 	/* NUMA specific cleanup's */
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 08 10:35:12 2011 +0100
@@ -706,7 +706,7 @@
 
 		for_each_cpu_mask(numa_cpu, cpu_mask) {
 			if (!cpu_online(numa_cpu))
-				cpu_clear(numa_cpu, cpu_mask);
+				cpumask_clear_cpu(numa_cpu, &cpu_mask);
 		}
 
 		num_cpus = cpumask_weight(&cpu_mask);
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/ia64/linux-xen/smp.c
--- a/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:35:12 2011 +0100
@@ -134,7 +134,7 @@
 	/*
 	 * Remove this CPU:
 	 */
-	cpu_clear(smp_processor_id(), cpu_online_map);
+	cpumask_clear_cpu(smp_processor_id(), &cpu_online_map);
 	max_xtp();
 	local_irq_disable();
 	cpu_halt();
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:35:12 2011 +0100
@@ -557,7 +557,7 @@
 	if (!cpumask_test_cpu(cpu, &cpu_callin_map)) {
 		printk(KERN_ERR "Processor 0x%x/0x%x is stuck.\n", cpu, sapicid);
 		ia64_cpu_to_sapicid[cpu] = -1;
-		cpu_clear(cpu, cpu_online_map);  /* was set in smp_callin() */
+		cpumask_clear_cpu(cpu, &cpu_online_map);  /* was set in smp_callin() */
 		return -EINVAL;
 	}
 	return 0;
@@ -727,12 +727,12 @@
 	int cpu = smp_processor_id();
 
 	remove_siblinginfo(cpu);
-	cpu_clear(cpu, cpu_online_map);
+	cpumask_clear_cpu(cpu, &cpu_online_map);
 #ifndef XEN
 	fixup_irqs();
 #endif
 	local_flush_tlb_all();
-	cpu_clear(cpu, cpu_callin_map);
+	cpumask_clear_cpu(cpu, &cpu_callin_map);
 }
 #else /* !CONFIG_HOTPLUG_CPU */
 void __cpu_disable(void)
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/x86/cpu/common.c
--- a/xen/arch/x86/cpu/common.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/x86/cpu/common.c	Tue Nov 08 10:35:12 2011 +0100
@@ -668,5 +668,5 @@
 
 void cpu_uninit(unsigned int cpu)
 {
-	cpu_clear(cpu, cpu_initialized);
+	cpumask_clear_cpu(cpu, &cpu_initialized);
 }
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/x86/mpparse.c
--- a/xen/arch/x86/mpparse.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/x86/mpparse.c	Tue Nov 08 10:35:12 2011 +0100
@@ -802,7 +802,7 @@
 	physid_clear(apic_id, phys_cpu_present_map);
 
 	x86_cpu_to_apicid[cpu] = BAD_APICID;
-	cpu_clear(cpu, cpu_present_map);
+	cpumask_clear_cpu(cpu, &cpu_present_map);
 }
 
 #ifdef	CONFIG_X86_IO_APIC
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/x86/smp.c	Tue Nov 08 10:35:12 2011 +0100
@@ -226,7 +226,7 @@
     if ( !__sync_local_execstate() ||
          (flush_flags & (FLUSH_TLB_GLOBAL | FLUSH_CACHE)) )
         flush_area_local(flush_va, flush_flags);
-    cpu_clear(smp_processor_id(), flush_cpumask);
+    cpumask_clear_cpu(smp_processor_id(), &flush_cpumask);
     irq_exit();
 }
 
@@ -353,7 +353,7 @@
 static void stop_this_cpu(void *dummy)
 {
     __stop_this_cpu();
-    cpu_clear(smp_processor_id(), cpu_online_map);
+    cpumask_clear_cpu(smp_processor_id(), &cpu_online_map);
     for ( ; ; )
         halt();
 }
diff -r 1f3056be6c83 -r 52d242adc94e xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Tue Nov 08 10:35:12 2011 +0100
@@ -151,7 +151,7 @@
     }
 
     atomic_set(&tsc_count, 0);
-    cpu_clear(slave, tsc_sync_cpu_mask);
+    cpumask_clear_cpu(slave, &tsc_sync_cpu_mask);
 }
 
 static void synchronize_tsc_slave(unsigned int slave)
diff -r 1f3056be6c83 -r 52d242adc94e xen/common/cpupool.c
--- a/xen/common/cpupool.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/common/cpupool.c	Tue Nov 08 10:35:12 2011 +0100
@@ -232,7 +232,7 @@
         return ret;
     }
 
-    cpu_clear(cpu, cpupool_free_cpus);
+    cpumask_clear_cpu(cpu, &cpupool_free_cpus);
     if (cpupool_moving_cpu == cpu)
     {
         cpupool_moving_cpu = -1;
@@ -259,7 +259,7 @@
         ret = schedule_cpu_switch(cpu, NULL);
         if ( ret )
         {
-            cpu_clear(cpu, cpupool_free_cpus);
+            cpumask_clear_cpu(cpu, &cpupool_free_cpus);
             goto out;
         }
         per_cpu(cpupool, cpu) = NULL;
diff -r 1f3056be6c83 -r 52d242adc94e xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/common/sched_credit2.c	Tue Nov 08 10:35:12 2011 +0100
@@ -1638,7 +1638,7 @@
 
     /* Clear "tickled" bit now that we've been scheduled */
     if ( cpumask_test_cpu(cpu, &rqd->tickled) )
-        cpu_clear(cpu, rqd->tickled);
+        cpumask_clear_cpu(cpu, &rqd->tickled);
 
     /* Update credits */
     burn_credits(rqd, scurr, now);
@@ -1709,7 +1709,7 @@
 
         /* Clear the idle mask if necessary */
         if ( cpumask_test_cpu(cpu, &rqd->idle) )
-            cpu_clear(cpu, rqd->idle);
+            cpumask_clear_cpu(cpu, &rqd->idle);
 
         snext->start_time = now;
 
@@ -1873,7 +1873,7 @@
     
     rqd->id = -1;
 
-    cpu_clear(rqi, prv->active_queues);
+    cpumask_clear_cpu(rqi, &prv->active_queues);
 }
 
 static void init_pcpu(const struct scheduler *ops, int cpu)
@@ -1977,8 +1977,8 @@
 
     printk("Removing cpu %d from runqueue %d\n", cpu, rqi);
 
-    cpu_clear(cpu, rqd->idle);
-    cpu_clear(cpu, rqd->active);
+    cpumask_clear_cpu(cpu, &rqd->idle);
+    cpumask_clear_cpu(cpu, &rqd->active);
 
     if ( cpumask_empty(&rqd->active) )
     {
@@ -1988,7 +1988,7 @@
 
     spin_unlock(&rqd->lock);
 
-    cpu_clear(cpu, prv->initialized);
+    cpumask_clear_cpu(cpu, &prv->initialized);
 
     spin_unlock_irqrestore(&prv->lock, flags);
 
diff -r 1f3056be6c83 -r 52d242adc94e xen/include/asm-x86/flushtlb.h
--- a/xen/include/asm-x86/flushtlb.h	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/include/asm-x86/flushtlb.h	Tue Nov 08 10:35:12 2011 +0100
@@ -54,7 +54,7 @@
     unsigned int cpu;                                                   \
     for_each_cpu_mask ( cpu, mask )                                     \
         if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
-            cpu_clear(cpu, mask);                                       \
+            cpumask_clear_cpu(cpu, &(mask));                            \
 } while ( 0 )
 
 void new_tlbflush_clock_period(void);
diff -r 1f3056be6c83 -r 52d242adc94e xen/include/asm-x86/numa.h
--- a/xen/include/asm-x86/numa.h	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/include/asm-x86/numa.h	Tue Nov 08 10:35:12 2011 +0100
@@ -43,7 +43,7 @@
 
 static inline void clear_node_cpumask(int cpu)
 {
-	cpu_clear(cpu, node_to_cpumask[cpu_to_node(cpu)]);
+	cpumask_clear_cpu(cpu, &node_to_cpumask[cpu_to_node(cpu)]);
 }
 
 /* Simple perfect hash to map pdx to node numbers */
diff -r 1f3056be6c83 -r 52d242adc94e xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Tue Nov 08 10:34:33 2011 +0100
+++ b/xen/include/xen/cpumask.h	Tue Nov 08 10:35:12 2011 +0100
@@ -102,7 +102,6 @@
 	set_bit(cpumask_check(cpu), dstp->bits);
 }
 
-#define cpu_clear(cpu, dst) cpumask_clear_cpu(cpu, &(dst))
 static inline void cpumask_clear_cpu(int cpu, volatile cpumask_t *dstp)
 {
 	clear_bit(cpumask_check(cpu), dstp->bits);

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:37:09 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:37:09 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROirU-0005d8-TD; Thu, 10 Nov 2011 20:37:08 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio0-0004At-3d
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:32 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1320985891!43900483!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9651 invoked from network); 11 Nov 2011 04:31:31 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:31:31 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinx-0001JJ-1D
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:29 +0000
Message-Id: <E1ROinx-0001JJ-1D@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:28 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate remaining uses of struct
	irq_cfg
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320745028 -3600
# Node ID d423189e16f5c13a8b17ba199e390d8ad32d2a02
# Parent  d89f1b65b5121b7ae1d915d8ffdcda7605894c66
eliminate remaining uses of struct irq_cfg

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r d89f1b65b512 -r d423189e16f5 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Tue Nov 08 10:36:10 2011 +0100
+++ b/xen/arch/x86/io_apic.c	Tue Nov 08 10:37:08 2011 +0100
@@ -2279,7 +2279,6 @@
     int apic, pin, irq, ret, vector, pirq;
     struct IO_APIC_route_entry rte = { 0 };
     unsigned long flags;
-    struct irq_cfg *cfg;
     struct irq_desc *desc;
 
     if ( (apic = ioapic_physbase_to_id(physbase)) < 0 )
@@ -2321,7 +2320,6 @@
         return irq;
 
     desc = irq_to_desc(irq);
-    cfg = &desc->arch;
 
     /*
      * Since PHYSDEVOP_alloc_irq_vector is dummy, rte.vector is the pirq
@@ -2338,7 +2336,7 @@
         spin_lock_irqsave(&ioapic_lock, flags);
         ret = io_apic_read(apic, 0x10 + 2 * pin);
         spin_unlock_irqrestore(&ioapic_lock, flags);
-        rte.vector = cfg->vector;
+        rte.vector = desc->arch.vector;
         if ( *(u32*)&rte != ret )
             WARN_BOGUS_WRITE("old_entry=%08x pirq=%d\n%s: "
                              "Attempt to modify IO-APIC pin for in-use IRQ!\n",
@@ -2346,7 +2344,7 @@
         return 0;
     }
 
-    if ( cfg->vector <= 0 || cfg->vector > LAST_DYNAMIC_VECTOR ) {
+    if ( desc->arch.vector <= 0 || desc->arch.vector > LAST_DYNAMIC_VECTOR ) {
         vector = assign_irq_vector(irq);
         if ( vector < 0 )
             return vector;
@@ -2370,7 +2368,7 @@
     /* Mask iff level triggered. */
     rte.mask = rte.trigger;
     /* Set the vector field to the real vector! */
-    rte.vector = cfg->vector;
+    rte.vector = desc->arch.vector;
 
     SET_DEST(rte.dest.dest32, rte.dest.logical.logical_dest,
              cpu_mask_to_apicid(desc->arch.cpu_mask));
diff -r d89f1b65b512 -r d423189e16f5 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Nov 08 10:36:10 2011 +0100
+++ b/xen/arch/x86/irq.c	Tue Nov 08 10:37:08 2011 +0100
@@ -285,16 +285,14 @@
 int irq_to_vector(int irq)
 {
     int vector = -1;
-    struct irq_cfg *cfg;
 
     BUG_ON(irq >= nr_irqs || irq < 0);
 
     if (IO_APIC_IRQ(irq))
         vector = irq_vector[irq];
-    else if(MSI_IRQ(irq)) {
-        cfg = irq_cfg(irq);
-        vector = cfg->vector;
-    } else
+    else if (MSI_IRQ(irq))
+        vector = irq_to_desc(irq)->arch.vector;
+    else
         vector = LEGACY_VECTOR(irq);
 
     return vector;
diff -r d89f1b65b512 -r d423189e16f5 xen/include/asm-ia64/linux-xen/asm/irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/irq.h	Tue Nov 08 10:36:10 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Tue Nov 08 10:37:08 2011 +0100
@@ -15,8 +15,7 @@
 #define NR_IRQS		256
 
 #ifdef XEN
-struct irq_cfg {
-#define arch_irq_desc irq_cfg
+struct arch_irq_desc {
         int  vector;
         cpumask_var_t cpu_mask;
 };
@@ -63,9 +62,6 @@
 #define create_irq(x) assign_irq_vector(AUTO_ASSIGN_IRQ)
 #define destroy_irq(x) free_irq_vector(x)
 
-#define irq_cfg(x)        (&irq_desc[x].arch)
-#define irq_to_desc(x)    (&irq_desc[x]
-
 #define irq_complete_move(x) do {} \
     while(!x)
 
diff -r d89f1b65b512 -r d423189e16f5 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Tue Nov 08 10:36:10 2011 +0100
+++ b/xen/include/asm-x86/irq.h	Tue Nov 08 10:37:08 2011 +0100
@@ -20,17 +20,13 @@
 
 #define LEGACY_VECTOR(irq)          ((irq) + FIRST_LEGACY_VECTOR)
 
-#define irq_to_desc(irq)    (&irq_desc[irq])
-#define irq_cfg(irq)        (&irq_desc[irq].arch)
-
 typedef struct {
     DECLARE_BITMAP(_bits,NR_VECTORS);
 } vmask_t;
 
 struct irq_desc;
 
-struct irq_cfg {
-#define arch_irq_desc irq_cfg
+struct arch_irq_desc {
         s16 vector;                  /* vector itself is only 8 bits, */
         s16 old_vector;              /* but we use -1 for unassigned  */
         cpumask_var_t cpu_mask;
@@ -42,7 +38,7 @@
         s8 used;
 };
 
-/* For use with irq_cfg.used */
+/* For use with irq_desc.arch.used */
 #define IRQ_UNUSED      (0)
 #define IRQ_USED        (1)
 #define IRQ_RESERVED    (-1)
diff -r d89f1b65b512 -r d423189e16f5 xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Tue Nov 08 10:36:10 2011 +0100
+++ b/xen/include/xen/irq.h	Tue Nov 08 10:37:08 2011 +0100
@@ -84,6 +84,8 @@
     struct list_head rl_link;
 } __cacheline_aligned irq_desc_t;
 
+#define irq_to_desc(irq)    (&irq_desc[irq])
+
 int init_one_irq_desc(struct irq_desc *);
 int arch_init_one_irq_desc(struct irq_desc *);
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:37:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:37:40 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROirz-0005jn-SE; Thu, 10 Nov 2011 20:37:39 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio0-0004Aw-8k
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:33 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1320986008!1119664!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6601 invoked from network); 11 Nov 2011 04:33:29 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:29 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinw-0001Io-Ex
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:28 +0000
Message-Id: <E1ROinw-0001Io-Ex@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:27 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] eliminate first_cpu() etc
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320744970 -3600
# Node ID d89f1b65b5121b7ae1d915d8ffdcda7605894c66
# Parent  52d242adc94edea36049fa93f668222f93d8518f
eliminate first_cpu() etc

This includes the conversion from for_each_cpu_mask() to for_each-cpu().

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 08 10:36:10 2011 +0100
@@ -704,7 +704,7 @@
 
 		cpu_mask = node_to_cpumask(iosapic_lists[iosapic_index].node);
 
-		for_each_cpu_mask(numa_cpu, cpu_mask) {
+		for_each_cpu(numa_cpu, &cpu_mask) {
 			if (!cpu_online(numa_cpu))
 				cpumask_clear_cpu(numa_cpu, &cpu_mask);
 		}
@@ -717,8 +717,8 @@
 		/* Use vector assigment to distribute across cpus in node */
 		cpu_index = vector % num_cpus;
 
-		for (numa_cpu = first_cpu(cpu_mask) ; i < cpu_index ; i++)
-			numa_cpu = next_cpu(numa_cpu, cpu_mask);
+		for (numa_cpu = cpumask_first(&cpu_mask) ; i < cpu_index ; i++)
+			numa_cpu = cpumask_next(numa_cpu, &cpu_mask);
 
 		if (numa_cpu != NR_CPUS)
 			return cpu_physical_id(numa_cpu);
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/linux-xen/mca.c
--- a/xen/arch/ia64/linux-xen/mca.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/linux-xen/mca.c	Tue Nov 08 10:36:10 2011 +0100
@@ -1415,7 +1415,7 @@
 #endif
 {
 	/* Trigger a CMC interrupt cascade  */
-	platform_send_ipi(first_cpu(cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
+	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
 }
 
 /*
@@ -1505,7 +1505,7 @@
 #endif
 {
 	/* Trigger a CPE interrupt cascade  */
-	platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
+	platform_send_ipi(cpumask_first(&cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
 }
 
 #endif /* CONFIG_ACPI */
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/linux-xen/smp.c
--- a/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smp.c	Tue Nov 08 10:36:10 2011 +0100
@@ -462,7 +462,7 @@
 	call_data = &data;
 	wmb();
 
-	for_each_cpu_mask(cpu, *selected)
+	for_each_cpu(cpu, selected)
 		send_IPI_single(cpu, IPI_CALL_FUNC);
 
 	while (atomic_read(wait ? &data.finished : &data.started) != nr_cpus)
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c	Tue Nov 08 10:36:10 2011 +0100
@@ -687,9 +687,9 @@
 {
 	int i;
 
-	for_each_cpu_mask(i, *per_cpu(cpu_sibling_mask, cpu))
+	for_each_cpu(i, per_cpu(cpu_sibling_mask, cpu))
 		cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, i));
-	for_each_cpu_mask(i, *per_cpu(cpu_core_mask, cpu))
+	for_each_cpu(i, per_cpu(cpu_core_mask, cpu))
 		cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, i));
 
 	cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/vmx/vacpi.c
--- a/xen/arch/ia64/vmx/vacpi.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/vmx/vacpi.c	Tue Nov 08 10:36:10 2011 +0100
@@ -191,7 +191,7 @@
 	s->last_gtime = NOW();
 
 	/* Set up callback to fire SCIs when the MSB of TMR_VAL changes */
-	init_timer(&s->timer, pmt_timer_callback, d, first_cpu(cpu_online_map));
+	init_timer(&s->timer, pmt_timer_callback, d, cpumask_first(&cpu_online_map));
 	pmt_timer_callback(d);
 }
 
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c	Tue Nov 08 10:36:10 2011 +0100
@@ -618,7 +618,7 @@
         XEN_GUEST_HANDLE_64(uint32) arr;
         uint32_t i, val, max_array_ent = ti->max_cpu_index;
 
-        ti->max_cpu_index = last_cpu(cpu_online_map);
+        ti->max_cpu_index = cpumask_last(&cpu_online_map);
         max_array_ent = min(max_array_ent, ti->max_cpu_index);
 
         arr = ti->cpu_to_core;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/xen/domain.c	Tue Nov 08 10:36:10 2011 +0100
@@ -501,7 +501,7 @@
 
 	if (!VMX_DOMAIN(v))
 		init_timer(&v->arch.hlt_timer, hlt_timer_fn, v,
-		           first_cpu(cpu_online_map));
+		           cpumask_any(&cpu_online_map));
 
 	return 0;
 }
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/ia64/xen/vhpt.c	Tue Nov 08 10:36:10 2011 +0100
@@ -463,7 +463,7 @@
 				local_purge = 0;
 		}
 	} else {
-		for_each_cpu_mask(cpu, entry->pcpu_dirty_mask) {
+		for_each_cpu(cpu, &entry->pcpu_dirty_mask) {
 			/* Invalidate VHPT entries.  */
 			cpu_flush_vhpt_range(cpu, vaddr, 1L << ps);
 
@@ -559,7 +559,7 @@
     if (cpumask_subset(mask, cpumask_of(cpu)))
         return;
 
-    for_each_cpu_mask (cpu, *mask)
+    for_each_cpu (cpu, mask)
         if (cpu != smp_processor_id())
             smp_call_function_single
                 (cpu, (void (*)(void *))flush_tlb_vhpt_all, NULL, 1);
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 10:36:10 2011 +0100
@@ -251,7 +251,7 @@
     cpumask_and(&target, mask, &cpuidle_mwait_flags);
 
     /* CPU is MWAITing on the cpuidle_mwait_wakeup flag. */
-    for_each_cpu_mask(cpu, target)
+    for_each_cpu(cpu, &target)
         mwait_wakeup(cpu) = 0;
 
     cpumask_andnot(mask, mask, &target);
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c	Tue Nov 08 10:36:10 2011 +0100
@@ -487,7 +487,7 @@
         return -EAGAIN;
     }
 
-    for_each_cpu_mask(j, online_policy_cpus)
+    for_each_cpu(j, &online_policy_cpus)
         cpufreq_statistic_update(j, perf->state, next_perf_state);
 
     perf->state = next_perf_state;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/acpi/cpufreq/powernow.c
--- a/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/acpi/cpufreq/powernow.c	Tue Nov 08 10:36:10 2011 +0100
@@ -130,7 +130,7 @@
 
     on_selected_cpus(cmd.mask, transition_pstate, &cmd, 1);
 
-    for_each_cpu_mask(j, online_policy_cpus)
+    for_each_cpu(j, &online_policy_cpus)
         cpufreq_statistic_update(j, perf->state, next_perf_state);
 
     perf->state = next_perf_state;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/genapic/x2apic.c
--- a/xen/arch/x86/genapic/x2apic.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/genapic/x2apic.c	Tue Nov 08 10:36:10 2011 +0100
@@ -72,7 +72,7 @@
 
     local_irq_save(flags);
 
-    for_each_cpu_mask ( cpu, *cpumask )
+    for_each_cpu ( cpu, cpumask )
     {
         if ( !cpu_online(cpu) || (cpu == smp_processor_id()) )
             continue;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/hpet.c	Tue Nov 08 10:36:10 2011 +0100
@@ -182,7 +182,7 @@
     now = NOW();
 
     /* find all expired events */
-    for_each_cpu_mask(cpu, *ch->cpumask)
+    for_each_cpu(cpu, ch->cpumask)
     {
         s_time_t deadline;
 
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/irq.c	Tue Nov 08 10:36:10 2011 +0100
@@ -125,7 +125,7 @@
     if ( desc->arch.vector != IRQ_VECTOR_UNASSIGNED )
         return -EBUSY;
     trace_irq_mask(TRC_HW_IRQ_BIND_VECTOR, irq, vector, &online_mask);
-    for_each_cpu_mask(cpu, online_mask)
+    for_each_cpu(cpu, &online_mask)
         per_cpu(vector_irq, cpu)[vector] = irq;
     desc->arch.vector = vector;
     cpumask_copy(desc->arch.cpu_mask, &online_mask);
@@ -223,7 +223,7 @@
     vector = desc->arch.vector;
     cpumask_and(&tmp_mask, desc->arch.cpu_mask, &cpu_online_map);
 
-    for_each_cpu_mask(cpu, tmp_mask) {
+    for_each_cpu(cpu, &tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[vector] == irq );
         per_cpu(vector_irq, cpu)[vector] = -1;
     }
@@ -248,7 +248,7 @@
     old_vector = desc->arch.old_vector;
     cpumask_and(&tmp_mask, desc->arch.old_cpu_mask, &cpu_online_map);
 
-    for_each_cpu_mask(cpu, tmp_mask) {
+    for_each_cpu(cpu, &tmp_mask) {
         ASSERT( per_cpu(vector_irq, cpu)[old_vector] == irq );
         TRACE_3D(TRC_HW_IRQ_MOVE_FINISH, irq, old_vector, cpu);
         per_cpu(vector_irq, cpu)[old_vector] = -1;
@@ -451,7 +451,7 @@
     else
         irq_used_vectors = irq_get_used_vector_mask(irq);
 
-    for_each_cpu_mask(cpu, *mask) {
+    for_each_cpu(cpu, mask) {
         int new_cpu;
         int vector, offset;
 
@@ -481,7 +481,7 @@
             && test_bit(vector, irq_used_vectors) )
             goto next;
 
-        for_each_cpu_mask(new_cpu, tmp_mask)
+        for_each_cpu(new_cpu, &tmp_mask)
             if (per_cpu(vector_irq, new_cpu)[vector] != -1)
                 goto next;
         /* Found one! */
@@ -493,7 +493,7 @@
             desc->arch.old_vector = desc->arch.vector;
         }
         trace_irq_mask(TRC_HW_IRQ_ASSIGN_VECTOR, irq, vector, &tmp_mask);
-        for_each_cpu_mask(new_cpu, tmp_mask)
+        for_each_cpu(new_cpu, &tmp_mask)
             per_cpu(vector_irq, new_cpu)[vector] = irq;
         desc->arch.vector = vector;
         cpumask_copy(desc->arch.cpu_mask, &tmp_mask);
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/microcode.c
--- a/xen/arch/x86/microcode.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/microcode.c	Tue Nov 08 10:36:10 2011 +0100
@@ -125,7 +125,7 @@
     if ( error )
         info->error = error;
 
-    info->cpu = next_cpu(info->cpu, cpu_online_map);
+    info->cpu = cpumask_next(info->cpu, &cpu_online_map);
     if ( info->cpu < nr_cpu_ids )
         return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info);
 
@@ -158,7 +158,7 @@
 
     info->buffer_size = len;
     info->error = 0;
-    info->cpu = first_cpu(cpu_online_map);
+    info->cpu = cpumask_first(&cpu_online_map);
 
     return continue_hypercall_on_cpu(info->cpu, do_microcode_update, info);
 }
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/platform_hypercall.c
--- a/xen/arch/x86/platform_hypercall.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/platform_hypercall.c	Tue Nov 08 10:36:10 2011 +0100
@@ -366,7 +366,7 @@
             goto out;
         guest_from_compat_handle(idletimes, op->u.getidletime.idletime);
 
-        for_each_cpu_mask ( cpu, *cpumap )
+        for_each_cpu ( cpu, cpumap )
         {
             if ( idle_vcpu[cpu] == NULL )
                 cpumask_clear_cpu(cpu, cpumap);
@@ -460,7 +460,7 @@
                 g_info->flags |= XEN_PCPU_FLAGS_ONLINE;
         }
 
-        g_info->max_present = last_cpu(cpu_present_map);
+        g_info->max_present = cpumask_last(&cpu_present_map);
 
         put_cpu_maps();
 
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/setup.c	Tue Nov 08 10:36:10 2011 +0100
@@ -229,9 +229,9 @@
          * Find remaining CPU with longest-prefix match on APIC ID.
          * Among identical longest-prefix matches, pick the smallest APIC ID.
          */
-        for ( j = next_cpu(i, cpu_present_map);
+        for ( j = cpumask_next(i, &cpu_present_map);
               j < nr_cpu_ids;
-              j = next_cpu(j, cpu_present_map) )
+              j = cpumask_next(j, &cpu_present_map) )
         {
             diff = x86_cpu_to_apicid[j] ^ apicid;
             while ( diff & (diff-1) )
@@ -248,12 +248,12 @@
         /* If no match then there must be no CPUs remaining to consider. */
         if ( min_cpu >= nr_cpu_ids )
         {
-            BUG_ON(next_cpu(i, cpu_present_map) < nr_cpu_ids);
+            BUG_ON(cpumask_next(i, &cpu_present_map) < nr_cpu_ids);
             break;
         }
 
         /* Switch the best-matching CPU with the next CPU in logical order. */
-        j = next_cpu(i, cpu_present_map);
+        j = cpumask_next(i, &cpu_present_map);
         apicid = x86_cpu_to_apicid[min_cpu];
         x86_cpu_to_apicid[min_cpu] = x86_cpu_to_apicid[j];
         x86_cpu_to_apicid[j] = apicid;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/smp.c
--- a/xen/arch/x86/smp.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/smp.c	Tue Nov 08 10:36:10 2011 +0100
@@ -182,7 +182,7 @@
 
     local_irq_save(flags);
 
-    for_each_cpu_mask ( query_cpu, *mask )
+    for_each_cpu ( query_cpu, mask )
     {
         if ( !cpu_online(query_cpu) || (query_cpu == smp_processor_id()) )
             continue;
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/smpboot.c	Tue Nov 08 10:36:10 2011 +0100
@@ -248,7 +248,7 @@
 
     if ( c[cpu].x86_num_siblings > 1 )
     {
-        for_each_cpu_mask ( i, cpu_sibling_setup_map )
+        for_each_cpu ( i, &cpu_sibling_setup_map )
         {
             if ( cpu_has(c, X86_FEATURE_TOPOEXT) ) {
                 if ( (c[cpu].phys_proc_id == c[i].phys_proc_id) &&
@@ -273,7 +273,7 @@
         return;
     }
 
-    for_each_cpu_mask ( i, cpu_sibling_setup_map )
+    for_each_cpu ( i, &cpu_sibling_setup_map )
     {
         if ( c[cpu].phys_proc_id == c[i].phys_proc_id )
         {
@@ -814,7 +814,7 @@
     int sibling;
     struct cpuinfo_x86 *c = cpu_data;
 
-    for_each_cpu_mask ( sibling, *per_cpu(cpu_core_mask, cpu) )
+    for_each_cpu ( sibling, per_cpu(cpu_core_mask, cpu) )
     {
         cpumask_clear_cpu(cpu, per_cpu(cpu_core_mask, sibling));
         /* Last thread sibling in this cpu core going down. */
@@ -822,7 +822,7 @@
             c[sibling].booted_cores--;
     }
    
-    for_each_cpu_mask(sibling, *per_cpu(cpu_sibling_mask, cpu))
+    for_each_cpu(sibling, per_cpu(cpu_sibling_mask, cpu))
         cpumask_clear_cpu(cpu, per_cpu(cpu_sibling_mask, sibling));
     cpumask_clear(per_cpu(cpu_sibling_mask, cpu));
     cpumask_clear(per_cpu(cpu_core_mask, cpu));
diff -r 52d242adc94e -r d89f1b65b512 xen/arch/x86/sysctl.c
--- a/xen/arch/x86/sysctl.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/arch/x86/sysctl.c	Tue Nov 08 10:36:10 2011 +0100
@@ -103,7 +103,7 @@
         uint32_t i, max_cpu_index, last_online_cpu;
         xen_sysctl_topologyinfo_t *ti = &sysctl->u.topologyinfo;
 
-        last_online_cpu = last_cpu(cpu_online_map);
+        last_online_cpu = cpumask_last(&cpu_online_map);
         max_cpu_index = min_t(uint32_t, ti->max_cpu_index, last_online_cpu);
         ti->max_cpu_index = last_online_cpu;
 
diff -r 52d242adc94e -r d89f1b65b512 xen/common/cpu.c
--- a/xen/common/cpu.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/cpu.c	Tue Nov 08 10:36:10 2011 +0100
@@ -205,7 +205,7 @@
 
     printk("Enabling non-boot CPUs  ...\n");
 
-    for_each_cpu_mask ( cpu, frozen_cpus )
+    for_each_cpu ( cpu, &frozen_cpus )
     {
         if ( (error = cpu_up(cpu)) )
         {
diff -r 52d242adc94e -r d89f1b65b512 xen/common/cpupool.c
--- a/xen/common/cpupool.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/cpupool.c	Tue Nov 08 10:36:10 2011 +0100
@@ -494,7 +494,7 @@
                         op->cpupool_id, cpu);
         spin_lock(&cpupool_lock);
         if ( cpu == XEN_SYSCTL_CPUPOOL_PAR_ANY )
-            cpu = first_cpu(cpupool_free_cpus);
+            cpu = cpumask_first(&cpupool_free_cpus);
         ret = -EINVAL;
         if ( cpu >= nr_cpu_ids )
             goto addcpu_out;
diff -r 52d242adc94e -r d89f1b65b512 xen/common/domctl.c
--- a/xen/common/domctl.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/domctl.c	Tue Nov 08 10:36:10 2011 +0100
@@ -190,7 +190,7 @@
     cpu = cpumask_first(&cpu_exclude_map);
     if ( cpumask_weight(&cpu_exclude_map) > 1 )
         cpu = cpumask_next(cpu, &cpu_exclude_map);
-    for_each_cpu_mask(i, *online)
+    for_each_cpu(i, online)
     {
         if ( cpumask_test_cpu(i, &cpu_exclude_map) )
             continue;
@@ -541,7 +541,7 @@
 
             cpu = (i == 0) ?
                 default_vcpu0_location(online) :
-                cycle_cpu(d->vcpu[i-1]->processor, *online);
+                cpumask_cycle(d->vcpu[i-1]->processor, online);
 
             if ( alloc_vcpu(d, i, cpu) == NULL )
                 goto maxvcpu_out;
diff -r 52d242adc94e -r d89f1b65b512 xen/common/keyhandler.c
--- a/xen/common/keyhandler.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/keyhandler.c	Tue Nov 08 10:36:10 2011 +0100
@@ -128,7 +128,7 @@
         return;
 
     /* Normal handling: synchronously dump the remaining CPUs' states. */
-    for_each_cpu_mask ( cpu, dump_execstate_mask )
+    for_each_cpu ( cpu, &dump_execstate_mask )
     {
         smp_send_state_dump(cpu);
         while ( cpumask_test_cpu(cpu, &dump_execstate_mask) )
diff -r 52d242adc94e -r d89f1b65b512 xen/common/perfc.c
--- a/xen/common/perfc.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/perfc.c	Tue Nov 08 10:36:10 2011 +0100
@@ -211,14 +211,14 @@
         {
         case TYPE_SINGLE:
         case TYPE_S_SINGLE:
-            for_each_cpu_mask ( cpu, perfc_cpumap )
+            for_each_cpu ( cpu, &perfc_cpumap )
                 perfc_vals[v++] = per_cpu(perfcounters, cpu)[j];
             ++j;
             break;
         case TYPE_ARRAY:
         case TYPE_S_ARRAY:
             memset(perfc_vals + v, 0, perfc_d[i].nr_vals * sizeof(*perfc_vals));
-            for_each_cpu_mask ( cpu, perfc_cpumap )
+            for_each_cpu ( cpu, &perfc_cpumap )
             {
                 perfc_t *counters = per_cpu(perfcounters, cpu) + j;
                 unsigned int k;
diff -r 52d242adc94e -r d89f1b65b512 xen/common/sched_credit2.c
--- a/xen/common/sched_credit2.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/sched_credit2.c	Tue Nov 08 10:36:10 2011 +0100
@@ -521,7 +521,7 @@
     cpumask_andnot(&mask, &rqd->active, &rqd->idle);
     cpumask_andnot(&mask, &mask, &rqd->tickled);
 
-    for_each_cpu_mask(i, mask)
+    for_each_cpu(i, &mask)
     {
         struct csched_vcpu * cur;
 
@@ -1051,7 +1051,7 @@
         else
         {
             d2printk("d%dv%d +\n", svc->vcpu->domain->domain_id, svc->vcpu->vcpu_id);
-            new_cpu = first_cpu(svc->migrate_rqd->active);
+            new_cpu = cpumask_first(&svc->migrate_rqd->active);
             goto out_up;
         }
     }
@@ -1061,7 +1061,7 @@
     min_avgload = MAX_LOAD;
 
     /* Find the runqueue with the lowest instantaneous load */
-    for_each_cpu_mask(i, prv->active_queues)
+    for_each_cpu(i, &prv->active_queues)
     {
         struct csched_runqueue_data *rqd;
         s_time_t rqd_avgload;
@@ -1099,7 +1099,7 @@
     else
     {
         BUG_ON(cpumask_empty(&prv->rqd[min_rqi].active));
-        new_cpu = first_cpu(prv->rqd[min_rqi].active);
+        new_cpu = cpumask_first(&prv->rqd[min_rqi].active);
     }
 
 out_up:
@@ -1179,7 +1179,7 @@
             on_runq=1;
         }
         __runq_deassign(svc);
-        svc->vcpu->processor = first_cpu(trqd->active);
+        svc->vcpu->processor = cpumask_first(&trqd->active);
         __runq_assign(svc, trqd);
         if ( on_runq )
         {
@@ -1219,7 +1219,7 @@
 
     st.load_delta = 0;
 
-    for_each_cpu_mask(i, prv->active_queues)
+    for_each_cpu(i, &prv->active_queues)
     {
         s_time_t delta;
         
@@ -1618,7 +1618,7 @@
         {
             int rq;
             other_rqi = -2;
-            for_each_cpu_mask ( rq, CSCHED_PRIV(ops)->active_queues )
+            for_each_cpu ( rq, &CSCHED_PRIV(ops)->active_queues )
             {
                 if ( scurr->rqd == &CSCHED_PRIV(ops)->rqd[rq] )
                 {
@@ -1803,7 +1803,7 @@
            "\tdefault-weight     = %d\n",
            cpumask_weight(&prv->active_queues),
            CSCHED_DEFAULT_WEIGHT);
-    for_each_cpu_mask(i, prv->active_queues)
+    for_each_cpu(i, &prv->active_queues)
     {
         s_time_t fraction;
         
diff -r 52d242adc94e -r d89f1b65b512 xen/common/sched_sedf.c
--- a/xen/common/sched_sedf.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/sched_sedf.c	Tue Nov 08 10:36:10 2011 +0100
@@ -442,7 +442,7 @@
 
     online = SEDF_CPUONLINE(v->domain->cpupool);
     cpumask_and(&online_affinity, v->cpu_affinity, online);
-    return first_cpu(online_affinity);
+    return cpumask_first(&online_affinity);
 }
 
 /*
@@ -1322,7 +1322,7 @@
 {
     struct vcpu *p;
     struct domain      *d;
-    unsigned int        cpu, nr_cpus = last_cpu(cpu_online_map) + 1;
+    unsigned int        cpu, nr_cpus = cpumask_last(&cpu_online_map) + 1;
     int                *sumw = xzalloc_array(int, nr_cpus);
     s_time_t           *sumt = xzalloc_array(s_time_t, nr_cpus);
 
diff -r 52d242adc94e -r d89f1b65b512 xen/common/schedule.c
--- a/xen/common/schedule.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/schedule.c	Tue Nov 08 10:36:10 2011 +0100
@@ -1450,7 +1450,7 @@
     printk("Scheduler: %s (%s)\n", sched->name, sched->opt_name);
     SCHED_OP(sched, dump_settings);
 
-    for_each_cpu_mask (i, *cpus)
+    for_each_cpu (i, cpus)
     {
         pcpu_schedule_lock(i);
         printk("CPU[%02d] ", i);
diff -r 52d242adc94e -r d89f1b65b512 xen/common/softirq.c
--- a/xen/common/softirq.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/softirq.c	Tue Nov 08 10:36:10 2011 +0100
@@ -74,7 +74,7 @@
     cpumask_t send_mask;
 
     cpumask_clear(&send_mask);
-    for_each_cpu_mask(cpu, *mask)
+    for_each_cpu(cpu, mask)
         if ( !test_and_set_bit(nr, &softirq_pending(cpu)) )
             cpumask_set_cpu(cpu, &send_mask);
 
diff -r 52d242adc94e -r d89f1b65b512 xen/common/stop_machine.c
--- a/xen/common/stop_machine.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/stop_machine.c	Tue Nov 08 10:36:10 2011 +0100
@@ -101,7 +101,7 @@
 
     smp_wmb();
 
-    for_each_cpu_mask ( i, allbutself )
+    for_each_cpu ( i, &allbutself )
         tasklet_schedule_on_cpu(&per_cpu(stopmachine_tasklet, i), i);
 
     stopmachine_set_state(STOPMACHINE_PREPARE);
diff -r 52d242adc94e -r d89f1b65b512 xen/common/timer.c
--- a/xen/common/timer.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/common/timer.c	Tue Nov 08 10:36:10 2011 +0100
@@ -548,7 +548,7 @@
 
 static void migrate_timers_from_cpu(unsigned int old_cpu)
 {
-    unsigned int new_cpu = first_cpu(cpu_online_map);
+    unsigned int new_cpu = cpumask_any(&cpu_online_map);
     struct timers *old_ts, *new_ts;
     struct timer *t;
     bool_t notify = 0;
diff -r 52d242adc94e -r d89f1b65b512 xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/drivers/acpi/pmstat.c	Tue Nov 08 10:36:10 2011 +0100
@@ -223,7 +223,7 @@
 
     if ( !(affected_cpus = xzalloc_array(uint32_t, op->u.get_para.cpu_num)) )
         return -ENOMEM;
-    for_each_cpu_mask(cpu, *policy->cpus)
+    for_each_cpu(cpu, policy->cpus)
         affected_cpus[j++] = cpu;
     ret = copy_to_guest(op->u.get_para.affected_cpus,
                        affected_cpus, op->u.get_para.cpu_num);
diff -r 52d242adc94e -r d89f1b65b512 xen/drivers/cpufreq/cpufreq_ondemand.c
--- a/xen/drivers/cpufreq/cpufreq_ondemand.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/drivers/cpufreq/cpufreq_ondemand.c	Tue Nov 08 10:36:10 2011 +0100
@@ -122,7 +122,7 @@
         return;
 
     /* Get Idle Time */
-    for_each_cpu_mask(j, *policy->cpus) {
+    for_each_cpu(j, policy->cpus) {
         uint64_t idle_ns, total_idle_ns;
         uint64_t load, load_freq, freq_avg;
         struct cpu_dbs_info_s *j_dbs_info;
@@ -233,7 +233,7 @@
 
         dbs_enable++;
 
-        for_each_cpu_mask(j, *policy->cpus) {
+        for_each_cpu(j, policy->cpus) {
             struct cpu_dbs_info_s *j_dbs_info;
             j_dbs_info = &per_cpu(cpu_dbs_info, j);
             j_dbs_info->cur_policy = policy;
diff -r 52d242adc94e -r d89f1b65b512 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 08 10:36:10 2011 +0100
@@ -1033,7 +1033,7 @@
     msg.address_lo = (MSI_ADDRESS_HEADER << (MSI_ADDRESS_HEADER_SHIFT + 8));
     msg.address_lo |= MSI_PHYSICAL_MODE << 2;
     msg.address_lo |= MSI_REDIRECTION_HINT_MODE << 3;
-    dest = cpu_physical_id(first_cpu(mask));
+    dest = cpu_physical_id(cpumask_first(mask));
     msg.address_lo |= dest << MSI_TARGET_CPU_SHIFT;
 #endif
 
diff -r 52d242adc94e -r d89f1b65b512 xen/include/asm-ia64/linux-xen/asm/acpi.h
--- a/xen/include/asm-ia64/linux-xen/asm/acpi.h	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/acpi.h	Tue Nov 08 10:36:10 2011 +0100
@@ -139,7 +139,7 @@
 #ifdef CONFIG_ACPI_NUMA
 extern cpumask_t early_cpu_possible_map;
 #define for_each_possible_early_cpu(cpu)  \
-	for_each_cpu_mask((cpu), early_cpu_possible_map)
+	for_each_cpu(cpu, &early_cpu_possible_map)
 
 static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
 {
diff -r 52d242adc94e -r d89f1b65b512 xen/include/asm-x86/flushtlb.h
--- a/xen/include/asm-x86/flushtlb.h	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/include/asm-x86/flushtlb.h	Tue Nov 08 10:36:10 2011 +0100
@@ -52,7 +52,7 @@
 #define tlbflush_filter(mask, page_timestamp)                           \
 do {                                                                    \
     unsigned int cpu;                                                   \
-    for_each_cpu_mask ( cpu, mask )                                     \
+    for_each_cpu ( cpu, &(mask) )                                       \
         if ( !NEED_FLUSH(per_cpu(tlbflush_time, cpu), page_timestamp) ) \
             cpumask_clear_cpu(cpu, &(mask));                            \
 } while ( 0 )
diff -r 52d242adc94e -r d89f1b65b512 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h	Tue Nov 08 10:35:12 2011 +0100
+++ b/xen/include/xen/cpumask.h	Tue Nov 08 10:36:10 2011 +0100
@@ -37,18 +37,19 @@
  * void cpumask_shift_right(dst, src, n) Shift right
  * void cpumask_shift_left(dst, src, n)	Shift left
  *
- * int first_cpu(mask)			Number lowest set bit, or NR_CPUS
- * int next_cpu(cpu, mask)		Next cpu past 'cpu', or NR_CPUS
- * int last_cpu(mask)			Number highest set bit, or NR_CPUS
- * int cycle_cpu(cpu, mask)		Next cpu cycling from 'cpu', or NR_CPUS
+ * int cpumask_first(mask)		Number lowest set bit, or NR_CPUS
+ * int cpumask_next(cpu, mask)		Next cpu past 'cpu', or NR_CPUS
+ * int cpumask_last(mask)		Number highest set bit, or NR_CPUS
+ * int cpumask_any(mask)		Any cpu in mask, or NR_CPUS
+ * int cpumask_cycle(cpu, mask)		Next cpu cycling from 'cpu', or NR_CPUS
  *
- * cpumask_t cpumask_of_cpu(cpu)	Return cpumask with bit 'cpu' set
+ * const cpumask_t *cpumask_of(cpu)	Return cpumask with bit 'cpu' set
  * unsigned long *cpumask_bits(mask)	Array of unsigned long's in mask
  *
  * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
  * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
  *
- * for_each_cpu_mask(cpu, mask)		for-loop cpu over mask
+ * for_each_cpu(cpu, mask)		for-loop cpu over mask
  *
  * int num_online_cpus()		Number of online CPUs
  * int num_possible_cpus()		Number of all possible CPUs
@@ -210,42 +211,43 @@
 	bitmap_shift_left(dstp->bits, srcp->bits, n, nr_cpumask_bits);
 }
 
-#define cpumask_first(src) __first_cpu(src, nr_cpu_ids)
-#define first_cpu(src) __first_cpu(&(src), nr_cpu_ids)
-static inline int __first_cpu(const cpumask_t *srcp, int nbits)
+static inline int cpumask_first(const cpumask_t *srcp)
 {
-	return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
+	return min_t(int, nr_cpu_ids, find_first_bit(srcp->bits, nr_cpu_ids));
 }
 
-#define cpumask_next(n, src) __next_cpu(n, src, nr_cpu_ids)
-#define next_cpu(n, src) __next_cpu((n), &(src), nr_cpu_ids)
-static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
+static inline int cpumask_next(int n, const cpumask_t *srcp)
 {
-	return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
+	/* -1 is a legal arg here. */
+	if (n != -1)
+		cpumask_check(n);
+
+	return min_t(int, nr_cpu_ids,
+                     find_next_bit(srcp->bits, nr_cpu_ids, n + 1));
 }
 
-#define cpumask_last(src) __last_cpu(src, nr_cpu_ids)
-#define last_cpu(src) __last_cpu(&(src), nr_cpu_ids)
-static inline int __last_cpu(const cpumask_t *srcp, int nbits)
+static inline int cpumask_last(const cpumask_t *srcp)
 {
-	int cpu, pcpu = nbits;
-	for (cpu = __first_cpu(srcp, nbits);
-	     cpu < nbits;
-	     cpu = __next_cpu(cpu, srcp, nbits))
+	int cpu, pcpu = nr_cpu_ids;
+
+	for (cpu = cpumask_first(srcp);
+	     cpu < nr_cpu_ids;
+	     cpu = cpumask_next(cpu, srcp))
 		pcpu = cpu;
 	return pcpu;
 }
 
-#define cpumask_cycle(n, src) __cycle_cpu(n, src, nr_cpu_ids)
-#define cycle_cpu(n, src) __cycle_cpu((n), &(src), nr_cpu_ids)
-static inline int __cycle_cpu(int n, const cpumask_t *srcp, int nbits)
+static inline int cpumask_cycle(int n, const cpumask_t *srcp)
 {
-    int nxt = __next_cpu(n, srcp, nbits);
-    if (nxt == nbits)
-        nxt = __first_cpu(srcp, nbits);
+    int nxt = cpumask_next(n, srcp);
+
+    if (nxt == nr_cpu_ids)
+        nxt = cpumask_first(srcp);
     return nxt;
 }
 
+#define cpumask_any(srcp) cpumask_first(srcp)
+
 /*
  * Special-case data structure for "single bit set only" constant CPU masks.
  *
@@ -262,8 +264,6 @@
 	return (const cpumask_t *)(p - cpu / BITS_PER_LONG);
 }
 
-#define cpumask_of_cpu(cpu) (*cpumask_of(cpu))
-
 #if defined(__ia64__) /* XXX needs cleanup */
 #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
 
@@ -366,12 +366,13 @@
 #endif
 
 #if NR_CPUS > 1
-#define for_each_cpu_mask(cpu, mask)		\
-	for ((cpu) = first_cpu(mask);		\
-		(cpu) < nr_cpu_ids;		\
-		(cpu) = next_cpu((cpu), (mask)))
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = cpumask_first(mask);	\
+	     (cpu) < nr_cpu_ids;		\
+	     (cpu) = cpumask_next(cpu, mask))
 #else /* NR_CPUS == 1 */
-#define for_each_cpu_mask(cpu, mask) for ((cpu) = 0; (cpu) < 1; (cpu)++)
+#define for_each_cpu(cpu, mask)			\
+	for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)(mask))
 #endif /* NR_CPUS */
 
 /*
@@ -450,18 +451,9 @@
 #define cpu_present(cpu)	((cpu) == 0)
 #endif
 
-#define any_online_cpu(mask)			\
-({						\
-	int cpu;				\
-	for_each_cpu_mask(cpu, (mask))		\
-		if (cpu_online(cpu))		\
-			break;			\
-	cpu;					\
-})
-
-#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
-#define for_each_online_cpu(cpu)   for_each_cpu_mask((cpu), cpu_online_map)
-#define for_each_present_cpu(cpu)  for_each_cpu_mask((cpu), cpu_present_map)
+#define for_each_possible_cpu(cpu) for_each_cpu(cpu, &cpu_possible_map)
+#define for_each_online_cpu(cpu)   for_each_cpu(cpu, &cpu_online_map)
+#define for_each_present_cpu(cpu)  for_each_cpu(cpu, &cpu_present_map)
 
 /* Copy to/from cpumap provided by control tools. */
 struct xenctl_cpumap;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:37:50 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:37:50 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROis7-0005mq-Nn; Thu, 10 Nov 2011 20:37:48 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio1-0004B1-DF
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:34 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-7.tower-174.messagelabs.com!1320986010!1115126!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 1869 invoked from network); 11 Nov 2011 04:33:30 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-7.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:30 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinx-0001Jq-MG
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:29 +0000
Message-Id: <E1ROinx-0001Jq-MG@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ats: Move some ats functions to a
	new directory.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1320747851 -3600
# Node ID d9d336238e772a1c32935dd02e3017d403606095
# Parent  d423189e16f5c13a8b17ba199e390d8ad32d2a02
ats: Move some ats functions to a new directory.

Remove VTD prefix from debug output.
passhrough/x86 holds vendor neutral codes for x86 architecture.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/Makefile
--- a/xen/drivers/passthrough/Makefile	Tue Nov 08 10:37:08 2011 +0100
+++ b/xen/drivers/passthrough/Makefile	Tue Nov 08 11:24:11 2011 +0100
@@ -1,6 +1,7 @@
 subdir-$(x86) += vtd
 subdir-$(ia64) += vtd
 subdir-$(x86) += amd
+subdir-$(x86_64) += x86
 
 obj-y += iommu.o
 obj-y += io.o
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/ats.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/drivers/passthrough/ats.h	Tue Nov 08 11:24:11 2011 +0100
@@ -0,0 +1,56 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#ifndef _ATS_H_
+#define _ATS_H_
+
+struct pci_ats_dev {
+    struct list_head list;
+    u16 seg;
+    u8 bus;
+    u8 devfn;
+    u16 ats_queue_depth;    /* ATS device invalidation queue depth */
+};
+
+#ifdef CONFIG_X86_64
+
+#define ATS_REG_CAP    4
+#define ATS_REG_CTL    6
+#define ATS_QUEUE_DEPTH_MASK     0xF
+#define ATS_ENABLE               (1<<15)
+
+extern struct list_head ats_devices;
+extern bool_t ats_enabled;
+
+int enable_ats_device(int seg, int bus, int devfn);
+void disable_ats_device(int seg, int bus, int devfn);
+
+#else
+
+#define ats_enabled 0
+static inline int enable_ats_device(int seg, int bus, int devfn)
+{
+    BUG();
+    return -ENOSYS;
+}
+
+static inline void disable_ats_device(int seg, int bus, int devfn)
+{
+    BUG();
+}
+#endif
+
+#endif /* _ATS_H_ */
+
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/vtd/extern.h
--- a/xen/drivers/passthrough/vtd/extern.h	Tue Nov 08 10:37:08 2011 +0100
+++ b/xen/drivers/passthrough/vtd/extern.h	Tue Nov 08 11:24:11 2011 +0100
@@ -57,18 +57,13 @@
 struct acpi_rhsa_unit * drhd_to_rhsa(struct acpi_drhd_unit *drhd);
 
 #ifdef CONFIG_X86_64
-extern bool_t ats_enabled;
-
 struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu);
 
 int ats_device(const struct pci_dev *, const struct acpi_drhd_unit *);
-int enable_ats_device(int seg, int bus, int devfn);
-void disable_ats_device(int seg, int bus, int devfn);
 
 int dev_invalidate_iotlb(struct iommu *iommu, u16 did,
                          u64 addr, unsigned int size_order, u64 type);
 #else
-#define ats_enabled 0
 
 static inline struct acpi_drhd_unit *find_ats_dev_drhd(struct iommu *iommu)
 {
@@ -80,15 +75,6 @@
 {
     return 0;
 }
-static inline int enable_ats_device(int seg, int bus, int devfn)
-{
-    BUG();
-    return -ENOSYS;
-}
-static inline void disable_ats_device(int seg, int bus, int devfn)
-{
-    BUG();
-}
 
 static inline int dev_invalidate_iotlb(struct iommu *iommu, u16 did, u64 addr,
                                        unsigned int size_order, u64 type)
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 08 10:37:08 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 08 11:24:11 2011 +0100
@@ -40,6 +40,7 @@
 #include "dmar.h"
 #include "extern.h"
 #include "vtd.h"
+#include "../ats.h"
 
 #ifdef __ia64__
 #define nr_ioapics              iosapic_get_nr_iosapics()
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/vtd/x86/ats.c
--- a/xen/drivers/passthrough/vtd/x86/ats.c	Tue Nov 08 10:37:08 2011 +0100
+++ b/xen/drivers/passthrough/vtd/x86/ats.c	Tue Nov 08 11:24:11 2011 +0100
@@ -27,51 +27,10 @@
 #include "../dmar.h"
 #include "../vtd.h"
 #include "../extern.h"
+#include "../../ats.h"
 
 static LIST_HEAD(ats_dev_drhd_units);
 
-#define ATS_REG_CAP    4
-#define ATS_REG_CTL    6
-#define ATS_QUEUE_DEPTH_MASK     0xF
-#define ATS_ENABLE               (1<<15)
-
-struct pci_ats_dev {
-    struct list_head list;
-    u16 seg;
-    u8 bus;
-    u8 devfn;
-    u16 ats_queue_depth;    /* ATS device invalidation queue depth */
-};
-static LIST_HEAD(ats_devices);
-
-static void parse_ats_param(char *s);
-custom_param("ats", parse_ats_param);
-
-bool_t __read_mostly ats_enabled = 1;
-
-static void __init parse_ats_param(char *s)
-{
-    char *ss;
-
-    do {
-        ss = strchr(s, ',');
-        if ( ss )
-            *ss = '\0';
-
-        switch ( parse_bool(s) )
-        {
-        case 0:
-            ats_enabled = 0;
-            break;
-        case 1:
-            ats_enabled = 1;
-            break;
-        }
-
-        s = ss + 1;
-    } while ( ss );
-}
-
 struct acpi_drhd_unit * find_ats_dev_drhd(struct iommu *iommu)
 {
     struct acpi_drhd_unit *drhd;
@@ -113,97 +72,6 @@
     return pos;
 }
 
-int enable_ats_device(int seg, int bus, int devfn)
-{
-    struct pci_ats_dev *pdev = NULL;
-    u32 value;
-    int pos;
-
-    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
-    BUG_ON(!pos);
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX,
-                "%04x:%02x:%02x.%u: ATS capability found\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-
-    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
-                            PCI_FUNC(devfn), pos + ATS_REG_CTL);
-    if ( value & ATS_ENABLE )
-    {
-        list_for_each_entry ( pdev, &ats_devices, list )
-        {
-            if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
-            {
-                pos = 0;
-                break;
-            }
-        }
-    }
-    if ( pos )
-        pdev = xmalloc(struct pci_ats_dev);
-    if ( !pdev )
-        return -ENOMEM;
-
-    if ( !(value & ATS_ENABLE) )
-    {
-        value |= ATS_ENABLE;
-        pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                         pos + ATS_REG_CTL, value);
-    }
-
-    if ( pos )
-    {
-        pdev->seg = seg;
-        pdev->bus = bus;
-        pdev->devfn = devfn;
-        value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
-                                PCI_FUNC(devfn), pos + ATS_REG_CAP);
-        pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK;
-        list_add(&pdev->list, &ats_devices);
-    }
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX,
-                "%04x:%02x:%02x.%u: ATS %s enabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                pos ? "is" : "was");
-
-    return pos;
-}
-
-void disable_ats_device(int seg, int bus, int devfn)
-{
-    struct pci_ats_dev *pdev;
-    u32 value;
-    int pos;
-
-    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
-    BUG_ON(!pos);
-
-    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
-                            PCI_FUNC(devfn), pos + ATS_REG_CTL);
-    value &= ~ATS_ENABLE;
-    pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
-                     pos + ATS_REG_CTL, value);
-
-    list_for_each_entry ( pdev, &ats_devices, list )
-    {
-        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
-        {
-            list_del(&pdev->list);
-            xfree(pdev);
-            break;
-        }
-    }
-
-    if ( iommu_verbose )
-        dprintk(XENLOG_INFO VTDPREFIX,
-                "%04x:%02x:%02x.%u: ATS is disabled\n",
-                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
-}
-
-
 static int device_in_domain(struct iommu *iommu, struct pci_ats_dev *pdev, u16 did)
 {
     struct root_entry *root_entry = NULL;
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/x86/Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/drivers/passthrough/x86/Makefile	Tue Nov 08 11:24:11 2011 +0100
@@ -0,0 +1,1 @@
+obj-$(CONFIG_X86_64) += ats.o
diff -r d423189e16f5 -r d9d336238e77 xen/drivers/passthrough/x86/ats.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/xen/drivers/passthrough/x86/ats.c	Tue Nov 08 11:24:11 2011 +0100
@@ -0,0 +1,136 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place - Suite 330, Boston, MA 02111-1307 USA.
+ */
+
+#include <xen/sched.h>
+#include <xen/pci.h>
+#include <xen/pci_regs.h>
+#include "../ats.h"
+
+LIST_HEAD(ats_devices);
+
+static void parse_ats_param(char *s);
+custom_param("ats", parse_ats_param);
+
+bool_t __read_mostly ats_enabled = 1;
+
+static void __init parse_ats_param(char *s)
+{
+    char *ss;
+
+    do {
+        ss = strchr(s, ',');
+        if ( ss )
+            *ss = '\0';
+
+        switch ( parse_bool(s) )
+        {
+        case 0:
+            ats_enabled = 0;
+            break;
+        case 1:
+            ats_enabled = 1;
+            break;
+        }
+
+        s = ss + 1;
+    } while ( ss );
+}
+
+int enable_ats_device(int seg, int bus, int devfn)
+{
+    struct pci_ats_dev *pdev = NULL;
+    u32 value;
+    int pos;
+
+    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    BUG_ON(!pos);
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS capability found\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+
+    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
+                            PCI_FUNC(devfn), pos + ATS_REG_CTL);
+    if ( value & ATS_ENABLE )
+    {
+        list_for_each_entry ( pdev, &ats_devices, list )
+        {
+            if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
+            {
+                pos = 0;
+                break;
+            }
+        }
+    }
+    if ( pos )
+        pdev = xmalloc(struct pci_ats_dev);
+    if ( !pdev )
+        return -ENOMEM;
+
+    if ( !(value & ATS_ENABLE) )
+    {
+        value |= ATS_ENABLE;
+        pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                         pos + ATS_REG_CTL, value);
+    }
+
+    if ( pos )
+    {
+        pdev->seg = seg;
+        pdev->bus = bus;
+        pdev->devfn = devfn;
+        value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
+                                PCI_FUNC(devfn), pos + ATS_REG_CAP);
+        pdev->ats_queue_depth = value & ATS_QUEUE_DEPTH_MASK;
+        list_add(&pdev->list, &ats_devices);
+    }
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS %s enabled\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                pos ? "is" : "was");
+
+    return pos;
+}
+
+void disable_ats_device(int seg, int bus, int devfn)
+{
+    struct pci_ats_dev *pdev;
+    u32 value;
+    int pos;
+
+    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    BUG_ON(!pos);
+
+    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn),
+                            PCI_FUNC(devfn), pos + ATS_REG_CTL);
+    value &= ~ATS_ENABLE;
+    pci_conf_write16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                     pos + ATS_REG_CTL, value);
+
+    list_for_each_entry ( pdev, &ats_devices, list )
+    {
+        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
+        {
+            list_del(&pdev->list);
+            xfree(pdev);
+            break;
+        }
+    }
+
+    if ( iommu_verbose )
+        dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS is disabled\n",
+                seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
+}

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:37:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:37:58 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROisH-0005q3-SN; Thu, 10 Nov 2011 20:37:57 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio2-0004BH-2N
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:34 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1320986010!1116173!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10229 invoked from network); 11 Nov 2011 04:33:31 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:31 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROiny-0001KQ-AM
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:30 +0000
Message-Id: <E1ROiny-0001KQ-AM@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Fix iommu page size
	encoding when page order > 0.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1320747919 -3600
# Node ID 4de6a56b7b5d0da75e380ecf55d8fbb2541f946b
# Parent  d9d336238e772a1c32935dd02e3017d403606095
amd iommu: Fix iommu page size encoding when page order > 0.

Fix io address in invalid all pages command.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r d9d336238e77 -r 4de6a56b7b5d xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:24:11 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:25:19 2011 +0100
@@ -77,23 +77,24 @@
 {
     u64 addr_lo, addr_hi;
     u32 cmd[4], entry;
-    u64 mask = 0;
     int sflag = 0, pde = 0;
 
+    ASSERT ( order == 0 || order == 9 || order == 18 );
+
+    /* All pages associated with the domainID are invalidated */
+    if ( order || (io_addr == INV_IOMMU_ALL_PAGES_ADDRESS ) )
+    {
+        sflag = 1;
+        pde = 1;
+    }
+
     /* If sflag == 1, the size of the invalidate command is determined
      by the first zero bit in the address starting from Address[12] */
-    if ( order == 9 || order == 18 )
+    if ( order )
     {
-        mask = ((1ULL << (order - 1)) - 1) << PAGE_SHIFT;
-        io_addr |= mask;
-        sflag = 1;
-    }
-
-    /* All pages associated with the domainID are invalidated */
-    else if ( io_addr == 0x7FFFFFFFFFFFF000ULL )
-    {
-        sflag = 1;
-        pde = 1;
+        u64 mask = 1ULL << (order - 1 + PAGE_SHIFT);
+        io_addr &= ~mask;
+        io_addr |= mask - 1;
     }
 
     addr_lo = io_addr & DMA_32BIT_MASK;
@@ -917,7 +918,7 @@
 
 void amd_iommu_flush_all_pages(struct domain *d)
 {
-    _amd_iommu_flush_pages(d, 0x7FFFFFFFFFFFFULL, 0);
+    _amd_iommu_flush_pages(d, INV_IOMMU_ALL_PAGES_ADDRESS, 0);
 }
 
 void amd_iommu_flush_pages(struct domain *d,
diff -r d9d336238e77 -r 4de6a56b7b5d xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Tue Nov 08 11:24:11 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Tue Nov 08 11:25:19 2011 +0100
@@ -407,4 +407,6 @@
 #define INT_REMAP_ENTRY_VECTOR_MASK     0x00FF0000
 #define INT_REMAP_ENTRY_VECTOR_SHIFT    16
 
+#define INV_IOMMU_ALL_PAGES_ADDRESS      ((1ULL << 63) - 1)
+
 #endif /* _ASM_X86_64_AMD_IOMMU_DEFS_H */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:12 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:12 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROisV-0005uZ-UN; Thu, 10 Nov 2011 20:38:11 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio2-0004BI-J3
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:34 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-174.messagelabs.com!1320986011!1105331!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22405 invoked from network); 11 Nov 2011 04:33:31 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:31 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROiny-0001Kz-SO
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:30 +0000
Message-Id: <E1ROiny-0001Kz-SO@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ats: Add new ATS helper functions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1320747951 -3600
# Node ID ca03648989b4bd52a631f38a993590e504b90dc3
# Parent  4de6a56b7b5d0da75e380ecf55d8fbb2541f946b
ats: Add new ATS helper functions

Signed-off-by Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 4de6a56b7b5d -r ca03648989b4 xen/drivers/passthrough/ats.h
--- a/xen/drivers/passthrough/ats.h	Tue Nov 08 11:25:19 2011 +0100
+++ b/xen/drivers/passthrough/ats.h	Tue Nov 08 11:25:51 2011 +0100
@@ -16,6 +16,8 @@
 #ifndef _ATS_H_
 #define _ATS_H_
 
+#include <xen/pci_regs.h>
+
 struct pci_ats_dev {
     struct list_head list;
     u16 seg;
@@ -36,6 +38,28 @@
 
 int enable_ats_device(int seg, int bus, int devfn);
 void disable_ats_device(int seg, int bus, int devfn);
+struct pci_ats_dev *get_ats_device(int seg, int bus, int devfn);
+
+static inline int pci_ats_enabled(int seg, int bus, int devfn)
+{
+    u32 value;
+    int pos;
+
+    pos = pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+    BUG_ON(!pos);
+
+    value = pci_conf_read16(seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn),
+                            pos + ATS_REG_CTL);
+    return value & ATS_ENABLE;
+}
+
+static inline int pci_ats_device(int seg, int bus, int devfn)
+{
+    if ( !ats_enabled )
+        return 0;
+
+    return pci_find_ext_capability(seg, bus, devfn, PCI_EXT_CAP_ID_ATS);
+}
 
 #else
 
@@ -50,6 +74,22 @@
 {
     BUG();
 }
+
+static inline int pci_ats_enabled(int seg, int bus, int devfn)
+{
+    return 0;
+}
+
+static inline int pci_ats_device(int seg, int bus, int devfn)
+{
+    return 0;
+}
+
+static inline struct pci_ats_dev *get_ats_device(int seg, int bus, int devfn)
+{
+    return NULL;
+}
+
 #endif
 
 #endif /* _ATS_H_ */
diff -r 4de6a56b7b5d -r ca03648989b4 xen/drivers/passthrough/x86/ats.c
--- a/xen/drivers/passthrough/x86/ats.c	Tue Nov 08 11:25:19 2011 +0100
+++ b/xen/drivers/passthrough/x86/ats.c	Tue Nov 08 11:25:51 2011 +0100
@@ -134,3 +134,19 @@
         dprintk(XENLOG_INFO, "%04x:%02x:%02x.%u: ATS is disabled\n",
                 seg, bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
 }
+
+struct pci_ats_dev *get_ats_device(int seg, int bus, int devfn)
+{
+    struct pci_ats_dev *pdev;
+
+    if ( !pci_ats_device(seg, bus, devfn) )
+        return NULL;
+
+    list_for_each_entry ( pdev, &ats_devices, list )
+    {
+        if ( pdev->seg == seg && pdev->bus == bus && pdev->devfn == devfn )
+            return pdev;
+    }
+
+    return NULL;
+}

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:24 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROisg-0005xc-Ko; Thu, 10 Nov 2011 20:38:23 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio2-0004BJ-I5
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:35 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-27.messagelabs.com!1320985985!48023804!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 30074 invoked from network); 11 Nov 2011 04:33:05 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:05 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROinz-0001LW-Ed
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:31 +0000
Message-Id: <E1ROinz-0001LW-Ed@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:30 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: add iotlb invalidation
	command
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1320747973 -3600
# Node ID 00ab8c0299e2a02618f8e83225db7d61c165f039
# Parent  ca03648989b4bd52a631f38a993590e504b90dc3
amd iommu: add iotlb invalidation command

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r ca03648989b4 -r 00ab8c0299e2 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:25:51 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:26:13 2011 +0100
@@ -23,6 +23,8 @@
 #include <xen/hvm/iommu.h>
 #include <asm/amd-iommu.h>
 #include <asm/hvm/svm/amd-iommu-proto.h>
+#include "../ats.h"
+#include <xen/pci.h>
 
 static int queue_iommu_command(struct amd_iommu *iommu, u32 cmd[])
 {
@@ -128,6 +130,75 @@
     send_iommu_command(iommu, cmd);
 }
 
+static void invalidate_iotlb_pages(struct amd_iommu *iommu,
+                                   u16 maxpend, u32 pasid, u16 queueid,
+                                   u64 io_addr, u16 dev_id, u16 order)
+{
+    u64 addr_lo, addr_hi;
+    u32 cmd[4], entry;
+    int sflag = 0;
+
+    ASSERT ( order == 0 || order == 9 || order == 18 );
+
+    if ( order || (io_addr == INV_IOMMU_ALL_PAGES_ADDRESS ) )
+        sflag = 1;
+
+    /* If sflag == 1, the size of the invalidate command is determined
+     by the first zero bit in the address starting from Address[12] */
+    if ( order )
+    {
+        u64 mask = 1ULL << (order - 1 + PAGE_SHIFT);
+        io_addr &= ~mask;
+        io_addr |= mask - 1;
+    }
+
+    addr_lo = io_addr & DMA_32BIT_MASK;
+    addr_hi = io_addr >> 32;
+
+    set_field_in_reg_u32(dev_id, 0,
+                         IOMMU_INV_IOTLB_PAGES_DEVICE_ID_MASK,
+                         IOMMU_INV_IOTLB_PAGES_DEVICE_ID_SHIFT, &entry);
+
+    set_field_in_reg_u32(maxpend, entry,
+                         IOMMU_INV_IOTLB_PAGES_MAXPEND_MASK,
+                         IOMMU_INV_IOTLB_PAGES_MAXPEND_SHIFT, &entry);
+
+    set_field_in_reg_u32(pasid & 0xff, entry,
+                         IOMMU_INV_IOTLB_PAGES_PASID1_MASK,
+                         IOMMU_INV_IOTLB_PAGES_PASID1_SHIFT, &entry);
+    cmd[0] = entry;
+
+    set_field_in_reg_u32(IOMMU_CMD_INVALIDATE_IOTLB_PAGES, 0,
+                         IOMMU_CMD_OPCODE_MASK, IOMMU_CMD_OPCODE_SHIFT,
+                         &entry);
+
+    set_field_in_reg_u32(pasid >> 8, entry,
+                         IOMMU_INV_IOTLB_PAGES_PASID2_MASK,
+                         IOMMU_INV_IOTLB_PAGES_PASID2_SHIFT,
+                         &entry);
+
+    set_field_in_reg_u32(queueid, entry,
+                         IOMMU_INV_IOTLB_PAGES_QUEUEID_MASK,
+                         IOMMU_INV_IOTLB_PAGES_QUEUEID_SHIFT,
+                         &entry);
+    cmd[1] = entry;
+
+    set_field_in_reg_u32(sflag, 0,
+                         IOMMU_INV_IOTLB_PAGES_S_FLAG_MASK,
+                         IOMMU_INV_IOTLB_PAGES_S_FLAG_MASK, &entry);
+
+    set_field_in_reg_u32((u32)addr_lo >> PAGE_SHIFT, entry,
+                         IOMMU_INV_IOTLB_PAGES_ADDR_LOW_MASK,
+                         IOMMU_INV_IOTLB_PAGES_ADDR_LOW_SHIFT, &entry);
+    cmd[2] = entry;
+
+    set_field_in_reg_u32((u32)addr_hi, 0,
+                         IOMMU_INV_IOTLB_PAGES_ADDR_HIGH_MASK,
+                         IOMMU_INV_IOTLB_PAGES_ADDR_HIGH_SHIFT, &entry);
+    cmd[3] = entry;
+
+    send_iommu_command(iommu, cmd);
+}
 void flush_command_buffer(struct amd_iommu *iommu)
 {
     u32 cmd[4], status;
@@ -896,6 +967,60 @@
     return 0;
 }
 
+void amd_iommu_flush_iotlb(struct pci_dev *pdev,
+                           uint64_t gaddr, unsigned int order)
+{
+    unsigned long flags;
+    struct amd_iommu *iommu;
+    unsigned int bdf, req_id, queueid, maxpend;
+    struct pci_ats_dev *ats_pdev;
+
+    if ( !ats_enabled )
+        return;
+
+    ats_pdev = get_ats_device(pdev->seg, pdev->bus, pdev->devfn);
+    if ( ats_pdev == NULL )
+        return;
+
+    if ( !pci_ats_enabled(ats_pdev->seg, ats_pdev->bus, ats_pdev->devfn) )
+        return;
+
+    bdf = PCI_BDF2(ats_pdev->bus, ats_pdev->devfn);
+    iommu = find_iommu_for_device(ats_pdev->seg, bdf);
+
+    if ( !iommu )
+    {
+        AMD_IOMMU_DEBUG("%s: Can't find iommu for %04x:%02x:%02x.%u\n",
+                        __func__, ats_pdev->seg, ats_pdev->bus,
+                        PCI_SLOT(ats_pdev->devfn), PCI_FUNC(ats_pdev->devfn));
+        return;
+    }
+
+    if ( !iommu->iotlb_support )
+        return;
+
+    req_id = get_dma_requestor_id(iommu->seg, bdf);
+    queueid = req_id;
+    maxpend = (ats_pdev->ats_queue_depth + 32) & 0xff;
+
+    /* send INVALIDATE_IOTLB_PAGES command */
+    spin_lock_irqsave(&iommu->lock, flags);
+    invalidate_iotlb_pages(iommu, maxpend, 0, queueid, gaddr, req_id, order);
+    flush_command_buffer(iommu);
+    spin_unlock_irqrestore(&iommu->lock, flags);
+}
+
+static void amd_iommu_flush_all_iotlbs(struct domain *d, uint64_t gaddr,
+                                       unsigned int order)
+{
+    struct pci_dev *pdev;
+
+    if ( !ats_enabled )
+        return;
+
+    for_each_pdev( d, pdev )
+        amd_iommu_flush_iotlb(pdev, gaddr, order);
+}
 
 /* Flush iommu cache after p2m changes. */
 static void _amd_iommu_flush_pages(struct domain *d,
@@ -914,6 +1039,9 @@
         flush_command_buffer(iommu);
         spin_unlock_irqrestore(&iommu->lock, flags);
     }
+
+    if ( ats_enabled )
+        amd_iommu_flush_all_iotlbs(d, gaddr, order);
 }
 
 void amd_iommu_flush_all_pages(struct domain *d)
diff -r ca03648989b4 -r 00ab8c0299e2 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Tue Nov 08 11:25:51 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Tue Nov 08 11:26:13 2011 +0100
@@ -233,6 +233,24 @@
 #define IOMMU_INV_INT_TABLE_DEVICE_ID_MASK   0x0000FFFF
 #define IOMMU_INV_INT_TABLE_DEVICE_ID_SHIFT  0
 
+/* INVALIDATE_IOTLB_PAGES command */
+#define IOMMU_INV_IOTLB_PAGES_MAXPEND_MASK          0xff000000
+#define IOMMU_INV_IOTLB_PAGES_MAXPEND_SHIFT         24
+#define IOMMU_INV_IOTLB_PAGES_PASID1_MASK           0x00ff0000
+#define IOMMU_INV_IOTLB_PAGES_PASID1_SHIFT          16
+#define IOMMU_INV_IOTLB_PAGES_PASID2_MASK           0x0fff0000
+#define IOMMU_INV_IOTLB_PAGES_PASID2_SHIFT          16
+#define IOMMU_INV_IOTLB_PAGES_QUEUEID_MASK          0x0000ffff
+#define IOMMU_INV_IOTLB_PAGES_QUEUEID_SHIFT         0
+#define IOMMU_INV_IOTLB_PAGES_DEVICE_ID_MASK        0x0000FFFF
+#define IOMMU_INV_IOTLB_PAGES_DEVICE_ID_SHIFT       0
+#define IOMMU_INV_IOTLB_PAGES_ADDR_LOW_MASK         0xFFFFF000
+#define IOMMU_INV_IOTLB_PAGES_ADDR_LOW_SHIFT        12
+#define IOMMU_INV_IOTLB_PAGES_ADDR_HIGH_MASK        0xFFFFFFFF
+#define IOMMU_INV_IOTLB_PAGES_ADDR_HIGH_SHIFT       0
+#define IOMMU_INV_IOTLB_PAGES_S_FLAG_MASK           0x00000001
+#define IOMMU_INV_IOTLB_PAGES_S_FLAG_SHIFT          0
+
 /* Event Log */
 #define IOMMU_EVENT_LOG_BASE_LOW_OFFSET		0x10
 #define IOMMU_EVENT_LOG_BASE_HIGH_OFFSET	0x14
diff -r ca03648989b4 -r 00ab8c0299e2 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Tue Nov 08 11:25:51 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Tue Nov 08 11:26:13 2011 +0100
@@ -55,6 +55,8 @@
 void amd_iommu_flush_pages(struct domain *d, unsigned long gfn,
                            unsigned int order);
 void amd_iommu_flush_all_pages(struct domain *d);
+void amd_iommu_flush_iotlb(struct pci_dev *pdev, uint64_t gaddr,
+                           unsigned int order);
 
 u64 amd_iommu_get_next_table_from_pte(u32 *entry);
 int amd_iommu_reserve_domain_unity_map(struct domain *domain,

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROisq-00060j-5z; Thu, 10 Nov 2011 20:38:32 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio3-0004BW-Fc
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:36 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1320985999!54573789!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22370 invoked from network); 11 Nov 2011 04:33:19 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:19 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio0-0001M0-Cz
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:32 +0000
Message-Id: <E1ROio0-0001M0-Cz@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:31 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: enable ats devices
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1320748013 -3600
# Node ID 452d9143687f826a30d0e56b7ba3b9783fb6bf24
# Parent  00ab8c0299e2a02618f8e83225db7d61c165f039
amd iommu: enable ats devices

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 00ab8c0299e2 -r 452d9143687f xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:26:13 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Tue Nov 08 11:26:53 2011 +0100
@@ -370,6 +370,17 @@
     dte[0] = entry;
 }
 
+void iommu_dte_set_iotlb(u32 *dte, u8 i)
+{
+    u32 entry;
+
+    entry = dte[3];
+    set_field_in_reg_u32(!!i, entry,
+                         IOMMU_DEV_TABLE_IOTLB_SUPPORT_MASK,
+                         IOMMU_DEV_TABLE_IOTLB_SUPPORT_SHIFT, &entry);
+    dte[3] = entry;
+}
+
 void __init amd_iommu_set_intremap_table(
     u32 *dte, u64 intremap_ptr, u8 int_valid)
 {
diff -r 00ab8c0299e2 -r 452d9143687f xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Tue Nov 08 11:26:13 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Tue Nov 08 11:26:53 2011 +0100
@@ -25,6 +25,7 @@
 #include <asm/hvm/iommu.h>
 #include <asm/amd-iommu.h>
 #include <asm/hvm/svm/amd-iommu-proto.h>
+#include "../ats.h"
 
 struct amd_iommu *find_iommu_for_device(int seg, int bdf)
 {
@@ -86,6 +87,9 @@
     void *dte;
     unsigned long flags;
     int req_id, valid = 1;
+    int dte_i = 0;
+    u8 bus = PCI_BUS(bdf);
+    u8 devfn = PCI_DEVFN2(bdf);
 
     struct hvm_iommu *hd = domain_hvm_iommu(domain);
 
@@ -94,6 +98,9 @@
     if ( iommu_passthrough && (domain->domain_id == 0) )
         valid = 0;
 
+    if ( ats_enabled )
+        dte_i = 1;
+
     /* get device-table entry */
     req_id = get_dma_requestor_id(iommu->seg, bdf);
     dte = iommu->dev_table.buffer + (req_id * IOMMU_DEV_TABLE_ENTRY_SIZE);
@@ -107,6 +114,10 @@
             (u32 *)dte, page_to_maddr(hd->root_table), hd->domain_id,
             hd->paging_mode, valid);
 
+        if ( pci_ats_device(iommu->seg, bus, devfn) &&
+             iommu->iotlb_support )
+            iommu_dte_set_iotlb((u32 *)dte, dte_i);
+
         invalidate_dev_table_entry(iommu, req_id);
         flush_command_buffer(iommu);
 
@@ -118,11 +129,27 @@
     }
 
     spin_unlock_irqrestore(&iommu->lock, flags);
+
+    ASSERT(spin_is_locked(&pcidevs_lock));
+
+    if ( pci_ats_device(iommu->seg, bus, devfn) &&
+         !pci_ats_enabled(iommu->seg, bus, devfn) )
+    {
+        struct pci_dev *pdev;
+
+        enable_ats_device(iommu->seg, bus, devfn);
+
+        ASSERT(spin_is_locked(&pcidevs_lock));
+        pdev = pci_get_pdev(iommu->seg, bus, devfn);
+
+        ASSERT( pdev != NULL );
+        amd_iommu_flush_iotlb(pdev, INV_IOMMU_ALL_PAGES_ADDRESS, 0);
+    }
 }
 
 static void __init amd_iommu_setup_dom0_device(struct pci_dev *pdev)
 {
-    int bdf = (pdev->bus << 8) | pdev->devfn;
+    int bdf = PCI_BDF2(pdev->bus, pdev->devfn);
     struct amd_iommu *iommu = find_iommu_for_device(pdev->seg, bdf);
 
     if ( likely(iommu != NULL) )
@@ -261,12 +288,14 @@
     setup_dom0_pci_devices(d, amd_iommu_setup_dom0_device);
 }
 
-static void amd_iommu_disable_domain_device(
-    struct domain *domain, struct amd_iommu *iommu, int bdf)
+void amd_iommu_disable_domain_device(struct domain *domain,
+                                     struct amd_iommu *iommu, int bdf)
 {
     void *dte;
     unsigned long flags;
     int req_id;
+    u8 bus = PCI_BUS(bdf);
+    u8 devfn = PCI_DEVFN2(bdf);
 
     BUG_ON ( iommu->dev_table.buffer == NULL );
     req_id = get_dma_requestor_id(iommu->seg, bdf);
@@ -276,6 +305,11 @@
     if ( is_translation_valid((u32 *)dte) )
     {
         disable_translation((u32 *)dte);
+
+        if ( pci_ats_device(iommu->seg, bus, devfn) &&
+             iommu->iotlb_support )
+            iommu_dte_set_iotlb((u32 *)dte, 0);
+
         invalidate_dev_table_entry(iommu, req_id);
         flush_command_buffer(iommu);
         AMD_IOMMU_DEBUG("Disable: device id = 0x%04x, "
@@ -284,6 +318,12 @@
                         domain_hvm_iommu(domain)->paging_mode);
     }
     spin_unlock_irqrestore(&iommu->lock, flags);
+
+    ASSERT(spin_is_locked(&pcidevs_lock));
+
+    if ( pci_ats_device(iommu->seg, bus, devfn) &&
+         pci_ats_enabled(iommu->seg, bus, devfn) )
+        disable_ats_device(iommu->seg, bus, devfn);
 }
 
 static int reassign_device( struct domain *source, struct domain *target,
@@ -299,7 +339,7 @@
     if ( !pdev )
         return -ENODEV;
 
-    bdf = (bus << 8) | devfn;
+    bdf = PCI_BDF2(bus, devfn);
     iommu = find_iommu_for_device(seg, bdf);
     if ( !iommu )
     {
@@ -421,7 +461,7 @@
     if ( !pdev->domain )
         return -EINVAL;
 
-    bdf = (pdev->bus << 8) | pdev->devfn;
+    bdf = PCI_BDF2(pdev->bus, pdev->devfn);
     iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
@@ -443,7 +483,7 @@
     if ( !pdev->domain )
         return -EINVAL;
 
-    bdf = (pdev->bus << 8) | pdev->devfn;
+    bdf = PCI_BDF2(pdev->bus, pdev->devfn);
     iommu = find_iommu_for_device(pdev->seg, bdf);
     if ( !iommu )
     {
diff -r 00ab8c0299e2 -r 452d9143687f xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Tue Nov 08 11:26:13 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Tue Nov 08 11:26:53 2011 +0100
@@ -75,6 +75,7 @@
     u32 *dte, u64 intremap_ptr, u8 int_valid);
 void amd_iommu_set_root_page_table(
     u32 *dte, u64 root_ptr, u16 domain_id, u8 paging_mode, u8 valid);
+void iommu_dte_set_iotlb(u32 *dte, u8 i);
 void invalidate_dev_table_entry(struct amd_iommu *iommu, u16 devic_id);
 
 /* send cmd to iommu */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:41 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROisy-00064M-LQ; Thu, 10 Nov 2011 20:38:40 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio4-0004C2-RG
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:38 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-174.messagelabs.com!1320986013!1119669!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6633 invoked from network); 11 Nov 2011 04:33:33 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:33 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio1-0001Ms-3W
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:33 +0000
Message-Id: <E1ROio1-0001Ms-3W@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:32 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mm: Cleanup,
	use PAGE_ORDER_4K as page_order instead of "0".
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jean Guyader <jean.guyader@eu.citrix.com>
# Date 1320757301 0
# Node ID be8daf78856a605ec8f8df11ff13c325dc4bc70f
# Parent  452d9143687f826a30d0e56b7ba3b9783fb6bf24
mm: Cleanup, use PAGE_ORDER_4K as page_order instead of "0".

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
---


diff -r 452d9143687f -r be8daf78856a xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Tue Nov 08 11:26:53 2011 +0100
+++ b/xen/arch/x86/mm.c	Tue Nov 08 13:01:41 2011 +0000
@@ -4005,7 +4005,7 @@
     else
         p2mt = p2m_grant_map_rw;
     rc = guest_physmap_add_entry(current->domain,
-                                 addr >> PAGE_SHIFT, frame, 0, p2mt);
+                                 addr >> PAGE_SHIFT, frame, PAGE_ORDER_4K, p2mt);
     if ( rc )
         return GNTST_general_error;
     else
@@ -4062,7 +4062,7 @@
                  type, mfn_x(old_mfn), frame);
         return GNTST_general_error;
     }
-    guest_physmap_remove_page(d, gfn, frame, 0);
+    guest_physmap_remove_page(d, gfn, frame, PAGE_ORDER_4K);
 
     return GNTST_okay;
 }
@@ -4689,7 +4689,7 @@
         {
             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, 0);
+                guest_physmap_remove_page(d, xatp.gpfn, prev_mfn, PAGE_ORDER_4K);
             else
                 /* Normal domain memory is freed, to avoid leaking memory. */
                 guest_remove_page(d, xatp.gpfn);
@@ -4699,10 +4699,10 @@
         gpfn = get_gpfn_from_mfn(mfn);
         ASSERT( gpfn != SHARED_M2P_ENTRY );
         if ( gpfn != INVALID_M2P_ENTRY )
-            guest_physmap_remove_page(d, gpfn, mfn, 0);
+            guest_physmap_remove_page(d, gpfn, mfn, PAGE_ORDER_4K);
 
         /* Map at new location. */
-        rc = guest_physmap_add_page(d, xatp.gpfn, mfn, 0);
+        rc = guest_physmap_add_page(d, xatp.gpfn, mfn, PAGE_ORDER_4K);
 
         domain_unlock(d);
 
diff -r 452d9143687f -r be8daf78856a xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Nov 08 11:26:53 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Tue Nov 08 13:01:41 2011 +0000
@@ -254,7 +254,7 @@
 
     /* Initialise physmap tables for slot zero. Other code assumes this. */
     p2m->defer_nested_flush = 1;
-    if ( !set_p2m_entry(p2m, 0, _mfn(INVALID_MFN), 0,
+    if ( !set_p2m_entry(p2m, 0, _mfn(INVALID_MFN), PAGE_ORDER_4K,
                         p2m_invalid, p2m->default_access) )
         goto error;
 
@@ -276,7 +276,7 @@
                 (gfn != 0x55555555L)
 #endif
                 && gfn != INVALID_M2P_ENTRY
-                && !set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_rw, p2m->default_access) )
+                && !set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_rw, p2m->default_access) )
                 goto error_unlock;
         }
         spin_unlock(&p2m->domain->page_alloc_lock);
@@ -549,7 +549,7 @@
 
     mfn = gfn_to_mfn_query(d, gfn, &pt);
     if ( pt == ot )
-        set_p2m_entry(p2m, gfn, mfn, 0, nt, p2m->default_access);
+        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, nt, p2m->default_access);
 
     p2m_unlock(p2m);
 
@@ -576,7 +576,7 @@
     {
         mfn = gfn_to_mfn_query(d, gfn, &pt);
         if ( pt == ot )
-            set_p2m_entry(p2m, gfn, mfn, 0, nt, p2m->default_access);
+            set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, nt, p2m->default_access);
     }
 
     p2m->defer_nested_flush = 0;
@@ -613,7 +613,7 @@
     }
 
     P2M_DEBUG("set mmio %lx %lx\n", gfn, mfn_x(mfn));
-    rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_mmio_direct, p2m->default_access);
+    rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_mmio_direct, p2m->default_access);
     audit_p2m(p2m, 1);
     p2m_unlock(p2m);
     if ( 0 == rc )
@@ -644,7 +644,7 @@
             "clear_mmio_p2m_entry: gfn_to_mfn failed! gfn=%08lx\n", gfn);
         goto out;
     }
-    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
+    rc = set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), PAGE_ORDER_4K, p2m_invalid, p2m->default_access);
     audit_p2m(p2m, 1);
 
 out:
@@ -674,7 +674,7 @@
     set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
 
     P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
-    rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared, p2m->default_access);
+    rc = set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_shared, p2m->default_access);
     p2m_unlock(p2m);
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
@@ -739,7 +739,7 @@
         goto out;
 
     /* Fix p2m entry */
-    set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_out, a);
+    set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_out, a);
     audit_p2m(p2m, 1);
     ret = 0;
 
@@ -806,7 +806,7 @@
         put_page(page);
 
     /* Remove mapping from p2m table */
-    set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), 0, p2m_ram_paged, a);
+    set_p2m_entry(p2m, gfn, _mfn(INVALID_MFN), PAGE_ORDER_4K, p2m_ram_paged, a);
     audit_p2m(p2m, 1);
 
     /* Clear content before returning the page to Xen */
@@ -900,7 +900,7 @@
         if ( p2mt == p2m_ram_paging_out )
             req.flags |= MEM_EVENT_FLAG_EVICT_FAIL;
 
-        set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in_start, a);
+        set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in_start, a);
         audit_p2m(p2m, 1);
     }
     p2m_unlock(p2m);
@@ -968,7 +968,7 @@
     }
 
     /* Fix p2m mapping */
-    set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_paging_in, a);
+    set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, p2m_ram_paging_in, a);
     audit_p2m(p2m, 1);
 
     atomic_dec(&d->paged_pages);
@@ -1016,7 +1016,7 @@
         if ( mfn_valid(mfn) && 
              (p2mt == p2m_ram_paging_in || p2mt == p2m_ram_paging_in_start) )
         {
-            set_p2m_entry(p2m, rsp.gfn, mfn, 0, p2m_ram_rw, a);
+            set_p2m_entry(p2m, rsp.gfn, mfn, PAGE_ORDER_4K, p2m_ram_rw, a);
             set_gpfn_from_mfn(mfn_x(mfn), rsp.gfn);
             audit_p2m(p2m, 1);
         }
diff -r 452d9143687f -r be8daf78856a xen/common/memory.c
--- a/xen/common/memory.c	Tue Nov 08 11:26:53 2011 +0100
+++ b/xen/common/memory.c	Tue Nov 08 13:01:41 2011 +0000
@@ -165,7 +165,7 @@
     mfn = mfn_x(gfn_to_mfn(d, gmfn, &p2mt)); 
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
-        guest_physmap_remove_page(d, gmfn, mfn, 0);
+        guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
         p2m_mem_paging_drop_page(d, gmfn);
         return 1;
     }
@@ -186,7 +186,7 @@
     if(p2m_is_shared(p2mt))
     {
         put_page_and_type(page);
-        guest_physmap_remove_page(d, gmfn, mfn, 0);
+        guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
         return 1;
     }
 
@@ -203,7 +203,7 @@
     if ( test_and_clear_bit(_PGC_allocated, &page->count_info) )
         put_page(page);
 
-    guest_physmap_remove_page(d, gmfn, mfn, 0);
+    guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
 
     put_page(page);
 
@@ -418,7 +418,7 @@
             gfn = mfn_to_gmfn(d, mfn);
             /* Pages were unshared above */
             BUG_ON(SHARED_M2P(gfn));
-            guest_physmap_remove_page(d, gfn, mfn, 0);
+            guest_physmap_remove_page(d, gfn, mfn, PAGE_ORDER_4K);
             put_page(page);
         }
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:47 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:47 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROit5-00067I-2N; Thu, 10 Nov 2011 20:38:47 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio5-0004CI-CH
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:38 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1320986014!1112364!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28184 invoked from network); 11 Nov 2011 04:33:34 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:34 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio1-0001NN-L0
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:33 +0000
Message-Id: <E1ROio1-0001NN-L0@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IRQ: create_irq() should call
	assign_irq_vector()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320769711 -3600
# Node ID c47cebd7a83f6760d58b0899e6ec154fde47d350
# Parent  be8daf78856a605ec8f8df11ff13c325dc4bc70f
x86/IRQ: create_irq() should call assign_irq_vector()

... rather than __assign_irq_vector(), to ensure desc->affinity gets
initialized properly.

This at once eliminates the need to forward-declare the latter function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r be8daf78856a -r c47cebd7a83f xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Tue Nov 08 13:01:41 2011 +0000
+++ b/xen/arch/x86/irq.c	Tue Nov 08 17:28:31 2011 +0100
@@ -25,7 +25,6 @@
 #include <public/physdev.h>
 
 static void parse_irq_vector_map_param(char *s);
-static int __assign_irq_vector(int irq, struct irq_desc *, const cpumask_t *);
 
 /* opt_noirqbalance: If true, software IRQ balancing/affinity is disabled. */
 bool_t __read_mostly opt_noirqbalance = 0;
@@ -156,7 +155,6 @@
  */
 int create_irq(void)
 {
-    unsigned long flags;
     int irq, ret;
     struct irq_desc *desc;
 
@@ -172,11 +170,7 @@
 
     ret = init_one_irq_desc(desc);
     if (!ret)
-    {
-        spin_lock_irqsave(&vector_lock, flags);
-        ret = __assign_irq_vector(irq, desc, TARGET_CPUS);
-        spin_unlock_irqrestore(&vector_lock, flags);
-    }
+        ret = assign_irq_vector(irq);
     if (ret < 0)
     {
         desc->arch.used = IRQ_UNUSED;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:38:56 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:38:56 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROitE-0006Ab-Oh; Thu, 10 Nov 2011 20:38:56 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio5-0004CK-B6
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:38 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-27.messagelabs.com!1320986001!54573791!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22479 invoked from network); 11 Nov 2011 04:33:21 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:21 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio2-0001Nz-8Q
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:34 +0000
Message-Id: <E1ROio2-0001Nz-8Q@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:33 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] bump sysctl interface version after
	c/s 23995:8943a9696358
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320769771 -3600
# Node ID dc8e55c90604b1f867c83ab7409a244e4e51e815
# Parent  c47cebd7a83f6760d58b0899e6ec154fde47d350
bump sysctl interface version after c/s 23995:8943a9696358

That c/s made binary incompatible changes to struct pm_cx_stat.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r c47cebd7a83f -r dc8e55c90604 xen/include/public/sysctl.h
--- a/xen/include/public/sysctl.h	Tue Nov 08 17:28:31 2011 +0100
+++ b/xen/include/public/sysctl.h	Tue Nov 08 17:29:31 2011 +0100
@@ -34,7 +34,7 @@
 #include "xen.h"
 #include "domctl.h"
 
-#define XEN_SYSCTL_INTERFACE_VERSION 0x00000008
+#define XEN_SYSCTL_INTERFACE_VERSION 0x00000009
 
 /*
  * Read console content from Xen buffer ring.

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:04 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:04 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROitL-0006EF-8r; Thu, 10 Nov 2011 20:39:03 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio6-0004Cj-RQ
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:39 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-174.messagelabs.com!1320986015!1114528!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3814 invoked from network); 11 Nov 2011 04:33:35 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:35 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio3-0001OV-3A
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:35 +0000
Message-Id: <E1ROio3-0001OV-3A@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/cpuidle: clean up hw residencies
	reading code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320769800 -3600
# Node ID 7f150d70ce5cf6165b7549eea56ffb566325f8a5
# Parent  dc8e55c90604b1f867c83ab7409a244e4e51e815
x86/cpuidle: clean up hw residencies reading code

Fold redundant code and eliminate pointless casts.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r dc8e55c90604 -r 7f150d70ce5c xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 17:29:31 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Tue Nov 08 17:30:00 2011 +0100
@@ -99,13 +99,19 @@
 static void do_get_hw_residencies(void *arg)
 {
     struct cpuinfo_x86 *c = &current_cpu_data;
-    struct hw_residencies *hw_res = (struct hw_residencies *)arg;
+    struct hw_residencies *hw_res = arg;
 
     if ( c->x86_vendor != X86_VENDOR_INTEL || c->x86 != 6 )
         return;
 
     switch ( c->x86_model )
     {
+    /* Sandy bridge */
+    case 0x2A:
+    case 0x2D:
+        GET_PC2_RES(hw_res->pc2);
+        GET_CC7_RES(hw_res->cc7);
+        /* fall through */
     /* Nehalem */
     case 0x1A:
     case 0x1E:
@@ -120,32 +126,22 @@
         GET_CC3_RES(hw_res->cc3);
         GET_CC6_RES(hw_res->cc6);
         break;
-    /* Sandy bridge */
-    case 0x2A:
-    case 0x2D:
-        GET_PC2_RES(hw_res->pc2);
-        GET_PC3_RES(hw_res->pc3);
-        GET_PC6_RES(hw_res->pc6);
-        GET_PC7_RES(hw_res->pc7);
-        GET_CC3_RES(hw_res->cc3);
-        GET_CC6_RES(hw_res->cc6);
-        GET_CC7_RES(hw_res->cc7);
-        break;
     }
 }
 
 static void get_hw_residencies(uint32_t cpu, struct hw_residencies *hw_res)
 {
+    memset(hw_res, 0, sizeof(*hw_res));
+
     if ( smp_processor_id() == cpu )
-        do_get_hw_residencies((void *)hw_res);
+        do_get_hw_residencies(hw_res);
     else
-        on_selected_cpus(cpumask_of(cpu),
-                         do_get_hw_residencies, (void *)hw_res, 1);
+        on_selected_cpus(cpumask_of(cpu), do_get_hw_residencies, hw_res, 1);
 }
 
 static void print_hw_residencies(uint32_t cpu)
 {
-    struct hw_residencies hw_res = {0};
+    struct hw_residencies hw_res;
 
     get_hw_residencies(cpu, &hw_res);
 
@@ -1042,7 +1038,7 @@
     struct acpi_processor_power *power = processor_powers[cpuid];
     uint64_t usage, res, idle_usage = 0, idle_res = 0;
     int i;
-    struct hw_residencies hw_res = {0};
+    struct hw_residencies hw_res;
 
     if ( power == NULL )
     {

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:13 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:13 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROitV-0006Hb-M2; Thu, 10 Nov 2011 20:39:13 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio7-0004Cw-AG
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:39 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1320986002!45192732!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4228 invoked from network); 11 Nov 2011 04:33:23 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:23 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio4-0001Pb-7E
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:36 +0000
Message-Id: <E1ROio4-0001Pb-7E@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: compare domain pointer in
	p2m_mem_paging_populate
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1320780901 0
# Node ID 89efd82620ec72d0a6dad5b977d1cdd45a1d701a
# Parent  4daa4ad90f1267d1dccb0873d680850db8311f2b
xenpaging: compare domain pointer in p2m_mem_paging_populate

Compare just the domain pointer instead of the domain_id number.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 4daa4ad90f12 -r 89efd82620ec xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Nov 08 19:33:46 2011 +0000
+++ b/xen/arch/x86/mm/p2m.c	Tue Nov 08 19:35:01 2011 +0000
@@ -906,7 +906,7 @@
     p2m_unlock(p2m);
 
     /* Pause domain if request came from guest and gfn has paging type */
-    if (  p2m_is_paging(p2mt) && v->domain->domain_id == d->domain_id )
+    if (  p2m_is_paging(p2mt) && v->domain == d )
     {
         vcpu_pause_nosync(v);
         req.flags |= MEM_EVENT_FLAG_VCPU_PAUSED;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:21 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROitd-0006Ky-Oh; Thu, 10 Nov 2011 20:39:21 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio7-0004Cz-DG
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:40 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-174.messagelabs.com!1320986016!1110283!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20595 invoked from network); 11 Nov 2011 04:33:36 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:36 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio3-0001P6-MT
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:35 +0000
Message-Id: <E1ROio3-0001P6-MT@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:35 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] waitqueue: Double size of x86 shadow
	stack.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1320780826 0
# Node ID 4daa4ad90f1267d1dccb0873d680850db8311f2b
# Parent  7f150d70ce5cf6165b7549eea56ffb566325f8a5
waitqueue: Double size of x86 shadow stack.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 7f150d70ce5c -r 4daa4ad90f12 xen/common/wait.c
--- a/xen/common/wait.c	Tue Nov 08 17:30:00 2011 +0100
+++ b/xen/common/wait.c	Tue Nov 08 19:33:46 2011 +0000
@@ -33,7 +33,7 @@
      * hypervisor context before sleeping (descheduling), setjmp/longjmp-style.
      */
     void *esp;
-    char stack[1500];
+    char stack[3000];
 #endif
 };
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROito-0006OV-9E; Thu, 10 Nov 2011 20:39:32 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio8-0004D4-VK
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:41 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1320985988!56782497!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6602 invoked from network); 11 Nov 2011 04:33:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio5-0001RC-TP
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:37 +0000
Message-Id: <E1ROio5-0001RC-TP@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:37 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/MSI: fix dump_msi() after c/s
	24068:6928172f7ded
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320831380 -3600
# Node ID 33215c3868a181c17dda1d0629d767d5b9c8a0f0
# Parent  fb1b32c9d03dfa5af4014688556a97805b118ac9
x86/MSI: fix dump_msi() after c/s 24068:6928172f7ded

The function must not blindly take the lock on IRQ descriptors.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r fb1b32c9d03d -r 33215c3868a1 xen/arch/x86/msi.c
--- a/xen/arch/x86/msi.c	Tue Nov 08 19:41:47 2011 +0000
+++ b/xen/arch/x86/msi.c	Wed Nov 09 10:36:20 2011 +0100
@@ -1076,6 +1076,9 @@
         unsigned long flags;
         char type;
 
+        if ( !irq_desc_initialized(desc) )
+            continue;
+
         spin_lock_irqsave(&desc->lock, flags);
 
         entry = desc->msi_desc;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:38 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROitt-0006RX-VI; Thu, 10 Nov 2011 20:39:38 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio8-0004D3-Sa
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:41 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-174.messagelabs.com!1320986017!1105365!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 6324 invoked from network); 11 Nov 2011 04:33:37 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:37 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio4-0001Q9-PK
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:36 +0000
Message-Id: <E1ROio4-0001Q9-PK@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] mem_event: check capabilities only
	once
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1320780942 0
# Node ID 2af5bfbc9fdee08af184d9dfc48c368619719e0f
# Parent  89efd82620ec72d0a6dad5b977d1cdd45a1d701a
mem_event: check capabilities only once

It is not required to check the system capabilities during every domctl.
Rearrange the code to check them only once.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 89efd82620ec -r 2af5bfbc9fde xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Tue Nov 08 19:35:01 2011 +0000
+++ b/xen/arch/x86/mm/mem_event.c	Tue Nov 08 19:35:42 2011 +0000
@@ -253,32 +253,35 @@
     case XEN_DOMCTL_MEM_EVENT_OP_PAGING:
     {
         struct mem_event_domain *med = &d->mem_paging;
-        struct p2m_domain *p2m = p2m_get_hostp2m(d);
-        rc = -ENODEV;
-        /* Only HAP is supported */
-        if ( !hap_enabled(d) )
-            break;
-
-        /* Currently only EPT is supported */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
-
-        rc = -EXDEV;
-        /* Disallow paging in a PoD guest */
-        if ( p2m->pod.entry_count )
-            break;
+        rc = -EINVAL;
 
         switch( mec->op )
         {
         case XEN_DOMCTL_MEM_EVENT_OP_PAGING_ENABLE:
         {
+            struct p2m_domain *p2m = p2m_get_hostp2m(d);
+            rc = -ENODEV;
+            /* Only HAP is supported */
+            if ( !hap_enabled(d) )
+                break;
+
+            /* Currently only EPT is supported */
+            if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+                break;
+
+            rc = -EXDEV;
+            /* Disallow paging in a PoD guest */
+            if ( p2m->pod.entry_count )
+                break;
+
             rc = mem_event_enable(d, mec, med);
         }
         break;
 
         case XEN_DOMCTL_MEM_EVENT_OP_PAGING_DISABLE:
         {
-            rc = mem_event_disable(med);
+            if ( med->ring_page )
+                rc = mem_event_disable(med);
         }
         break;
 
@@ -295,26 +298,29 @@
     case XEN_DOMCTL_MEM_EVENT_OP_ACCESS: 
     {
         struct mem_event_domain *med = &d->mem_access;
-        rc = -ENODEV;
-        /* Only HAP is supported */
-        if ( !hap_enabled(d) )
-            break;
-
-        /* Currently only EPT is supported */
-        if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-            break;
+        rc = -EINVAL;
 
         switch( mec->op )
         {
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_ENABLE:
         {
+            rc = -ENODEV;
+            /* Only HAP is supported */
+            if ( !hap_enabled(d) )
+                break;
+
+            /* Currently only EPT is supported */
+            if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
+                break;
+
             rc = mem_event_enable(d, mec, med);
         }
         break;
 
         case XEN_DOMCTL_MEM_EVENT_OP_ACCESS_DISABLE:
         {
-            rc = mem_event_disable(&d->mem_access);
+            if ( med->ring_page )
+                rc = mem_event_disable(&d->mem_access);
         }
         break;
 

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:45 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:45 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiu1-0006UV-ET; Thu, 10 Nov 2011 20:39:45 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROio9-0004DA-3Y
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:41 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1320986017!1116182!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10354 invoked from network); 11 Nov 2011 04:33:38 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:38 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio5-0001Qj-CU
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:37 +0000
Message-Id: <E1ROio5-0001Qj-CU@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:36 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xsm: Add support for
	HVMOP_track_dirty_vram.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jean Guyader <jean.guyader@eu.citrix.com>
# Date 1320781307 0
# Node ID fb1b32c9d03dfa5af4014688556a97805b118ac9
# Parent  2af5bfbc9fdee08af184d9dfc48c368619719e0f
xsm: Add support for HVMOP_track_dirty_vram.

Xen try to inforce the xsm policy when a HVMOP_track_dirty_vram
is received (xen/arch/x86/hvm/hvm.c:3637). It was failing because
in flask_hvmcontext, xsm didn't have any case for this operation.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 2af5bfbc9fde -r fb1b32c9d03d tools/flask/policy/policy/flask/access_vectors
--- a/tools/flask/policy/policy/flask/access_vectors	Tue Nov 08 19:35:42 2011 +0000
+++ b/tools/flask/policy/policy/flask/access_vectors	Tue Nov 08 19:41:47 2011 +0000
@@ -90,6 +90,7 @@
     pciroute
 	bind_irq
 	cacheattr
+    trackdirtyvram
 }
 
 class event
diff -r 2af5bfbc9fde -r fb1b32c9d03d tools/flask/policy/policy/modules/xen/xen.if
--- a/tools/flask/policy/policy/modules/xen/xen.if	Tue Nov 08 19:35:42 2011 +0000
+++ b/tools/flask/policy/policy/modules/xen/xen.if	Tue Nov 08 19:41:47 2011 +0000
@@ -22,7 +22,7 @@
 ################################################################################
 define(`create_hvm_dom', `
 	create_domain($1, $2, $3)
-	allow $1 $2:hvm { setparam getparam cacheattr pciroute irqlevel	pcilevel };
+	allow $1 $2:hvm { setparam getparam cacheattr pciroute irqlevel	pcilevel trackdirtyvram };
 	allow $2 $2:hvm setparam;
 ')	
 
diff -r 2af5bfbc9fde -r fb1b32c9d03d xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c	Tue Nov 08 19:35:42 2011 +0000
+++ b/xen/xsm/flask/hooks.c	Tue Nov 08 19:41:47 2011 +0000
@@ -816,6 +816,9 @@
     case XEN_DOMCTL_gethvmcontext_partial:
         perm = HVM__GETHVMC;
         break;
+    case HVMOP_track_dirty_vram:
+        perm = HVM__TRACKDIRTYVRAM;
+        break;
     default:
         return -EPERM;
     }
diff -r 2af5bfbc9fde -r fb1b32c9d03d xen/xsm/flask/include/av_perm_to_string.h
--- a/xen/xsm/flask/include/av_perm_to_string.h	Tue Nov 08 19:35:42 2011 +0000
+++ b/xen/xsm/flask/include/av_perm_to_string.h	Tue Nov 08 19:41:47 2011 +0000
@@ -56,6 +56,7 @@
    S_(SECCLASS_HVM, HVM__GETHVMC, "gethvmc")
    S_(SECCLASS_HVM, HVM__SETPARAM, "setparam")
    S_(SECCLASS_HVM, HVM__GETPARAM, "getparam")
+   S_(SECCLASS_HVM, HVM__TRACKDIRTYVRAM, "trackdirtyvram")
    S_(SECCLASS_HVM, HVM__PCILEVEL, "pcilevel")
    S_(SECCLASS_HVM, HVM__IRQLEVEL, "irqlevel")
    S_(SECCLASS_HVM, HVM__PCIROUTE, "pciroute")
diff -r 2af5bfbc9fde -r fb1b32c9d03d xen/xsm/flask/include/av_permissions.h
--- a/xen/xsm/flask/include/av_permissions.h	Tue Nov 08 19:35:42 2011 +0000
+++ b/xen/xsm/flask/include/av_permissions.h	Tue Nov 08 19:41:47 2011 +0000
@@ -63,6 +63,7 @@
 #define HVM__PCIROUTE                             0x00000040UL
 #define HVM__BIND_IRQ                             0x00000080UL
 #define HVM__CACHEATTR                            0x00000100UL
+#define HVM__TRACKDIRTYVRAM                       0x00000200UL
 
 #define EVENT__BIND                               0x00000001UL
 #define EVENT__SEND                               0x00000002UL

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:53 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:53 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiu9-0006XZ-6A; Thu, 10 Nov 2011 20:39:53 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioA-0004Dc-6T
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:42 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1320986005!45192737!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4335 invoked from network); 11 Nov 2011 04:33:25 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:25 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio7-0001SJ-3S
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:39 +0000
Message-Id: <E1ROio7-0001SJ-3S@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:38 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] add a comment for
	hypercall_xlat_continuation
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1320917059 -3600
# Node ID 073d59fbbbbdcb94e10f4ec7b41fa59e7593b37f
# Parent  f7988da4b6ea6cfed02e9d730f18e640d95c3015
add a comment for hypercall_xlat_continuation

The interface of this function is really rather complex and having reverse
engineered it for the N'th time I think it is time to write things down.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r f7988da4b6ea -r 073d59fbbbbd xen/include/xen/compat.h
--- a/xen/include/xen/compat.h	Wed Nov 09 10:37:45 2011 +0100
+++ b/xen/include/xen/compat.h	Thu Nov 10 10:24:19 2011 +0100
@@ -185,6 +185,34 @@
     CHECK_FIELD_COMMON_(k, CHECK_NAME_(k, n ## __ ## f1 ## __ ## f2 ## __ ## \
                                        f3, F2), n, f1.f2.f3)
 
+/*
+ * Translate a native continuation into a compat guest continuation.
+ *
+ * id: If non-NULL then points to an integer N between 0-5. Will be updated
+ * with the value of the N'th argument to the hypercall. The N'th argument must
+ * not be subject to translation (i.e. cannot be referenced by @mask below).
+ * This option is useful for extracting the "op" argument or similar from the
+ * hypercall to enable further xlat processing.
+ *
+ * mask: Specifies which of the hypercall arguments require compat translation.
+ * bit 0 indicates that the 0'th argument requires translation, bit 1 indicates
+ * that the first argument requires translation and so on. Native and compat
+ * values for each translated argument are provided as @varargs (see below).
+ *
+ * varargs: For each bit which is set in @mask the varargs contain a native
+ * value (unsigned long) and a compat value (unsigned int). If the native value
+ * and compat value differ and the N'th argument is equal to the native value
+ * then that argument is replaced by the compat value. If the native and compat
+ * values are equal then no translation takes place. If the N'th argument does
+ * not equal the native value then no translation takes place.
+ *
+ * Any untranslated argument (whether due to not being requested in @mask,
+ * native and compat values being equal or N'th argument not equalling native
+ * value) must be equal in both native and compat representations (i.e. the
+ * native version cannot have any bits > 32 set)
+ *
+ * Return: Number of arguments which were actually translated.
+ */
 int hypercall_xlat_continuation(unsigned int *id, unsigned int mask, ...);
 
 /* In-place translation functons: */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:39:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:39:59 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiuF-0006ad-GD; Thu, 10 Nov 2011 20:39:59 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioA-0004Dd-9A
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:42 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-174.messagelabs.com!1320986018!1116184!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10362 invoked from network); 11 Nov 2011 04:33:39 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:39 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio6-0001Rl-Hl
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:38 +0000
Message-Id: <E1ROio6-0001Rl-Hl@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:37 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] VMX: extend last branch MSR info to
	cover newer CPU models #2
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1320831465 -3600
# Node ID f7988da4b6ea6cfed02e9d730f18e640d95c3015
# Parent  33215c3868a181c17dda1d0629d767d5b9c8a0f0
VMX: extend last branch MSR info to cover newer CPU models #2

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: "Shan, Haitao" <haitao.shan@intel.com>
---


diff -r 33215c3868a1 -r f7988da4b6ea xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 09 10:36:20 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Wed Nov 09 10:37:45 2011 +0100
@@ -1740,6 +1740,8 @@
             break;
         /* Nehalem */
         case 26: case 30: case 31: case 46:
+        /* Westmere */
+        case 37: case 44: case 47:
         /* Sandy Bridge */
         case 42: case 45:
             return nh_lbr;

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:40:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:40:10 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiuQ-0006eA-6o; Thu, 10 Nov 2011 20:40:10 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioB-0004Du-Cv
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:43 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-174.messagelabs.com!1320986020!1119839!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8851 invoked from network); 11 Nov 2011 04:33:40 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:40 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio7-0001St-MI
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:39 +0000
Message-Id: <E1ROio7-0001St-MI@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Refactor mm-lock ordering
	constructs
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1320923555 0
# Node ID 9bb159ec3337e7999c0d49b81105518810cb7b17
# Parent  073d59fbbbbdcb94e10f4ec7b41fa59e7593b37f
x86/mm: Refactor mm-lock ordering constructs

The mm layer has a construct to enforce locks are taken in a pre-
defined order, and thus avert deadlock. Refactor pieces of this
code for later use, no functional changes.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 073d59fbbbbd -r 9bb159ec3337 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 10:24:19 2011 +0100
+++ b/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 11:12:35 2011 +0000
@@ -28,6 +28,7 @@
 
 /* Per-CPU variable for enforcing the lock ordering */
 DECLARE_PER_CPU(int, mm_lock_level);
+#define __get_lock_level()  (this_cpu(mm_lock_level))
 
 static inline void mm_lock_init(mm_lock_t *l)
 {
@@ -42,22 +43,32 @@
     return (l->lock.recurse_cpu == current->processor);
 }
 
+/* If you see this crash, the numbers printed are lines in this file 
+ * where the offending locks are declared. */
+#define __check_lock_level(l)                           \
+do {                                                    \
+    if ( unlikely(__get_lock_level()) > (l) )           \
+        panic("mm locking order violation: %i > %i\n",  \
+              __get_lock_level(), (l));                 \
+} while(0)
+
+#define __set_lock_level(l)         \
+do {                                \
+    __get_lock_level() = (l);       \
+} while(0)
+
 static inline void _mm_lock(mm_lock_t *l, const char *func, int level, int rec)
 {
-    /* If you see this crash, the numbers printed are lines in this file 
-     * where the offending locks are declared. */
-    if ( unlikely(this_cpu(mm_lock_level) > level) )
-        panic("mm locking order violation: %i > %i\n", 
-              this_cpu(mm_lock_level), level);
+    __check_lock_level(level);
     spin_lock_recursive(&l->lock);
     if ( l->lock.recurse_cnt == 1 )
     {
         l->locker_function = func;
-        l->unlock_level = this_cpu(mm_lock_level);
+        l->unlock_level = __get_lock_level();
     }
     else if ( (unlikely(!rec)) )
         panic("mm lock already held by %s\n", l->locker_function);
-    this_cpu(mm_lock_level) = level;
+    __set_lock_level(level);
 }
 /* This wrapper uses the line number to express the locking order below */
 #define declare_mm_lock(name)                                                 \
@@ -72,7 +83,7 @@
     if ( l->lock.recurse_cnt == 1 )
     {
         l->locker_function = "nobody";
-        this_cpu(mm_lock_level) = l->unlock_level;
+        __set_lock_level(l->unlock_level);
     }
     spin_unlock_recursive(&l->lock);
 }

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:40:17 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:40:17 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiuX-0006hc-9f; Thu, 10 Nov 2011 20:40:17 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioC-0004Dv-0u
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:44 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-174.messagelabs.com!1320986020!1113481!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17695 invoked from network); 11 Nov 2011 04:33:40 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:40 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio8-0001TR-7u
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:40 +0000
Message-Id: <E1ROio8-0001TR-7u@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:39 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Declare an order-enforcing
	construct for external locks used in the mm layer
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1320923555 0
# Node ID ff5c8383eb9fcc57e2eba8c3fa254568f594a7f2
# Parent  9bb159ec3337e7999c0d49b81105518810cb7b17
x86/mm: Declare an order-enforcing construct for external locks used in the mm layer

Declare an order-enforcing construct for a lock used in the mm layer
that is not of type mm_lock_t. This is useful whenever the mm layer
takes locks from other subsystems, or locks not implemented as
mm_lock_t.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 9bb159ec3337 -r ff5c8383eb9f xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 11:12:35 2011 +0000
@@ -70,6 +70,27 @@
         panic("mm lock already held by %s\n", l->locker_function);
     __set_lock_level(level);
 }
+
+static inline void _mm_enforce_order_lock_pre(int level)
+{
+    __check_lock_level(level);
+}
+
+static inline void _mm_enforce_order_lock_post(int level, int *unlock_level,
+                                                unsigned short *recurse_count)
+{
+    if ( recurse_count )
+    {
+        if ( *recurse_count++ == 0 )
+        {
+            *unlock_level = __get_lock_level();
+        }
+    } else {
+        *unlock_level = __get_lock_level();
+    }
+    __set_lock_level(level);
+}
+
 /* This wrapper uses the line number to express the locking order below */
 #define declare_mm_lock(name)                                                 \
     static inline void mm_lock_##name(mm_lock_t *l, const char *func, int rec)\
@@ -78,6 +99,16 @@
 #define mm_lock(name, l) mm_lock_##name(l, __func__, 0)
 #define mm_lock_recursive(name, l) mm_lock_##name(l, __func__, 1)
 
+/* This wrapper is intended for "external" locks which do not use
+ * the mm_lock_t types. Such locks inside the mm code are also subject
+ * to ordering constraints. */
+#define declare_mm_order_constraint(name)                                   \
+    static inline void mm_enforce_order_lock_pre_##name(void)               \
+    { _mm_enforce_order_lock_pre(__LINE__); }                               \
+    static inline void mm_enforce_order_lock_post_##name(                   \
+                        int *unlock_level, unsigned short *recurse_count)   \
+    { _mm_enforce_order_lock_post(__LINE__, unlock_level, recurse_count); } \
+
 static inline void mm_unlock(mm_lock_t *l)
 {
     if ( l->lock.recurse_cnt == 1 )
@@ -88,6 +119,21 @@
     spin_unlock_recursive(&l->lock);
 }
 
+static inline void mm_enforce_order_unlock(int unlock_level, 
+                                            unsigned short *recurse_count)
+{
+    if ( recurse_count )
+    {
+        BUG_ON(*recurse_count == 0);
+        if ( *recurse_count-- == 1 )
+        {
+            __set_lock_level(unlock_level);
+        }
+    } else {
+        __set_lock_level(unlock_level);
+    }
+}
+
 /************************************************************************
  *                                                                      *
  * To avoid deadlocks, these locks _MUST_ be taken in the order they're *

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:40:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:40:23 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiud-0006kd-Nj; Thu, 10 Nov 2011 20:40:23 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioC-0004E9-NZ
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:45 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-3.tower-174.messagelabs.com!1320986021!1112372!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28263 invoked from network); 11 Nov 2011 04:33:41 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-3.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:41 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio9-0001U9-0l
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:41 +0000
Message-Id: <E1ROio9-0001U9-0l@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Enforce ordering constraints
	for the page alloc lock in the PoD code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1320923555 0
# Node ID 3e726d259039e31eed07ff0ad63b77ab419125ac
# Parent  ff5c8383eb9fcc57e2eba8c3fa254568f594a7f2
x86/mm: Enforce ordering constraints for the page alloc lock in the PoD code

The page alloc lock is sometimes used in the PoD code, with an
explicit expectation of ordering. Use our ordering constructs in the
mm layer to enforce this.

The additional book-keeping variables are kept in the arch_domain
sub-struct, as they are x86-specific to the whole domain.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r ff5c8383eb9f -r 3e726d259039 xen/arch/x86/mm/mm-locks.h
--- a/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/mm/mm-locks.h	Thu Nov 10 11:12:35 2011 +0000
@@ -174,6 +174,18 @@
 #define p2m_unlock(p)         mm_unlock(&(p)->lock)
 #define p2m_locked_by_me(p)   mm_locked_by_me(&(p)->lock)
 
+/* Page alloc lock (per-domain)
+ *
+ * This is an external lock, not represented by an mm_lock_t. However, 
+ * pod code uses it in conjunction with the p2m lock, and expecting
+ * the ordering which we enforce here.
+ * The lock is not recursive. */
+
+declare_mm_order_constraint(page_alloc)
+#define page_alloc_mm_pre_lock()   mm_enforce_order_lock_pre_page_alloc()
+#define page_alloc_mm_post_lock(l) mm_enforce_order_lock_post_page_alloc(&(l), NULL)
+#define page_alloc_mm_unlock(l)    mm_enforce_order_unlock((l), NULL)
+
 /* Paging lock (per-domain)
  *
  * For shadow pagetables, this lock protects
diff -r ff5c8383eb9f -r 3e726d259039 xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/mm/p2m-pod.c	Thu Nov 10 11:12:35 2011 +0000
@@ -45,6 +45,20 @@
 
 #define superpage_aligned(_x)  (((_x)&(SUPERPAGE_PAGES-1))==0)
 
+/* Enforce lock ordering when grabbing the "external" page_alloc lock */
+static inline void lock_page_alloc(struct p2m_domain *p2m)
+{
+    page_alloc_mm_pre_lock();
+    spin_lock(&(p2m->domain->page_alloc_lock));
+    page_alloc_mm_post_lock(p2m->domain->arch.page_alloc_unlock_level);
+}
+
+static inline void unlock_page_alloc(struct p2m_domain *p2m)
+{
+    page_alloc_mm_unlock(p2m->domain->arch.page_alloc_unlock_level);
+    spin_unlock(&(p2m->domain->page_alloc_lock));
+}
+
 /*
  * Populate-on-demand functionality
  */
@@ -100,7 +114,7 @@
         unmap_domain_page(b);
     }
 
-    spin_lock(&d->page_alloc_lock);
+    lock_page_alloc(p2m);
 
     /* First, take all pages off the domain list */
     for(i=0; i < 1 << order ; i++)
@@ -128,7 +142,7 @@
      * This may cause "zombie domains" since the page will never be freed. */
     BUG_ON( d->arch.relmem != RELMEM_not_started );
 
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
 
     return 0;
 }
@@ -245,7 +259,7 @@
 
         /* Grab the lock before checking that pod.super is empty, or the last
          * entries may disappear before we grab the lock. */
-        spin_lock(&d->page_alloc_lock);
+        lock_page_alloc(p2m);
 
         if ( (p2m->pod.count - pod_target) > SUPERPAGE_PAGES
              && !page_list_empty(&p2m->pod.super) )
@@ -257,7 +271,7 @@
 
         ASSERT(page != NULL);
 
-        spin_unlock(&d->page_alloc_lock);
+        unlock_page_alloc(p2m);
 
         /* Then free them */
         for ( i = 0 ; i < (1 << order) ; i++ )
@@ -378,7 +392,7 @@
     BUG_ON(!d->is_dying);
     spin_barrier(&p2m->lock.lock);
 
-    spin_lock(&d->page_alloc_lock);
+    lock_page_alloc(p2m);
 
     while ( (page = page_list_remove_head(&p2m->pod.super)) )
     {
@@ -403,7 +417,7 @@
 
     BUG_ON(p2m->pod.count != 0);
 
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
 }
 
 int
@@ -417,7 +431,7 @@
     if ( !(d = page_get_owner(p)) || !(p2m = p2m_get_hostp2m(d)) )
         return 0;
 
-    spin_lock(&d->page_alloc_lock);
+    lock_page_alloc(p2m);
     bmfn = mfn_x(page_to_mfn(p));
     page_list_for_each_safe(q, tmp, &p2m->pod.super)
     {
@@ -448,12 +462,12 @@
         }
     }
 
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
     return 0;
 
 pod_hit:
     page_list_add_tail(p, &d->arch.relmem_list);
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
     return 1;
 }
 
@@ -994,7 +1008,7 @@
     if ( q == p2m_guest && gfn > p2m->pod.max_guest )
         p2m->pod.max_guest = gfn;
 
-    spin_lock(&d->page_alloc_lock);
+    lock_page_alloc(p2m);
 
     if ( p2m->pod.count == 0 )
         goto out_of_memory;
@@ -1008,7 +1022,7 @@
 
     BUG_ON((mfn_x(mfn) & ((1 << order)-1)) != 0);
 
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
 
     gfn_aligned = (gfn >> order) << order;
 
@@ -1040,7 +1054,7 @@
 
     return 0;
 out_of_memory:
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
 
     printk("%s: Out of populate-on-demand memory! tot_pages %" PRIu32 " pod_entries %" PRIi32 "\n",
            __func__, d->tot_pages, p2m->pod.entry_count);
@@ -1049,7 +1063,7 @@
     return -1;
 remap_and_retry:
     BUG_ON(order != PAGE_ORDER_2M);
-    spin_unlock(&d->page_alloc_lock);
+    unlock_page_alloc(p2m);
 
     /* Remap this 2-meg region in singleton chunks */
     gfn_aligned = (gfn>>order)<<order;
diff -r ff5c8383eb9f -r 3e726d259039 xen/include/asm-x86/domain.h
--- a/xen/include/asm-x86/domain.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/include/asm-x86/domain.h	Thu Nov 10 11:12:35 2011 +0000
@@ -269,6 +269,9 @@
 
     struct paging_domain paging;
     struct p2m_domain *p2m;
+    /* To enforce lock ordering in the pod code wrt the 
+     * page_alloc lock */
+    int page_alloc_unlock_level;
 
     /* nestedhvm: translate l2 guest physical to host physical */
     struct p2m_domain *nested_p2m[MAX_NESTEDP2M];
diff -r ff5c8383eb9f -r 3e726d259039 xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Nov 10 11:12:35 2011 +0000
@@ -270,6 +270,11 @@
      * + p2m_pod_demand_populate() grabs both; the p2m lock to avoid
      *   double-demand-populating of pages, the page_alloc lock to
      *   protect moving stuff from the PoD cache to the domain page list.
+     *
+     * We enforce this lock ordering through a construct in mm-locks.h.
+     * This demands, however, that we store the previous lock-ordering
+     * level in effect before grabbing the page_alloc lock. The unlock
+     * level is stored in the arch section of the domain struct.
      */
     struct {
         struct page_list_head super,   /* List of superpages                */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 10 20:40:30 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 10 Nov 2011 20:40:30 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROiuk-0006nz-IV; Thu, 10 Nov 2011 20:40:30 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROioD-0004EP-2L
	for xen-changelog@lists.xensource.com; Thu, 10 Nov 2011 20:33:45 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1320986021!1105634!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20862 invoked from network); 11 Nov 2011 04:33:42 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 04:33:42 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROio9-0001Ug-Ho
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 04:33:41 +0000
Message-Id: <E1ROio9-0001Ug-Ho@xenbits.xen.org>
Date: Fri, 11 Nov 2011 04:33:41 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/mm: Refactor p2m get_entry
	accessor
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Tim Deegan <tim@xen.org>
# Date 1320923555 0
# Node ID d0bbe0622d1d8db2d11b722322287945d16d5982
# Parent  3e726d259039e31eed07ff0ad63b77ab419125ac
x86/mm: Refactor p2m get_entry accessor

Move the main query accessor to the p2m outside of an inline and into the
p2m code itself. This will allow for p2m internal locking to be added
to the accessor later.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Tim Deegan <tim@xen.org>
---


diff -r 3e726d259039 -r d0bbe0622d1d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Nov 10 11:12:35 2011 +0000
@@ -144,6 +144,44 @@
     p2m_unlock(p2m);
 }
 
+mfn_t gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
+                    p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
+                    unsigned int *page_order)
+{
+    mfn_t mfn;
+
+    if ( !p2m || !paging_mode_translate(p2m->domain) )
+    {
+        /* Not necessarily true, but for non-translated guests, we claim
+         * it's the most generic kind of memory */
+        *t = p2m_ram_rw;
+        return _mfn(gfn);
+    }
+
+    mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
+
+#ifdef __x86_64__
+    if ( q == p2m_unshare && p2m_is_shared(*t) )
+    {
+        ASSERT(!p2m_is_nestedp2m(p2m));
+        mem_sharing_unshare_page(p2m->domain, gfn, 0);
+        mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
+    }
+#endif
+
+#ifdef __x86_64__
+    if (unlikely((p2m_is_broken(*t))))
+    {
+        /* Return invalid_mfn to avoid caller's access */
+        mfn = _mfn(INVALID_MFN);
+        if (q == p2m_guest)
+            domain_crash(p2m->domain);
+    }
+#endif
+
+    return mfn;
+}
+
 int set_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, 
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma)
 {
diff -r 3e726d259039 -r d0bbe0622d1d xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/include/asm-x86/p2m.h	Thu Nov 10 11:12:35 2011 +0000
@@ -313,45 +313,9 @@
  * If the lookup succeeds, the return value is != INVALID_MFN and 
  * *page_order is filled in with the order of the superpage (if any) that
  * the entry was found in.  */
-static inline mfn_t
-gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
+mfn_t gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
                     p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
-                    unsigned int *page_order)
-{
-    mfn_t mfn;
-
-    if ( !p2m || !paging_mode_translate(p2m->domain) )
-    {
-        /* Not necessarily true, but for non-translated guests, we claim
-         * it's the most generic kind of memory */
-        *t = p2m_ram_rw;
-        return _mfn(gfn);
-    }
-
-    mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
-
-#ifdef __x86_64__
-    if ( q == p2m_unshare && p2m_is_shared(*t) )
-    {
-        ASSERT(!p2m_is_nestedp2m(p2m));
-        mem_sharing_unshare_page(p2m->domain, gfn, 0);
-        mfn = p2m->get_entry(p2m, gfn, t, a, q, page_order);
-    }
-#endif
-
-#ifdef __x86_64__
-    if (unlikely((p2m_is_broken(*t))))
-    {
-        /* Return invalid_mfn to avoid caller's access */
-        mfn = _mfn(INVALID_MFN);
-        if (q == p2m_guest)
-            domain_crash(p2m->domain);
-    }
-#endif
-
-    return mfn;
-}
-
+                    unsigned int *page_order);
 
 /* General conversion function from gfn to mfn */
 static inline mfn_t gfn_to_mfn_type(struct domain *d,

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 01:11:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 01:11:20 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROn8p-0000wy-Nb; Fri, 11 Nov 2011 01:11:19 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROn8g-0000w6-Sm
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 01:11:11 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-216.messagelabs.com!1321002667!4456691!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 27017 invoked from network); 11 Nov 2011 09:11:07 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 09:11:07 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROn8d-0001lf-Bv
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 09:11:07 +0000
Message-Id: <E1ROn8d-0001lf-Bv@xenbits.xen.org>
Date: Fri, 11 Nov 2011 09:11:06 +0000
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] x86: undo_limit_pages() must
	reset page count
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321001481 -3600
# Node ID 97f927a1e3edba4c0b7f9d1ce8cf5577654d3a63
# Parent  2d7a321286c99098a59b6e12f0e448f0cb0d6cdd
x86: undo_limit_pages() must reset page count

... before calling __free_pages() as it is already being called in the
context of that or a similar function (which used put_page_testzero()
first or otherwise assumes the page count is zero).

Reported-by: Daniel Kiper <dkiper@net-space.pl>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 2d7a321286c9 -r 97f927a1e3ed arch/i386/mm/hypervisor.c
--- a/arch/i386/mm/hypervisor.c	Mon Oct 17 10:14:48 2011 +0200
+++ b/arch/i386/mm/hypervisor.c	Fri Nov 11 09:51:21 2011 +0100
@@ -437,6 +437,7 @@
 	BUG_ON(order > max_contig_order);
 	xen_limit_pages_to_max_mfn(pages, order, 0);
 	ClearPageForeign(pages);
+	init_page_count(pages);
 	__free_pages(pages, order);
 }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 01:11:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 01:11:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROn92-0000ze-1H; Fri, 11 Nov 2011 01:11:32 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROn8h-0000w7-EW
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 01:11:13 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1321002668!3768607!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24402 invoked from network); 11 Nov 2011 09:11:08 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 09:11:08 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROn8d-0001n0-S1
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 09:11:07 +0000
Message-Id: <E1ROn8d-0001n0-S1@xenbits.xen.org>
Date: Fri, 11 Nov 2011 09:11:07 +0000
From: Xen patchbot-linux-2.6.18-xen <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [linux-2.6.18-xen] Sync Xen public headers
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321002159 -3600
# Node ID 985b8f62df2525dc15ad573b2d748622cda9d2db
# Parent  97f927a1e3edba4c0b7f9d1ce8cf5577654d3a63
Sync Xen public headers

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 97f927a1e3ed -r 985b8f62df25 include/xen/interface/io/blkif.h
--- a/include/xen/interface/io/blkif.h	Fri Nov 11 09:51:21 2011 +0100
+++ b/include/xen/interface/io/blkif.h	Fri Nov 11 10:02:39 2011 +0100
@@ -82,25 +82,49 @@
  */
 #define BLKIF_OP_RESERVED_1        4
 /*
- * Recognised only if "feature-trim" is present in backend xenbus info.
- * The "feature-trim" node contains a boolean indicating whether trim
- * requests are likely to succeed or fail. Either way, a trim request
+ * Recognised only if "feature-discard" is present in backend xenbus info.
+ * The "feature-discard" node contains a boolean indicating whether trim
+ * (ATA) or unmap (SCSI) - conviently called discard requests are likely
+ * to succeed or fail. Either way, a discard 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 trim requests.
- * If a backend does not recognise BLKIF_OP_TRIM, it should *not*
- * create the "feature-trim" node!
- * 
- * Trim operation is a request for the underlying block device to mark
- * extents to be erased. Trim operations are passed with sector_number as the
- * sector index to begin trim operations at and nr_sectors as the number of
- * sectors to be trimmed. The specified sectors should be trimmed if the
- * underlying block device supports trim operations, or a BLKIF_RSP_EOPNOTSUPP
- * should be returned. More information about trim operations at:
+ * or not it is worthwhile for the frontend to attempt discard requests.
+ * If a backend does not recognise BLKIF_OP_DISCARD, it should *not*
+ * create the "feature-discard" node!
+ *
+ * Discard operation is a request for the underlying block device to mark
+ * extents to be erased. However, discard does not guarantee that the blocks
+ * will be erased from the device - it is just a hint to the device
+ * controller that these blocks are no longer in use. What the device
+ * controller does with that information is left to the controller.
+ * Discard operations are passed with sector_number as the
+ * sector index to begin discard operations at and nr_sectors as the number of
+ * sectors to be discarded. The specified sectors should be discarded if the
+ * underlying block device supports trim (ATA) or unmap (SCSI) operations,
+ * or a BLKIF_RSP_EOPNOTSUPP  should be returned.
+ * More information about trim/unmap operations at:
  * http://t13.org/Documents/UploadedDocuments/docs2008/
  *     e07154r6-Data_Set_Management_Proposal_for_ATA-ACS2.doc
+ * http://www.seagate.com/staticfiles/support/disc/manuals/
+ *     Interface%20manuals/100293068c.pdf
+ * The backend can optionally provide these extra XenBus attributes to
+ * further optimize the discard functionality:
+ * 'discard-aligment' - Devices that support discard functionality may
+ * internally allocate space in units that are bigger than the exported
+ * logical block size. The discard-alignment parameter indicates how many bytes
+ * the beginning of the partition is offset from the internal allocation unit's
+ * natural alignment. Do not confuse this with natural disk alignment offset.
+ * 'discard-granularity'  - Devices that support discard functionality may
+ * internally allocate space using units that are bigger than the logical block
+ * size. The discard-granularity parameter indicates the size of the internal
+ * allocation unit in bytes if reported by the device. Otherwise the
+ * discard-granularity will be set to match the device's physical block size.
+ * It is the minimum size you can discard.
+ * 'discard-secure' - All copies of the discarded sectors (potentially created
+ * by garbage collection) must also be erased.  To use this feature, the flag
+ * BLKIF_DISCARD_SECURE must be set in the blkif_request_discard.
  */
-#define BLKIF_OP_TRIM              5
+#define BLKIF_OP_DISCARD           5
 
 /*
  * Maximum scatter/gather segments per request.
@@ -135,17 +159,18 @@
 
 /*
  * Cast to this structure when blkif_request.operation == BLKIF_OP_TRIM
- * sizeof(struct blkif_request_trim) <= sizeof(struct blkif_request)
+ * sizeof(struct blkif_request_discard) <= sizeof(struct blkif_request)
  */
-struct blkif_request_trim {
-    uint8_t        operation;    /* BLKIF_OP_TRIM                        */
-    uint8_t        reserved;     /*                                      */
+struct blkif_request_discard {
+    uint8_t        operation;    /* BLKIF_OP_DISCARD                     */
+    uint8_t        flag;         /* BLKIF_DISCARD_SECURE or zero         */
+#define BLKIF_DISCARD_SECURE (1<<0)  /* ignored if discard-secure=0      */
     blkif_vdev_t   handle;       /* same as for read/write requests      */
     uint64_t       id;           /* private guest value, echoed in resp  */
     blkif_sector_t sector_number;/* start sector idx on disk             */
-    uint64_t       nr_sectors;   /* number of contiguous sectors to trim */
+    uint64_t       nr_sectors;   /* number of contiguous sectors to discard*/
 };
-typedef struct blkif_request_trim blkif_request_trim_t;
+typedef struct blkif_request_discard blkif_request_discard_t;
 
 struct blkif_response {
     uint64_t        id;              /* copied from request */
diff -r 97f927a1e3ed -r 985b8f62df25 include/xen/interface/io/libxenvchan.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/include/xen/interface/io/libxenvchan.h	Fri Nov 11 10:02:39 2011 +0100
@@ -0,0 +1,97 @@
+/**
+ * @file
+ * @section AUTHORS
+ *
+ * Copyright (C) 2010  Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *
+ *  Authors:
+ *       Rafal Wojtczuk  <rafal@invisiblethingslab.com>
+ *       Daniel De Graaf <dgdegra@tycho.nsa.gov>
+ *
+ * @section LICENSE
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+ *
+ * @section DESCRIPTION
+ *
+ *  Originally borrowed from the Qubes OS Project, http://www.qubes-os.org,
+ *  this code has been substantially rewritten to use the gntdev and gntalloc
+ *  devices instead of raw MFNs and map_foreign_range.
+ *
+ *  This is a library for inter-domain communication.  A standard Xen ring
+ *  buffer is used, with a datagram-based interface built on top.  The grant
+ *  reference and event channels are shared in XenStore under a user-specified
+ *  path.
+ *
+ *  The ring.h macros define an asymmetric interface to a shared data structure
+ *  that assumes all rings reside in a single contiguous memory space. This is
+ *  not suitable for vchan because the interface to the ring is symmetric except
+ *  for the setup. Unlike the producer-consumer rings defined in ring.h, the
+ *  size of the rings used in vchan are determined at execution time instead of
+ *  compile time, so the macros in ring.h cannot be used to access the rings.
+ */
+
+#include <stdint.h>
+#include <sys/types.h>
+
+struct ring_shared {
+	uint32_t cons, prod;
+};
+
+#define VCHAN_NOTIFY_WRITE 0x1
+#define VCHAN_NOTIFY_READ 0x2
+
+/**
+ * vchan_interface: primary shared data structure
+ */
+struct vchan_interface {
+	/**
+	 * Standard consumer/producer interface, one pair per buffer
+	 * left is client write, server read
+	 * right is client read, server write
+	 */
+	struct ring_shared left, right;
+	/**
+	 * size of the rings, which determines their location
+	 * 10   - at offset 1024 in ring's page
+	 * 11   - at offset 2048 in ring's page
+	 * 12+  - uses 2^(N-12) grants to describe the multi-page ring
+	 * These should remain constant once the page is shared.
+	 * Only one of the two orders can be 10 (or 11).
+	 */
+	uint16_t left_order, right_order;
+	/**
+	 * Shutdown detection:
+	 *  0: client (or server) has exited
+	 *  1: client (or server) is connected
+	 *  2: client has not yet connected
+	 */
+	uint8_t cli_live, srv_live;
+	/**
+	 * Notification bits:
+	 *  VCHAN_NOTIFY_WRITE: send notify when data is written
+	 *  VCHAN_NOTIFY_READ: send notify when data is read (consumed)
+	 * cli_notify is used for the client to inform the server of its action
+	 */
+	uint8_t cli_notify, srv_notify;
+	/**
+	 * Grant list: ordering is left, right. Must not extend into actual ring
+	 * or grow beyond the end of the initial shared page.
+	 * These should remain constant once the page is shared, to allow
+	 * for possible remapping by a client that restarts.
+	 */
+	uint32_t grants[0];
+};
+
diff -r 97f927a1e3ed -r 985b8f62df25 include/xen/interface/mem_event.h
--- a/include/xen/interface/mem_event.h	Fri Nov 11 09:51:21 2011 +0100
+++ b/include/xen/interface/mem_event.h	Fri Nov 11 10:02:39 2011 +0100
@@ -38,6 +38,7 @@
 /* Memory event flags */
 #define MEM_EVENT_FLAG_VCPU_PAUSED  (1 << 0)
 #define MEM_EVENT_FLAG_DROP_PAGE    (1 << 1)
+#define MEM_EVENT_FLAG_EVICT_FAIL   (1 << 2)
 
 /* Reasons for the memory event request */
 #define MEM_EVENT_REASON_UNKNOWN     0    /* typical reason */
diff -r 97f927a1e3ed -r 985b8f62df25 include/xen/interface/sysctl.h
--- a/include/xen/interface/sysctl.h	Fri Nov 11 09:51:21 2011 +0100
+++ b/include/xen/interface/sysctl.h	Fri Nov 11 10:02:39 2011 +0100
@@ -34,7 +34,7 @@
 #include "xen.h"
 #include "domctl.h"
 
-#define XEN_SYSCTL_INTERFACE_VERSION 0x00000008
+#define XEN_SYSCTL_INTERFACE_VERSION 0x00000009
 
 /*
  * Read console content from Xen buffer ring.
@@ -225,11 +225,13 @@
     uint64_aligned_t idle_time;                 /* idle time from boot */
     XEN_GUEST_HANDLE_64(uint64) triggers;    /* Cx trigger counts */
     XEN_GUEST_HANDLE_64(uint64) residencies; /* Cx residencies */
+    uint64_aligned_t pc2;
     uint64_aligned_t pc3;
     uint64_aligned_t pc6;
     uint64_aligned_t pc7;
     uint64_aligned_t cc3;
     uint64_aligned_t cc6;
+    uint64_aligned_t cc7;
 };
 
 struct xen_sysctl_get_pmstat {

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:11:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:11:19 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROslD-0002UK-6l; Fri, 11 Nov 2011 07:11:19 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROsl8-0002TP-0B
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:14 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1321024153!43983917!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18562 invoked from network); 11 Nov 2011 15:09:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:09:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl4-0000Ws-Im
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:10 +0000
Message-Id: <E1ROsl4-0000Ws-Im@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/IRQ: eliminate irq_vector[]
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321001260 -3600
# Node ID 6534da595d695a4f2af12a64e46fb06219a0e4bc
# Parent  d0bbe0622d1d8db2d11b722322287945d16d5982
x86/IRQ: eliminate irq_vector[]

The vector is already being tracked in struct irq_desc's arch.vector
member, so there's no real need for a second place where this to get
stored. The only caveat is that legacy vectors (used for interrupts
handled through the 8259) must be special cased to not prevent non-
legacy vectors from being assigned.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
---


diff -r d0bbe0622d1d -r 6534da595d69 xen/arch/x86/io_apic.c
--- a/xen/arch/x86/io_apic.c	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/io_apic.c	Fri Nov 11 09:47:40 2011 +0100
@@ -452,10 +452,10 @@
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-static void __eoi_IO_APIC_irq(unsigned int irq)
+static void __eoi_IO_APIC_irq(struct irq_desc *desc)
 {
-    struct irq_pin_list *entry = irq_2_pin + irq;
-    unsigned int pin, vector = IO_APIC_VECTOR(irq);
+    struct irq_pin_list *entry = irq_2_pin + desc->irq;
+    unsigned int pin, vector = desc->arch.vector;
 
     for (;;) {
         pin = entry->pin;
@@ -468,11 +468,11 @@
     }
 }
 
-static void eoi_IO_APIC_irq(unsigned int irq)
+static void eoi_IO_APIC_irq(struct irq_desc *desc)
 {
     unsigned long flags;
     spin_lock_irqsave(&ioapic_lock, flags);
-    __eoi_IO_APIC_irq(irq);
+    __eoi_IO_APIC_irq(desc);
     spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
@@ -1200,7 +1200,7 @@
         struct irq_pin_list *entry = irq_2_pin + i;
         if (entry->pin < 0)
             continue;
-        printk(KERN_DEBUG "IRQ%d ", IO_APIC_VECTOR(i));
+        printk(KERN_DEBUG "IRQ%d ", irq_to_desc(i)->arch.vector);
         for (;;) {
             printk("-> %d:%d", entry->apic, entry->pin);
             if (!entry->next)
@@ -1621,7 +1621,7 @@
  * operation to prevent an edge-triggered interrupt escaping meanwhile.
  * The idea is from Manfred Spraul.  --macro
  */
-    i = IO_APIC_VECTOR(desc->irq);
+    i = desc->arch.vector;
 
     v = apic_read(APIC_TMR + ((i & ~0x1f) >> 1));
 
@@ -1653,12 +1653,12 @@
         {
             if ( !(desc->status & (IRQ_DISABLED|IRQ_MOVE_PENDING)) )
             {
-                eoi_IO_APIC_irq(desc->irq);
+                eoi_IO_APIC_irq(desc);
                 return;
             }
 
             mask_IO_APIC_irq(desc);
-            eoi_IO_APIC_irq(desc->irq);
+            eoi_IO_APIC_irq(desc);
             if ( (desc->status & IRQ_MOVE_PENDING) &&
                  !io_apic_level_ack_pending(desc->irq) )
                 move_masked_irq(desc);
@@ -1689,7 +1689,7 @@
  * operation to prevent an edge-triggered interrupt escaping meanwhile.
  * The idea is from Manfred Spraul.  --macro
  */
-    i = IO_APIC_VECTOR(desc->irq);
+    i = desc->arch.vector;
 
     /* Manually EOI the old vector if we are moving to the new */
     if ( vector && i != vector )
@@ -1752,7 +1752,7 @@
     int irq;
     /* Xen: This is way simpler than the Linux implementation. */
     for (irq = 0; platform_legacy_irq(irq); irq++)
-        if (IO_APIC_IRQ(irq) && !IO_APIC_VECTOR(irq))
+        if (IO_APIC_IRQ(irq) && !irq_to_vector(irq))
             make_8259A_irq(irq);
 }
 
diff -r d0bbe0622d1d -r 6534da595d69 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/irq.c	Fri Nov 11 09:47:40 2011 +0100
@@ -40,7 +40,6 @@
 
 vmask_t global_used_vector_map;
 
-u8 __read_mostly *irq_vector;
 struct irq_desc __read_mostly *irq_desc = NULL;
 
 static DECLARE_BITMAP(used_vectors, NR_VECTORS);
@@ -134,8 +133,6 @@
         set_bit(vector, desc->arch.used_vectors);
     }
     desc->arch.used = IRQ_USED;
-    if (IO_APIC_IRQ(irq))
-        irq_vector[irq] = vector;
     return 0;
 }
 
@@ -283,7 +280,11 @@
     BUG_ON(irq >= nr_irqs || irq < 0);
 
     if (IO_APIC_IRQ(irq))
-        vector = irq_vector[irq];
+    {
+        vector = irq_to_desc(irq)->arch.vector;
+        if (vector >= FIRST_LEGACY_VECTOR && vector <= LAST_LEGACY_VECTOR)
+            vector = 0;
+    }
     else if (MSI_IRQ(irq))
         vector = irq_to_desc(irq)->arch.vector;
     else
@@ -325,9 +326,8 @@
         this_cpu(vector_irq)[vector] = -1;
 
     irq_desc = xzalloc_array(struct irq_desc, nr_irqs);
-    irq_vector = xzalloc_array(u8, nr_irqs_gsi);
     
-    if ( !irq_desc || !irq_vector )
+    if ( !irq_desc )
         return -ENOMEM;
 
     for (irq = 0; irq < nr_irqs_gsi; irq++) {
@@ -420,7 +420,7 @@
     vmask_t *irq_used_vectors = NULL;
 
     old_vector = irq_to_vector(irq);
-    if (old_vector) {
+    if (old_vector > 0) {
         cpumask_and(&tmp_mask, mask, &cpu_online_map);
         if (cpumask_intersects(&tmp_mask, desc->arch.cpu_mask)) {
             desc->arch.vector = old_vector;
@@ -479,7 +479,7 @@
         /* Found one! */
         current_vector = vector;
         current_offset = offset;
-        if (old_vector) {
+        if (old_vector > 0) {
             desc->arch.move_in_progress = 1;
             cpumask_copy(desc->arch.old_cpu_mask, desc->arch.cpu_mask);
             desc->arch.old_vector = desc->arch.vector;
@@ -495,9 +495,6 @@
                || (desc->arch.used_vectors == irq_used_vectors));
         desc->arch.used_vectors = irq_used_vectors;
 
-        if (IO_APIC_IRQ(irq))
-            irq_vector[irq] = vector;
-
         if ( desc->arch.used_vectors )
         {
             ASSERT(!test_bit(vector, desc->arch.used_vectors));
diff -r d0bbe0622d1d -r 6534da595d69 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/arch/x86/smpboot.c	Fri Nov 11 09:47:40 2011 +0100
@@ -998,7 +998,7 @@
      * IRQ0 must be given a fixed assignment and initialized,
      * because it's used before the IO-APIC is set up.
      */
-    irq_vector[0] = FIRST_HIPRIORITY_VECTOR;
+    irq_to_desc(0)->arch.vector = FIRST_HIPRIORITY_VECTOR;
 
     /*
      * Also ensure serial interrupts are high priority. We do not
@@ -1008,7 +1008,6 @@
     {
         if ( (irq = serial_irq(seridx)) < 0 )
             continue;
-        irq_vector[irq] = FIRST_HIPRIORITY_VECTOR + seridx + 1;
         per_cpu(vector_irq, cpu)[FIRST_HIPRIORITY_VECTOR + seridx + 1] = irq;
         irq_to_desc(irq)->arch.vector = FIRST_HIPRIORITY_VECTOR + seridx + 1;
         cpumask_copy(irq_to_desc(irq)->arch.cpu_mask, &cpu_online_map);
diff -r d0bbe0622d1d -r 6534da595d69 xen/include/asm-x86/irq.h
--- a/xen/include/asm-x86/irq.h	Thu Nov 10 11:12:35 2011 +0000
+++ b/xen/include/asm-x86/irq.h	Fri Nov 11 09:47:40 2011 +0100
@@ -14,7 +14,6 @@
 #define IO_APIC_IRQ(irq)    (platform_legacy_irq(irq) ?    \
 			     (1 << (irq)) & io_apic_irqs : \
 			     (irq) < nr_irqs_gsi)
-#define IO_APIC_VECTOR(irq) (irq_vector[irq])
 
 #define MSI_IRQ(irq)       ((irq) >= nr_irqs_gsi && (irq) < nr_irqs)
 
@@ -48,8 +47,6 @@
 typedef int vector_irq_t[NR_VECTORS];
 DECLARE_PER_CPU(vector_irq_t, vector_irq);
 
-extern u8 *irq_vector;
-
 extern bool_t opt_noirqbalance;
 
 #define OPT_IRQ_VECTOR_MAP_DEFAULT 0 /* Do the default thing  */

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:11:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:11:34 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROslS-0002XR-5t; Fri, 11 Nov 2011 07:11:34 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROsl8-0002TQ-9g
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:14 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-21.messagelabs.com!1321024271!3832101!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4730 invoked from network); 11 Nov 2011 15:11:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:11:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl5-0000Y0-6q
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:11 +0000
Message-Id: <E1ROsl5-0000Y0-6q@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Hypercall continuation cancelation
	in compat mode for XENMEM_get/set_pod_target
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jean Guyader <jean.guyader@eu.citrix.com>
# Date 1321002862 -3600
# Node ID a095cf28f2b6eeb8f5873c18eb18d4d7e5544e2c
# Parent  6534da595d695a4f2af12a64e46fb06219a0e4bc
Hypercall continuation cancelation in compat mode for XENMEM_get/set_pod_target

If copy_to_guest failed in the compat code after a continuation as been
done in the native code we need to cancel it so we won't reexecute the
hypercall but return from the hypercall with the appropriate error.

Signed-off-by: Jean Guyader <jean.guyader@eu.citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 6534da595d69 -r a095cf28f2b6 xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Nov 11 09:47:40 2011 +0100
+++ b/xen/arch/x86/domain.c	Fri Nov 11 10:14:22 2011 +0100
@@ -1724,6 +1724,24 @@
     __arg;                                                                  \
 })
 
+void hypercall_cancel_continuation(void)
+{
+    struct cpu_user_regs *regs = guest_cpu_user_regs();
+    struct mc_state *mcs = &current->mc_state;
+
+    if ( test_bit(_MCSF_in_multicall, &mcs->flags) )
+    {
+        __clear_bit(_MCSF_call_preempted, &mcs->flags);
+    }
+    else
+    {
+        if ( !is_hvm_vcpu(current) )
+            regs->eip += 2; /* skip re-execute 'syscall' / 'int $xx' */
+        else
+            current->arch.hvm_vcpu.hcall_preempted = 0;
+    }
+}
+
 unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...)
 {
diff -r 6534da595d69 -r a095cf28f2b6 xen/arch/x86/x86_64/compat/mm.c
--- a/xen/arch/x86/x86_64/compat/mm.c	Fri Nov 11 09:47:40 2011 +0100
+++ b/xen/arch/x86/x86_64/compat/mm.c	Fri Nov 11 10:14:22 2011 +0100
@@ -133,7 +133,11 @@
         XLAT_pod_target(&cmp, nat);
 
         if ( copy_to_guest(arg, &cmp, 1) )
+        {
+            if ( rc == __HYPERVISOR_memory_op )
+                hypercall_cancel_continuation();
             rc = -EFAULT;
+        }
 
         break;
     }
diff -r 6534da595d69 -r a095cf28f2b6 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h	Fri Nov 11 09:47:40 2011 +0100
+++ b/xen/include/xen/sched.h	Fri Nov 11 10:14:22 2011 +0100
@@ -554,6 +554,7 @@
  */
 unsigned long hypercall_create_continuation(
     unsigned int op, const char *format, ...);
+void hypercall_cancel_continuation(void);
 
 #define hypercall_preempt_check() (unlikely(    \
         softirq_pending(smp_processor_id()) |   \

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:11:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:11:43 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROsla-0002aj-Ti; Fri, 11 Nov 2011 07:11:42 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROsl8-0002TR-Un
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:15 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1321024271!2772619!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18581 invoked from network); 11 Nov 2011 15:11:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:11:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl5-0000Yf-OG
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:11 +0000
Message-Id: <E1ROsl5-0000Yf-OG@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Use pci access function
	to detect msi capabilities
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009315 -3600
# Node ID 223b10f17d31c55249fac07be41328f7a12569cb
# Parent  a095cf28f2b6eeb8f5873c18eb18d4d7e5544e2c
amd iommu: Use pci access function to detect msi capabilities

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r a095cf28f2b6 -r 223b10f17d31 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 10:14:22 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 12:01:55 2011 +0100
@@ -30,38 +30,19 @@
 static int __init get_iommu_msi_capabilities(
     u16 seg, u8 bus, u8 dev, u8 func, struct amd_iommu *iommu)
 {
-    int cap_ptr, cap_id;
-    u32 cap_header;
+    int pos;
     u16 control;
-    int count = 0;
 
-    cap_ptr = pci_conf_read8(seg, bus, dev, func,
-            PCI_CAPABILITY_LIST);
+    pos = pci_find_cap_offset(seg, bus, dev, func, PCI_CAP_ID_MSI);
 
-    while ( cap_ptr >= PCI_MIN_CAP_OFFSET &&
-        count < PCI_MAX_CAP_BLOCKS )
-    {
-        cap_ptr &= PCI_CAP_PTR_MASK;
-        cap_header = pci_conf_read32(seg, bus, dev, func, cap_ptr);
-        cap_id = get_field_from_reg_u32(cap_header,
-                PCI_CAP_ID_MASK, PCI_CAP_ID_SHIFT);
-
-        if ( cap_id == PCI_CAP_ID_MSI )
-        {
-            iommu->msi_cap = cap_ptr;
-            break;
-        }
-        cap_ptr = get_field_from_reg_u32(cap_header,
-                PCI_CAP_NEXT_PTR_MASK, PCI_CAP_NEXT_PTR_SHIFT);
-        count++;
-    }
-
-    if ( !iommu->msi_cap )
+    if ( !pos )
         return -ENODEV;
 
-    AMD_IOMMU_DEBUG("Found MSI capability block \n");
+    AMD_IOMMU_DEBUG("Found MSI capability block at %#x\n", pos);
+
+    iommu->msi_cap = pos;
     control = pci_conf_read16(seg, bus, dev, func,
-            iommu->msi_cap + PCI_MSI_FLAGS);
+                              iommu->msi_cap + PCI_MSI_FLAGS);
     iommu->maskbit = control & PCI_MSI_FLAGS_MASKBIT;
     return 0;
 }

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:11:56 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:11:56 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROslo-0002dn-LZ; Fri, 11 Nov 2011 07:11:56 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROsl9-0002TS-BI
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:15 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-21.messagelabs.com!1321024272!3822045!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17625 invoked from network); 11 Nov 2011 15:11:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:11:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl6-0000ZK-9P
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:12 +0000
Message-Id: <E1ROsl6-0000ZK-9P@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Cleanup iommu pci
	capabilites detection
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009401 -3600
# Node ID 0ed7b19992969b787ec61a43b5d5528b20c02e97
# Parent  223b10f17d31c55249fac07be41328f7a12569cb
amd iommu: Cleanup iommu pci capabilites detection

* Define new structure to represent capability block.
* Remove unnecessary read for unused information.
* Add sanity check into get_iommu_capabilities.
* iommu capability offset is 16 bit not 8 bit, fix that.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 223b10f17d31 -r 0ed7b1999296 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 12:01:55 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 12:03:21 2011 +0100
@@ -48,25 +48,16 @@
 }
 
 static int __init get_iommu_capabilities(
-    u16 seg, u8 bus, u8 dev, u8 func, u8 cap_ptr, struct amd_iommu *iommu)
+    u16 seg, u8 bus, u8 dev, u8 func, u16 cap_ptr, struct amd_iommu *iommu)
 {
-    u32 cap_header, cap_range, misc_info;
+    u8 type;
 
-    cap_header = pci_conf_read32(seg, bus, dev, func, cap_ptr);
-    iommu->revision = get_field_from_reg_u32(
-        cap_header, PCI_CAP_REV_MASK, PCI_CAP_REV_SHIFT);
-    iommu->pte_not_present_cached = get_field_from_reg_u32(
-        cap_header, PCI_CAP_NP_CACHE_MASK, PCI_CAP_NP_CACHE_SHIFT);
+    iommu->cap.header = pci_conf_read32(seg, bus, dev, func, cap_ptr);
+    type = get_field_from_reg_u32(iommu->cap.header, PCI_CAP_TYPE_MASK,
+                                  PCI_CAP_TYPE_SHIFT);
 
-    cap_range = pci_conf_read32(seg, bus, dev, func,
-                                cap_ptr + PCI_CAP_RANGE_OFFSET);
-    iommu->unit_id = get_field_from_reg_u32(
-        cap_range, PCI_CAP_UNIT_ID_MASK, PCI_CAP_UNIT_ID_SHIFT);
-
-    misc_info = pci_conf_read32(seg, bus, dev, func,
-                                cap_ptr + PCI_MISC_INFO_OFFSET);
-    iommu->msi_number = get_field_from_reg_u32(
-        misc_info, PCI_CAP_MSI_NUMBER_MASK, PCI_CAP_MSI_NUMBER_SHIFT);
+    if ( type != PCI_CAP_TYPE_IOMMU )
+        return -ENODEV;
 
     return 0;
 }
@@ -76,6 +67,7 @@
     struct amd_iommu *iommu;
     u8 bus, dev, func;
     struct acpi_ivhd_block_header *ivhd_block;
+    int rt = 0;
 
     ivhd_block = (struct acpi_ivhd_block_header *)ivhd;
 
@@ -125,12 +117,19 @@
     iommu->ht_tunnel_enable = get_field_from_byte(ivhd_block->header.flags,
                         AMD_IOMMU_ACPI_HT_TUN_ENB_MASK,
                         AMD_IOMMU_ACPI_HT_TUN_ENB_SHIFT);
-    bus = iommu->bdf >> 8;
-    dev = PCI_SLOT(iommu->bdf & 0xFF);
-    func = PCI_FUNC(iommu->bdf & 0xFF);
-    get_iommu_capabilities(iommu->seg, bus, dev, func,
-                           iommu->cap_offset, iommu);
-    get_iommu_msi_capabilities(iommu->seg, bus, dev, func, iommu);
+
+    bus = PCI_BUS(iommu->bdf);
+    dev = PCI_SLOT(iommu->bdf);
+    func = PCI_FUNC(iommu->bdf);
+
+    rt = get_iommu_capabilities(iommu->seg, bus, dev, func,
+                                iommu->cap_offset, iommu);
+    if ( rt )
+        return -ENODEV;
+
+    rt = get_iommu_msi_capabilities(iommu->seg, bus, dev, func, iommu);
+    if ( rt )
+        return -ENODEV;
 
     list_add_tail(&iommu->list, &amd_iommu_head);
 
diff -r 223b10f17d31 -r 0ed7b1999296 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:01:55 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:03:21 2011 +0100
@@ -36,16 +36,22 @@
     unsigned long alloc_size;
 };
 
+typedef struct iommu_cap {
+    uint32_t header;                    /* offset 00h */
+    uint32_t base_low;                  /* offset 04h */
+    uint32_t base_hi;                   /* offset 08h */
+    uint32_t range;                     /* offset 0Ch */
+    uint32_t misc;                      /* offset 10h */
+} iommu_cap_t;
+
 struct amd_iommu {
     struct list_head list;
     spinlock_t lock; /* protect iommu */
 
     u16 seg;
     u16 bdf;
-    u8  cap_offset;
-    u8  revision;
-    u8  unit_id;
-    u8  msi_number;
+    u16 cap_offset;
+    iommu_cap_t cap;
 
     u8 pte_not_present_cached;
     u8 ht_tunnel_support;
diff -r 223b10f17d31 -r 0ed7b1999296 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Fri Nov 11 12:01:55 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Fri Nov 11 12:03:21 2011 +0100
@@ -74,7 +74,7 @@
 
 #define PCI_CAP_UNIT_ID_MASK    0x0000001F
 #define PCI_CAP_UNIT_ID_SHIFT   0
-#define PCI_MISC_INFO_OFFSET    0x10
+#define PCI_CAP_MISC_INFO_OFFSET    0x10
 #define PCI_CAP_MSI_NUMBER_MASK     0x0000001F
 #define PCI_CAP_MSI_NUMBER_SHIFT    0
 

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:12:06 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:12:06 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROsly-0002hl-G5; Fri, 11 Nov 2011 07:12:06 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROsl9-0002TT-TH
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-27.messagelabs.com!1321024243!52731890!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 663 invoked from network); 11 Nov 2011 15:10:43 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:10:43 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl6-0000Zy-Qv
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:12 +0000
Message-Id: <E1ROsl6-0000Zy-Qv@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Simplify IVHD device flag
	handling
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009450 -3600
# Node ID 8567b33f5837eb0057eb3dad417fd4408c74b2ba
# Parent  0ed7b19992969b787ec61a43b5d5528b20c02e97
amd iommu: Simplify IVHD device flag handling

These bits are aligned to corresponding fields in device table entry. They
can be updated by a single device entry write.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 0ed7b1999296 -r 8567b33f5837 xen/drivers/passthrough/amd/iommu_acpi.c
--- a/xen/drivers/passthrough/amd/iommu_acpi.c	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_acpi.c	Fri Nov 11 12:04:10 2011 +0100
@@ -31,38 +31,14 @@
     u16 bdf, u16 alias_id, u8 flags, struct amd_iommu *iommu)
 {
     struct ivrs_mappings *ivrs_mappings = get_ivrs_mappings(iommu->seg);
-    u8 sys_mgt, lint1_pass, lint0_pass, nmi_pass, ext_int_pass, init_pass;
+
     ASSERT( ivrs_mappings != NULL );
 
     /* setup requestor id */
     ivrs_mappings[bdf].dte_requestor_id = alias_id;
 
     /* override flags for range of devices */
-    sys_mgt = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_SYS_MGT_MASK,
-                                  AMD_IOMMU_ACPI_SYS_MGT_SHIFT);
-    lint1_pass = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_LINT1_PASS_MASK,
-                                  AMD_IOMMU_ACPI_LINT1_PASS_SHIFT);
-    lint0_pass = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_LINT0_PASS_MASK,
-                                  AMD_IOMMU_ACPI_LINT0_PASS_SHIFT);
-    nmi_pass = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_NMI_PASS_MASK,
-                                  AMD_IOMMU_ACPI_NMI_PASS_SHIFT);
-    ext_int_pass = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_EINT_PASS_MASK,
-                                  AMD_IOMMU_ACPI_EINT_PASS_SHIFT);
-    init_pass = get_field_from_byte(flags,
-                                  AMD_IOMMU_ACPI_INIT_PASS_MASK,
-                                  AMD_IOMMU_ACPI_INIT_PASS_SHIFT);
-
-    ivrs_mappings[bdf].dte_sys_mgt_enable = sys_mgt;
-    ivrs_mappings[bdf].dte_lint1_pass = lint1_pass;
-    ivrs_mappings[bdf].dte_lint0_pass = lint0_pass;
-    ivrs_mappings[bdf].dte_nmi_pass = nmi_pass;
-    ivrs_mappings[bdf].dte_ext_int_pass = ext_int_pass;
-    ivrs_mappings[bdf].dte_init_pass = init_pass;
+    ivrs_mappings[bdf].device_flags = flags;
 
     if (ivrs_mappings[alias_id].intremap_table == NULL )
     {
diff -r 0ed7b1999296 -r 8567b33f5837 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:04:10 2011 +0100
@@ -790,18 +790,12 @@
     for ( bdf = 0; bdf < ivrs_bdf_entries; bdf++ )
     {
         ivrs_mappings[bdf].dte_requestor_id = bdf;
-        ivrs_mappings[bdf].dte_sys_mgt_enable =
-            IOMMU_DEV_TABLE_SYS_MGT_MSG_FORWARDED;
         ivrs_mappings[bdf].dte_allow_exclusion = IOMMU_CONTROL_DISABLED;
         ivrs_mappings[bdf].unity_map_enable = IOMMU_CONTROL_DISABLED;
         ivrs_mappings[bdf].iommu = NULL;
 
         ivrs_mappings[bdf].intremap_table = NULL;
-        ivrs_mappings[bdf].dte_lint1_pass = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].dte_lint0_pass = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].dte_nmi_pass = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].dte_ext_int_pass = IOMMU_CONTROL_DISABLED;
-        ivrs_mappings[bdf].dte_init_pass = IOMMU_CONTROL_DISABLED;
+        ivrs_mappings[bdf].device_flags = 0;
 
         if ( amd_iommu_perdev_intremap )
             spin_lock_init(&ivrs_mappings[bdf].intremap_lock);
@@ -817,8 +811,6 @@
 {
     int bdf;
     void *intr_tb, *dte;
-    int sys_mgt, dev_ex, lint1_pass, lint0_pass,
-       nmi_pass, ext_int_pass, init_pass;
 
     BUG_ON( (ivrs_bdf_entries == 0) );
 
@@ -840,21 +832,9 @@
 
         if ( intr_tb )
         {
-            sys_mgt = ivrs_mappings[bdf].dte_sys_mgt_enable;
-            dev_ex = ivrs_mappings[bdf].dte_allow_exclusion;
-
-            /* get interrupt remapping settings */
-            lint1_pass = ivrs_mappings[bdf].dte_lint1_pass;
-            lint0_pass = ivrs_mappings[bdf].dte_lint0_pass;
-            nmi_pass = ivrs_mappings[bdf].dte_nmi_pass;
-            ext_int_pass = ivrs_mappings[bdf].dte_ext_int_pass;
-            init_pass = ivrs_mappings[bdf].dte_init_pass;
-
             /* add device table entry */
             dte = device_table.buffer + (bdf * IOMMU_DEV_TABLE_ENTRY_SIZE);
-            amd_iommu_add_dev_table_entry(
-                dte, sys_mgt, dev_ex, lint1_pass, lint0_pass,
-                nmi_pass, ext_int_pass, init_pass);
+            iommu_dte_add_device_entry(dte, &ivrs_mappings[bdf]);
 
             amd_iommu_set_intremap_table(
                 dte, (u64)virt_to_maddr(intr_tb), iommu_intremap);
diff -r 0ed7b1999296 -r 8567b33f5837 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Fri Nov 11 12:04:10 2011 +0100
@@ -23,6 +23,7 @@
 #include <xen/hvm/iommu.h>
 #include <asm/amd-iommu.h>
 #include <asm/hvm/svm/amd-iommu-proto.h>
+#include <asm/hvm/svm/amd-iommu-acpi.h>
 #include "../ats.h"
 #include <xen/pci.h>
 
@@ -419,35 +420,23 @@
     dte[4] = entry;
 }
 
-void __init amd_iommu_add_dev_table_entry(
-    u32 *dte, u8 sys_mgt, u8 dev_ex, u8 lint1_pass, u8 lint0_pass, 
-    u8 nmi_pass, u8 ext_int_pass, u8 init_pass)
+void __init iommu_dte_add_device_entry(u32 *dte, struct ivrs_mappings *ivrs_dev)
 {
     u32 entry;
+    u8 sys_mgt, dev_ex, flags;
+    u8 mask = ~(0x7 << 3);
 
     dte[7] = dte[6] = dte[4] = dte[2] = dte[1] = dte[0] = 0;
 
+    flags = ivrs_dev->device_flags;
+    sys_mgt = get_field_from_byte(flags, AMD_IOMMU_ACPI_SYS_MGT_MASK,
+                                  AMD_IOMMU_ACPI_SYS_MGT_SHIFT);
+    dev_ex = ivrs_dev->dte_allow_exclusion;
 
-    set_field_in_reg_u32(init_pass ? IOMMU_CONTROL_ENABLED :
-                        IOMMU_CONTROL_DISABLED, 0,
-                        IOMMU_DEV_TABLE_INIT_PASSTHRU_MASK,
-                        IOMMU_DEV_TABLE_INIT_PASSTHRU_SHIFT, &entry);
-    set_field_in_reg_u32(ext_int_pass ? IOMMU_CONTROL_ENABLED :
-                        IOMMU_CONTROL_DISABLED, entry,
-                        IOMMU_DEV_TABLE_EINT_PASSTHRU_MASK,
-                        IOMMU_DEV_TABLE_EINT_PASSTHRU_SHIFT, &entry);
-    set_field_in_reg_u32(nmi_pass ? IOMMU_CONTROL_ENABLED :
-                        IOMMU_CONTROL_DISABLED, entry,
-                        IOMMU_DEV_TABLE_NMI_PASSTHRU_MASK,
-                        IOMMU_DEV_TABLE_NMI_PASSTHRU_SHIFT, &entry);
-    set_field_in_reg_u32(lint0_pass ? IOMMU_CONTROL_ENABLED :
-                        IOMMU_CONTROL_DISABLED, entry,
-                        IOMMU_DEV_TABLE_LINT0_ENABLE_MASK,
-                        IOMMU_DEV_TABLE_LINT0_ENABLE_SHIFT, &entry);
-    set_field_in_reg_u32(lint1_pass ? IOMMU_CONTROL_ENABLED :
-                        IOMMU_CONTROL_DISABLED, entry,
-                        IOMMU_DEV_TABLE_LINT1_ENABLE_MASK,
-                        IOMMU_DEV_TABLE_LINT1_ENABLE_SHIFT, &entry);
+    flags &= mask;
+    set_field_in_reg_u32(flags, 0,
+                         IOMMU_DEV_TABLE_IVHD_FLAGS_MASK,
+                         IOMMU_DEV_TABLE_IVHD_FLAGS_SHIFT, &entry);
     dte[5] = entry;
 
     set_field_in_reg_u32(sys_mgt, 0,
diff -r 0ed7b1999296 -r 8567b33f5837 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:04:10 2011 +0100
@@ -86,7 +86,6 @@
 
 struct ivrs_mappings {
     u16 dte_requestor_id;
-    u8 dte_sys_mgt_enable;
     u8 dte_allow_exclusion;
     u8 unity_map_enable;
     u8 write_permission;
@@ -99,12 +98,8 @@
     void *intremap_table;
     spinlock_t intremap_lock;
 
-    /* interrupt remapping settings */
-    u8 dte_lint1_pass;
-    u8 dte_lint0_pass;
-    u8 dte_nmi_pass;
-    u8 dte_ext_int_pass;
-    u8 dte_init_pass;
+    /* ivhd device data settings */
+    u8 device_flags;
 };
 
 extern unsigned short ivrs_bdf_entries;
diff -r 0ed7b1999296 -r 8567b33f5837 xen/include/asm-x86/hvm/svm/amd-iommu-defs.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-defs.h	Fri Nov 11 12:04:10 2011 +0100
@@ -158,18 +158,11 @@
 /* DeviceTable Entry[191:160] */
 #define IOMMU_DEV_TABLE_INT_TABLE_PTR_HIGH_MASK     0x000FFFFF
 #define IOMMU_DEV_TABLE_INT_TABLE_PTR_HIGH_SHIFT    0
-#define IOMMU_DEV_TABLE_INIT_PASSTHRU_MASK      0x01000000
-#define IOMMU_DEV_TABLE_INIT_PASSTHRU_SHIFT     24
-#define IOMMU_DEV_TABLE_EINT_PASSTHRU_MASK      0x02000000
-#define IOMMU_DEV_TABLE_EINT_PASSTHRU_SHIFT     25
-#define IOMMU_DEV_TABLE_NMI_PASSTHRU_MASK       0x04000000
-#define IOMMU_DEV_TABLE_NMI_PASSTHRU_SHIFT      26
+#define IOMMU_DEV_TABLE_IVHD_FLAGS_SHIFT        24
+#define IOMMU_DEV_TABLE_IVHD_FLAGS_MASK         0xC7000000
 #define IOMMU_DEV_TABLE_INT_CONTROL_MASK        0x30000000
 #define IOMMU_DEV_TABLE_INT_CONTROL_SHIFT       28
-#define IOMMU_DEV_TABLE_LINT0_ENABLE_MASK       0x40000000
-#define IOMMU_DEV_TABLE_LINT0_ENABLE_SHIFT      30
-#define IOMMU_DEV_TABLE_LINT1_ENABLE_MASK       0x80000000
-#define IOMMU_DEV_TABLE_LINT1_ENABLE_SHIFT      31
+
 
 /* Command Buffer */
 #define IOMMU_CMD_BUFFER_BASE_LOW_OFFSET	0x08
diff -r 0ed7b1999296 -r 8567b33f5837 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:03:21 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:04:10 2011 +0100
@@ -68,14 +68,12 @@
 
 /* device table functions */
 int get_dma_requestor_id(u16 seg, u16 bdf);
-void amd_iommu_add_dev_table_entry(
-    u32 *dte, u8 sys_mgt, u8 dev_ex, u8 lint1_pass, u8 lint0_pass, 
-    u8 nmi_pass, u8 ext_int_pass, u8 init_pass);
 void amd_iommu_set_intremap_table(
     u32 *dte, u64 intremap_ptr, u8 int_valid);
 void amd_iommu_set_root_page_table(
     u32 *dte, u64 root_ptr, u16 domain_id, u8 paging_mode, u8 valid);
 void iommu_dte_set_iotlb(u32 *dte, u8 i);
+void iommu_dte_add_device_entry(u32 *dte, struct ivrs_mappings *ivrs_dev);
 void invalidate_dev_table_entry(struct amd_iommu *iommu, u16 devic_id);
 
 /* send cmd to iommu */

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:12:14 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:12:14 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROsm6-0002kl-0c; Fri, 11 Nov 2011 07:12:14 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROslA-0002TV-Vx
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-27.messagelabs.com!1321024156!43983924!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18688 invoked from network); 11 Nov 2011 15:09:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:09:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl7-0000bH-TJ
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:13 +0000
Message-Id: <E1ROsl7-0000bH-TJ@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Compress hyper-transport
	flags into a single byte
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009514 -3600
# Node ID d23685e36486bbd974bb97b95629e4efe93a0c5b
# Parent  a2d9ba837d70000474af1b5389bfa0536b886d46
amd iommu: Compress hyper-transport flags into a single byte

These flags are single bit, no need to be saved as integers.
Add 3 inline helpers to make single bit access easier.
Introduce iommu_has_ht_flag and set_iommu_ht_flags

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r a2d9ba837d70 -r d23685e36486 xen/drivers/passthrough/amd/iommu_detect.c
--- a/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 12:04:41 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_detect.c	Fri Nov 11 12:05:14 2011 +0100
@@ -98,25 +98,8 @@
     iommu->cap_offset = ivhd_block->cap_offset;
     iommu->mmio_base_phys = ivhd_block->mmio_base;
 
-    /* override IOMMU support flags */
-    iommu->coherent = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_COHERENT_MASK,
-                        AMD_IOMMU_ACPI_COHERENT_SHIFT);
-    iommu->iotlb_support = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_IOTLB_SUP_MASK,
-                        AMD_IOMMU_ACPI_IOTLB_SUP_SHIFT);
-    iommu->isochronous = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_ISOC_MASK,
-                        AMD_IOMMU_ACPI_ISOC_SHIFT);
-    iommu->res_pass_pw = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_RES_PASS_PW_MASK,
-                        AMD_IOMMU_ACPI_RES_PASS_PW_SHIFT);
-    iommu->pass_pw = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_PASS_PW_MASK,
-                        AMD_IOMMU_ACPI_PASS_PW_SHIFT);
-    iommu->ht_tunnel_enable = get_field_from_byte(ivhd_block->header.flags,
-                        AMD_IOMMU_ACPI_HT_TUN_ENB_MASK,
-                        AMD_IOMMU_ACPI_HT_TUN_ENB_SHIFT);
+    /* override IOMMU HT flags */
+    iommu->ht_flags = ivhd_block->header.flags;
 
     bus = PCI_BUS(iommu->bdf);
     dev = PCI_SLOT(iommu->bdf);
diff -r a2d9ba837d70 -r d23685e36486 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:04:41 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:05:14 2011 +0100
@@ -28,6 +28,7 @@
 #include <asm/hvm/svm/amd-iommu-proto.h>
 #include <asm-x86/fixmap.h>
 #include <mach_apic.h>
+#include <asm/hvm/svm/amd-iommu-acpi.h>
 
 static int __initdata nr_amd_iommus;
 
@@ -36,6 +37,12 @@
 struct list_head amd_iommu_head;
 struct table_struct device_table;
 
+static int iommu_has_ht_flag(struct amd_iommu *iommu, uint8_t bit)
+{
+    u8 mask = 1U << bit;
+    return iommu->ht_flags & mask;
+}
+
 static int __init map_iommu_mmio_region(struct amd_iommu *iommu)
 {
     unsigned long mfn;
@@ -66,6 +73,34 @@
     }
 }
 
+static void set_iommu_ht_flags(struct amd_iommu *iommu)
+{
+    u32 entry;
+    entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
+
+    /* Setup HT flags */
+    iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_HT_TUN_ENB_SHIFT) ?
+        iommu_set_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT):
+        iommu_clear_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT);
+
+    iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_RES_PASS_PW_SHIFT) ?
+        iommu_set_bit(&entry, IOMMU_CONTROL_RESP_PASS_POSTED_WRITE_SHIFT):
+        iommu_clear_bit(&entry, IOMMU_CONTROL_RESP_PASS_POSTED_WRITE_SHIFT);
+
+    iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_ISOC_SHIFT) ?
+        iommu_set_bit(&entry, IOMMU_CONTROL_ISOCHRONOUS_SHIFT):
+        iommu_clear_bit(&entry, IOMMU_CONTROL_ISOCHRONOUS_SHIFT);
+
+    iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_PASS_PW_SHIFT) ?
+        iommu_set_bit(&entry, IOMMU_CONTROL_PASS_POSTED_WRITE_SHIFT):
+        iommu_clear_bit(&entry, IOMMU_CONTROL_PASS_POSTED_WRITE_SHIFT);
+
+    /* Force coherent */
+    iommu_set_bit(&entry, IOMMU_CONTROL_COHERENT_SHIFT);
+
+    writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET);
+}
+
 static void register_iommu_dev_table_in_mmio_space(struct amd_iommu *iommu)
 {
     u64 addr_64, addr_lo, addr_hi;
@@ -150,33 +185,10 @@
 
     entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
 
-    if ( enable )
-    {
-        set_field_in_reg_u32(iommu->ht_tunnel_support ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_MASK,
-                         IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT, &entry);
-        set_field_in_reg_u32(iommu->isochronous ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_ISOCHRONOUS_MASK,
-                         IOMMU_CONTROL_ISOCHRONOUS_SHIFT, &entry);
-        set_field_in_reg_u32(iommu->coherent ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_COHERENT_MASK,
-                         IOMMU_CONTROL_COHERENT_SHIFT, &entry);
-        set_field_in_reg_u32(iommu->res_pass_pw ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_RESP_PASS_POSTED_WRITE_MASK,
-                         IOMMU_CONTROL_RESP_PASS_POSTED_WRITE_SHIFT, &entry);
-        /* do not set PassPW bit */
-        set_field_in_reg_u32(IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_PASS_POSTED_WRITE_MASK,
-                         IOMMU_CONTROL_PASS_POSTED_WRITE_SHIFT, &entry);
-    }
-    set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_TRANSLATION_ENABLE_MASK,
-                         IOMMU_CONTROL_TRANSLATION_ENABLE_SHIFT, &entry);
+    enable ?
+        iommu_set_bit(&entry, IOMMU_CONTROL_TRANSLATION_ENABLE_SHIFT):
+        iommu_clear_bit(&entry, IOMMU_CONTROL_TRANSLATION_ENABLE_SHIFT);
+
     writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET);
 }
 
@@ -186,17 +198,17 @@
     u32 entry;
 
     entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
-    set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_MASK,
-                         IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_SHIFT, &entry);
 
     /*reset head and tail pointer manually before enablement */
-    if ( enable == IOMMU_CONTROL_ENABLED )
+    if ( enable )
     {
         writel(0x0, iommu->mmio_base + IOMMU_CMD_BUFFER_HEAD_OFFSET);
         writel(0x0, iommu->mmio_base + IOMMU_CMD_BUFFER_TAIL_OFFSET);
+
+        iommu_set_bit(&entry, IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_SHIFT);
     }
+    else
+        iommu_clear_bit(&entry, IOMMU_CONTROL_COMMAND_BUFFER_ENABLE_SHIFT);
 
     writel(entry, iommu->mmio_base+IOMMU_CONTROL_MMIO_OFFSET);
 }
@@ -247,24 +259,24 @@
     u32 entry;
 
     entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
-    set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_EVENT_LOG_ENABLE_MASK,
-                         IOMMU_CONTROL_EVENT_LOG_ENABLE_SHIFT, &entry);
-    set_field_in_reg_u32(enable ? IOMMU_CONTROL_ENABLED :
-                         IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_EVENT_LOG_INT_MASK,
-                         IOMMU_CONTROL_EVENT_LOG_INT_SHIFT, &entry);
-    set_field_in_reg_u32(IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_CONTROL_COMP_WAIT_INT_MASK,
-                         IOMMU_CONTROL_COMP_WAIT_INT_SHIFT, &entry);
 
     /*reset head and tail pointer manually before enablement */
-    if ( enable == IOMMU_CONTROL_ENABLED )
+    if ( enable )
     {
         writel(0x0, iommu->mmio_base + IOMMU_EVENT_LOG_HEAD_OFFSET);
         writel(0x0, iommu->mmio_base + IOMMU_EVENT_LOG_TAIL_OFFSET);
+
+        iommu_set_bit(&entry, IOMMU_CONTROL_EVENT_LOG_INT_SHIFT);
+        iommu_set_bit(&entry, IOMMU_CONTROL_EVENT_LOG_ENABLE_SHIFT);
     }
+    else
+    {
+        iommu_clear_bit(&entry, IOMMU_CONTROL_EVENT_LOG_INT_SHIFT);
+        iommu_clear_bit(&entry, IOMMU_CONTROL_EVENT_LOG_ENABLE_SHIFT);
+    }
+
+    iommu_clear_bit(&entry, IOMMU_CONTROL_COMP_WAIT_INT_SHIFT);
+
     writel(entry, iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
 }
 
@@ -313,9 +325,7 @@
     /* wait until EventLogRun bit = 0 */
     do {
         entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET);
-        log_run = get_field_from_reg_u32(entry,
-                                        IOMMU_STATUS_EVENT_LOG_RUN_MASK,
-                                        IOMMU_STATUS_EVENT_LOG_RUN_SHIFT);
+        log_run = iommu_get_bit(entry, IOMMU_STATUS_EVENT_LOG_RUN_SHIFT);
         loop_count--;
     } while ( log_run && loop_count );
 
@@ -330,11 +340,9 @@
 
     /* read event log for debugging */
     amd_iommu_read_event_log(iommu);
+    /*clear overflow bit */
+    iommu_clear_bit(&entry, IOMMU_STATUS_EVENT_OVERFLOW_SHIFT);
 
-    /*clear overflow bit */
-    set_field_in_reg_u32(IOMMU_CONTROL_DISABLED, entry,
-                         IOMMU_STATUS_EVENT_OVERFLOW_MASK,
-                         IOMMU_STATUS_EVENT_OVERFLOW_SHIFT, &entry);
     writel(entry, iommu->mmio_base+IOMMU_STATUS_MMIO_OFFSET);
 
     /*reset event log base address */
@@ -519,7 +527,6 @@
 {
     u32 entry;
     unsigned long flags;
-    int of;
     struct amd_iommu *iommu = dev_id;
 
     spin_lock_irqsave(&iommu->lock, flags);
@@ -527,19 +534,14 @@
 
     /*check event overflow */
     entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET);
-    of = get_field_from_reg_u32(entry,
-                               IOMMU_STATUS_EVENT_OVERFLOW_MASK,
-                               IOMMU_STATUS_EVENT_OVERFLOW_SHIFT);
 
-    /* reset event log if event overflow */
-    if ( of )
+    if ( iommu_get_bit(entry, IOMMU_STATUS_EVENT_OVERFLOW_SHIFT) )
         amd_iommu_reset_event_log(iommu);
 
     /* reset interrupt status bit */
     entry = readl(iommu->mmio_base + IOMMU_STATUS_MMIO_OFFSET);
-    set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, entry,
-                         IOMMU_STATUS_EVENT_LOG_INT_MASK,
-                         IOMMU_STATUS_EVENT_LOG_INT_SHIFT, &entry);
+    iommu_set_bit(&entry, IOMMU_STATUS_EVENT_LOG_INT_SHIFT);
+
     writel(entry, iommu->mmio_base+IOMMU_STATUS_MMIO_OFFSET);
     spin_unlock_irqrestore(&iommu->lock, flags);
 }
@@ -590,6 +592,7 @@
     iommu_msi_set_affinity(irq_to_desc(iommu->irq), &cpu_online_map);
     amd_iommu_msi_enable(iommu, IOMMU_CONTROL_ENABLED);
 
+    set_iommu_ht_flags(iommu);
     set_iommu_command_buffer_control(iommu, IOMMU_CONTROL_ENABLED);
     set_iommu_event_log_control(iommu, IOMMU_CONTROL_ENABLED);
     set_iommu_translation_control(iommu, IOMMU_CONTROL_ENABLED);
diff -r a2d9ba837d70 -r d23685e36486 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:04:41 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:05:14 2011 +0100
@@ -57,11 +57,7 @@
     u8 ht_tunnel_support;
     u8 iotlb_support;
 
-    u8 isochronous;
-    u8 coherent;
-    u8 res_pass_pw;
-    u8 pass_pw;
-    u8 ht_tunnel_enable;
+    u8 ht_flags;
 
     void *mmio_base;
     unsigned long mmio_base_phys;
diff -r a2d9ba837d70 -r d23685e36486 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:04:41 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:05:14 2011 +0100
@@ -166,4 +166,19 @@
     free_xenheap_pages(table, order);
 }
 
+static inline void iommu_set_bit(uint32_t *reg, uint32_t bit)
+{
+    set_field_in_reg_u32(IOMMU_CONTROL_ENABLED, *reg, 1U << bit, bit, reg);
+}
+
+static inline void iommu_clear_bit(uint32_t *reg, uint32_t bit)
+{
+    set_field_in_reg_u32(IOMMU_CONTROL_DISABLED, *reg, 1U << bit, bit, reg);
+}
+
+static inline uint32_t iommu_get_bit(uint32_t reg, uint32_t bit)
+{
+    return get_field_from_reg_u32(reg, 1U << bit, bit);
+}
+
 #endif /* _ASM_X86_64_AMD_IOMMU_PROTO_H */

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:12:23 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:12:23 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROsmE-0002no-Ta; Fri, 11 Nov 2011 07:12:22 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROslA-0002TU-Su
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-216.messagelabs.com!1321024273!3178241!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 10507 invoked from network); 11 Nov 2011 15:11:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:11:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl7-0000ac-Bh
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:13 +0000
Message-Id: <E1ROsl7-0000ac-Bh@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Disable debug output for
	early DTE update
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009481 -3600
# Node ID a2d9ba837d70000474af1b5389bfa0536b886d46
# Parent  8567b33f5837eb0057eb3dad417fd4408c74b2ba
amd iommu: Disable debug output for early DTE update

Some systems may have IVHD device entries that cover large device id range.
Having those entries displayed will take very long time to boot.

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 8567b33f5837 -r a2d9ba837d70 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:04:10 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:04:41 2011 +0100
@@ -838,10 +838,6 @@
 
             amd_iommu_set_intremap_table(
                 dte, (u64)virt_to_maddr(intr_tb), iommu_intremap);
-
-            AMD_IOMMU_DEBUG("Add device table entry: device id = 0x%04x, "
-                            "interupt table = 0x%"PRIx64"\n", bdf,
-                            (u64)virt_to_maddr(intr_tb));
         }
     }
 

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 07:12:31 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 07:12:31 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROsmN-0002qs-6z; Fri, 11 Nov 2011 07:12:31 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROslB-0002Te-ME
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 07:11:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1321024274!2763764!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21038 invoked from network); 11 Nov 2011 15:11:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 15:11:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROsl8-0000bx-Ey
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 15:11:14 +0000
Message-Id: <E1ROsl8-0000bx-Ey@xenbits.xen.org>
Date: Fri, 11 Nov 2011 15:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] amd iommu: Introduce iommu_has_cap()
	function
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Wei Wang <wei.wang2@amd.com>
# Date 1321009561 -3600
# Node ID 4699decb8424a00447c466205be3cb4d0fb95a76
# Parent  d23685e36486bbd974bb97b95629e4efe93a0c5b
amd iommu: Introduce iommu_has_cap() function

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r d23685e36486 -r 4699decb8424 xen/drivers/passthrough/amd/iommu_init.c
--- a/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:05:14 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_init.c	Fri Nov 11 12:06:01 2011 +0100
@@ -79,9 +79,10 @@
     entry = readl(iommu->mmio_base + IOMMU_CONTROL_MMIO_OFFSET);
 
     /* Setup HT flags */
-    iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_HT_TUN_ENB_SHIFT) ?
-        iommu_set_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT):
-        iommu_clear_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT);
+    if ( iommu_has_cap(iommu, PCI_CAP_HT_TUNNEL_SHIFT) )
+        iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_HT_TUN_ENB_SHIFT) ?
+            iommu_set_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT) :
+            iommu_clear_bit(&entry, IOMMU_CONTROL_HT_TUNNEL_TRANSLATION_SHIFT);
 
     iommu_has_ht_flag(iommu, AMD_IOMMU_ACPI_RES_PASS_PW_SHIFT) ?
         iommu_set_bit(&entry, IOMMU_CONTROL_RESP_PASS_POSTED_WRITE_SHIFT):
diff -r d23685e36486 -r 4699decb8424 xen/drivers/passthrough/amd/iommu_map.c
--- a/xen/drivers/passthrough/amd/iommu_map.c	Fri Nov 11 12:05:14 2011 +0100
+++ b/xen/drivers/passthrough/amd/iommu_map.c	Fri Nov 11 12:06:01 2011 +0100
@@ -996,7 +996,7 @@
         return;
     }
 
-    if ( !iommu->iotlb_support )
+    if ( !iommu_has_cap(iommu, PCI_CAP_IOTLB_SHIFT) )
         return;
 
     req_id = get_dma_requestor_id(iommu->seg, bdf);
diff -r d23685e36486 -r 4699decb8424 xen/drivers/passthrough/amd/pci_amd_iommu.c
--- a/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 11 12:05:14 2011 +0100
+++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c	Fri Nov 11 12:06:01 2011 +0100
@@ -115,7 +115,7 @@
             hd->paging_mode, valid);
 
         if ( pci_ats_device(iommu->seg, bus, devfn) &&
-             iommu->iotlb_support )
+             iommu_has_cap(iommu, PCI_CAP_IOTLB_SHIFT) )
             iommu_dte_set_iotlb((u32 *)dte, dte_i);
 
         invalidate_dev_table_entry(iommu, req_id);
@@ -307,7 +307,7 @@
         disable_translation((u32 *)dte);
 
         if ( pci_ats_device(iommu->seg, bus, devfn) &&
-             iommu->iotlb_support )
+             iommu_has_cap(iommu, PCI_CAP_IOTLB_SHIFT) )
             iommu_dte_set_iotlb((u32 *)dte, 0);
 
         invalidate_dev_table_entry(iommu, req_id);
diff -r d23685e36486 -r 4699decb8424 xen/include/asm-x86/amd-iommu.h
--- a/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:05:14 2011 +0100
+++ b/xen/include/asm-x86/amd-iommu.h	Fri Nov 11 12:06:01 2011 +0100
@@ -53,10 +53,6 @@
     u16 cap_offset;
     iommu_cap_t cap;
 
-    u8 pte_not_present_cached;
-    u8 ht_tunnel_support;
-    u8 iotlb_support;
-
     u8 ht_flags;
 
     void *mmio_base;
diff -r d23685e36486 -r 4699decb8424 xen/include/asm-x86/hvm/svm/amd-iommu-proto.h
--- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:05:14 2011 +0100
+++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h	Fri Nov 11 12:06:01 2011 +0100
@@ -181,4 +181,10 @@
     return get_field_from_reg_u32(reg, 1U << bit, bit);
 }
 
+static inline int iommu_has_cap(struct amd_iommu *iommu, uint32_t bit)
+{
+    u32 mask = 1U << bit;
+    return iommu->cap.header & mask;
+}
+
 #endif /* _ASM_X86_64_AMD_IOMMU_PROTO_H */

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:11:43 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:11:43 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyNy-0004Hz-RD; Fri, 11 Nov 2011 13:11:42 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNW-0004GC-GJ
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1321045871!3222538!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16768 invoked from network); 11 Nov 2011 21:11:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNT-0006qP-2c
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:11 +0000
Message-Id: <E1ROyNT-0006qP-2c@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86: quiesce cpuidle code
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321017916 -3600
# Node ID 8b08b2166aa82e7df0b1fa620ed57078810f8c12
# Parent  4699decb8424a00447c466205be3cb4d0fb95a76
x86: quiesce cpuidle code

So far these messages got pointlessly (as the code in other places
assumes symmetric configuration) emitted once per CPU. Hide the debug
one behind opt_cpu_info, and issue the info one just once (if the code
gets adjusted to support assymtric configurations, this would need to
be revisited, but ideally without producing per-CPU messages again).

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 4699decb8424 -r 8b08b2166aa8 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Fri Nov 11 12:06:01 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Fri Nov 11 14:25:16 2011 +0100
@@ -663,6 +663,8 @@
     unsigned int edx_part;
     unsigned int cstate_type; /* C-state type and not ACPI C-state type */
     unsigned int num_cstate_subtype;
+    int ret = 0;
+    static unsigned long printed;
 
     if ( c->cpuid_level < CPUID_MWAIT_LEAF )
     {
@@ -671,8 +673,9 @@
     }
 
     cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
-    printk(XENLOG_DEBUG "cpuid.MWAIT[.eax=%x, .ebx=%x, .ecx=%x, .edx=%x]\n",
-           eax, ebx, ecx, edx);
+    if ( opt_cpu_info )
+        printk(XENLOG_DEBUG "cpuid.MWAIT[eax=%x ebx=%x ecx=%x edx=%x]\n",
+               eax, ebx, ecx, edx);
 
     /* Check whether this particular cx_type (in CST) is supported or not */
     cstate_type = (cx->reg.address >> MWAIT_SUBSTATE_SIZE) + 1;
@@ -680,15 +683,16 @@
     num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
 
     if ( num_cstate_subtype < (cx->reg.address & MWAIT_SUBSTATE_MASK) )
-        return -EFAULT;
-
+        ret = -ERANGE;
     /* mwait ecx extensions INTERRUPT_BREAK should be supported for C2/C3 */
-    if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
-         !(ecx & CPUID5_ECX_INTERRUPT_BREAK) )
-        return -EFAULT;
-
-    printk(XENLOG_INFO "Monitor-Mwait will be used to enter C-%d state\n", cx->type);
-    return 0;
+    else if ( !(ecx & CPUID5_ECX_EXTENSIONS_SUPPORTED) ||
+              !(ecx & CPUID5_ECX_INTERRUPT_BREAK) )
+        ret = -ENODEV;
+    else if ( opt_cpu_info || cx->type >= BITS_PER_LONG ||
+              !test_and_set_bit(cx->type, &printed) )
+        printk(XENLOG_INFO "Monitor-Mwait will be used to enter C%d state\n",
+               cx->type);
+    return ret;
 }
 
 /*

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:11:59 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:11:59 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyOF-0004Kt-E3; Fri, 11 Nov 2011 13:11:59 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNX-0004GE-7a
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-27.messagelabs.com!1321045834!62865524!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2102 invoked from network); 11 Nov 2011 21:10:35 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:10:35 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNT-0006ra-QI
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:11 +0000
Message-Id: <E1ROyNT-0006ra-QI@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/amd-ucode: further turn down
	verbosity
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321018008 -3600
# Node ID 69f8b6f4c29cb2fb2d11e27c391090f543e6b393
# Parent  8b08b2166aa82e7df0b1fa620ed57078810f8c12
x86/amd-ucode: further turn down verbosity

Turn up the log level on various (mostly debug-only) messages.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 8b08b2166aa8 -r 69f8b6f4c29c xen/arch/x86/microcode_amd.c
--- a/xen/arch/x86/microcode_amd.c	Fri Nov 11 14:25:16 2011 +0100
+++ b/xen/arch/x86/microcode_amd.c	Fri Nov 11 14:26:48 2011 +0100
@@ -59,7 +59,7 @@
 
     rdmsrl(MSR_AMD_PATCHLEVEL, csig->rev);
 
-    printk(KERN_INFO "microcode: collect_cpu_info: patch_id=0x%x\n",
+    printk(KERN_DEBUG "microcode: collect_cpu_info: patch_id=0x%x\n",
            csig->rev);
 
     return 0;
@@ -92,7 +92,7 @@
 
     if ( (mc_header->processor_rev_id) != equiv_cpu_id )
     {
-        printk(KERN_INFO "microcode: CPU%d patch does not match "
+        printk(KERN_DEBUG "microcode: CPU%d patch does not match "
                "(patch is %x, cpu base id is %x) \n",
                cpu, mc_header->processor_rev_id, equiv_cpu_id);
         return -EINVAL;
@@ -101,7 +101,7 @@
     if ( mc_header->patch_id <= uci->cpu_sig.rev )
         return -EINVAL;
 
-    printk(KERN_INFO "microcode: CPU%d found a matching microcode "
+    printk(KERN_DEBUG "microcode: CPU%d found a matching microcode "
            "update with version 0x%x (current=0x%x)\n",
            cpu, mc_header->patch_id, uci->cpu_sig.rev);
 
@@ -139,8 +139,7 @@
         return -EIO;
     }
 
-    printk("microcode: CPU%d updated from revision "
-           "0x%x to 0x%x \n",
+    printk(KERN_INFO "microcode: CPU%d updated from revision %#x to %#x\n",
            cpu, uci->cpu_sig.rev, mc_amd->hdr.patch_id);
 
     uci->cpu_sig.rev = rev;
@@ -170,7 +169,7 @@
 
     total_size = (unsigned long) (bufp[off+4] + (bufp[off+5] << 8));
 
-    printk(KERN_INFO "microcode: size %lu, total_size %lu, offset %ld\n",
+    printk(KERN_DEBUG "microcode: size %lu, total_size %lu, offset %ld\n",
            (unsigned long)size, total_size, off);
 
     if ( (off + total_size) > size )

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:12:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:12:16 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyOW-0004Og-Dk; Fri, 11 Nov 2011 13:12:16 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNX-0004GF-RS
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1321045872!1232775!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7083 invoked from network); 11 Nov 2011 21:11:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNU-0006sD-CY
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:12 +0000
Message-Id: <E1ROyNU-0006sD-CY@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] multicall: don't ignore failure from
	__copy_to_guest() upon preemption
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321018061 -3600
# Node ID b44278816b72557c9de29681f58daf107806a18d
# Parent  69f8b6f4c29cb2fb2d11e27c391090f543e6b393
multicall: don't ignore failure from __copy_to_guest() upon preemption

At once adjust perf counter updates to also count calls from here even
if a guest memory access failed.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 69f8b6f4c29c -r b44278816b72 xen/common/multicall.c
--- a/xen/common/multicall.c	Fri Nov 11 14:26:48 2011 +0100
+++ b/xen/common/multicall.c	Fri Nov 11 14:27:41 2011 +0100
@@ -25,6 +25,7 @@
 {
     struct mc_state *mcs = &current->mc_state;
     unsigned int     i;
+    int              rc = 0;
 
     if ( unlikely(__test_and_set_bit(_MCSF_in_multicall, &mcs->flags)) )
     {
@@ -33,15 +34,18 @@
     }
 
     if ( unlikely(!guest_handle_okay(call_list, nr_calls)) )
-        goto fault;
+        rc = -EFAULT;
 
-    for ( i = 0; i < nr_calls; i++ )
+    for ( i = 0; !rc && i < nr_calls; i++ )
     {
         if ( hypercall_preempt_check() )
             goto preempted;
 
         if ( unlikely(__copy_from_guest(&mcs->call, call_list, 1)) )
-            goto fault;
+        {
+            rc = -EFAULT;
+            break;
+        }
 
         do_multicall_call(&mcs->call);
 
@@ -58,30 +62,25 @@
 #endif
 
         if ( unlikely(__copy_field_to_guest(call_list, &mcs->call, result)) )
-            goto fault;
-
-        if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
+            rc = -EFAULT;
+        else if ( test_bit(_MCSF_call_preempted, &mcs->flags) )
         {
             /* Translate sub-call continuation to guest layout */
             xlat_multicall_entry(mcs);
 
             /* Copy the sub-call continuation. */
-            (void)__copy_to_guest(call_list, &mcs->call, 1);
-            goto preempted;
+            if ( likely(!__copy_to_guest(call_list, &mcs->call, 1)) )
+                goto preempted;
+            rc = -EFAULT;
         }
-
-        guest_handle_add_offset(call_list, 1);
+        else
+            guest_handle_add_offset(call_list, 1);
     }
 
     perfc_incr(calls_to_multicall);
-    perfc_add(calls_from_multicall, nr_calls);
+    perfc_add(calls_from_multicall, i);
     mcs->flags = 0;
-    return 0;
-
- fault:
-    perfc_incr(calls_to_multicall);
-    mcs->flags = 0;
-    return -EFAULT;
+    return rc;
 
  preempted:
     perfc_add(calls_from_multicall, i);

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:12:28 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:12:28 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyOi-0004Rh-ON; Fri, 11 Nov 2011 13:12:28 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNY-0004GG-7b
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1321045873!3777339!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15209 invoked from network); 11 Nov 2011 21:11:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNU-0006sj-Uw
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:12 +0000
Message-Id: <E1ROyNU-0006sj-Uw@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: get rid of
	set_error_fn() macro
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018161 -3600
# Node ID b2891cecc67630767cdf81a08ee82ed5c9929a45
# Parent  b44278816b72557c9de29681f58daf107806a18d
Decompressors: get rid of set_error_fn() macro

From: Lasse Collin <lasse.collin@tukaani.org>

set_error_fn() is a useless complication. Only unlzma.c had some use
for it and that was easy to change too.

This also gets rid of the static function pointer "error".

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r b44278816b72 -r b2891cecc676 xen/common/bunzip2.c
--- a/xen/common/bunzip2.c	Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/bunzip2.c	Fri Nov 11 14:29:21 2011 +0100
@@ -666,13 +666,12 @@
 			int(*flush)(void*, unsigned int),
 			unsigned char *outbuf,
 			unsigned int *pos,
-			void(*error_fn)(const char *x))
+			void(*error)(const char *x))
 {
 	struct bunzip_data *bd;
 	int i = -1;
 	unsigned char *inbuf;
 
-	set_error_fn(error_fn);
 	if (flush)
 		outbuf = malloc(BZIP2_IOBUF_SIZE);
 
diff -r b44278816b72 -r b2891cecc676 xen/common/decompress.h
--- a/xen/common/decompress.h	Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/decompress.h	Fri Nov 11 14:29:21 2011 +0100
@@ -10,9 +10,6 @@
 #define INIT __init
 #define INITDATA __initdata
 
-static void(*__initdata error)(const char *);
-#define set_error_fn(x) error = x;
-
 #define malloc xmalloc_bytes
 #define free xfree
 
diff -r b44278816b72 -r b2891cecc676 xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:29:21 2011 +0100
@@ -67,6 +67,7 @@
 	uint32_t code;
 	uint32_t range;
 	uint32_t bound;
+	void (*error)(const char *);
 };
 
 
@@ -85,7 +86,7 @@
 {
 	rc->buffer_size = rc->fill((char *)rc->buffer, LZMA_IOBUF_SIZE);
 	if (rc->buffer_size <= 0)
-		error("unexpected EOF");
+		rc->error("unexpected EOF");
 	rc->ptr = rc->buffer;
 	rc->buffer_end = rc->buffer + rc->buffer_size;
 }
@@ -529,7 +530,7 @@
 		       int(*flush)(void*, unsigned int),
 		       unsigned char *output,
 		       unsigned int *posp,
-		       void(*error_fn)(const char *x)
+		       void(*error)(const char *x)
 	)
 {
 	struct lzma_header header;
@@ -545,7 +546,7 @@
 	unsigned char *inbuf;
 	int ret = -1;
 
-	set_error_fn(error_fn);
+	rc.error = error;
 
 	if (buf)
 		inbuf = buf;
diff -r b44278816b72 -r b2891cecc676 xen/common/unlzo.c
--- a/xen/common/unlzo.c	Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unlzo.c	Fri Nov 11 14:29:21 2011 +0100
@@ -105,7 +105,7 @@
 		      int (*fill) (void *, unsigned int),
 		      int (*flush) (void *, unsigned int),
 		      u8 *output, unsigned int *posp,
-		      void (*error_fn) (const char *x))
+		      void (*error) (const char *x))
 {
 	u8 skip = 0, r = 0;
 	u32 src_len, dst_len;
@@ -113,8 +113,6 @@
 	u8 *in_buf, *in_buf_save, *out_buf;
 	int ret = -1;
 
-	set_error_fn(error_fn);
-
 	if (output) {
 		out_buf = output;
 	} else if (!flush) {
diff -r b44278816b72 -r b2891cecc676 xen/common/unxz.c
--- a/xen/common/unxz.c	Fri Nov 11 14:27:41 2011 +0100
+++ b/xen/common/unxz.c	Fri Nov 11 14:29:21 2011 +0100
@@ -161,15 +161,13 @@
 		     int (*fill)(void *dest, unsigned int size),
 		     int (*flush)(void *src, unsigned int size),
 		     unsigned char *out, unsigned int *in_used,
-		     void (*error_fn)(const char *x))
+		     void (*error)(const char *x))
 {
 	struct xz_buf b;
 	struct xz_dec *s;
 	enum xz_ret ret;
 	bool_t must_free_in = false;
 
-	set_error_fn(error_fn);
-
 	xz_crc32_init();
 
 	if (in_used != NULL)

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:12:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:12:40 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyOu-0004Ua-6C; Fri, 11 Nov 2011 13:12:40 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNY-0004GH-NA
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-10.tower-182.messagelabs.com!1321045873!2806899!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4802 invoked from network); 11 Nov 2011 21:11:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-10.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNV-0006tI-Fl
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:13 +0000
Message-Id: <E1ROyNV-0006tI-Fl@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] bzip2: Add missing checks for malloc
	returning NULL
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Phillip Lougher <phillip@lougher.demon.co.uk>
# Date 1321018236 -3600
# Node ID 57db49cf118889792d32d22e80129604b4ca04af
# Parent  b2891cecc67630767cdf81a08ee82ed5c9929a45
bzip2: Add missing checks for malloc returning NULL

From: Phillip Lougher <phillip@lougher.demon.co.uk>

Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r b2891cecc676 -r 57db49cf1188 xen/common/bunzip2.c
--- a/xen/common/bunzip2.c	Fri Nov 11 14:29:21 2011 +0100
+++ b/xen/common/bunzip2.c	Fri Nov 11 14:30:36 2011 +0100
@@ -629,6 +629,8 @@
 
 	/* Allocate bunzip_data.  Most fields initialize to zero. */
 	bd = *bdp = malloc(i);
+	if (!bd)
+		return RETVAL_OUT_OF_MEMORY;
 	memset(bd, 0, sizeof(struct bunzip_data));
 	/* Setup input buffer */
 	bd->inbuf = inbuf;
@@ -656,6 +658,8 @@
 	bd->dbufSize = 100000*(i-BZh0);
 
 	bd->dbuf = large_malloc(bd->dbufSize * sizeof(int));
+	if (!bd->dbuf)
+		return RETVAL_OUT_OF_MEMORY;
 	return RETVAL_OK;
 }
 
@@ -677,7 +681,7 @@
 
 	if (!outbuf) {
 		error("Could not allocate output bufer");
-		return -1;
+		return RETVAL_OUT_OF_MEMORY;
 	}
 	if (buf)
 		inbuf = buf;
@@ -685,6 +689,7 @@
 		inbuf = malloc(BZIP2_IOBUF_SIZE);
 	if (!inbuf) {
 		error("Could not allocate input bufer");
+		i = RETVAL_OUT_OF_MEMORY;
 		goto exit_0;
 	}
 	i = start_bunzip(&bd, inbuf, len, fill);
@@ -711,11 +716,14 @@
 	} else if (i == RETVAL_UNEXPECTED_OUTPUT_EOF) {
 		error("Compressed file ends unexpectedly");
 	}
+	if (!bd)
+		goto exit_1;
 	if (bd->dbuf)
 		large_free(bd->dbuf);
 	if (pos)
 		*pos = bd->inbufPos;
 	free(bd);
+exit_1:
 	if (!buf)
 		free(inbuf);
 exit_0:

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:12:58 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:12:58 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPC-0004Xz-3l; Fri, 11 Nov 2011 13:12:58 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNZ-0004GI-9m
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-182.messagelabs.com!1321045874!2802221!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 13663 invoked from network); 11 Nov 2011 21:11:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNW-0006tw-0s
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:14 +0000
Message-Id: <E1ROyNW-0006tw-0s@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: remove unused
	function from unlzma.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018298 -3600
# Node ID 7c5eb2265fba5fb33addd0e0f30b77ce4ff17af0
# Parent  57db49cf118889792d32d22e80129604b4ca04af
Decompressors: remove unused function from unlzma.c

From: Lasse Collin <lasse.collin@tukaani.org>

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 57db49cf1188 -r 7c5eb2265fba xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:30:36 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:31:38 2011 +0100
@@ -121,12 +121,6 @@
 }
 
 
-/* Called once. TODO: bb_maybe_free() */
-static inline void INIT rc_free(struct rc *rc)
-{
-	free(rc->buffer);
-}
-
 /* Called twice, but one callsite is in inline'd rc_is_bit_0_helper() */
 static void INIT rc_do_normalize(struct rc *rc)
 {

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:08 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:08 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPL-0004bH-PM; Fri, 11 Nov 2011 13:13:07 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNa-0004GJ-11
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-174.messagelabs.com!1321045874!1232779!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 7136 invoked from network); 11 Nov 2011 21:11:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNW-0006uW-Id
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:14 +0000
Message-Id: <E1ROyNW-0006uW-Id@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: fix header validation
	in unlzma.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018323 -3600
# Node ID 71abe73298b321ce168cf1a496615d06deb86220
# Parent  7c5eb2265fba5fb33addd0e0f30b77ce4ff17af0
Decompressors: fix header validation in unlzma.c

From: Lasse Collin <lasse.collin@tukaani.org>

Validation of header.pos calls error() but doesn't make the function
return to indicate an error to the caller.  Instead the decoding is
attempted with invalid header.pos.  This fixes it.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 7c5eb2265fba -r 71abe73298b3 xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:31:38 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:32:03 2011 +0100
@@ -568,8 +568,10 @@
 		((unsigned char *)&header)[i] = *rc.ptr++;
 	}
 
-	if (header.pos >= (9 * 5 * 5))
+	if (header.pos >= (9 * 5 * 5)) {
 		error("bad header");
+		goto exit_1;
+	}
 
 	mi = 0;
 	lc = header.pos;

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:15 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:15 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPT-0004eD-Q4; Fri, 11 Nov 2011 13:13:15 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNa-0004GP-Rd
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1321045875!2800407!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28802 invoked from network); 11 Nov 2011 21:11:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNX-0006vd-LZ
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:15 +0000
Message-Id: <E1ROyNX-0006vd-LZ@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: check for write
	errors in unlzma.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018410 -3600
# Node ID 2ffeeb28e9be98c932905f7fd2bf80bfc089622c
# Parent  fe9a59ff84750086b731c5be84417f8d302d84db
Decompressors: check for write errors in unlzma.c

From: Lasse Collin <lasse.collin@tukaani.org>

The return value of wr->flush() is not checked in write_byte().  This
means that the decompressor won't stop even if the caller doesn't want
more data.  This can happen e.g.  with corrupt LZMA-compressed initramfs.
Returning the error quickly allows the user to see the error message
quicker.

There is a similar missing check for wr.flush() near the end of unlzma().

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r fe9a59ff8475 -r 2ffeeb28e9be xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:32:57 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:33:30 2011 +0100
@@ -307,32 +307,38 @@
 
 }
 
-static inline void INIT write_byte(struct writer *wr, uint8_t byte)
+static inline int INIT write_byte(struct writer *wr, uint8_t byte)
 {
 	wr->buffer[wr->buffer_pos++] = wr->previous_byte = byte;
 	if (wr->flush && wr->buffer_pos == wr->header->dict_size) {
 		wr->buffer_pos = 0;
 		wr->global_pos += wr->header->dict_size;
-		wr->flush((char *)wr->buffer, wr->header->dict_size);
+		if (wr->flush((char *)wr->buffer, wr->header->dict_size)
+				!= wr->header->dict_size)
+			return -1;
 	}
+	return 0;
 }
 
 
-static inline void INIT copy_byte(struct writer *wr, uint32_t offs)
+static inline int INIT copy_byte(struct writer *wr, uint32_t offs)
 {
-	write_byte(wr, peek_old_byte(wr, offs));
+	return write_byte(wr, peek_old_byte(wr, offs));
 }
 
-static inline void INIT copy_bytes(struct writer *wr,
+static inline int INIT copy_bytes(struct writer *wr,
 					 uint32_t rep0, int len)
 {
 	do {
-		copy_byte(wr, rep0);
+		if (copy_byte(wr, rep0))
+			return -1;
 		len--;
 	} while (len != 0 && wr->buffer_pos < wr->header->dst_size);
+
+	return len;
 }
 
-static inline void INIT process_bit0(struct writer *wr, struct rc *rc,
+static inline int INIT process_bit0(struct writer *wr, struct rc *rc,
 				     struct cstate *cst, uint16_t *p,
 				     int pos_state, uint16_t *prob,
 				     int lc, uint32_t literal_pos_mask) {
@@ -366,16 +372,17 @@
 		uint16_t *prob_lit = prob + mi;
 		rc_get_bit(rc, prob_lit, &mi);
 	}
-	write_byte(wr, mi);
 	if (cst->state < 4)
 		cst->state = 0;
 	else if (cst->state < 10)
 		cst->state -= 3;
 	else
 		cst->state -= 6;
+
+	return write_byte(wr, mi);
 }
 
-static inline void INIT process_bit1(struct writer *wr, struct rc *rc,
+static inline int INIT process_bit1(struct writer *wr, struct rc *rc,
 					    struct cstate *cst, uint16_t *p,
 					    int pos_state, uint16_t *prob) {
   int offset;
@@ -406,8 +413,7 @@
 
 				cst->state = cst->state < LZMA_NUM_LIT_STATES ?
 					9 : 11;
-				copy_byte(wr, cst->rep0);
-				return;
+				return copy_byte(wr, cst->rep0);
 			} else {
 				rc_update_bit_1(rc, prob);
 			}
@@ -509,12 +515,12 @@
 		} else
 			cst->rep0 = pos_slot;
 		if (++(cst->rep0) == 0)
-			return;
+			return 0;
 	}
 
 	len += LZMA_MATCH_MIN_LEN;
 
-	copy_bytes(wr, cst->rep0, len);
+	return copy_bytes(wr, cst->rep0, len);
 }
 
 
@@ -617,11 +623,17 @@
 		int pos_state =	get_pos(&wr) & pos_state_mask;
 		uint16_t *prob = p + LZMA_IS_MATCH +
 			(cst.state << LZMA_NUM_POS_BITS_MAX) + pos_state;
-		if (rc_is_bit_0(&rc, prob))
-			process_bit0(&wr, &rc, &cst, p, pos_state, prob,
-				     lc, literal_pos_mask);
-		else {
-			process_bit1(&wr, &rc, &cst, p, pos_state, prob);
+		if (rc_is_bit_0(&rc, prob)) {
+			if (process_bit0(&wr, &rc, &cst, p, pos_state, prob,
+					lc, literal_pos_mask)) {
+				error("LZMA data is corrupt");
+				goto exit_3;
+			}
+		} else {
+			if (process_bit1(&wr, &rc, &cst, p, pos_state, prob)) {
+				error("LZMA data is corrupt");
+				goto exit_3;
+			}
 			if (cst.rep0 == 0)
 				break;
 		}
@@ -631,9 +643,8 @@
 
 	if (posp)
 		*posp = rc.ptr-rc.buffer;
-	if (wr.flush)
-		wr.flush(wr.buffer, wr.buffer_pos);
-	ret = 0;
+	if (!wr.flush || wr.flush(wr.buffer, wr.buffer_pos) == wr.buffer_pos)
+		ret = 0;
 exit_3:
 	large_free(p);
 exit_2:

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:22 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:22 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPZ-0004hH-Tj; Fri, 11 Nov 2011 13:13:21 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNa-0004GL-Fs
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-174.messagelabs.com!1321045875!1216879!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9082 invoked from network); 11 Nov 2011 21:11:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNX-0006v5-4b
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:15 +0000
Message-Id: <E1ROyNX-0006v5-4b@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: check for read errors
	in unlzma.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018377 -3600
# Node ID fe9a59ff84750086b731c5be84417f8d302d84db
# Parent  71abe73298b321ce168cf1a496615d06deb86220
Decompressors: check for read errors in unlzma.c

From: Lasse Collin <lasse.collin@tukaani.org>

Return value of rc->fill() is checked in rc_read() and error() is called
when needed, but then the code continues as if nothing had happened.

rc_read() is a void function and it's on the top of performance critical
call stacks, so propagating the error code via return values doesn't sound
like the best fix.  It seems better to check rc->buffer_size (which holds
the return value of rc->fill()) in the main loop.  It does nothing bad
that the code runs a little with unknown data after a failed rc->fill().

This fixes an infinite loop in initramfs decompression if the
LZMA-compressed initramfs image is corrupt.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 71abe73298b3 -r fe9a59ff8475 xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:32:03 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:32:57 2011 +0100
@@ -625,6 +625,8 @@
 			if (cst.rep0 == 0)
 				break;
 		}
+		if (rc.buffer_size <= 0)
+			goto exit_3;
 	}
 
 	if (posp)
@@ -632,6 +634,7 @@
 	if (wr.flush)
 		wr.flush(wr.buffer, wr.buffer_pos);
 	ret = 0;
+exit_3:
 	large_free(p);
 exit_2:
 	if (!output)

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPj-0004kN-GK; Fri, 11 Nov 2011 13:13:31 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNb-0004GT-7V
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:20 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-27.messagelabs.com!1321045846!56901314!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9510 invoked from network); 11 Nov 2011 21:10:46 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:10:46 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNY-0006wA-5r
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:16 +0000
Message-Id: <E1ROyNY-0006wA-5r@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:15 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: validate match
	distance in unlzma.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018464 -3600
# Node ID 88347644935e4de008e16daa13d10d11b0e726d3
# Parent  2ffeeb28e9be98c932905f7fd2bf80bfc089622c
Decompressors: validate match distance in unlzma.c

From: Lasse Collin <lasse.collin@tukaani.org>

Validate the newly decoded distance (rep0) in process_bit1().  This is to
detect corrupt LZMA data quickly.  The old code can run for long time
producing garbage until it hits the end of the input.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 2ffeeb28e9be -r 88347644935e xen/common/unlzma.c
--- a/xen/common/unlzma.c	Fri Nov 11 14:33:30 2011 +0100
+++ b/xen/common/unlzma.c	Fri Nov 11 14:34:24 2011 +0100
@@ -516,6 +516,9 @@
 			cst->rep0 = pos_slot;
 		if (++(cst->rep0) == 0)
 			return 0;
+		if (cst->rep0 > wr->header->dict_size
+				|| cst->rep0 > get_pos(wr))
+			return -1;
 	}
 
 	len += LZMA_MATCH_MIN_LEN;

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:38 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:38 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPp-0004nM-Uq; Fri, 11 Nov 2011 13:13:38 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNb-0004GZ-Vr
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:20 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-21.messagelabs.com!1321045876!3845814!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 17249 invoked from network); 11 Nov 2011 21:11:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNY-0006wm-NX
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:16 +0000
Message-Id: <E1ROyNY-0006wm-NX@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: check for write
	errors in unlzo.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018505 -3600
# Node ID 276db7ceeb5d5f4ac47a1ed83c3574cb46d7aa84
# Parent  88347644935e4de008e16daa13d10d11b0e726d3
Decompressors: check for write errors in unlzo.c

From: Lasse Collin <lasse.collin@tukaani.org>

The return value of flush() is not checked in unlzo().  This means that
the decompressor won't stop even if the caller doesn't want more data.
This can happen e.g.  with a corrupt LZO-compressed initramfs image.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 88347644935e -r 276db7ceeb5d xen/common/unlzo.c
--- a/xen/common/unlzo.c	Fri Nov 11 14:34:24 2011 +0100
+++ b/xen/common/unlzo.c	Fri Nov 11 14:35:05 2011 +0100
@@ -202,8 +202,8 @@
 			}
 		}
 
-		if (flush)
-			flush(out_buf, dst_len);
+		if (flush && flush(out_buf, dst_len) != dst_len)
+			goto exit_2;
 		if (output)
 			out_buf += dst_len;
 		if (posp)

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:46 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyPy-0004qO-J4; Fri, 11 Nov 2011 13:13:46 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNc-0004Ge-Fe
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:21 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-182.messagelabs.com!1321045877!2801800!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 24728 invoked from network); 11 Nov 2011 21:11:17 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:17 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNZ-0006xP-8X
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:17 +0000
Message-Id: <E1ROyNZ-0006xP-8X@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:16 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Decompressors: check input size in
	unlzo.c
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Lasse Collin <lasse.collin@tukaani.org>
# Date 1321018551 -3600
# Node ID 44d925615ac6dc5667cfae5e287dbbd720d89fc7
# Parent  276db7ceeb5d5f4ac47a1ed83c3574cb46d7aa84
Decompressors: check input size in unlzo.c

From: Lasse Collin <lasse.collin@tukaani.org>

The code assumes that the input is valid and not truncated.  Add checks to
avoid reading past the end of the input buffer.  Change the type of "skip"
from u8 to int to fix a possible integer overflow.

Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 276db7ceeb5d -r 44d925615ac6 xen/common/unlzo.c
--- a/xen/common/unlzo.c	Fri Nov 11 14:35:05 2011 +0100
+++ b/xen/common/unlzo.c	Fri Nov 11 14:35:51 2011 +0100
@@ -63,14 +63,25 @@
 
 #define LZO_BLOCK_SIZE        (256*1024l)
 #define HEADER_HAS_FILTER      0x00000800L
+#define HEADER_SIZE_MIN       (9 + 7     + 4 + 8     + 1       + 4)
+#define HEADER_SIZE_MAX       (9 + 7 + 1 + 8 + 8 + 4 + 1 + 255 + 4)
 
-static int INIT parse_header(u8 *input, u8 *skip)
+static int INIT parse_header(u8 *input, int *skip, int in_len)
 {
 	int l;
 	u8 *parse = input;
+	u8 *end = input + in_len;
 	u8 level = 0;
 	u16 version;
 
+	/*
+	 * Check that there's enough input to possibly have a valid header.
+	 * Then it is possible to parse several fields until the minimum
+	 * size may have been used.
+	 */
+	if (in_len < HEADER_SIZE_MIN)
+		return 0;
+
 	/* read magic: 9 first bits */
 	for (l = 0; l < 9; l++) {
 		if (*parse++ != lzop_magic[l])
@@ -88,6 +99,15 @@
 	else
 		parse += 4; /* flags */
 
+	/*
+	 * At least mode, mtime_low, filename length, and checksum must
+	 * be left to be parsed. If also mtime_high is present, it's OK
+	 * because the next input buffer check is after reading the
+	 * filename length.
+	 */
+	if (end - parse < 8 + 1 + 4)
+		return 0;
+
 	/* skip mode and mtime_low */
 	parse += 8;
 	if (version >= 0x0940)
@@ -95,6 +115,8 @@
 
 	l = *parse++;
 	/* don't care about the file name, and skip checksum */
+	if (end - parse < l + 4)
+		return 0;
 	parse += l + 4;
 
 	*skip = parse - input;
@@ -107,7 +129,8 @@
 		      u8 *output, unsigned int *posp,
 		      void (*error) (const char *x))
 {
-	u8 skip = 0, r = 0;
+	u8 r = 0;
+	int skip = 0;
 	u32 src_len, dst_len;
 	size_t tmp;
 	u8 *in_buf, *in_buf_save, *out_buf;
@@ -149,19 +172,25 @@
 	if (fill)
 		fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE));
 
-	if (!parse_header(input, &skip)) {
+	if (!parse_header(input, &skip, in_len)) {
 		error("invalid header");
 		goto exit_2;
 	}
 	in_buf += skip;
+	in_len -= skip;
 
 	if (posp)
 		*posp = skip;
 
 	for (;;) {
 		/* read uncompressed block size */
+		if (in_len < 4) {
+			error("file corrupted");
+			goto exit_2;
+		}
 		dst_len = get_unaligned_be32(in_buf);
 		in_buf += 4;
+		in_len -= 4;
 
 		/* exit if last block */
 		if (dst_len == 0) {
@@ -176,10 +205,15 @@
 		}
 
 		/* read compressed block size, and skip block checksum info */
+		if (in_len < 8) {
+			error("file corrupted");
+			goto exit_2;
+		}
 		src_len = get_unaligned_be32(in_buf);
 		in_buf += 8;
+		in_len -= 8;
 
-		if (src_len <= 0 || src_len > dst_len) {
+		if (src_len <= 0 || src_len > dst_len || src_len > in_len) {
 			error("file corrupted");
 			goto exit_2;
 		}
@@ -211,8 +245,10 @@
 		if (fill) {
 			in_buf = in_buf_save;
 			fill(in_buf, lzo1x_worst_compress(LZO_BLOCK_SIZE));
-		} else
+		} else {
 			in_buf += src_len;
+			in_len -= src_len;
+		}
 	}
 
 	ret = 0;

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 13:13:54 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 13:13:54 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1ROyQ6-0004tp-PI; Fri, 11 Nov 2011 13:13:54 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1ROyNc-0004Go-VU
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 13:11:22 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-12.tower-182.messagelabs.com!1321045877!2800408!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28823 invoked from network); 11 Nov 2011 21:11:18 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-12.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	11 Nov 2011 21:11:18 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1ROyNZ-0006xy-P7
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 21:11:17 +0000
Message-Id: <E1ROyNZ-0006xy-P7@xenbits.xen.org>
Date: Fri, 11 Nov 2011 21:11:17 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ia64: introduce atomic_{read,
	write}NN()
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321029979 -3600
# Node ID 9af6829a927379b6455a64ca49e769de34120800
# Parent  44d925615ac6dc5667cfae5e287dbbd720d89fc7
ia64: introduce atomic_{read,write}NN()

These are required to be able to build certain portions of common code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
---


diff -r 44d925615ac6 -r 9af6829a9273 xen/include/asm-ia64/linux-xen/asm/atomic.h
--- a/xen/include/asm-ia64/linux-xen/asm/atomic.h	Fri Nov 11 14:35:51 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/atomic.h	Fri Nov 11 17:46:19 2011 +0100
@@ -24,12 +24,9 @@
 typedef struct { volatile __s64 counter; } atomic64_t;
 
 #ifndef XEN
+
 #define ATOMIC_INIT(i)		((atomic_t) { (i) })
 #define ATOMIC64_INIT(i)	((atomic64_t) { (i) })
-#else
-#define ATOMIC_INIT(i)		{ (i) }
-#define ATOMIC64_INIT(i)	{ (i) }
-#endif
 
 #define atomic_read(v)		((v)->counter)
 #define atomic64_read(v)	((v)->counter)
@@ -37,6 +34,55 @@
 #define atomic_set(v,i)		(((v)->counter) = (i))
 #define atomic64_set(v,i)	(((v)->counter) = (i))
 
+#else
+
+#define ATOMIC_INIT(i)		{ (i) }
+#define ATOMIC64_INIT(i)	{ (i) }
+
+#define build_atomic_read(tag, type) \
+static inline type atomic_read##tag(const volatile type *addr) \
+{ \
+	type ret; \
+	asm volatile("ld%2.acq %0 = %1" \
+		     : "=r" (ret) \
+		     : "m" (*addr), "i" (sizeof(type))); \
+	return ret; \
+}
+
+#define build_atomic_write(tag, type) \
+static inline void atomic_write##tag(volatile type *addr, type val) \
+{ \
+	asm volatile("st%2.rel %0 = %1" \
+		     : "=m" (*addr) \
+		     : "r" (val), "i" (sizeof(type))); \
+}
+
+build_atomic_read(8, uint8_t)
+build_atomic_read(16, uint16_t)
+build_atomic_read(32, uint32_t)
+build_atomic_read(64, uint64_t)
+build_atomic_read(_int, int)
+build_atomic_read(_long, long)
+
+build_atomic_write(8, uint8_t)
+build_atomic_write(16, uint16_t)
+build_atomic_write(32, uint32_t)
+build_atomic_write(64, uint64_t)
+build_atomic_write(_int, int)
+build_atomic_write(_long, long)
+
+#define _atomic_read(v)		((v).counter)
+#define _atomic64_read(v)	((v).counter)
+#define atomic_read(v)		atomic_read_int(&((v)->counter))
+#define atomic64_read(v)	atomic_read_long(&((v)->counter))
+
+#define _atomic_set(v,i)	(((v).counter) = (i))
+#define _atomic64_set(v,i)	(((v).counter) = (i))
+#define atomic_set(v,i)		atomic_write_int(&((v)->counter), i)
+#define atomic64_set(v,l)	atomic_write_long(&((v)->counter), l)
+
+#endif
+
 static __inline__ int
 ia64_atomic_add (int i, atomic_t *v)
 {
@@ -59,7 +105,7 @@
 
 	do {
 		CMPXCHG_BUGCHECK(v);
-		old = atomic_read(v);
+		old = atomic64_read(v);
 		new = old + i;
 	} while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old);
 	return new;
@@ -87,7 +133,7 @@
 
 	do {
 		CMPXCHG_BUGCHECK(v);
-		old = atomic_read(v);
+		old = atomic64_read(v);
 		new = old - i;
 	} while (ia64_cmpxchg(acq, v, old, new, sizeof(atomic64_t)) != old);
 	return new;

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 16:12:16 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 16:12:16 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RP1Cg-0001ep-Ld; Fri, 11 Nov 2011 16:12:15 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RP1C4-0001dM-V5
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 16:11:38 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-182.messagelabs.com!1321056693!2796404!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 12014 invoked from network); 12 Nov 2011 00:11:34 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	12 Nov 2011 00:11:34 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RP1C1-0005mN-G9
	for xen-changelog@lists.xensource.com; Sat, 12 Nov 2011 00:11:33 +0000
Message-Id: <E1RP1C1-0005mN-G9@xenbits.xen.org>
Date: Sat, 12 Nov 2011 00:11:32 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Revert c/s 23666:b96f8bdcaa15 KEXEC:
	disconnect all PCI devices from the PCI bus on crash
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1321035275 0
# Node ID 0844b17df7a9dd885e98e505f14fc99c1951b483
# Parent  3622d7fae14dfc2d00f378738ace3b65ee65b6cc
Revert c/s 23666:b96f8bdcaa15 KEXEC: disconnect all PCI devices from the PCI bus on crash

It turns out that this causes all mannor of problems on certain
motherboards (so far with no pattern I can discern)

Problems include:
* Hanging forever checking hlt instruction.
* Panics when trying to change switch root device
* Drivers hanging when trying to check for interrupts.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 3622d7fae14d -r 0844b17df7a9 xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Fri Nov 11 18:11:34 2011 +0000
+++ b/xen/arch/x86/crash.c	Fri Nov 11 18:14:35 2011 +0000
@@ -28,7 +28,6 @@
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <xen/iommu.h>
-#include <xen/pci.h>
 #include <asm/hpet.h>
 
 static atomic_t waiting_for_crash_ipi;
@@ -83,8 +82,6 @@
         msecs--;
     }
 
-    disconnect_pci_devices();
-
     /* Crash shutdown any IOMMU functionality as the crashdump kernel is not
      * happy when booting if interrupt/dma remapping is still enabled */
     iommu_crash_shutdown();
diff -r 3622d7fae14d -r 0844b17df7a9 xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Fri Nov 11 18:11:34 2011 +0000
+++ b/xen/drivers/passthrough/pci.c	Fri Nov 11 18:14:35 2011 +0000
@@ -683,30 +683,6 @@
     spin_unlock(&pcidevs_lock);
 }
 
-/* Disconnect all PCI devices from the PCI buses. From the PCI spec:
- *   "When a 0 is written to [the COMMAND] register, the device is
- *    logically disconnected from the PCI bus for all accesses except
- *    configuration accesses. All devices are required to support
- *    this base level of functionality."
- */
-static int _disconnect_pci_devices(struct pci_seg *pseg, void *arg)
-{
-    struct pci_dev *pdev;
-
-    list_for_each_entry ( pdev, &pseg->alldevs_list, alldevs_list )
-        pci_conf_write16(pseg->nr, pdev->bus, PCI_SLOT(pdev->devfn),
-                         PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
-
-    return 0;
-}
-
-void disconnect_pci_devices(void)
-{
-    spin_lock(&pcidevs_lock);
-    pci_segments_iterate(_disconnect_pci_devices, NULL);
-    spin_unlock(&pcidevs_lock);
-}
-
 #ifdef SUPPORT_MSI_REMAPPING
 static int _dump_pci_devices(struct pci_seg *pseg, void *arg)
 {
diff -r 3622d7fae14d -r 0844b17df7a9 xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Fri Nov 11 18:11:34 2011 +0000
+++ b/xen/include/xen/pci.h	Fri Nov 11 18:14:35 2011 +0000
@@ -100,8 +100,6 @@
 struct pci_dev *pci_get_pdev_by_domain(
     struct domain *, int seg, int bus, int devfn);
 
-void disconnect_pci_devices(void);
-
 uint8_t pci_conf_read8(
     unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
     unsigned int reg);

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

From xen-changelog-bounces@lists.xensource.com Fri Nov 11 16:12:42 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Fri, 11 Nov 2011 16:12:42 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RP1D8-0001hx-Dp; Fri, 11 Nov 2011 16:12:42 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RP1C4-0001dL-Ez
	for xen-changelog@lists.xensource.com; Fri, 11 Nov 2011 16:11:45 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-182.messagelabs.com!1321056693!2801999!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8686 invoked from network); 12 Nov 2011 00:11:33 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	12 Nov 2011 00:11:33 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RP1C0-0005kX-FD
	for xen-changelog@lists.xensource.com; Sat, 12 Nov 2011 00:11:32 +0000
Message-Id: <E1RP1C0-0005kX-FD@xenbits.xen.org>
Date: Sat, 12 Nov 2011 00:11:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] Modify naming of queries into the p2m
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andres Lagar-Cavilla <andres@lagarcavilla.org>
# Date 1321035094 0
# Node ID 3622d7fae14dfc2d00f378738ace3b65ee65b6cc
# Parent  9af6829a927379b6455a64ca49e769de34120800
Modify naming of queries into the p2m

Callers of lookups into the p2m code are now variants of get_gfn. All
callers need to call put_gfn. The code behind it is a no-op at the
moment, but will change to proper locking in a later patch.

This patch does not change functionality. Only naming, and adds
put_gfn's.

set_p2m_entry retains its name because it is always called with
p2m_lock held.

This patch is humongous, unfortunately, given the dozens of call sites
involved.

After this patch, anyone using old style gfn_to_mfn will not succeed
in compiling their code. This is on purpose: adapt to the new API.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: Tim Deegan <tim@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/cpu/mcheck/vmce.c
--- a/xen/arch/x86/cpu/mcheck/vmce.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/cpu/mcheck/vmce.c	Fri Nov 11 18:11:34 2011 +0000
@@ -574,6 +574,7 @@
 {
     mfn_t r_mfn;
     p2m_type_t pt;
+    int rc;
 
     /* Always trust dom0's MCE handler will prevent future access */
     if ( d == dom0 )
@@ -585,14 +586,16 @@
     if ( !is_hvm_domain(d) || !paging_mode_hap(d) )
         return -ENOSYS;
 
-    r_mfn = gfn_to_mfn_query(d, gfn, &pt);
+    rc = -1;
+    r_mfn = get_gfn_query(d, gfn, &pt);
     if ( p2m_to_mask(pt) & P2M_UNMAP_TYPES)
     {
         ASSERT(mfn_x(r_mfn) == mfn_x(mfn));
         p2m_change_type(d, gfn, pt, p2m_ram_broken);
-        return 0;
+        rc = 0;
     }
+    put_gfn(d, gfn);
 
-    return -1;
+    return rc;
 }
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/debug.c
--- a/xen/arch/x86/debug.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/debug.c	Fri Nov 11 18:11:34 2011 +0000
@@ -43,22 +43,23 @@
 
 /* Returns: mfn for the given (hvm guest) vaddr */
 static unsigned long 
-dbg_hvm_va2mfn(dbgva_t vaddr, struct domain *dp, int toaddr)
+dbg_hvm_va2mfn(dbgva_t vaddr, struct domain *dp, int toaddr,
+                unsigned long *gfn)
 {
-    unsigned long mfn, gfn;
+    unsigned long mfn;
     uint32_t pfec = PFEC_page_present;
     p2m_type_t gfntype;
 
     DBGP2("vaddr:%lx domid:%d\n", vaddr, dp->domain_id);
 
-    gfn = paging_gva_to_gfn(dp->vcpu[0], vaddr, &pfec);
-    if ( gfn == INVALID_GFN )
+    *gfn = paging_gva_to_gfn(dp->vcpu[0], vaddr, &pfec);
+    if ( *gfn == INVALID_GFN )
     {
         DBGP2("kdb:bad gfn from gva_to_gfn\n");
         return INVALID_MFN;
     }
 
-    mfn = mfn_x(gfn_to_mfn(dp, gfn, &gfntype)); 
+    mfn = mfn_x(get_gfn(dp, *gfn, &gfntype)); 
     if ( p2m_is_readonly(gfntype) && toaddr )
     {
         DBGP2("kdb:p2m_is_readonly: gfntype:%x\n", gfntype);
@@ -193,12 +194,12 @@
     while ( len > 0 )
     {
         char *va;
-        unsigned long mfn, pagecnt;
+        unsigned long mfn, gfn = INVALID_GFN, pagecnt;
 
         pagecnt = min_t(long, PAGE_SIZE - (addr & ~PAGE_MASK), len);
 
         mfn = (dp->is_hvm
-               ? dbg_hvm_va2mfn(addr, dp, toaddr)
+               ? dbg_hvm_va2mfn(addr, dp, toaddr, &gfn)
                : dbg_pv_va2mfn(addr, dp, pgd3));
         if ( mfn == INVALID_MFN ) 
             break;
@@ -217,6 +218,8 @@
         }
 
         unmap_domain_page(va);
+        if ( gfn != INVALID_GFN )
+            put_gfn(dp, gfn);
 
         addr += pagecnt;
         buf += pagecnt;
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/domain.c	Fri Nov 11 18:11:34 2011 +0000
@@ -720,6 +720,7 @@
     struct vcpu *v, vcpu_guest_context_u c)
 {
     struct domain *d = v->domain;
+    unsigned long cr3_gfn;
     unsigned long cr3_pfn = INVALID_MFN;
     unsigned long flags, cr4;
     unsigned int i;
@@ -931,7 +932,8 @@
 
     if ( !compat )
     {
-        cr3_pfn = gmfn_to_mfn(d, xen_cr3_to_pfn(c.nat->ctrlreg[3]));
+        cr3_gfn = xen_cr3_to_pfn(c.nat->ctrlreg[3]);
+        cr3_pfn = get_gfn_untyped(d, cr3_gfn);
 
         if ( !mfn_valid(cr3_pfn) ||
              (paging_mode_refcounts(d)
@@ -939,16 +941,18 @@
               : !get_page_and_type(mfn_to_page(cr3_pfn), d,
                                    PGT_base_page_table)) )
         {
+            put_gfn(d, cr3_gfn);
             destroy_gdt(v);
             return -EINVAL;
         }
 
         v->arch.guest_table = pagetable_from_pfn(cr3_pfn);
-
+        put_gfn(d, cr3_gfn);
 #ifdef __x86_64__
         if ( c.nat->ctrlreg[1] )
         {
-            cr3_pfn = gmfn_to_mfn(d, xen_cr3_to_pfn(c.nat->ctrlreg[1]));
+            cr3_gfn = xen_cr3_to_pfn(c.nat->ctrlreg[1]);
+            cr3_pfn = get_gfn_untyped(d, cr3_gfn);
 
             if ( !mfn_valid(cr3_pfn) ||
                  (paging_mode_refcounts(d)
@@ -962,11 +966,13 @@
                     put_page(mfn_to_page(cr3_pfn));
                 else
                     put_page_and_type(mfn_to_page(cr3_pfn));
+                put_gfn(d, cr3_gfn); 
                 destroy_gdt(v);
                 return -EINVAL;
             }
 
             v->arch.guest_table_user = pagetable_from_pfn(cr3_pfn);
+            put_gfn(d, cr3_gfn); 
         }
         else if ( !(flags & VGCF_in_kernel) )
         {
@@ -978,7 +984,8 @@
     {
         l4_pgentry_t *l4tab;
 
-        cr3_pfn = gmfn_to_mfn(d, compat_cr3_to_pfn(c.cmp->ctrlreg[3]));
+        cr3_gfn = compat_cr3_to_pfn(c.cmp->ctrlreg[3]);
+        cr3_pfn = get_gfn_untyped(d, cr3_gfn);
 
         if ( !mfn_valid(cr3_pfn) ||
              (paging_mode_refcounts(d)
@@ -986,6 +993,7 @@
               : !get_page_and_type(mfn_to_page(cr3_pfn), d,
                                    PGT_l3_page_table)) )
         {
+            put_gfn(d, cr3_gfn); 
             destroy_gdt(v);
             return -EINVAL;
         }
@@ -993,6 +1001,7 @@
         l4tab = __va(pagetable_get_paddr(v->arch.guest_table));
         *l4tab = l4e_from_pfn(
             cr3_pfn, _PAGE_PRESENT|_PAGE_RW|_PAGE_USER|_PAGE_ACCESSED);
+        put_gfn(d, cr3_gfn); 
 #endif
     }
 
@@ -1058,11 +1067,12 @@
  * event doesn't get missed.
  */
 static int
-map_vcpu_info(struct vcpu *v, unsigned long mfn, unsigned offset)
+map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset)
 {
     struct domain *d = v->domain;
     void *mapping;
     vcpu_info_t *new_info;
+    unsigned long mfn;
     int i;
 
     if ( offset > (PAGE_SIZE - sizeof(vcpu_info_t)) )
@@ -1075,15 +1085,19 @@
     if ( (v != current) && !test_bit(_VPF_down, &v->pause_flags) )
         return -EINVAL;
 
-    mfn = gmfn_to_mfn(d, mfn);
+    mfn = get_gfn_untyped(d, gfn);
     if ( !mfn_valid(mfn) ||
          !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
+    {
+        put_gfn(d, gfn); 
         return -EINVAL;
+    }
 
     mapping = map_domain_page_global(mfn);
     if ( mapping == NULL )
     {
         put_page_and_type(mfn_to_page(mfn));
+        put_gfn(d, gfn); 
         return -ENOMEM;
     }
 
@@ -1113,6 +1127,7 @@
     for ( i = 0; i < BITS_PER_EVTCHN_WORD(d); i++ )
         set_bit(i, &vcpu_info(v, evtchn_pending_sel));
 
+    put_gfn(d, gfn); 
     return 0;
 }
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/domctl.c	Fri Nov 11 18:11:34 2011 +0000
@@ -199,7 +199,7 @@
 
                 for ( j = 0; j < k; j++ )
                 {
-                    unsigned long type = 0, mfn = gmfn_to_mfn(d, arr[j]);
+                    unsigned long type = 0, mfn = get_gfn_untyped(d, arr[j]);
 
                     page = mfn_to_page(mfn);
 
@@ -235,6 +235,7 @@
                         type = XEN_DOMCTL_PFINFO_XTAB;
 
                     arr[j] = type;
+                    put_gfn(d, arr[j]);
                 }
 
                 if ( copy_to_guest_offset(domctl->u.getpageframeinfo3.array,
@@ -299,7 +300,8 @@
             for ( j = 0; j < k; j++ )
             {      
                 struct page_info *page;
-                unsigned long mfn = gmfn_to_mfn(d, arr32[j]);
+                unsigned long gfn = arr32[j];
+                unsigned long mfn = get_gfn_untyped(d, gfn);
 
                 page = mfn_to_page(mfn);
 
@@ -310,8 +312,10 @@
                      unlikely(is_xen_heap_mfn(mfn)) )
                     arr32[j] |= XEN_DOMCTL_PFINFO_XTAB;
                 else if ( xsm_getpageframeinfo(page) != 0 )
+                {
+                    put_gfn(d, gfn); 
                     continue;
-                else if ( likely(get_page(page, d)) )
+                } else if ( likely(get_page(page, d)) )
                 {
                     unsigned long type = 0;
 
@@ -339,6 +343,7 @@
                 else
                     arr32[j] |= XEN_DOMCTL_PFINFO_XTAB;
 
+                put_gfn(d, gfn); 
             }
 
             if ( copy_to_guest_offset(domctl->u.getpageframeinfo2.array,
@@ -425,12 +430,13 @@
             break;
         }
 
-        mfn = gmfn_to_mfn(d, gmfn);
+        mfn = get_gfn_untyped(d, gmfn);
 
         ret = -EACCES;
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
         {
+            put_gfn(d, gmfn); 
             rcu_unlock_domain(d);
             break;
         }
@@ -443,6 +449,7 @@
 
         put_page_and_type(mfn_to_page(mfn));
 
+        put_gfn(d, gmfn); 
         rcu_unlock_domain(d);
     }
     break;
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/emulate.c
--- a/xen/arch/x86/hvm/emulate.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/emulate.c	Fri Nov 11 18:11:34 2011 +0000
@@ -63,14 +63,18 @@
     int rc;
 
     /* Check for paged out page */
-    ram_mfn = gfn_to_mfn_unshare(curr->domain, ram_gfn, &p2mt);
+    ram_mfn = get_gfn_unshare(curr->domain, ram_gfn, &p2mt);
     if ( p2m_is_paging(p2mt) )
     {
         p2m_mem_paging_populate(curr->domain, ram_gfn);
+        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_RETRY;
     }
     if ( p2m_is_shared(p2mt) )
+    {
+        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_RETRY;
+    }
 
     /*
      * Weird-sized accesses have undefined behaviour: we discard writes
@@ -82,6 +86,7 @@
         ASSERT(p_data != NULL); /* cannot happen with a REP prefix */
         if ( dir == IOREQ_READ )
             memset(p_data, ~0, size);
+        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -101,7 +106,10 @@
             paddr_t pa = vio->mmio_large_write_pa;
             unsigned int bytes = vio->mmio_large_write_bytes;
             if ( (addr >= pa) && ((addr + size) <= (pa + bytes)) )
+            {
+                put_gfn(curr->domain, ram_gfn); 
                 return X86EMUL_OKAY;
+            }
         }
         else
         {
@@ -111,6 +119,7 @@
             {
                 memcpy(p_data, &vio->mmio_large_read[addr - pa],
                        size);
+                put_gfn(curr->domain, ram_gfn); 
                 return X86EMUL_OKAY;
             }
         }
@@ -123,15 +132,22 @@
     case HVMIO_completed:
         vio->io_state = HVMIO_none;
         if ( p_data == NULL )
+        {
+            put_gfn(curr->domain, ram_gfn);
             return X86EMUL_UNHANDLEABLE;
+        }
         goto finish_access;
     case HVMIO_dispatched:
         /* May have to wait for previous cycle of a multi-write to complete. */
         if ( is_mmio && !value_is_ptr && (dir == IOREQ_WRITE) &&
              (addr == (vio->mmio_large_write_pa +
                        vio->mmio_large_write_bytes)) )
+        {
+            put_gfn(curr->domain, ram_gfn);
             return X86EMUL_RETRY;
+        }
     default:
+        put_gfn(curr->domain, ram_gfn);
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -139,6 +155,7 @@
     {
         gdprintk(XENLOG_WARNING, "WARNING: io already pending (%d)?\n",
                  p->state);
+        put_gfn(curr->domain, ram_gfn); 
         return X86EMUL_UNHANDLEABLE;
     }
 
@@ -189,7 +206,10 @@
     }
 
     if ( rc != X86EMUL_OKAY )
+    {
+        put_gfn(curr->domain, ram_gfn); 
         return rc;
+    }
 
  finish_access:
     if ( p_data != NULL )
@@ -223,6 +243,7 @@
         }
     }
 
+    put_gfn(curr->domain, ram_gfn); 
     return X86EMUL_OKAY;
 }
 
@@ -671,12 +692,14 @@
     if ( rc != X86EMUL_OKAY )
         return rc;
 
-    (void)gfn_to_mfn(current->domain, sgpa >> PAGE_SHIFT, &p2mt);
+    /* Unlocked works here because we get_gfn for real in whatever
+     * we call later. */
+    (void)get_gfn_unlocked(current->domain, sgpa >> PAGE_SHIFT, &p2mt);
     if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
         return hvmemul_do_mmio(
             sgpa, reps, bytes_per_rep, dgpa, IOREQ_READ, df, NULL);
 
-    (void)gfn_to_mfn(current->domain, dgpa >> PAGE_SHIFT, &p2mt);
+    (void)get_gfn_unlocked(current->domain, dgpa >> PAGE_SHIFT, &p2mt);
     if ( !p2m_is_ram(p2mt) && !p2m_is_grant(p2mt) )
         return hvmemul_do_mmio(
             dgpa, reps, bytes_per_rep, sgpa, IOREQ_WRITE, df, NULL);
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Fri Nov 11 18:11:34 2011 +0000
@@ -355,26 +355,37 @@
     unsigned long mfn;
     void *va;
 
-    mfn = mfn_x(gfn_to_mfn_unshare(d, gmfn, &p2mt));
+    mfn = mfn_x(get_gfn_unshare(d, gmfn, &p2mt));
     if ( !p2m_is_ram(p2mt) )
+    {
+        put_gfn(d, gmfn);
         return -EINVAL;
+    }
     if ( p2m_is_paging(p2mt) )
     {
         p2m_mem_paging_populate(d, gmfn);
+        put_gfn(d, gmfn);
         return -ENOENT;
     }
     if ( p2m_is_shared(p2mt) )
+    {
+        put_gfn(d, gmfn);
         return -ENOENT;
+    }
     ASSERT(mfn_valid(mfn));
 
     page = mfn_to_page(mfn);
     if ( !get_page_and_type(page, d, PGT_writable_page) )
+    {
+        put_gfn(d, gmfn);
         return -EINVAL;
+    }
 
     va = map_domain_page_global(mfn);
     if ( va == NULL )
     {
         put_page_and_type(page);
+        put_gfn(d, gmfn);
         return -ENOMEM;
     }
 
@@ -385,6 +396,7 @@
         spin_unlock(&iorp->lock);
         unmap_domain_page_global(va);
         put_page_and_type(mfn_to_page(mfn));
+        put_gfn(d, gmfn);
         return -EINVAL;
     }
 
@@ -392,6 +404,7 @@
     iorp->page = page;
 
     spin_unlock(&iorp->lock);
+    put_gfn(d, gmfn);
 
     domain_unpause(d);
 
@@ -1182,6 +1195,7 @@
     mfn_t mfn;
     struct vcpu *v = current;
     struct p2m_domain *p2m;
+    int rc;
 
     /* On Nested Virtualization, walk the guest page table.
      * If this succeeds, all is fine.
@@ -1216,7 +1230,7 @@
     }
 
     p2m = p2m_get_hostp2m(v->domain);
-    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
+    mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
 
     /* Check access permissions first, then handle faults */
     if ( access_valid && (mfn_x(mfn) != INVALID_MFN) )
@@ -1255,8 +1269,8 @@
         if ( violation )
         {
             p2m_mem_access_check(gpa, gla_valid, gla, access_r, access_w, access_x);
-
-            return 1;
+            rc = 1;
+            goto out_put_gfn;
         }
     }
 
@@ -1268,7 +1282,8 @@
     {
         if ( !handle_mmio() )
             hvm_inject_exception(TRAP_gp_fault, 0, 0);
-        return 1;
+        rc = 1;
+        goto out_put_gfn;
     }
 
 #ifdef __x86_64__
@@ -1281,7 +1296,8 @@
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
         mem_sharing_unshare_page(p2m->domain, gfn, 0);
-        return 1;
+        rc = 1;
+        goto out_put_gfn;
     }
 #endif
  
@@ -1295,7 +1311,8 @@
          */
         paging_mark_dirty(v->domain, mfn_x(mfn));
         p2m_change_type(v->domain, gfn, p2m_ram_logdirty, p2m_ram_rw);
-        return 1;
+        rc = 1;
+        goto out_put_gfn;
     }
 
     /* Shouldn't happen: Maybe the guest was writing to a r/o grant mapping? */
@@ -1304,10 +1321,14 @@
         gdprintk(XENLOG_WARNING,
                  "trying to write to read-only grant mapping\n");
         hvm_inject_exception(TRAP_gp_fault, 0, 0);
-        return 1;
+        rc = 1;
+        goto out_put_gfn;
     }
 
-    return 0;
+    rc = 0;
+out_put_gfn:
+    put_gfn(p2m->domain, gfn);
+    return rc;
 }
 
 int hvm_handle_xsetbv(u64 new_bv)
@@ -1530,10 +1551,11 @@
         {
             /* The guest CR3 must be pointing to the guest physical. */
             gfn = v->arch.hvm_vcpu.guest_cr[3]>>PAGE_SHIFT;
-            mfn = mfn_x(gfn_to_mfn(v->domain, gfn, &p2mt));
+            mfn = mfn_x(get_gfn(v->domain, gfn, &p2mt));
             if ( !p2m_is_ram(p2mt) || !mfn_valid(mfn) ||
                  !get_page(mfn_to_page(mfn), v->domain))
             {
+                put_gfn(v->domain, gfn);
                 gdprintk(XENLOG_ERR, "Invalid CR3 value = %lx (mfn=%lx)\n",
                          v->arch.hvm_vcpu.guest_cr[3], mfn);
                 domain_crash(v->domain);
@@ -1545,6 +1567,7 @@
 
             HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx, mfn = %lx",
                         v->arch.hvm_vcpu.guest_cr[3], mfn);
+            put_gfn(v->domain, gfn);
         }
     }
     else if ( !(value & X86_CR0_PG) && (old_value & X86_CR0_PG) )
@@ -1621,13 +1644,17 @@
     {
         /* Shadow-mode CR3 change. Check PDBR and update refcounts. */
         HVM_DBG_LOG(DBG_LEVEL_VMMU, "CR3 value = %lx", value);
-        mfn = mfn_x(gfn_to_mfn(v->domain, value >> PAGE_SHIFT, &p2mt));
+        mfn = mfn_x(get_gfn(v->domain, value >> PAGE_SHIFT, &p2mt));
         if ( !p2m_is_ram(p2mt) || !mfn_valid(mfn) ||
              !get_page(mfn_to_page(mfn), v->domain) )
+        {
+              put_gfn(v->domain, value >> PAGE_SHIFT);
               goto bad_cr3;
+        }
 
         put_page(pagetable_get_page(v->arch.guest_table));
         v->arch.guest_table = pagetable_from_pfn(mfn);
+        put_gfn(v->domain, value >> PAGE_SHIFT);
 
         HVM_DBG_LOG(DBG_LEVEL_VMMU, "Update CR3 value = %lx", value);
     }
@@ -1764,6 +1791,7 @@
     return 0;
 }
 
+/* We leave this function holding a lock on the p2m entry */
 static void *__hvm_map_guest_frame(unsigned long gfn, bool_t writable)
 {
     unsigned long mfn;
@@ -1771,13 +1799,17 @@
     struct domain *d = current->domain;
 
     mfn = mfn_x(writable
-                ? gfn_to_mfn_unshare(d, gfn, &p2mt)
-                : gfn_to_mfn(d, gfn, &p2mt));
+                ? get_gfn_unshare(d, gfn, &p2mt)
+                : get_gfn(d, gfn, &p2mt));
     if ( (p2m_is_shared(p2mt) && writable) || !p2m_is_ram(p2mt) )
+    {
+        put_gfn(d, gfn);
         return NULL;
+    }
     if ( p2m_is_paging(p2mt) )
     {
         p2m_mem_paging_populate(d, gfn);
+        put_gfn(d, gfn);
         return NULL;
     }
 
@@ -1805,9 +1837,8 @@
         unmap_domain_page(p);
 }
 
-static void *hvm_map_entry(unsigned long va)
+static void *hvm_map_entry(unsigned long va, unsigned long *gfn)
 {
-    unsigned long gfn;
     uint32_t pfec;
     char *v;
 
@@ -1824,11 +1855,11 @@
      * treat it as a kernel-mode read (i.e. no access checks).
      */
     pfec = PFEC_page_present;
-    gfn = paging_gva_to_gfn(current, va, &pfec);
+    *gfn = paging_gva_to_gfn(current, va, &pfec);
     if ( (pfec == PFEC_page_paged) || (pfec == PFEC_page_shared) )
         goto fail;
 
-    v = hvm_map_guest_frame_rw(gfn);
+    v = hvm_map_guest_frame_rw(*gfn);
     if ( v == NULL )
         goto fail;
 
@@ -1839,9 +1870,11 @@
     return NULL;
 }
 
-static void hvm_unmap_entry(void *p)
+static void hvm_unmap_entry(void *p, unsigned long gfn)
 {
     hvm_unmap_guest_frame(p);
+    if ( p && (gfn != INVALID_GFN) )
+        put_gfn(current->domain, gfn);
 }
 
 static int hvm_load_segment_selector(
@@ -1853,6 +1886,7 @@
     int fault_type = TRAP_invalid_tss;
     struct cpu_user_regs *regs = guest_cpu_user_regs();
     struct vcpu *v = current;
+    unsigned long pdesc_gfn = INVALID_GFN;
 
     if ( regs->eflags & X86_EFLAGS_VM )
     {
@@ -1886,7 +1920,7 @@
     if ( ((sel & 0xfff8) + 7) > desctab.limit )
         goto fail;
 
-    pdesc = hvm_map_entry(desctab.base + (sel & 0xfff8));
+    pdesc = hvm_map_entry(desctab.base + (sel & 0xfff8), &pdesc_gfn);
     if ( pdesc == NULL )
         goto hvm_map_fail;
 
@@ -1946,7 +1980,7 @@
     desc.b |= 0x100;
 
  skip_accessed_flag:
-    hvm_unmap_entry(pdesc);
+    hvm_unmap_entry(pdesc, pdesc_gfn);
 
     segr.base = (((desc.b <<  0) & 0xff000000u) |
                  ((desc.b << 16) & 0x00ff0000u) |
@@ -1962,7 +1996,7 @@
     return 0;
 
  unmap_and_fail:
-    hvm_unmap_entry(pdesc);
+    hvm_unmap_entry(pdesc, pdesc_gfn);
  fail:
     hvm_inject_exception(fault_type, sel & 0xfffc, 0);
  hvm_map_fail:
@@ -1977,7 +2011,7 @@
     struct cpu_user_regs *regs = guest_cpu_user_regs();
     struct segment_register gdt, tr, prev_tr, segr;
     struct desc_struct *optss_desc = NULL, *nptss_desc = NULL, tss_desc;
-    unsigned long eflags;
+    unsigned long eflags, optss_gfn = INVALID_GFN, nptss_gfn = INVALID_GFN;
     int exn_raised, rc;
     struct {
         u16 back_link,__blh;
@@ -2003,11 +2037,11 @@
         goto out;
     }
 
-    optss_desc = hvm_map_entry(gdt.base + (prev_tr.sel & 0xfff8));
+    optss_desc = hvm_map_entry(gdt.base + (prev_tr.sel & 0xfff8), &optss_gfn);
     if ( optss_desc == NULL )
         goto out;
 
-    nptss_desc = hvm_map_entry(gdt.base + (tss_sel & 0xfff8));
+    nptss_desc = hvm_map_entry(gdt.base + (tss_sel & 0xfff8), &nptss_gfn);
     if ( nptss_desc == NULL )
         goto out;
 
@@ -2172,8 +2206,8 @@
     }
 
  out:
-    hvm_unmap_entry(optss_desc);
-    hvm_unmap_entry(nptss_desc);
+    hvm_unmap_entry(optss_desc, optss_gfn);
+    hvm_unmap_entry(nptss_desc, nptss_gfn);
 }
 
 #define HVMCOPY_from_guest (0u<<0)
@@ -2230,19 +2264,29 @@
             gfn = addr >> PAGE_SHIFT;
         }
 
-        mfn = mfn_x(gfn_to_mfn_unshare(curr->domain, gfn, &p2mt));
+        mfn = mfn_x(get_gfn_unshare(curr->domain, gfn, &p2mt));
 
         if ( p2m_is_paging(p2mt) )
         {
             p2m_mem_paging_populate(curr->domain, gfn);
+            put_gfn(curr->domain, gfn);
             return HVMCOPY_gfn_paged_out;
         }
         if ( p2m_is_shared(p2mt) )
+        {
+            put_gfn(curr->domain, gfn);
             return HVMCOPY_gfn_shared;
+        }
         if ( p2m_is_grant(p2mt) )
+        {
+            put_gfn(curr->domain, gfn);
             return HVMCOPY_unhandleable;
+        }
         if ( !p2m_is_ram(p2mt) )
+        {
+            put_gfn(curr->domain, gfn);
             return HVMCOPY_bad_gfn_to_mfn;
+        }
         ASSERT(mfn_valid(mfn));
 
         p = (char *)map_domain_page(mfn) + (addr & ~PAGE_MASK);
@@ -2273,6 +2317,7 @@
         addr += count;
         buf  += count;
         todo -= count;
+        put_gfn(curr->domain, gfn);
     }
 
     return HVMCOPY_okay;
@@ -3697,11 +3742,11 @@
         for ( pfn = a.first_pfn; pfn < a.first_pfn + a.nr; pfn++ )
         {
             p2m_type_t t;
-            mfn_t mfn = gfn_to_mfn(d, pfn, &t);
+            mfn_t mfn = get_gfn(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
                 p2m_mem_paging_populate(d, pfn);
-
+                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail3;
             }
@@ -3716,6 +3761,7 @@
                 /* don't take a long time and don't die either */
                 sh_remove_shadows(d->vcpu[0], mfn, 1, 0);
             }
+            put_gfn(d, pfn);
         }
 
     param_fail3:
@@ -3739,7 +3785,7 @@
         rc = -EINVAL;
         if ( is_hvm_domain(d) )
         {
-            gfn_to_mfn_unshare(d, a.pfn, &t);
+            get_gfn_unshare_unlocked(d, a.pfn, &t);
             if ( p2m_is_mmio(t) )
                 a.mem_type =  HVMMEM_mmio_dm;
             else if ( p2m_is_readonly(t) )
@@ -3792,20 +3838,23 @@
             p2m_type_t t;
             p2m_type_t nt;
             mfn_t mfn;
-            mfn = gfn_to_mfn_unshare(d, pfn, &t);
+            mfn = get_gfn_unshare(d, pfn, &t);
             if ( p2m_is_paging(t) )
             {
                 p2m_mem_paging_populate(d, pfn);
+                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail4;
             }
             if ( p2m_is_shared(t) )
             {
+                put_gfn(d, pfn);
                 rc = -EINVAL;
                 goto param_fail4;
             } 
             if ( p2m_is_grant(t) )
             {
+                put_gfn(d, pfn);
                 gdprintk(XENLOG_WARNING,
                          "type for pfn 0x%lx changed to grant while "
                          "we were working?\n", pfn);
@@ -3816,6 +3865,7 @@
                 nt = p2m_change_type(d, pfn, t, memtype[a.hvmmem_type]);
                 if ( nt != t )
                 {
+                    put_gfn(d, pfn);
                     gdprintk(XENLOG_WARNING,
                              "type of pfn 0x%lx changed from %d to %d while "
                              "we were trying to change it to %d\n",
@@ -3823,6 +3873,7 @@
                     goto param_fail4;
                 }
             }
+            put_gfn(d, pfn);
         }
 
         rc = 0;
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/mtrr.c
--- a/xen/arch/x86/hvm/mtrr.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/mtrr.c	Fri Nov 11 18:11:34 2011 +0000
@@ -389,7 +389,7 @@
     {
         struct domain *d = v->domain;
         p2m_type_t p2mt;
-        gfn_to_mfn_query(d, paddr_to_pfn(gpaddr), &p2mt);
+        get_gfn_query_unlocked(d, paddr_to_pfn(gpaddr), &p2mt);
         if (p2m_is_ram(p2mt))
             gdprintk(XENLOG_WARNING,
                     "Conflict occurs for a given guest l1e flags:%x "
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/stdvga.c
--- a/xen/arch/x86/hvm/stdvga.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/stdvga.c	Fri Nov 11 18:11:34 2011 +0000
@@ -482,7 +482,7 @@
                 if ( hvm_copy_to_guest_phys(data, &tmp, p->size) !=
                      HVMCOPY_okay )
                 {
-                    (void)gfn_to_mfn(d, data >> PAGE_SHIFT, &p2mt);
+                    (void)get_gfn_unlocked(d, data >> PAGE_SHIFT, &p2mt);
                     /*
                      * The only case we handle is vga_mem <-> vga_mem.
                      * Anything else disables caching and leaves it to qemu-dm.
@@ -504,7 +504,7 @@
                 if ( hvm_copy_from_guest_phys(&tmp, data, p->size) !=
                      HVMCOPY_okay )
                 {
-                    (void)gfn_to_mfn(d, data >> PAGE_SHIFT, &p2mt);
+                    (void)get_gfn_unlocked(d, data >> PAGE_SHIFT, &p2mt);
                     if ( (p2mt != p2m_mmio_dm) || (data < VGA_MEM_BASE) ||
                          ((data + p->size) > (VGA_MEM_BASE + VGA_MEM_SIZE)) )
                         return 0;
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/svm/nestedsvm.c
--- a/xen/arch/x86/hvm/svm/nestedsvm.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/svm/nestedsvm.c	Fri Nov 11 18:11:34 2011 +0000
@@ -81,6 +81,10 @@
         if (nv->nv_vvmcx == NULL)
             return 0;
         nv->nv_vvmcxaddr = vmcbaddr;
+        /* put_gfn here even though the map survives beyond this caller.
+         * The map can likely survive beyond a hypervisor exit, thus we
+         * need to put the gfn */
+        put_gfn(current->domain, vmcbaddr >> PAGE_SHIFT);
     }
 
     return 1;
@@ -354,6 +358,7 @@
     ioport_80 = test_bit(0x80, ns_viomap);
     ioport_ed = test_bit(0xed, ns_viomap);
     hvm_unmap_guest_frame(ns_viomap);
+    put_gfn(current->domain, svm->ns_iomap_pa >> PAGE_SHIFT);
 
     svm->ns_iomap = nestedhvm_vcpu_iomap_get(ioport_80, ioport_ed);
 
@@ -857,23 +862,25 @@
     ioio_info_t ioinfo;
     uint16_t port;
     bool_t enabled;
+    unsigned long gfn = 0; /* gcc ... */
 
     ioinfo.bytes = exitinfo1;
     port = ioinfo.fields.port;
 
     switch (port) {
     case 0 ... 32767: /* first 4KB page */
-        io_bitmap = hvm_map_guest_frame_ro(iopm_gfn);
+        gfn = iopm_gfn;
         break;
     case 32768 ... 65535: /* second 4KB page */
         port -= 32768;
-        io_bitmap = hvm_map_guest_frame_ro(iopm_gfn+1);
+        gfn = iopm_gfn + 1;
         break;
     default:
         BUG();
         break;
     }
 
+    io_bitmap = hvm_map_guest_frame_ro(gfn);
     if (io_bitmap == NULL) {
         gdprintk(XENLOG_ERR,
             "IOIO intercept: mapping of permission map failed\n");
@@ -882,6 +889,8 @@
 
     enabled = test_bit(port, io_bitmap);
     hvm_unmap_guest_frame(io_bitmap);
+    put_gfn(current->domain, gfn);
+
     if (!enabled)
         return NESTEDHVM_VMEXIT_HOST;
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/svm/svm.c	Fri Nov 11 18:11:34 2011 +0000
@@ -244,9 +244,10 @@
     {
         if ( c->cr0 & X86_CR0_PG )
         {
-            mfn = mfn_x(gfn_to_mfn(v->domain, c->cr3 >> PAGE_SHIFT, &p2mt));
+            mfn = mfn_x(get_gfn(v->domain, c->cr3 >> PAGE_SHIFT, &p2mt));
             if ( !p2m_is_ram(p2mt) || !get_page(mfn_to_page(mfn), v->domain) )
             {
+                put_gfn(v->domain, c->cr3 >> PAGE_SHIFT);
                 gdprintk(XENLOG_ERR, "Invalid CR3 value=0x%"PRIx64"\n",
                          c->cr3);
                 return -EINVAL;
@@ -257,6 +258,8 @@
             put_page(pagetable_get_page(v->arch.guest_table));
 
         v->arch.guest_table = pagetable_from_pfn(mfn);
+        if ( c->cr0 & X86_CR0_PG )
+            put_gfn(v->domain, c->cr3 >> PAGE_SHIFT);
     }
 
     v->arch.hvm_vcpu.guest_cr[0] = c->cr0 | X86_CR0_ET;
@@ -1161,7 +1164,9 @@
         p2m = p2m_get_p2m(v);
         _d.gpa = gpa;
         _d.qualification = 0;
-        _d.mfn = mfn_x(gfn_to_mfn_type_p2m(p2m, gfn, &_d.p2mt, &p2ma, p2m_query, NULL));
+        mfn = get_gfn_type_access(p2m, gfn, &_d.p2mt, &p2ma, p2m_query, NULL);
+        __put_gfn(p2m, gfn);
+        _d.mfn = mfn_x(mfn);
         
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
@@ -1181,7 +1186,8 @@
     if ( p2m == NULL )
         p2m = p2m_get_p2m(v);
     /* Everything else is an error. */
-    mfn = gfn_to_mfn_type_p2m(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
+    mfn = get_gfn_type_access(p2m, gfn, &p2mt, &p2ma, p2m_guest, NULL);
+    __put_gfn(p2m, gfn);
     gdprintk(XENLOG_ERR,
          "SVM violation gpa %#"PRIpaddr", mfn %#lx, type %i\n",
          gpa, mfn_x(mfn), p2mt);
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/viridian.c
--- a/xen/arch/x86/hvm/viridian.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/viridian.c	Fri Nov 11 18:11:34 2011 +0000
@@ -134,12 +134,13 @@
 static void enable_hypercall_page(struct domain *d)
 {
     unsigned long gmfn = d->arch.hvm_domain.viridian.hypercall_gpa.fields.pfn;
-    unsigned long mfn = gmfn_to_mfn(d, gmfn);
+    unsigned long mfn = get_gfn_untyped(d, gmfn);
     uint8_t *p;
 
     if ( !mfn_valid(mfn) ||
          !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
     {
+        put_gfn(d, gmfn); 
         gdprintk(XENLOG_WARNING, "Bad GMFN %lx (MFN %lx)\n", gmfn, mfn);
         return;
     }
@@ -162,13 +163,14 @@
     unmap_domain_page(p);
 
     put_page_and_type(mfn_to_page(mfn));
+    put_gfn(d, gmfn); 
 }
 
 void initialize_apic_assist(struct vcpu *v)
 {
     struct domain *d = v->domain;
     unsigned long gmfn = v->arch.hvm_vcpu.viridian.apic_assist.fields.pfn;
-    unsigned long mfn = gmfn_to_mfn(d, gmfn);
+    unsigned long mfn = get_gfn_untyped(d, gmfn);
     uint8_t *p;
 
     /*
@@ -184,6 +186,7 @@
     if ( !mfn_valid(mfn) ||
          !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
     {
+        put_gfn(d, gmfn); 
         gdprintk(XENLOG_WARNING, "Bad GMFN %lx (MFN %lx)\n", gmfn, mfn);
         return;
     }
@@ -195,6 +198,7 @@
     unmap_domain_page(p);
 
     put_page_and_type(mfn_to_page(mfn));
+    put_gfn(d, gmfn); 
 }
 
 int wrmsr_viridian_regs(uint32_t idx, uint64_t val)
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vmx.c	Fri Nov 11 18:11:34 2011 +0000
@@ -487,9 +487,10 @@
     {
         if ( cr0 & X86_CR0_PG )
         {
-            mfn = mfn_x(gfn_to_mfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
+            mfn = mfn_x(get_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
             if ( !p2m_is_ram(p2mt) || !get_page(mfn_to_page(mfn), v->domain) )
             {
+                put_gfn(v->domain, cr3 >> PAGE_SHIFT);
                 gdprintk(XENLOG_ERR, "Invalid CR3 value=0x%lx\n", cr3);
                 return -EINVAL;
             }
@@ -499,6 +500,8 @@
             put_page(pagetable_get_page(v->arch.guest_table));
 
         v->arch.guest_table = pagetable_from_pfn(mfn);
+        if ( cr0 & X86_CR0_PG )
+            put_gfn(v->domain, cr3 >> PAGE_SHIFT);
     }
 
     v->arch.hvm_vcpu.guest_cr[0] = cr0 | X86_CR0_ET;
@@ -1007,9 +1010,12 @@
     if ( cr3 & 0x1fUL )
         goto crash;
 
-    mfn = mfn_x(gfn_to_mfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
+    mfn = mfn_x(get_gfn(v->domain, cr3 >> PAGE_SHIFT, &p2mt));
     if ( !p2m_is_ram(p2mt) )
+    {
+        put_gfn(v->domain, cr3 >> PAGE_SHIFT);
         goto crash;
+    }
 
     p = map_domain_page(mfn);
 
@@ -1037,6 +1043,7 @@
     vmx_vmcs_exit(v);
 
     unmap_domain_page(p);
+    put_gfn(v->domain, cr3 >> PAGE_SHIFT);
     return;
 
  crash:
@@ -2090,7 +2097,7 @@
 
         _d.gpa = gpa;
         _d.qualification = qualification;
-        _d.mfn = mfn_x(gfn_to_mfn_query(d, gfn, &_d.p2mt));
+        _d.mfn = mfn_x(get_gfn_query_unlocked(d, gfn, &_d.p2mt));
         
         __trace_var(TRC_HVM_NPF, 0, sizeof(_d), &_d);
     }
@@ -2106,7 +2113,7 @@
         return;
 
     /* Everything else is an error. */
-    mfn = gfn_to_mfn_guest(d, gfn, &p2mt);
+    mfn = get_gfn_guest_unlocked(d, gfn, &p2mt);
     gdprintk(XENLOG_ERR, "EPT violation %#lx (%c%c%c/%c%c%c), "
              "gpa %#"PRIpaddr", mfn %#lx, type %i.\n", 
              qualification, 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/hvm/vmx/vvmx.c
--- a/xen/arch/x86/hvm/vmx/vvmx.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/hvm/vmx/vvmx.c	Fri Nov 11 18:11:34 2011 +0000
@@ -558,9 +558,12 @@
 
     index = vmcs_reg == IO_BITMAP_A ? 0 : 1;
     if (nvmx->iobitmap[index])
-        hvm_unmap_guest_frame (nvmx->iobitmap[index]);
+        hvm_unmap_guest_frame (nvmx->iobitmap[index]); 
     gpa = __get_vvmcs(vcpu_nestedhvm(v).nv_vvmcx, vmcs_reg);
     nvmx->iobitmap[index] = hvm_map_guest_frame_ro (gpa >> PAGE_SHIFT);
+    /* See comment in nestedsvm_vmcb_map re putting this gfn and 
+     * liveness of the map it backs */
+    put_gfn(current->domain, gpa >> PAGE_SHIFT);
 }
 
 static inline void map_io_bitmap_all(struct vcpu *v)
@@ -577,12 +580,12 @@
 
     __clear_current_vvmcs(v);
     if ( nvcpu->nv_vvmcxaddr != VMCX_EADDR )
-        hvm_unmap_guest_frame (nvcpu->nv_vvmcx);
+        hvm_unmap_guest_frame(nvcpu->nv_vvmcx);
     nvcpu->nv_vvmcx == NULL;
     nvcpu->nv_vvmcxaddr = VMCX_EADDR;
     for (i=0; i<2; i++) {
         if ( nvmx->iobitmap[i] ) {
-            hvm_unmap_guest_frame (nvmx->iobitmap[i]);
+            hvm_unmap_guest_frame(nvmx->iobitmap[i]); 
             nvmx->iobitmap[i] = NULL;
         }
     }
@@ -1138,6 +1141,9 @@
         nvcpu->nv_vvmcx = hvm_map_guest_frame_rw (gpa >> PAGE_SHIFT);
         nvcpu->nv_vvmcxaddr = gpa;
         map_io_bitmap_all (v);
+        /* See comment in nestedsvm_vmcb_map regarding putting this 
+         * gfn and liveness of the map that uses it */
+        put_gfn(current->domain, gpa >> PAGE_SHIFT);
     }
 
     vmreturn(regs, VMSUCCEED);
@@ -1199,6 +1205,7 @@
         if ( vvmcs ) 
             __set_vvmcs(vvmcs, NVMX_LAUNCH_STATE, 0);
         hvm_unmap_guest_frame(vvmcs);
+        put_gfn(current->domain, gpa >> PAGE_SHIFT);
     }
 
     vmreturn(regs, VMSUCCEED);
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm.c	Fri Nov 11 18:11:34 2011 +0000
@@ -663,13 +663,19 @@
         return 0;
 
     gmfn = l1e_get_pfn(l1e);
-    mfn = gmfn_to_mfn(d, gmfn);
+    mfn = get_gfn_untyped(d, gmfn);
     if ( unlikely(!mfn_valid(mfn)) )
+    {
+        put_gfn(d, gmfn); 
         return 0;
+    }
 
     okay = get_page_and_type(mfn_to_page(mfn), d, PGT_seg_desc_page);
     if ( unlikely(!okay) )
+    {
+        put_gfn(d, gmfn); 
         return 0;
+    }
 
     nl1e = l1e_from_pfn(mfn, l1e_get_flags(l1e) | _PAGE_RW);
 
@@ -678,6 +684,7 @@
     v->arch.pv_vcpu.shadow_ldt_mapcnt++;
     spin_unlock(&v->arch.pv_vcpu.shadow_ldt_lock);
 
+    put_gfn(d, gmfn); 
     return 1;
 }
 
@@ -1798,7 +1805,6 @@
 {
     l1_pgentry_t ol1e;
     struct domain *pt_dom = pt_vcpu->domain;
-    unsigned long mfn;
     p2m_type_t p2mt;
     int rc = 0;
 
@@ -1815,9 +1821,14 @@
     if ( l1e_get_flags(nl1e) & _PAGE_PRESENT )
     {
         /* Translate foreign guest addresses. */
-        mfn = mfn_x(gfn_to_mfn(pg_dom, l1e_get_pfn(nl1e), &p2mt));
+        unsigned long mfn, gfn;
+        gfn = l1e_get_pfn(nl1e);
+        mfn = mfn_x(get_gfn(pg_dom, gfn, &p2mt));
         if ( !p2m_is_ram(p2mt) || unlikely(mfn == INVALID_MFN) )
+        {
+            put_gfn(pg_dom, gfn);
             return -EINVAL;
+        }
         ASSERT((mfn & ~(PADDR_MASK >> PAGE_SHIFT)) == 0);
         nl1e = l1e_from_pfn(mfn, l1e_get_flags(nl1e));
 
@@ -1825,6 +1836,7 @@
         {
             MEM_LOG("Bad L1 flags %x",
                     l1e_get_flags(nl1e) & l1_disallow_mask(pt_dom));
+            put_gfn(pg_dom, gfn);
             return -EINVAL;
         }
 
@@ -1835,12 +1847,14 @@
             if ( UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu,
                               preserve_ad) )
                 return 0;
+            put_gfn(pg_dom, gfn);
             return -EBUSY;
         }
 
         switch ( rc = get_page_from_l1e(nl1e, pt_dom, pg_dom) )
         {
         default:
+            put_gfn(pg_dom, gfn);
             return rc;
         case 0:
             break;
@@ -1856,6 +1870,7 @@
             ol1e = nl1e;
             rc = -EBUSY;
         }
+        put_gfn(pg_dom, gfn);
     }
     else if ( unlikely(!UPDATE_ENTRY(l1, pl1e, ol1e, nl1e, gl1mfn, pt_vcpu,
                                      preserve_ad)) )
@@ -3023,7 +3038,7 @@
             if ( paging_mode_refcounts(pg_owner) )
                 break;
 
-            mfn = gmfn_to_mfn(pg_owner, op.arg1.mfn);
+            mfn = get_gfn_untyped(pg_owner, op.arg1.mfn);
             rc = get_page_and_type_from_pagenr(mfn, type, pg_owner, 0, 1);
             okay = !rc;
             if ( unlikely(!okay) )
@@ -3032,6 +3047,7 @@
                     rc = -EAGAIN;
                 else if ( rc != -EAGAIN )
                     MEM_LOG("Error while pinning mfn %lx", mfn);
+                put_gfn(pg_owner, op.arg1.mfn);
                 break;
             }
 
@@ -3040,6 +3056,7 @@
             if ( (rc = xsm_memory_pin_page(d, page)) != 0 )
             {
                 put_page_and_type(page);
+                put_gfn(pg_owner, op.arg1.mfn);
                 okay = 0;
                 break;
             }
@@ -3049,6 +3066,7 @@
             {
                 MEM_LOG("Mfn %lx already pinned", mfn);
                 put_page_and_type(page);
+                put_gfn(pg_owner, op.arg1.mfn);
                 okay = 0;
                 break;
             }
@@ -3067,6 +3085,7 @@
                 spin_unlock(&pg_owner->page_alloc_lock);
                 if ( drop_ref )
                     put_page_and_type(page);
+                put_gfn(pg_owner, op.arg1.mfn);
             }
 
             break;
@@ -3079,9 +3098,10 @@
             if ( paging_mode_refcounts(pg_owner) )
                 break;
 
-            mfn = gmfn_to_mfn(pg_owner, op.arg1.mfn);
+            mfn = get_gfn_untyped(pg_owner, op.arg1.mfn);
             if ( unlikely(!(okay = get_page_from_pagenr(mfn, pg_owner))) )
             {
+                put_gfn(pg_owner, op.arg1.mfn);
                 MEM_LOG("Mfn %lx bad domain", mfn);
                 break;
             }
@@ -3092,6 +3112,7 @@
             {
                 okay = 0;
                 put_page(page);
+                put_gfn(pg_owner, op.arg1.mfn);
                 MEM_LOG("Mfn %lx not pinned", mfn);
                 break;
             }
@@ -3102,18 +3123,20 @@
             /* A page is dirtied when its pin status is cleared. */
             paging_mark_dirty(pg_owner, mfn);
 
+            put_gfn(pg_owner, op.arg1.mfn);
             break;
         }
 
         case MMUEXT_NEW_BASEPTR:
-            okay = new_guest_cr3(gmfn_to_mfn(d, op.arg1.mfn));
+            okay = new_guest_cr3(get_gfn_untyped(d, op.arg1.mfn));
+            put_gfn(d, op.arg1.mfn);
             break;
         
 #ifdef __x86_64__
         case MMUEXT_NEW_USER_BASEPTR: {
             unsigned long old_mfn, mfn;
 
-            mfn = gmfn_to_mfn(d, op.arg1.mfn);
+            mfn = get_gfn_untyped(d, op.arg1.mfn);
             if ( mfn != 0 )
             {
                 if ( paging_mode_refcounts(d) )
@@ -3123,6 +3146,7 @@
                         mfn, PGT_root_page_table, d, 0, 0);
                 if ( unlikely(!okay) )
                 {
+                    put_gfn(d, op.arg1.mfn);
                     MEM_LOG("Error while installing new mfn %lx", mfn);
                     break;
                 }
@@ -3130,6 +3154,7 @@
 
             old_mfn = pagetable_get_pfn(curr->arch.guest_table_user);
             curr->arch.guest_table_user = pagetable_from_pfn(mfn);
+            put_gfn(d, op.arg1.mfn);
 
             if ( old_mfn != 0 )
             {
@@ -3247,11 +3272,12 @@
             unsigned long mfn;
             unsigned char *ptr;
 
-            mfn = gmfn_to_mfn(d, op.arg1.mfn);
+            mfn = get_gfn_untyped(d, op.arg1.mfn);
             okay = !get_page_and_type_from_pagenr(
                 mfn, PGT_writable_page, d, 0, 0);
             if ( unlikely(!okay) )
             {
+                put_gfn(d, op.arg1.mfn);
                 MEM_LOG("Error while clearing mfn %lx", mfn);
                 break;
             }
@@ -3264,6 +3290,7 @@
             fixunmap_domain_page(ptr);
 
             put_page_and_type(mfn_to_page(mfn));
+            put_gfn(d, op.arg1.mfn);
             break;
         }
 
@@ -3273,20 +3300,23 @@
             unsigned char *dst;
             unsigned long src_mfn, mfn;
 
-            src_mfn = gmfn_to_mfn(d, op.arg2.src_mfn);
+            src_mfn = get_gfn_untyped(d, op.arg2.src_mfn);
             okay = get_page_from_pagenr(src_mfn, d);
             if ( unlikely(!okay) )
             {
+                put_gfn(d, op.arg2.src_mfn);
                 MEM_LOG("Error while copying from mfn %lx", src_mfn);
                 break;
             }
 
-            mfn = gmfn_to_mfn(d, op.arg1.mfn);
+            mfn = get_gfn_untyped(d, op.arg1.mfn);
             okay = !get_page_and_type_from_pagenr(
                 mfn, PGT_writable_page, d, 0, 0);
             if ( unlikely(!okay) )
             {
+                put_gfn(d, op.arg1.mfn);
                 put_page(mfn_to_page(src_mfn));
+                put_gfn(d, op.arg2.src_mfn);
                 MEM_LOG("Error while copying to mfn %lx", mfn);
                 break;
             }
@@ -3301,7 +3331,9 @@
             unmap_domain_page(src);
 
             put_page_and_type(mfn_to_page(mfn));
+            put_gfn(d, op.arg1.mfn);
             put_page(mfn_to_page(src_mfn));
+            put_gfn(d, op.arg2.src_mfn);
             break;
         }
 
@@ -3489,14 +3521,14 @@
 
             req.ptr -= cmd;
             gmfn = req.ptr >> PAGE_SHIFT;
-            mfn = mfn_x(gfn_to_mfn(pt_owner, gmfn, &p2mt));
+            mfn = mfn_x(get_gfn(pt_owner, gmfn, &p2mt));
             if ( !p2m_is_valid(p2mt) )
-              mfn = INVALID_MFN;
+                mfn = INVALID_MFN;
 
             if ( p2m_is_paged(p2mt) )
             {
                 p2m_mem_paging_populate(pg_owner, gmfn);
-
+                put_gfn(pt_owner, gmfn);
                 rc = -ENOENT;
                 break;
             }
@@ -3504,6 +3536,7 @@
             if ( unlikely(!get_page_from_pagenr(mfn, pt_owner)) )
             {
                 MEM_LOG("Could not get page for normal update");
+                put_gfn(pt_owner, gmfn);
                 break;
             }
 
@@ -3516,6 +3549,7 @@
             if ( rc ) {
                 unmap_domain_page_with_cache(va, &mapcache);
                 put_page(page);
+                put_gfn(pt_owner, gmfn);
                 break;
             }
 
@@ -3527,16 +3561,20 @@
                 {
                     l1_pgentry_t l1e = l1e_from_intpte(req.val);
                     p2m_type_t l1e_p2mt;
-                    gfn_to_mfn(pg_owner, l1e_get_pfn(l1e), &l1e_p2mt);
+                    unsigned long l1egfn = l1e_get_pfn(l1e), l1emfn;
+    
+                    l1emfn = mfn_x(get_gfn(pg_owner, l1egfn, &l1e_p2mt));
 
                     if ( p2m_is_paged(l1e_p2mt) )
                     {
                         p2m_mem_paging_populate(pg_owner, l1e_get_pfn(l1e));
+                        put_gfn(pg_owner, l1egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_paging_in_start == l1e_p2mt && !mfn_valid(mfn) )
                     {
+                        put_gfn(pg_owner, l1egfn);
                         rc = -ENOENT;
                         break;
                     }
@@ -3553,7 +3591,10 @@
                                                           l1e_get_pfn(l1e), 
                                                           0);
                             if ( rc )
+                            {
+                                put_gfn(pg_owner, l1egfn);
                                 break; 
+                            }
                         }
                     } 
 #endif
@@ -3561,27 +3602,33 @@
                     rc = mod_l1_entry(va, l1e, mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v,
                                       pg_owner);
+                    put_gfn(pg_owner, l1egfn);
                 }
                 break;
                 case PGT_l2_page_table:
                 {
                     l2_pgentry_t l2e = l2e_from_intpte(req.val);
                     p2m_type_t l2e_p2mt;
-                    gfn_to_mfn(pg_owner, l2e_get_pfn(l2e), &l2e_p2mt);
+                    unsigned long l2egfn = l2e_get_pfn(l2e), l2emfn;
+
+                    l2emfn = mfn_x(get_gfn(pg_owner, l2egfn, &l2e_p2mt));
 
                     if ( p2m_is_paged(l2e_p2mt) )
                     {
-                        p2m_mem_paging_populate(pg_owner, l2e_get_pfn(l2e));
+                        p2m_mem_paging_populate(pg_owner, l2egfn);
+                        put_gfn(pg_owner, l2egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_paging_in_start == l2e_p2mt && !mfn_valid(mfn) )
                     {
+                        put_gfn(pg_owner, l2egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_shared == l2e_p2mt )
                     {
+                        put_gfn(pg_owner, l2egfn);
                         MEM_LOG("Unexpected attempt to map shared page.\n");
                         break;
                     }
@@ -3589,33 +3636,40 @@
 
                     rc = mod_l2_entry(va, l2e, mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, v);
+                    put_gfn(pg_owner, l2egfn);
                 }
                 break;
                 case PGT_l3_page_table:
                 {
                     l3_pgentry_t l3e = l3e_from_intpte(req.val);
                     p2m_type_t l3e_p2mt;
-                    gfn_to_mfn(pg_owner, l3e_get_pfn(l3e), &l3e_p2mt);
+                    unsigned long l3egfn = l3e_get_pfn(l3e), l3emfn;
+
+                    l3emfn = mfn_x(get_gfn(pg_owner, l3egfn, &l3e_p2mt));
 
                     if ( p2m_is_paged(l3e_p2mt) )
                     {
-                        p2m_mem_paging_populate(pg_owner, l3e_get_pfn(l3e));
+                        p2m_mem_paging_populate(pg_owner, l3egfn);
+                        put_gfn(pg_owner, l3egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_paging_in_start == l3e_p2mt && !mfn_valid(mfn) )
                     {
+                        put_gfn(pg_owner, l3egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_shared == l3e_p2mt )
                     {
+                        put_gfn(pg_owner, l3egfn);
                         MEM_LOG("Unexpected attempt to map shared page.\n");
                         break;
                     }
 
                     rc = mod_l3_entry(va, l3e, mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, 1, v);
+                    put_gfn(pg_owner, l3egfn);
                 }
                 break;
 #if CONFIG_PAGING_LEVELS >= 4
@@ -3623,27 +3677,33 @@
                 {
                     l4_pgentry_t l4e = l4e_from_intpte(req.val);
                     p2m_type_t l4e_p2mt;
-                    gfn_to_mfn(pg_owner, l4e_get_pfn(l4e), &l4e_p2mt);
+                    unsigned long l4egfn = l4e_get_pfn(l4e), l4emfn;
+
+                    l4emfn = mfn_x(get_gfn(pg_owner, l4egfn, &l4e_p2mt));
 
                     if ( p2m_is_paged(l4e_p2mt) )
                     {
-                        p2m_mem_paging_populate(pg_owner, l4e_get_pfn(l4e));
+                        p2m_mem_paging_populate(pg_owner, l4egfn);
+                        put_gfn(pg_owner, l4egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_paging_in_start == l4e_p2mt && !mfn_valid(mfn) )
                     {
+                        put_gfn(pg_owner, l4egfn);
                         rc = -ENOENT;
                         break;
                     }
                     else if ( p2m_ram_shared == l4e_p2mt )
                     {
+                        put_gfn(pg_owner, l4egfn);
                         MEM_LOG("Unexpected attempt to map shared page.\n");
                         break;
                     }
 
                     rc = mod_l4_entry(va, l4e, mfn,
                                       cmd == MMU_PT_UPDATE_PRESERVE_AD, 1, v);
+                    put_gfn(pg_owner, l4egfn);
                 }
                 break;
 #endif
@@ -3667,6 +3727,7 @@
 
             unmap_domain_page_with_cache(va, &mapcache);
             put_page(page);
+            put_gfn(pt_owner, gmfn);
         }
         break;
 
@@ -3753,10 +3814,11 @@
     adjust_guest_l1e(nl1e, d);
 
     gmfn = pte_addr >> PAGE_SHIFT;
-    mfn = gmfn_to_mfn(d, gmfn);
+    mfn = get_gfn_untyped(d, gmfn);
 
     if ( unlikely(!get_page_from_pagenr(mfn, current->domain)) )
     {
+        put_gfn(d, gmfn);
         MEM_LOG("Could not get page for normal update");
         return GNTST_general_error;
     }
@@ -3794,6 +3856,7 @@
  failed:
     unmap_domain_page(va);
     put_page(page);
+    put_gfn(d, gmfn);
 
     return rc;
 }
@@ -3808,10 +3871,11 @@
     l1_pgentry_t ol1e;
 
     gmfn = addr >> PAGE_SHIFT;
-    mfn = gmfn_to_mfn(d, gmfn);
+    mfn = get_gfn_untyped(d, gmfn);
 
     if ( unlikely(!get_page_from_pagenr(mfn, current->domain)) )
     {
+        put_gfn(d, gmfn);
         MEM_LOG("Could not get page for normal update");
         return GNTST_general_error;
     }
@@ -3863,6 +3927,7 @@
  failed:
     unmap_domain_page(va);
     put_page(page);
+    put_gfn(d, gmfn);
     return rc;
 }
 
@@ -4054,9 +4119,10 @@
     if ( new_addr != 0 || (flags & GNTMAP_contains_pte) )
         return GNTST_general_error;
 
-    old_mfn = gfn_to_mfn(d, gfn, &type);
+    old_mfn = get_gfn(d, gfn, &type);
     if ( !p2m_is_grant(type) || mfn_x(old_mfn) != frame )
     {
+        put_gfn(d, gfn);
         gdprintk(XENLOG_WARNING,
                  "replace_grant_p2m_mapping: old mapping invalid (type %d, mfn %lx, frame %lx)\n",
                  type, mfn_x(old_mfn), frame);
@@ -4064,6 +4130,7 @@
     }
     guest_physmap_remove_page(d, gfn, frame, PAGE_ORDER_4K);
 
+    put_gfn(d, gfn);
     return GNTST_okay;
 }
 
@@ -4444,15 +4511,20 @@
     struct domain *d = v->domain;
     /* NB. There are 512 8-byte entries per GDT page. */
     int i, nr_pages = (entries + 511) / 512;
-    unsigned long mfn;
+    unsigned long mfn, *pfns;
 
     if ( entries > FIRST_RESERVED_GDT_ENTRY )
         return -EINVAL;
 
+    pfns = xmalloc_array(unsigned long, nr_pages);
+    if ( !pfns )
+        return -ENOMEM;
+
     /* Check the pages in the new GDT. */
     for ( i = 0; i < nr_pages; i++ )
     {
-        mfn = frames[i] = gmfn_to_mfn(d, frames[i]);
+        pfns[i] = frames[i];
+        mfn = frames[i] = get_gfn_untyped(d, frames[i]);
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), d, PGT_seg_desc_page) )
             goto fail;
@@ -4468,13 +4540,19 @@
         v->arch.pv_vcpu.gdt_frames[i] = frames[i];
         l1e_write(&v->arch.perdomain_ptes[i],
                   l1e_from_pfn(frames[i], __PAGE_HYPERVISOR));
+        put_gfn(d, pfns[i]);
     }
 
+    xfree(pfns);
     return 0;
 
  fail:
     while ( i-- > 0 )
+    {
         put_page_and_type(mfn_to_page(frames[i]));
+        put_gfn(d, pfns[i]);
+    }
+    xfree(pfns);
     return -EINVAL;
 }
 
@@ -4518,15 +4596,21 @@
 
     *(u64 *)&d = desc;
 
-    mfn = gmfn_to_mfn(dom, gmfn);
+    mfn = get_gfn_untyped(dom, gmfn);
     if ( (((unsigned int)pa % sizeof(struct desc_struct)) != 0) ||
          !mfn_valid(mfn) ||
          !check_descriptor(dom, &d) )
+    {
+        put_gfn(dom, gmfn);
         return -EINVAL;
+    }
 
     page = mfn_to_page(mfn);
     if ( unlikely(!get_page(page, dom)) )
+    {
+        put_gfn(dom, gmfn);
         return -EINVAL;
+    }
 
     /* Check if the given frame is in use in an unsafe context. */
     switch ( page->u.inuse.type_info & PGT_type_mask )
@@ -4554,6 +4638,7 @@
 
  out:
     put_page(page);
+    put_gfn(dom, gmfn);
 
     return ret;
 }
@@ -4595,6 +4680,7 @@
 long arch_memory_op(int op, XEN_GUEST_HANDLE(void) arg)
 {
     struct page_info *page = NULL;
+    unsigned long gfn = 0; /* gcc ... */
     int rc;
 
     switch ( op )
@@ -4652,11 +4738,13 @@
         case XENMAPSPACE_gmfn:
         {
             p2m_type_t p2mt;
-
-            xatp.idx = mfn_x(gfn_to_mfn_unshare(d, xatp.idx, &p2mt));
+            gfn = xatp.idx;
+
+            xatp.idx = mfn_x(get_gfn_unshare(d, xatp.idx, &p2mt));
             /* If the page is still shared, exit early */
             if ( p2m_is_shared(p2mt) )
             {
+                put_gfn(d, gfn);
                 rcu_unlock_domain(d);
                 return -ENOMEM;
             }
@@ -4674,6 +4762,8 @@
         {
             if ( page )
                 put_page(page);
+            if ( xatp.space == XENMAPSPACE_gmfn )
+                put_gfn(d, gfn);
             rcu_unlock_domain(d);
             return -EINVAL;
         }
@@ -4684,7 +4774,7 @@
             put_page(page);
 
         /* Remove previously mapped page if it was present. */
-        prev_mfn = gmfn_to_mfn(d, xatp.gpfn);
+        prev_mfn = get_gfn_untyped(d, xatp.gpfn);
         if ( mfn_valid(prev_mfn) )
         {
             if ( is_xen_heap_mfn(prev_mfn) )
@@ -4694,6 +4784,8 @@
                 /* Normal domain memory is freed, to avoid leaking memory. */
                 guest_remove_page(d, xatp.gpfn);
         }
+        /* In the XENMAPSPACE_gmfn case we still hold a ref on the old page. */
+        put_gfn(d, xatp.gpfn);
 
         /* Unmap from old location, if any. */
         gpfn = get_gpfn_from_mfn(mfn);
@@ -4704,6 +4796,9 @@
         /* Map at new location. */
         rc = guest_physmap_add_page(d, xatp.gpfn, mfn, PAGE_ORDER_4K);
 
+        /* In the XENMAPSPACE_gmfn, we took a ref and locked the p2m at the top */
+        if ( xatp.space == XENMAPSPACE_gmfn )
+            put_gfn(d, gfn);
         domain_unlock(d);
 
         rcu_unlock_domain(d);
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/guest_walk.c
--- a/xen/arch/x86/mm/guest_walk.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/guest_walk.c	Fri Nov 11 18:11:34 2011 +0000
@@ -86,30 +86,35 @@
     return 0;
 }
 
+/* If the map is non-NULL, we leave this function having 
+ * called get_gfn, you need to call put_gfn. */
 static inline void *map_domain_gfn(struct p2m_domain *p2m,
                                    gfn_t gfn, 
                                    mfn_t *mfn,
                                    p2m_type_t *p2mt,
                                    uint32_t *rc) 
 {
-    p2m_access_t a;
+    p2m_access_t p2ma;
 
     /* Translate the gfn, unsharing if shared */
-    *mfn = gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), p2mt, &a, p2m_unshare, NULL);
+    *mfn = get_gfn_type_access(p2m, gfn_x(gfn), p2mt, &p2ma, p2m_unshare, NULL);
     if ( p2m_is_paging(*p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
         p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
+        __put_gfn(p2m, gfn_x(gfn));
         *rc = _PAGE_PAGED;
         return NULL;
     }
     if ( p2m_is_shared(*p2mt) )
     {
+        __put_gfn(p2m, gfn_x(gfn));
         *rc = _PAGE_SHARED;
         return NULL;
     }
     if ( !p2m_is_ram(*p2mt) ) 
     {
+        __put_gfn(p2m, gfn_x(gfn));
         *rc |= _PAGE_PRESENT;
         return NULL;
     }
@@ -120,6 +125,9 @@
 
 
 /* Walk the guest pagetables, after the manner of a hardware walker. */
+/* Because the walk is essentially random, it can cause a deadlock 
+ * warning in the p2m locking code. Highly unlikely this is an actual
+ * deadlock, because who would walk page table in the opposite order? */
 uint32_t
 guest_walk_tables(struct vcpu *v, struct p2m_domain *p2m,
                   unsigned long va, walk_t *gw, 
@@ -288,7 +296,6 @@
 #endif
             rc |= _PAGE_INVALID_BITS;
         }
-
         /* Increment the pfn by the right number of 4k pages.  
          * Mask out PAT and invalid bits. */
         start = _gfn((gfn_x(start) & ~GUEST_L2_GFN_MASK) +
@@ -347,12 +354,24 @@
 
  out:
 #if GUEST_PAGING_LEVELS == 4
-    if ( l3p ) unmap_domain_page(l3p);
+    if ( l3p ) 
+    {
+        unmap_domain_page(l3p);
+        __put_gfn(p2m, gfn_x(guest_l4e_get_gfn(gw->l4e)));
+    }
 #endif
 #if GUEST_PAGING_LEVELS >= 3
-    if ( l2p ) unmap_domain_page(l2p);
+    if ( l2p ) 
+    {
+        unmap_domain_page(l2p);
+        __put_gfn(p2m, gfn_x(guest_l3e_get_gfn(gw->l3e))); 
+    }
 #endif
-    if ( l1p ) unmap_domain_page(l1p);
+    if ( l1p ) 
+    {
+        unmap_domain_page(l1p);
+        __put_gfn(p2m, gfn_x(guest_l2e_get_gfn(gw->l2e)));
+    }
 
     return rc;
 }
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/hap/guest_walk.c
--- a/xen/arch/x86/mm/hap/guest_walk.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/hap/guest_walk.c	Fri Nov 11 18:11:34 2011 +0000
@@ -56,26 +56,30 @@
     p2m_type_t p2mt;
     p2m_access_t p2ma;
     walk_t gw;
+    unsigned long top_gfn;
 
     /* Get the top-level table's MFN */
-    top_mfn = gfn_to_mfn_type_p2m(p2m, cr3 >> PAGE_SHIFT, 
-                                  &p2mt, &p2ma, p2m_unshare, NULL);
+    top_gfn = cr3 >> PAGE_SHIFT;
+    top_mfn = get_gfn_type_access(p2m, top_gfn, &p2mt, &p2ma, p2m_unshare, NULL);
     if ( p2m_is_paging(p2mt) )
     {
         ASSERT(!p2m_is_nestedp2m(p2m));
         p2m_mem_paging_populate(p2m->domain, cr3 >> PAGE_SHIFT);
 
         pfec[0] = PFEC_page_paged;
+        __put_gfn(p2m, top_gfn);
         return INVALID_GFN;
     }
     if ( p2m_is_shared(p2mt) )
     {
         pfec[0] = PFEC_page_shared;
+        __put_gfn(p2m, top_gfn);
         return INVALID_GFN;
     }
     if ( !p2m_is_ram(p2mt) )
     {
         pfec[0] &= ~PFEC_page_present;
+        __put_gfn(p2m, top_gfn);
         return INVALID_GFN;
     }
 
@@ -87,26 +91,31 @@
 #endif
     missing = guest_walk_tables(v, p2m, ga, &gw, pfec[0], top_mfn, top_map);
     unmap_domain_page(top_map);
+    __put_gfn(p2m, top_gfn);
 
     /* Interpret the answer */
     if ( missing == 0 )
     {
         gfn_t gfn = guest_l1e_get_gfn(gw.l1e);
-        gfn_to_mfn_type_p2m(p2m, gfn_x(gfn), &p2mt, &p2ma, p2m_unshare, NULL);
+        (void)get_gfn_type_access(p2m, gfn_x(gfn), &p2mt, &p2ma, p2m_unshare, NULL); 
         if ( p2m_is_paging(p2mt) )
         {
             ASSERT(!p2m_is_nestedp2m(p2m));
             p2m_mem_paging_populate(p2m->domain, gfn_x(gfn));
 
             pfec[0] = PFEC_page_paged;
+            __put_gfn(p2m, gfn_x(gfn));
             return INVALID_GFN;
         }
         if ( p2m_is_shared(p2mt) )
         {
             pfec[0] = PFEC_page_shared;
+            __put_gfn(p2m, gfn_x(gfn));
             return INVALID_GFN;
         }
 
+        __put_gfn(p2m, gfn_x(gfn));
+
         if ( page_order )
             *page_order = guest_walk_to_page_order(&gw);
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/hap/nested_hap.c
--- a/xen/arch/x86/mm/hap/nested_hap.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/hap/nested_hap.c	Fri Nov 11 18:11:34 2011 +0000
@@ -146,22 +146,29 @@
     mfn_t mfn;
     p2m_type_t p2mt;
     p2m_access_t p2ma;
+    int rc;
 
     /* walk L0 P2M table */
-    mfn = gfn_to_mfn_type_p2m(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, 
+    mfn = get_gfn_type_access(p2m, L1_gpa >> PAGE_SHIFT, &p2mt, &p2ma, 
                               p2m_query, page_order);
 
+    rc = NESTEDHVM_PAGEFAULT_MMIO;
     if ( p2m_is_mmio(p2mt) )
-        return NESTEDHVM_PAGEFAULT_MMIO;
+        goto out;
 
+    rc = NESTEDHVM_PAGEFAULT_ERROR;
     if ( p2m_is_paging(p2mt) || p2m_is_shared(p2mt) || !p2m_is_ram(p2mt) )
-        return NESTEDHVM_PAGEFAULT_ERROR;
+        goto out;
 
+    rc = NESTEDHVM_PAGEFAULT_ERROR;
     if ( !mfn_valid(mfn) )
-        return NESTEDHVM_PAGEFAULT_ERROR;
+        goto out;
 
     *L0_gpa = (mfn_x(mfn) << PAGE_SHIFT) + (L1_gpa & ~PAGE_MASK);
-    return NESTEDHVM_PAGEFAULT_DONE;
+    rc = NESTEDHVM_PAGEFAULT_DONE;
+out:
+    __put_gfn(p2m, L1_gpa >> PAGE_SHIFT);
+    return rc;
 }
 
 /* This function uses L2_gpa to walk the P2M page table in L1. If the 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/mem_event.c
--- a/xen/arch/x86/mm/mem_event.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/mem_event.c	Fri Nov 11 18:11:34 2011 +0000
@@ -47,7 +47,7 @@
     unsigned long ring_addr = mec->ring_addr;
     unsigned long shared_addr = mec->shared_addr;
     l1_pgentry_t l1e;
-    unsigned long gfn;
+    unsigned long shared_gfn = 0, ring_gfn = 0; /* gcc ... */
     p2m_type_t p2mt;
     mfn_t ring_mfn;
     mfn_t shared_mfn;
@@ -60,23 +60,36 @@
 
     /* Get MFN of ring page */
     guest_get_eff_l1e(v, ring_addr, &l1e);
-    gfn = l1e_get_pfn(l1e);
-    ring_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
+    ring_gfn = l1e_get_pfn(l1e);
+    /* We're grabbing these two in an order that could deadlock
+     * dom0 if 1. it were an hvm 2. there were two concurrent
+     * enables 3. the two gfn's in each enable criss-crossed
+     * 2MB regions. Duly noted.... */
+    ring_mfn = get_gfn(dom_mem_event, ring_gfn, &p2mt);
 
     if ( unlikely(!mfn_valid(mfn_x(ring_mfn))) )
+    {
+        put_gfn(dom_mem_event, ring_gfn);
         return -EINVAL;
+    }
 
     /* Get MFN of shared page */
     guest_get_eff_l1e(v, shared_addr, &l1e);
-    gfn = l1e_get_pfn(l1e);
-    shared_mfn = gfn_to_mfn(dom_mem_event, gfn, &p2mt);
+    shared_gfn = l1e_get_pfn(l1e);
+    shared_mfn = get_gfn(dom_mem_event, shared_gfn, &p2mt);
 
     if ( unlikely(!mfn_valid(mfn_x(shared_mfn))) )
+    {
+        put_gfn(dom_mem_event, ring_gfn);
+        put_gfn(dom_mem_event, shared_gfn);
         return -EINVAL;
+    }
 
     /* Map ring and shared pages */
     med->ring_page = map_domain_page(mfn_x(ring_mfn));
     med->shared_page = map_domain_page(mfn_x(shared_mfn));
+    put_gfn(dom_mem_event, ring_gfn);
+    put_gfn(dom_mem_event, shared_gfn); 
 
     /* Allocate event channel */
     rc = alloc_unbound_xen_event_channel(d->vcpu[0],
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/mem_sharing.c
--- a/xen/arch/x86/mm/mem_sharing.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/mem_sharing.c	Fri Nov 11 18:11:34 2011 +0000
@@ -227,7 +227,7 @@
                             g->domain, g->gfn, mfn_x(e->mfn));
                     continue;
                 }
-                mfn = gfn_to_mfn(d, g->gfn, &t); 
+                mfn = get_gfn_unlocked(d, g->gfn, &t); 
                 if(mfn_x(mfn) != mfn_x(e->mfn))
                     MEM_SHARING_DEBUG("Incorrect P2M for d=%d, PFN=%lx."
                                       "Expecting MFN=%ld, got %ld\n",
@@ -335,7 +335,7 @@
     p2m_type_t p2mt;
     mfn_t mfn;
 
-    mfn = gfn_to_mfn(d, gfn, &p2mt);
+    mfn = get_gfn_unlocked(d, gfn, &p2mt);
 
     printk("Debug for domain=%d, gfn=%lx, ", 
             d->domain_id, 
@@ -460,7 +460,7 @@
     *phandle = 0UL;
 
     shr_lock(); 
-    mfn = gfn_to_mfn(d, gfn, &p2mt);
+    mfn = get_gfn(d, gfn, &p2mt);
 
     /* Check if mfn is valid */
     ret = -EINVAL;
@@ -524,6 +524,7 @@
     ret = 0;
 
 out:
+    put_gfn(d, gfn);
     shr_unlock();
     return ret;
 }
@@ -593,14 +594,18 @@
     shr_handle_t handle;
     struct list_head *le;
 
+    /* Remove the gfn_info from the list */
+   
+    /* This is one of the reasons why we can't enforce ordering
+     * between shr_lock and p2m fine-grained locks in mm-lock. 
+     * Callers may walk in here already holding the lock for this gfn */
     shr_lock();
     mem_sharing_audit();
-    
-    /* Remove the gfn_info from the list */
-    mfn = gfn_to_mfn(d, gfn, &p2mt);
+    mfn = get_gfn(d, gfn, &p2mt);
     
     /* Has someone already unshared it? */
     if (!p2m_is_shared(p2mt)) {
+        put_gfn(d, gfn);
         shr_unlock();
         return 0;
     }
@@ -634,6 +639,7 @@
             /* Even though we don't allocate a private page, we have to account
              * for the MFN that originally backed this PFN. */
             atomic_dec(&nr_saved_mfns);
+        put_gfn(d, gfn);
         shr_unlock();
         put_page_and_type(page);
         if(last_gfn && 
@@ -653,6 +659,7 @@
         /* We've failed to obtain memory for private page. Need to re-add the
          * gfn_info to relevant list */
         list_add(&gfn_info->list, &hash_entry->gfns);
+        put_gfn(d, gfn);
         shr_unlock();
         return -ENOMEM;
     }
@@ -663,6 +670,13 @@
     unmap_domain_page(s);
     unmap_domain_page(t);
 
+    /* NOTE: set_shared_p2m_entry will switch the underlying mfn. If
+     * we do get_page withing get_gfn, the correct sequence here
+     * should be
+       get_page(page);
+       put_page(old_page);
+     * so that the ref to the old page is dropped, and a ref to
+     * the new page is obtained to later be dropped in put_gfn */
     BUG_ON(set_shared_p2m_entry(d, gfn, page_to_mfn(page)) == 0);
     put_page_and_type(old_page);
 
@@ -683,6 +697,7 @@
     /* Update m2p entry */
     set_gpfn_from_mfn(mfn_x(page_to_mfn(page)), gfn);
 
+    put_gfn(d, gfn);
     shr_unlock();
     return 0;
 }
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/p2m-pod.c
--- a/xen/arch/x86/mm/p2m-pod.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/p2m-pod.c	Fri Nov 11 18:11:34 2011 +0000
@@ -531,9 +531,10 @@
     /* FIXME: Add contiguous; query for PSE entries? */
     for ( i=0; i<(1<<order); i++)
     {
+        p2m_access_t a;
         p2m_type_t t;
 
-        gfn_to_mfn_query(d, gpfn + i, &t);
+        (void)p2m->get_entry(p2m, gpfn + i, &t, &a, p2m_query, NULL);
 
         if ( t == p2m_populate_on_demand )
             pod++;
@@ -572,8 +573,9 @@
     {
         mfn_t mfn;
         p2m_type_t t;
+        p2m_access_t a;
 
-        mfn = gfn_to_mfn_query(d, gpfn + i, &t);
+        mfn = p2m->get_entry(p2m, gpfn + i, &t, &a, p2m_query, NULL);
         if ( t == p2m_populate_on_demand )
         {
             set_p2m_entry(p2m, gpfn + i, _mfn(INVALID_MFN), 0, p2m_invalid, p2m->default_access);
@@ -653,8 +655,8 @@
      * and aligned, and mapping them. */
     for ( i=0; i<SUPERPAGE_PAGES; i++ )
     {
-        
-        mfn = gfn_to_mfn_query(d, gfn + i, &type);
+        p2m_access_t a; 
+        mfn = p2m->get_entry(p2m, gfn + i, &type, &a, p2m_query, NULL);
 
         if ( i == 0 )
         {
@@ -782,7 +784,8 @@
     /* First, get the gfn list, translate to mfns, and map the pages. */
     for ( i=0; i<count; i++ )
     {
-        mfns[i] = gfn_to_mfn_query(d, gfns[i], types + i);
+        p2m_access_t a;
+        mfns[i] = p2m->get_entry(p2m, gfns[i], types + i, &a, p2m_query, NULL);
         /* If this is ram, and not a pagetable or from the xen heap, and probably not mapped
            elsewhere, map it; otherwise, skip. */
         if ( p2m_is_ram(types[i])
@@ -923,7 +926,8 @@
     /* FIXME: Figure out how to avoid superpages */
     for ( i=p2m->pod.reclaim_single; i > 0 ; i-- )
     {
-        gfn_to_mfn_query(p2m->domain, i, &t );
+        p2m_access_t a;
+        (void)p2m->get_entry(p2m, i, &t, &a, p2m_query, NULL);
         if ( p2m_is_ram(t) )
         {
             gfns[j] = i;
@@ -1112,7 +1116,8 @@
     /* Make sure all gpfns are unused */
     for ( i = 0; i < (1UL << order); i++ )
     {
-        omfn = gfn_to_mfn_query(d, gfn + i, &ot);
+        p2m_access_t a;
+        omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
         if ( p2m_is_ram(ot) )
         {
             printk("%s: gfn_to_mfn returned type %d!\n",
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/p2m.c	Fri Nov 11 18:11:34 2011 +0000
@@ -144,7 +144,7 @@
     p2m_unlock(p2m);
 }
 
-mfn_t gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
+mfn_t get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn,
                     p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
                     unsigned int *page_order)
 {
@@ -343,28 +343,27 @@
 #ifdef __x86_64__
     unsigned long gfn;
     p2m_type_t t;
-    p2m_access_t a;
     mfn_t mfn;
 #endif
 
     if (p2m == NULL)
         return;
 
+    p2m_lock(p2m);
+
 #ifdef __x86_64__
     for ( gfn=0; gfn < p2m->max_mapped_pfn; gfn++ )
     {
-        mfn = gfn_to_mfn_type_p2m(p2m, gfn, &t, &a, p2m_query, NULL);
+        p2m_access_t a;
+        mfn = p2m->get_entry(p2m, gfn, &t, &a, p2m_query, NULL);
         if ( mfn_valid(mfn) && (t == p2m_ram_shared) )
         {
             ASSERT(!p2m_is_nestedp2m(p2m));
             BUG_ON(mem_sharing_unshare_page(d, gfn, MEM_SHARING_DESTROY_GFN));
         }
-
     }
 #endif
 
-    p2m_lock(p2m);
-
     p2m->phys_table = pagetable_null();
 
     while ( (pg = page_list_remove_head(&p2m->pages)) )
@@ -454,6 +453,7 @@
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     unsigned long i, ogfn;
     p2m_type_t ot;
+    p2m_access_t a;
     mfn_t omfn;
     int pod_count = 0;
     int rc = 0;
@@ -489,12 +489,13 @@
     /* First, remove m->p mappings for existing p->m mappings */
     for ( i = 0; i < (1UL << page_order); i++ )
     {
-        omfn = gfn_to_mfn_query(d, gfn + i, &ot);
+        omfn = p2m->get_entry(p2m, gfn + i, &ot, &a, p2m_query, NULL);
         if ( p2m_is_grant(ot) )
         {
             /* Really shouldn't be unmapping grant maps this way */
             domain_crash(d);
             p2m_unlock(p2m);
+            
             return -EINVAL;
         }
         else if ( p2m_is_ram(ot) )
@@ -528,7 +529,7 @@
              * address */
             P2M_DEBUG("aliased! mfn=%#lx, old gfn=%#lx, new gfn=%#lx\n",
                       mfn + i, ogfn, gfn + i);
-            omfn = gfn_to_mfn_query(d, ogfn, &ot);
+            omfn = p2m->get_entry(p2m, ogfn, &ot, &a, p2m_query, NULL);
             if ( p2m_is_ram(ot) )
             {
                 ASSERT(mfn_valid(omfn));
@@ -577,6 +578,7 @@
 p2m_type_t p2m_change_type(struct domain *d, unsigned long gfn, 
                            p2m_type_t ot, p2m_type_t nt)
 {
+    p2m_access_t a;
     p2m_type_t pt;
     mfn_t mfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -585,7 +587,7 @@
 
     p2m_lock(p2m);
 
-    mfn = gfn_to_mfn_query(d, gfn, &pt);
+    mfn = p2m->get_entry(p2m, gfn, &pt, &a, p2m_query, NULL);
     if ( pt == ot )
         set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, nt, p2m->default_access);
 
@@ -600,6 +602,7 @@
                            unsigned long start, unsigned long end,
                            p2m_type_t ot, p2m_type_t nt)
 {
+    p2m_access_t a;
     p2m_type_t pt;
     unsigned long gfn;
     mfn_t mfn;
@@ -612,7 +615,7 @@
 
     for ( gfn = start; gfn < end; gfn++ )
     {
-        mfn = gfn_to_mfn_query(d, gfn, &pt);
+        mfn = p2m->get_entry(p2m, gfn, &pt, &a, p2m_query, NULL);
         if ( pt == ot )
             set_p2m_entry(p2m, gfn, mfn, PAGE_ORDER_4K, nt, p2m->default_access);
     }
@@ -629,6 +632,7 @@
 set_mmio_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn)
 {
     int rc = 0;
+    p2m_access_t a;
     p2m_type_t ot;
     mfn_t omfn;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
@@ -637,7 +641,7 @@
         return 0;
 
     p2m_lock(p2m);
-    omfn = gfn_to_mfn_query(d, gfn, &ot);
+    omfn = p2m->get_entry(p2m, gfn, &ot, &a, p2m_query, NULL);
     if ( p2m_is_grant(ot) )
     {
         p2m_unlock(p2m);
@@ -657,7 +661,7 @@
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
-            mfn_x(gfn_to_mfn_query(d, gfn, &ot)));
+            mfn_x(get_gfn_query_unlocked(p2m->domain, gfn, &ot)));
     return rc;
 }
 
@@ -666,6 +670,7 @@
 {
     int rc = 0;
     mfn_t mfn;
+    p2m_access_t a;
     p2m_type_t t;
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
 
@@ -673,7 +678,7 @@
         return 0;
 
     p2m_lock(p2m);
-    mfn = gfn_to_mfn_query(d, gfn, &t);
+    mfn = p2m->get_entry(p2m, gfn, &t, &a, p2m_query, NULL);
 
     /* Do not use mfn_valid() here as it will usually fail for MMIO pages. */
     if ( (INVALID_MFN == mfn_x(mfn)) || (t != p2m_mmio_direct) )
@@ -696,6 +701,7 @@
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     int rc = 0;
+    p2m_access_t a;
     p2m_type_t ot;
     mfn_t omfn;
 
@@ -703,7 +709,7 @@
         return 0;
 
     p2m_lock(p2m);
-    omfn = gfn_to_mfn_query(p2m->domain, gfn, &ot);
+    omfn = p2m->get_entry(p2m, gfn, &ot, &a, p2m_query, NULL);
     /* At the moment we only allow p2m change if gfn has already been made
      * sharable first */
     ASSERT(p2m_is_shared(ot));
@@ -717,7 +723,7 @@
     if ( 0 == rc )
         gdprintk(XENLOG_ERR,
             "set_shared_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",
-            mfn_x(gfn_to_mfn_query(d, gfn, &ot)));
+            mfn_x(get_gfn_query_unlocked(p2m->domain, gfn, &ot)));
     return rc;
 }
 
@@ -1168,7 +1174,7 @@
 {
     struct p2m_domain *p2m = p2m_get_hostp2m(d);
     unsigned long pfn;
-    p2m_access_t a;
+    p2m_access_t a, _a;
     p2m_type_t t;
     mfn_t mfn;
     int rc = 0;
@@ -1202,7 +1208,7 @@
     p2m_lock(p2m);
     for ( pfn = start_pfn; pfn < start_pfn + nr; pfn++ )
     {
-        mfn = gfn_to_mfn_query(d, pfn, &t);
+        mfn = p2m->get_entry(p2m, pfn, &t, &_a, p2m_query, NULL);
         if ( p2m->set_entry(p2m, pfn, mfn, PAGE_ORDER_4K, t, a) == 0 )
         {
             rc = -ENOMEM;
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/shadow/common.c
--- a/xen/arch/x86/mm/shadow/common.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/shadow/common.c	Fri Nov 11 18:11:34 2011 +0000
@@ -3676,7 +3676,7 @@
 
         /* Iterate over VRAM to track dirty bits. */
         for ( i = 0; i < nr; i++ ) {
-            mfn_t mfn = gfn_to_mfn_query(d, begin_pfn + i, &t);
+            mfn_t mfn = get_gfn_query(d, begin_pfn + i, &t);
             struct page_info *page;
             int dirty = 0;
             paddr_t sl1ma = dirty_vram->sl1ma[i];
@@ -3741,6 +3741,8 @@
                 }
             }
 
+            put_gfn(d, begin_pfn + i);
+
             if ( dirty )
             {
                 dirty_vram->dirty_bitmap[i / 8] |= 1 << (i % 8);
@@ -3761,7 +3763,7 @@
                 /* was clean for more than two seconds, try to disable guest
                  * write access */
                 for ( i = begin_pfn; i < end_pfn; i++ ) {
-                    mfn_t mfn = gfn_to_mfn_query(d, i, &t);
+                    mfn_t mfn = get_gfn_query_unlocked(d, i, &t);
                     if (mfn_x(mfn) != INVALID_MFN)
                         flush_tlb |= sh_remove_write_access(d->vcpu[0], mfn, 1, 0);
                 }
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/shadow/multi.c	Fri Nov 11 18:11:34 2011 +0000
@@ -2265,7 +2265,7 @@
     if ( guest_l4e_get_flags(new_gl4e) & _PAGE_PRESENT )
     {
         gfn_t gl3gfn = guest_l4e_get_gfn(new_gl4e);
-        mfn_t gl3mfn = gfn_to_mfn_query(d, gl3gfn, &p2mt);
+        mfn_t gl3mfn = get_gfn_query(d, gl3gfn, &p2mt);
         if ( p2m_is_ram(p2mt) )
             sl3mfn = get_shadow_status(v, gl3mfn, SH_type_l3_shadow);
         else if ( p2mt != p2m_populate_on_demand )
@@ -2275,6 +2275,7 @@
         if ( mfn_valid(sl3mfn) )
             shadow_resync_all(v);
 #endif
+        put_gfn(d, gfn_x(gl3gfn));
     }
     l4e_propagate_from_guest(v, new_gl4e, sl3mfn, &new_sl4e, ft_prefetch);
 
@@ -2322,7 +2323,7 @@
     if ( guest_l3e_get_flags(new_gl3e) & _PAGE_PRESENT )
     {
         gfn_t gl2gfn = guest_l3e_get_gfn(new_gl3e);
-        mfn_t gl2mfn = gfn_to_mfn_query(v->domain, gl2gfn, &p2mt);
+        mfn_t gl2mfn = get_gfn_query(v->domain, gl2gfn, &p2mt);
         if ( p2m_is_ram(p2mt) )
             sl2mfn = get_shadow_status(v, gl2mfn, SH_type_l2_shadow);
         else if ( p2mt != p2m_populate_on_demand )
@@ -2332,6 +2333,7 @@
         if ( mfn_valid(sl2mfn) )
             shadow_resync_all(v);
 #endif
+        put_gfn(v->domain, gfn_x(gl2gfn));
     }
     l3e_propagate_from_guest(v, new_gl3e, sl2mfn, &new_sl3e, ft_prefetch);
     result |= shadow_set_l3e(v, sl3p, new_sl3e, sl3mfn);
@@ -2371,11 +2373,12 @@
         }
         else
         {
-            mfn_t gl1mfn = gfn_to_mfn_query(v->domain, gl1gfn, &p2mt);
+            mfn_t gl1mfn = get_gfn_query(v->domain, gl1gfn, &p2mt);
             if ( p2m_is_ram(p2mt) )
                 sl1mfn = get_shadow_status(v, gl1mfn, SH_type_l1_shadow); 
             else if ( p2mt != p2m_populate_on_demand )
                 result |= SHADOW_SET_ERROR;
+            put_gfn(v->domain, gfn_x(gl1gfn));
         }
     }
     l2e_propagate_from_guest(v, new_gl2e, sl1mfn, &new_sl2e, ft_prefetch);
@@ -2441,7 +2444,7 @@
     perfc_incr(shadow_validate_gl1e_calls);
 
     gfn = guest_l1e_get_gfn(new_gl1e);
-    gmfn = gfn_to_mfn_query(v->domain, gfn, &p2mt);
+    gmfn = get_gfn_query(v->domain, gfn, &p2mt);
 
     l1e_propagate_from_guest(v, new_gl1e, gmfn, &new_sl1e, ft_prefetch, p2mt);
     result |= shadow_set_l1e(v, sl1p, new_sl1e, p2mt, sl1mfn);
@@ -2463,6 +2466,7 @@
     }
 #endif /* OOS */
 
+    put_gfn(v->domain, gfn_x(gfn));
     return result;
 }
 
@@ -2501,10 +2505,11 @@
             shadow_l1e_t nsl1e;
 
             gfn = guest_l1e_get_gfn(gl1e);
-            gmfn = gfn_to_mfn_query(v->domain, gfn, &p2mt);
+            gmfn = get_gfn_query(v->domain, gfn, &p2mt);
             l1e_propagate_from_guest(v, gl1e, gmfn, &nsl1e, ft_prefetch, p2mt);
             rc |= shadow_set_l1e(v, sl1p, nsl1e, p2mt, sl1mfn);
 
+            put_gfn(v->domain, gfn_x(gfn));
             *snpl1p = gl1e;
         }
     });
@@ -2824,7 +2829,7 @@
 
         /* Look at the gfn that the l1e is pointing at */
         gfn = guest_l1e_get_gfn(gl1e);
-        gmfn = gfn_to_mfn_query(v->domain, gfn, &p2mt);
+        gmfn = get_gfn_query(v->domain, gfn, &p2mt);
 
         /* Propagate the entry.  */
         l1e_propagate_from_guest(v, gl1e, gmfn, &sl1e, ft_prefetch, p2mt);
@@ -2834,6 +2839,8 @@
         if ( snpl1p != NULL )
             snpl1p[i] = gl1e;
 #endif /* OOS */
+
+        put_gfn(v->domain, gfn_x(gfn));
     }
     if ( gl1p != NULL )
         sh_unmap_domain_page(gl1p);
@@ -3182,7 +3189,7 @@
 
     /* What mfn is the guest trying to access? */
     gfn = guest_l1e_get_gfn(gw.l1e);
-    gmfn = gfn_to_mfn_guest(d, gfn, &p2mt);
+    gmfn = get_gfn_guest(d, gfn, &p2mt);
 
     if ( shadow_mode_refcounts(d) && 
          ((!p2m_is_valid(p2mt) && !p2m_is_grant(p2mt)) ||
@@ -3192,6 +3199,7 @@
         SHADOW_PRINTK("BAD gfn=%"SH_PRI_gfn" gmfn=%"PRI_mfn"\n", 
                       gfn_x(gfn), mfn_x(gmfn));
         reset_early_unshadow(v);
+        put_gfn(d, gfn_x(gfn));
         goto propagate;
     }
 
@@ -3236,6 +3244,7 @@
     if ( rc & GW_RMWR_REWALK )
     {
         paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
         goto rewalk;
     }
 #endif /* OOS */
@@ -3244,6 +3253,7 @@
     {
         perfc_incr(shadow_inconsistent_gwalk);
         paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
         goto rewalk;
     }
 
@@ -3270,6 +3280,7 @@
         ASSERT(d->is_shutting_down);
 #endif
         paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
         trace_shadow_gen(TRC_SHADOW_DOMF_DYING, va);
         return 0;
     }
@@ -3287,6 +3298,7 @@
          * failed. We cannot safely continue since some page is still
          * OOS but not in the hash table anymore. */
         paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
         return 0;
     }
 
@@ -3296,6 +3308,7 @@
     {
         perfc_incr(shadow_inconsistent_gwalk);
         paging_unlock(d);
+        put_gfn(d, gfn_x(gfn));
         goto rewalk;
     }
 #endif /* OOS */
@@ -3389,6 +3402,7 @@
     SHADOW_PRINTK("fixed\n");
     shadow_audit_tables(v);
     paging_unlock(d);
+    put_gfn(d, gfn_x(gfn));
     return EXCRET_fault_fixed;
 
  emulate:
@@ -3457,6 +3471,7 @@
     sh_audit_gw(v, &gw);
     shadow_audit_tables(v);
     paging_unlock(d);
+    put_gfn(d, gfn_x(gfn));
 
     this_cpu(trace_emulate_write_val) = 0;
 
@@ -3595,6 +3610,7 @@
     shadow_audit_tables(v);
     reset_early_unshadow(v);
     paging_unlock(d);
+    put_gfn(d, gfn_x(gfn));
     trace_shadow_gen(TRC_SHADOW_MMIO, va);
     return (handle_mmio_with_translation(va, gpa >> PAGE_SHIFT)
             ? EXCRET_fault_fixed : 0);
@@ -3605,6 +3621,7 @@
     shadow_audit_tables(v);
     reset_early_unshadow(v);
     paging_unlock(d);
+    put_gfn(d, gfn_x(gfn));
 
 propagate:
     trace_not_shadow_fault(gw.l1e, va);
@@ -4292,7 +4309,7 @@
             if ( guest_l3e_get_flags(gl3e[i]) & _PAGE_PRESENT )
             {
                 gl2gfn = guest_l3e_get_gfn(gl3e[i]);
-                gl2mfn = gfn_to_mfn_query(d, gl2gfn, &p2mt);
+                gl2mfn = get_gfn_query_unlocked(d, gfn_x(gl2gfn), &p2mt);
                 if ( p2m_is_ram(p2mt) )
                     flush |= sh_remove_write_access(v, gl2mfn, 2, 0);
             }
@@ -4305,13 +4322,14 @@
             if ( guest_l3e_get_flags(gl3e[i]) & _PAGE_PRESENT )
             {
                 gl2gfn = guest_l3e_get_gfn(gl3e[i]);
-                gl2mfn = gfn_to_mfn_query(d, gl2gfn, &p2mt);
+                gl2mfn = get_gfn_query(d, gl2gfn, &p2mt);
                 if ( p2m_is_ram(p2mt) )
                     sh_set_toplevel_shadow(v, i, gl2mfn, (i == 3) 
                                            ? SH_type_l2h_shadow 
                                            : SH_type_l2_shadow);
                 else
                     sh_set_toplevel_shadow(v, i, _mfn(INVALID_MFN), 0); 
+                put_gfn(d, gfn_x(gl2gfn));
             }
             else
                 sh_set_toplevel_shadow(v, i, _mfn(INVALID_MFN), 0); 
@@ -4689,11 +4707,12 @@
     int flush = 0;
     int fast_path = 0;
     paddr_t gcr3 = 0;
-    mfn_t smfn, gmfn;
     p2m_type_t p2mt;
     char *gl3pa = NULL;
     guest_l3e_t *gl3e = NULL;
     paddr_t gl2a = 0;
+    unsigned long l3gfn;
+    mfn_t l3mfn;
 
     paging_lock(v->domain);
 
@@ -4702,8 +4721,9 @@
     if ( gcr3 == gpa )
         fast_path = 1;
 
-    gmfn = gfn_to_mfn_query(v->domain, _gfn(gpa >> PAGE_SHIFT), &p2mt);
-    if ( !mfn_valid(gmfn) || !p2m_is_ram(p2mt) )
+    l3gfn = gpa >> PAGE_SHIFT;
+    l3mfn = get_gfn_query(v->domain, _gfn(l3gfn), &p2mt);
+    if ( !mfn_valid(l3mfn) || !p2m_is_ram(p2mt) )
     {
         printk(XENLOG_DEBUG "sh_pagetable_dying: gpa not valid %"PRIpaddr"\n",
                gpa);
@@ -4711,19 +4731,24 @@
     }
     if ( !fast_path )
     {
-        gl3pa = sh_map_domain_page(gmfn);
+        gl3pa = sh_map_domain_page(l3mfn);
         gl3e = (guest_l3e_t *)(gl3pa + ((unsigned long)gpa & ~PAGE_MASK));
     }
     for ( i = 0; i < 4; i++ )
     {
+        unsigned long gfn;
+        mfn_t smfn, gmfn;
+
         if ( fast_path )
             smfn = _mfn(pagetable_get_pfn(v->arch.shadow_table[i]));
         else
         {
             /* retrieving the l2s */
             gl2a = guest_l3e_get_paddr(gl3e[i]);
-            gmfn = gfn_to_mfn_query(v->domain, _gfn(gl2a >> PAGE_SHIFT), &p2mt);
+            gfn = gl2a >> PAGE_SHIFT;
+            gmfn = get_gfn_query(v->domain, _gfn(gfn), &p2mt);
             smfn = shadow_hash_lookup(v, mfn_x(gmfn), SH_type_l2_pae_shadow);
+            put_gfn(v->domain, gfn);
         }
 
         if ( mfn_valid(smfn) )
@@ -4747,6 +4772,7 @@
 out:
     if ( !fast_path )
         unmap_domain_page(gl3pa);
+    put_gfn(v->domain, l3gfn);
     paging_unlock(v->domain);
 }
 #else
@@ -4757,12 +4783,14 @@
 
     paging_lock(v->domain);
 
-    gmfn = gfn_to_mfn_query(v->domain, _gfn(gpa >> PAGE_SHIFT), &p2mt);
+    gmfn = get_gfn_query(v->domain, _gfn(gpa >> PAGE_SHIFT), &p2mt);
 #if GUEST_PAGING_LEVELS == 2
     smfn = shadow_hash_lookup(v, mfn_x(gmfn), SH_type_l2_32_shadow);
 #else
     smfn = shadow_hash_lookup(v, mfn_x(gmfn), SH_type_l4_64_shadow);
 #endif
+    put_gfn(v->domain, gpa >> PAGE_SHIFT);
+    
     if ( mfn_valid(smfn) )
     {
         mfn_to_page(gmfn)->shadow_flags |= SHF_pagetable_dying;
@@ -4811,15 +4839,22 @@
 
     /* Translate the GFN to an MFN */
     ASSERT(!paging_locked_by_me(v->domain));
-    mfn = gfn_to_mfn_guest(v->domain, _gfn(gfn), &p2mt);
+    mfn = get_gfn_guest(v->domain, _gfn(gfn), &p2mt);
         
     if ( p2m_is_readonly(p2mt) )
+    {
+        put_gfn(v->domain, gfn);
         return _mfn(READONLY_GFN);
+    }
     if ( !p2m_is_ram(p2mt) )
+    {
+        put_gfn(v->domain, gfn);
         return _mfn(BAD_GFN_TO_MFN);
+    }
 
     ASSERT(mfn_valid(mfn));
     v->arch.paging.last_write_was_pt = !!sh_mfn_is_a_page_table(mfn);
+    put_gfn(v->domain, gfn);
     return mfn;
 }
 
@@ -5220,7 +5255,7 @@
             {
                 gfn = guest_l1e_get_gfn(*gl1e);
                 mfn = shadow_l1e_get_mfn(*sl1e);
-                gmfn = gfn_to_mfn_query(v->domain, gfn, &p2mt);
+                gmfn = get_gfn_query_unlocked(v->domain, gfn_x(gfn), &p2mt);
                 if ( !p2m_is_grant(p2mt) && mfn_x(gmfn) != mfn_x(mfn) )
                     AUDIT_FAIL(1, "bad translation: gfn %" SH_PRI_gfn
                                " --> %" PRI_mfn " != mfn %" PRI_mfn,
@@ -5291,16 +5326,17 @@
             mfn = shadow_l2e_get_mfn(*sl2e);
             gmfn = (guest_l2e_get_flags(*gl2e) & _PAGE_PSE)  
                 ? get_fl1_shadow_status(v, gfn)
-                : get_shadow_status(v, gfn_to_mfn_query(v->domain, gfn, &p2mt),
-                                    SH_type_l1_shadow);
+                : get_shadow_status(v, 
+                    get_gfn_query_unlocked(v->domain, gfn_x(gfn), 
+                                        &p2mt), SH_type_l1_shadow);
             if ( mfn_x(gmfn) != mfn_x(mfn) )
                 AUDIT_FAIL(2, "bad translation: gfn %" SH_PRI_gfn
                            " (--> %" PRI_mfn ")"
                            " --> %" PRI_mfn " != mfn %" PRI_mfn,
                            gfn_x(gfn), 
                            (guest_l2e_get_flags(*gl2e) & _PAGE_PSE) ? 0
-                           : mfn_x(gfn_to_mfn_query(v->domain,
-                                   gfn, &p2mt)), mfn_x(gmfn), mfn_x(mfn));
+                           : mfn_x(get_gfn_query_unlocked(v->domain,
+                                   gfn_x(gfn), &p2mt)), mfn_x(gmfn), mfn_x(mfn));
         }
     });
     sh_unmap_domain_page(gp);
@@ -5339,7 +5375,8 @@
         {
             gfn = guest_l3e_get_gfn(*gl3e);
             mfn = shadow_l3e_get_mfn(*sl3e);
-            gmfn = get_shadow_status(v, gfn_to_mfn_query(v->domain, gfn, &p2mt),
+            gmfn = get_shadow_status(v, get_gfn_query_unlocked(
+                                        v->domain, gfn_x(gfn), &p2mt),
                                      ((GUEST_PAGING_LEVELS == 3 ||
                                        is_pv_32on64_vcpu(v))
                                       && !shadow_mode_external(v->domain)
@@ -5387,8 +5424,8 @@
         {
             gfn = guest_l4e_get_gfn(*gl4e);
             mfn = shadow_l4e_get_mfn(*sl4e);
-            gmfn = get_shadow_status(v, gfn_to_mfn_query(v->domain,
-                                     gfn, &p2mt), 
+            gmfn = get_shadow_status(v, get_gfn_query_unlocked(
+                                     v->domain, gfn_x(gfn), &p2mt), 
                                      SH_type_l3_shadow);
             if ( mfn_x(gmfn) != mfn_x(mfn) )
                 AUDIT_FAIL(4, "bad translation: gfn %" SH_PRI_gfn
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/mm/shadow/types.h
--- a/xen/arch/x86/mm/shadow/types.h	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/mm/shadow/types.h	Fri Nov 11 18:11:34 2011 +0000
@@ -191,11 +191,11 @@
 })
 #endif
 
- /* Override gfn_to_mfn to work with gfn_t */
-#undef gfn_to_mfn_query
-#define gfn_to_mfn_query(d, g, t) gfn_to_mfn_type((d), gfn_x(g), (t), p2m_query)
-#undef gfn_to_mfn_guest
-#define gfn_to_mfn_guest(d, g, t) gfn_to_mfn_type((d), gfn_x(g), (t), p2m_guest)
+ /* Override get_gfn to work with gfn_t */
+#undef get_gfn_query
+#define get_gfn_query(d, g, t) get_gfn_type((d), gfn_x(g), (t), p2m_query)
+#undef get_gfn_guest
+#define get_gfn_guest(d, g, t) get_gfn_type((d), gfn_x(g), (t), p2m_guest)
 
 /* The shadow types needed for the various levels. */
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/physdev.c	Fri Nov 11 18:11:34 2011 +0000
@@ -297,16 +297,20 @@
             break;
 
         ret = -EINVAL;
-        mfn = gmfn_to_mfn(current->domain, info.gmfn);
+        mfn = get_gfn_untyped(current->domain, info.gmfn);
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), v->domain,
                                 PGT_writable_page) )
+        {
+            put_gfn(current->domain, info.gmfn);
             break;
+        }
 
         if ( cmpxchg(&v->domain->arch.pv_domain.pirq_eoi_map_mfn,
                      0, mfn) != 0 )
         {
             put_page_and_type(mfn_to_page(mfn));
+            put_gfn(current->domain, info.gmfn);
             ret = -EBUSY;
             break;
         }
@@ -316,10 +320,12 @@
         {
             v->domain->arch.pv_domain.pirq_eoi_map_mfn = 0;
             put_page_and_type(mfn_to_page(mfn));
+            put_gfn(current->domain, info.gmfn);
             ret = -ENOSPC;
             break;
         }
 
+        put_gfn(current->domain, info.gmfn);
         ret = 0;
         break;
     }
diff -r 9af6829a9273 -r 3622d7fae14d xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/arch/x86/traps.c	Fri Nov 11 18:11:34 2011 +0000
@@ -673,11 +673,12 @@
             return 0;
         }
 
-        mfn = gmfn_to_mfn(d, gmfn);
+        mfn = get_gfn_untyped(d, gmfn);
 
         if ( !mfn_valid(mfn) ||
              !get_page_and_type(mfn_to_page(mfn), d, PGT_writable_page) )
         {
+            put_gfn(d, gmfn);
             gdprintk(XENLOG_WARNING,
                      "Bad GMFN %lx (MFN %lx) to MSR %08x\n",
                      gmfn, mfn, base + idx);
@@ -689,6 +690,7 @@
         unmap_domain_page(hypercall_page);
 
         put_page_and_type(mfn_to_page(mfn));
+        put_gfn(d, gmfn);
         break;
     }
 
@@ -2347,18 +2349,25 @@
             arch_set_cr2(v, *reg);
             break;
 
-        case 3: /* Write CR3 */
+        case 3: {/* Write CR3 */
+            unsigned long mfn, gfn;
             domain_lock(v->domain);
             if ( !is_pv_32on64_vcpu(v) )
-                rc = new_guest_cr3(gmfn_to_mfn(v->domain, xen_cr3_to_pfn(*reg)));
+            {
+                gfn = xen_cr3_to_pfn(*reg);
 #ifdef CONFIG_COMPAT
-            else
-                rc = new_guest_cr3(gmfn_to_mfn(v->domain, compat_cr3_to_pfn(*reg)));
+            } else {
+                gfn = compat_cr3_to_pfn(*reg);
 #endif
+            }
+            mfn = get_gfn_untyped(v->domain, gfn);
+            rc = new_guest_cr3(mfn);
+            put_gfn(v->domain, gfn);
             domain_unlock(v->domain);
             if ( rc == 0 ) /* not okay */
                 goto fail;
             break;
+        }
 
         case 4: /* Write CR4 */
             v->arch.pv_vcpu.ctrlreg[4] = pv_guest_cr4_fixup(v, *reg);
diff -r 9af6829a9273 -r 3622d7fae14d xen/common/grant_table.c
--- a/xen/common/grant_table.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/common/grant_table.c	Fri Nov 11 18:11:34 2011 +0000
@@ -110,7 +110,7 @@
 #define gfn_to_mfn_private(_d, _gfn) ({                     \
     p2m_type_t __p2mt;                                      \
     unsigned long __x;                                      \
-    __x = mfn_x(gfn_to_mfn_unshare((_d), (_gfn), &__p2mt)); \
+    __x = mfn_x(get_gfn_unshare((_d), (_gfn), &__p2mt));    \
     BUG_ON(p2m_is_shared(__p2mt)); /* XXX fixme */          \
     if ( !p2m_is_valid(__p2mt) )                            \
         __x = INVALID_MFN;                                  \
@@ -150,10 +150,10 @@
     mfn_t mfn;
 
     if ( readonly )
-        mfn = gfn_to_mfn(rd, gfn, &p2mt);
+        mfn = get_gfn(rd, gfn, &p2mt);
     else
     {
-        mfn = gfn_to_mfn_unshare(rd, gfn, &p2mt);
+        mfn = get_gfn_unshare(rd, gfn, &p2mt);
         BUG_ON(p2m_is_shared(p2mt));
         /* XXX Here, and above in gfn_to_mfn_private, need to handle
          * XXX failure to unshare. */
@@ -164,14 +164,16 @@
         if ( p2m_is_paging(p2mt) )
         {
             p2m_mem_paging_populate(rd, gfn);
+            put_gfn(rd, gfn);
             rc = GNTST_eagain;
         }
     } else {
+       put_gfn(rd, gfn);
        *frame = INVALID_MFN;
        rc = GNTST_bad_page;
     }
 #else
-    *frame = readonly ? gmfn_to_mfn(rd, gfn) : gfn_to_mfn_private(rd, gfn);
+    *frame = readonly ? get_gfn_untyped(rd, gfn) : gfn_to_mfn_private(rd, gfn);
 #endif
 
     return rc;
@@ -468,13 +470,14 @@
     struct domain *ld, *rd, *owner;
     struct vcpu   *led;
     int            handle;
+    unsigned long  gfn = INVALID_GFN;
     unsigned long  frame = 0, nr_gets = 0;
     struct page_info *pg;
     int            rc = GNTST_okay;
     u32            old_pin;
     u32            act_pin;
     unsigned int   cache_flags;
-    struct active_grant_entry *act;
+    struct active_grant_entry *act = NULL;
     struct grant_mapping *mt;
     grant_entry_v1_t *sha1;
     grant_entry_v2_t *sha2;
@@ -565,7 +568,6 @@
 
         if ( !act->pin )
         {
-            unsigned long gfn;
             unsigned long frame;
 
             gfn = sha1 ? sha1->frame : sha2->full_page.frame;
@@ -698,6 +700,7 @@
     op->handle       = handle;
     op->status       = GNTST_okay;
 
+    put_gfn(rd, gfn);
     rcu_unlock_domain(rd);
     return;
 
@@ -735,6 +738,8 @@
         gnttab_clear_flag(_GTF_reading, status);
 
  unlock_out:
+    if ( gfn != INVALID_GFN )
+        put_gfn(rd, gfn);
     spin_unlock(&rd->grant_table->lock);
     op->status = rc;
     put_maptrack_handle(ld->grant_table, handle);
@@ -1475,6 +1480,7 @@
         /* Check the passed page frame for basic validity. */
         if ( unlikely(!mfn_valid(mfn)) )
         { 
+            put_gfn(d, gop.mfn);
             gdprintk(XENLOG_INFO, "gnttab_transfer: out-of-range %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
@@ -1484,6 +1490,7 @@
         page = mfn_to_page(mfn);
         if ( unlikely(is_xen_heap_page(page)) )
         { 
+            put_gfn(d, gop.mfn);
             gdprintk(XENLOG_INFO, "gnttab_transfer: xen frame %lx\n",
                     (unsigned long)gop.mfn);
             gop.status = GNTST_bad_page;
@@ -1492,6 +1499,7 @@
 
         if ( steal_page(d, page, 0) < 0 )
         {
+            put_gfn(d, gop.mfn);
             gop.status = GNTST_bad_page;
             goto copyback;
         }
@@ -1504,6 +1512,7 @@
         /* Find the target domain. */
         if ( unlikely((e = rcu_lock_domain_by_id(gop.domid)) == NULL) )
         {
+            put_gfn(d, gop.mfn);
             gdprintk(XENLOG_INFO, "gnttab_transfer: can't find domain %d\n",
                     gop.domid);
             page->count_info &= ~(PGC_count_mask|PGC_allocated);
@@ -1514,6 +1523,7 @@
 
         if ( xsm_grant_transfer(d, e) )
         {
+            put_gfn(d, gop.mfn);
             gop.status = GNTST_permission_denied;
         unlock_and_copyback:
             rcu_unlock_domain(e);
@@ -1566,6 +1576,7 @@
                         e->tot_pages, e->max_pages, gop.ref, e->is_dying);
             spin_unlock(&e->page_alloc_lock);
             rcu_unlock_domain(e);
+            put_gfn(d, gop.mfn);
             page->count_info &= ~(PGC_count_mask|PGC_allocated);
             free_domheap_page(page);
             gop.status = GNTST_general_error;
@@ -1579,6 +1590,7 @@
         page_set_owner(page, e);
 
         spin_unlock(&e->page_alloc_lock);
+        put_gfn(d, gop.mfn);
 
         TRACE_1D(TRC_MEM_PAGE_GRANT_TRANSFER, e->domain_id);
 
@@ -1850,6 +1862,8 @@
         {
             gfn = sha1->frame;
             rc = __get_paged_frame(gfn, &grant_frame, readonly, rd);
+            /* We drop this immediately per the comments at the top */
+            put_gfn(rd, gfn);
             if ( rc != GNTST_okay )
                 goto unlock_out;
             act->gfn = gfn;
@@ -1862,6 +1876,7 @@
         {
             gfn = sha2->full_page.frame;
             rc = __get_paged_frame(gfn, &grant_frame, readonly, rd);
+            put_gfn(rd, gfn);
             if ( rc != GNTST_okay )
                 goto unlock_out;
             act->gfn = gfn;
@@ -1874,6 +1889,7 @@
         {
             gfn = sha2->sub_page.frame;
             rc = __get_paged_frame(gfn, &grant_frame, readonly, rd);
+            put_gfn(rd, gfn);
             if ( rc != GNTST_okay )
                 goto unlock_out;
             act->gfn = gfn;
@@ -1973,6 +1989,7 @@
     {
 #ifdef CONFIG_X86
         rc = __get_paged_frame(op->source.u.gmfn, &s_frame, 1, sd);
+        put_gfn(sd, op->source.u.gmfn);
         if ( rc != GNTST_okay )
             goto error_out;
 #else
@@ -2012,6 +2029,7 @@
     {
 #ifdef CONFIG_X86
         rc = __get_paged_frame(op->dest.u.gmfn, &d_frame, 0, dd);
+        put_gfn(dd, op->dest.u.gmfn);
         if ( rc != GNTST_okay )
             goto error_out;
 #else
diff -r 9af6829a9273 -r 3622d7fae14d xen/common/memory.c
--- a/xen/common/memory.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/common/memory.c	Fri Nov 11 18:11:34 2011 +0000
@@ -162,11 +162,12 @@
     unsigned long mfn;
 
 #ifdef CONFIG_X86
-    mfn = mfn_x(gfn_to_mfn(d, gmfn, &p2mt)); 
+    mfn = mfn_x(get_gfn(d, gmfn, &p2mt)); 
     if ( unlikely(p2m_is_paging(p2mt)) )
     {
         guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
         p2m_mem_paging_drop_page(d, gmfn);
+        put_gfn(d, gmfn);
         return 1;
     }
 #else
@@ -174,6 +175,7 @@
 #endif
     if ( unlikely(!mfn_valid(mfn)) )
     {
+        put_gfn(d, gmfn);
         gdprintk(XENLOG_INFO, "Domain %u page number %lx invalid\n",
                 d->domain_id, gmfn);
         return 0;
@@ -187,12 +189,14 @@
     {
         put_page_and_type(page);
         guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
+        put_gfn(d, gmfn);
         return 1;
     }
 
 #endif /* CONFIG_X86 */
     if ( unlikely(!get_page(page, d)) )
     {
+        put_gfn(d, gmfn);
         gdprintk(XENLOG_INFO, "Bad page free for domain %u\n", d->domain_id);
         return 0;
     }
@@ -206,6 +210,7 @@
     guest_physmap_remove_page(d, gmfn, mfn, PAGE_ORDER_4K);
 
     put_page(page);
+    put_gfn(d, gmfn);
 
     return 1;
 }
@@ -265,7 +270,7 @@
     PAGE_LIST_HEAD(out_chunk_list);
     unsigned long in_chunk_order, out_chunk_order;
     xen_pfn_t     gpfn, gmfn, mfn;
-    unsigned long i, j, k;
+    unsigned long i, j, k = 0; /* gcc ... */
     unsigned int  memflags = 0;
     long          rc = 0;
     struct domain *d;
@@ -363,9 +368,10 @@
                 p2m_type_t p2mt;
 
                 /* Shared pages cannot be exchanged */
-                mfn = mfn_x(gfn_to_mfn_unshare(d, gmfn + k, &p2mt));
+                mfn = mfn_x(get_gfn_unshare(d, gmfn + k, &p2mt));
                 if ( p2m_is_shared(p2mt) )
                 {
+                    put_gfn(d, gmfn + k);
                     rc = -ENOMEM;
                     goto fail; 
                 }
@@ -374,6 +380,7 @@
 #endif
                 if ( unlikely(!mfn_valid(mfn)) )
                 {
+                    put_gfn(d, gmfn + k);
                     rc = -EINVAL;
                     goto fail;
                 }
@@ -382,11 +389,13 @@
 
                 if ( unlikely(steal_page(d, page, MEMF_no_refcount)) )
                 {
+                    put_gfn(d, gmfn + k);
                     rc = -EINVAL;
                     goto fail;
                 }
 
                 page_list_add(page, &in_chunk_list);
+                put_gfn(d, gmfn + k);
             }
         }
 
@@ -487,8 +496,12 @@
  fail:
     /* Reassign any input pages we managed to steal. */
     while ( (page = page_list_remove_head(&in_chunk_list)) )
+    {
+        put_gfn(d, gmfn + k--);
         if ( assign_pages(d, page, 0, MEMF_no_refcount) )
             BUG();
+    }
+
  dying:
     rcu_unlock_domain(d);
     /* Free any output pages we managed to allocate. */
diff -r 9af6829a9273 -r 3622d7fae14d xen/common/tmem_xen.c
--- a/xen/common/tmem_xen.c	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/common/tmem_xen.c	Fri Nov 11 18:11:34 2011 +0000
@@ -109,22 +109,28 @@
     struct page_info *page;
     int ret;
 
-    cli_mfn = mfn_x(gfn_to_mfn(current->domain, cmfn, &t));
+    cli_mfn = mfn_x(get_gfn(current->domain, cmfn, &t));
     if ( t != p2m_ram_rw || !mfn_valid(cli_mfn) )
+    {
+            put_gfn(current->domain, (unsigned long) cmfn);
             return NULL;
+    }
     page = mfn_to_page(cli_mfn);
     if ( cli_write )
         ret = get_page_and_type(page, current->domain, PGT_writable_page);
     else
         ret = get_page(page, current->domain);
     if ( !ret )
+    {
+        put_gfn(current->domain, (unsigned long) cmfn);
         return NULL;
+    }
     *pcli_mfn = cli_mfn;
     *pcli_pfp = (pfp_t *)page;
     return map_domain_page(cli_mfn);
 }
 
-static inline void cli_put_page(void *cli_va, pfp_t *cli_pfp,
+static inline void cli_put_page(tmem_cli_mfn_t cmfn, void *cli_va, pfp_t *cli_pfp,
                                 unsigned long cli_mfn, bool_t mark_dirty)
 {
     if ( mark_dirty )
@@ -135,6 +141,7 @@
     else
         put_page((struct page_info *)cli_pfp);
     unmap_domain_page(cli_va);
+    put_gfn(current->domain, (unsigned long) cmfn);
 }
 #endif
 
@@ -169,7 +176,7 @@
               (pfn_offset+len <= PAGE_SIZE) )
         memcpy((char *)tmem_va+tmem_offset,(char *)cli_va+pfn_offset,len);
     if ( !tmemc )
-        cli_put_page(cli_va, cli_pfp, cli_mfn, 0);
+        cli_put_page(cmfn, cli_va, cli_pfp, cli_mfn, 0);
     unmap_domain_page(tmem_va);
     return 1;
 }
@@ -197,7 +204,7 @@
     ASSERT(ret == LZO_E_OK);
     *out_va = dmem;
     if ( !tmemc )
-        cli_put_page(cli_va, cli_pfp, cli_mfn, 0);
+        cli_put_page(cmfn, cli_va, cli_pfp, cli_mfn, 0);
     unmap_domain_page(cli_va);
     return 1;
 }
@@ -225,7 +232,7 @@
         memcpy((char *)cli_va+pfn_offset,(char *)tmem_va+tmem_offset,len);
     unmap_domain_page(tmem_va);
     if ( !tmemc )
-        cli_put_page(cli_va, cli_pfp, cli_mfn, 1);
+        cli_put_page(cmfn, cli_va, cli_pfp, cli_mfn, 1);
     mb();
     return 1;
 }
@@ -249,7 +256,7 @@
     ASSERT(ret == LZO_E_OK);
     ASSERT(out_len == PAGE_SIZE);
     if ( !tmemc )
-        cli_put_page(cli_va, cli_pfp, cli_mfn, 1);
+        cli_put_page(cmfn, cli_va, cli_pfp, cli_mfn, 1);
     mb();
     return 1;
 }
@@ -271,7 +278,7 @@
         memcpy((char *)cli_va,(char *)tmem_va,len);
     if ( len < PAGE_SIZE )
         memset((char *)cli_va+len,0,PAGE_SIZE-len);
-    cli_put_page(cli_va, cli_pfp, cli_mfn, 1);
+    cli_put_page(cmfn, cli_va, cli_pfp, cli_mfn, 1);
     mb();
     return 1;
 }
diff -r 9af6829a9273 -r 3622d7fae14d xen/include/asm-ia64/mm.h
--- a/xen/include/asm-ia64/mm.h	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/include/asm-ia64/mm.h	Fri Nov 11 18:11:34 2011 +0000
@@ -549,6 +549,8 @@
 #define gmfn_to_mfn(_d, gpfn)			\
     gmfn_to_mfn_foreign((_d), (gpfn))
 
+#define put_gfn(d, g)   ((void)0)
+
 #define __gpfn_invalid(_d, gpfn)			\
 	(lookup_domain_mpa((_d), ((gpfn)<<PAGE_SHIFT), NULL) == INVALID_MFN)
 
diff -r 9af6829a9273 -r 3622d7fae14d xen/include/asm-x86/guest_pt.h
--- a/xen/include/asm-x86/guest_pt.h	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/include/asm-x86/guest_pt.h	Fri Nov 11 18:11:34 2011 +0000
@@ -51,9 +51,9 @@
     return ((paddr_t)gfn_x(gfn)) << PAGE_SHIFT;
 }
 
-/* Override gfn_to_mfn to work with gfn_t */
-#undef gfn_to_mfn
-#define gfn_to_mfn(d, g, t) gfn_to_mfn_type((d), gfn_x(g), (t), p2m_alloc)
+/* Override get_gfn to work with gfn_t */
+#undef get_gfn
+#define get_gfn(d, g, t) get_gfn_type((d), gfn_x(g), (t), p2m_alloc)
 
 
 /* Types of the guest's page tables and access functions for them */
diff -r 9af6829a9273 -r 3622d7fae14d xen/include/asm-x86/p2m.h
--- a/xen/include/asm-x86/p2m.h	Fri Nov 11 17:46:19 2011 +0100
+++ b/xen/include/asm-x86/p2m.h	Fri Nov 11 18:11:34 2011 +0000
@@ -3,6 +3,7 @@
  *
  * physical-to-machine mappings for automatically-translated domains.
  *
+ * Copyright (c) 2011 GridCentric Inc. (Andres Lagar-Cavilla)
  * Copyright (c) 2007 Advanced Micro Devices (Wei Huang)
  * Parts of this code are Copyright (c) 2006-2007 by XenSource Inc.
  * Parts of this code are Copyright (c) 2006 by Michael A Fetterman
@@ -305,47 +306,66 @@
 
 #define p2m_get_pagetable(p2m)  ((p2m)->phys_table)
 
+/**** p2m query accessors. After calling any of the variants below, you
+ * need to call put_gfn(domain, gfn). If you don't, you'll lock the
+ * hypervisor. ****/
 
 /* Read a particular P2M table, mapping pages as we go.  Most callers
- * should _not_ call this directly; use the other gfn_to_mfn_* functions
+ * should _not_ call this directly; use the other get_gfn* functions
  * below unless you know you want to walk a p2m that isn't a domain's
  * main one.
  * If the lookup succeeds, the return value is != INVALID_MFN and 
  * *page_order is filled in with the order of the superpage (if any) that
  * the entry was found in.  */
-mfn_t gfn_to_mfn_type_p2m(struct p2m_domain *p2m, unsigned long gfn,
+mfn_t get_gfn_type_access(struct p2m_domain *p2m, unsigned long gfn,
                     p2m_type_t *t, p2m_access_t *a, p2m_query_t q,
                     unsigned int *page_order);
 
 /* General conversion function from gfn to mfn */
-static inline mfn_t gfn_to_mfn_type(struct domain *d,
+static inline mfn_t get_gfn_type(struct domain *d,
                                     unsigned long gfn, p2m_type_t *t,
                                     p2m_query_t q)
 {
     p2m_access_t a;
-    return gfn_to_mfn_type_p2m(p2m_get_hostp2m(d), gfn, t, &a, q, NULL);
+    return get_gfn_type_access(p2m_get_hostp2m(d), gfn, t, &a, q, NULL);
 }
 
 /* Syntactic sugar: most callers will use one of these. 
- * N.B. gfn_to_mfn_query() is the _only_ one guaranteed not to take the
+ * N.B. get_gfn_query() is the _only_ one guaranteed not to take the
  * p2m lock; none of the others can be called with the p2m or paging
  * lock held. */
-#define gfn_to_mfn(d, g, t)         gfn_to_mfn_type((d), (g), (t), p2m_alloc)
-#define gfn_to_mfn_query(d, g, t)   gfn_to_mfn_type((d), (g), (t), p2m_query)
-#define gfn_to_mfn_guest(d, g, t)   gfn_to_mfn_type((d), (g), (t), p2m_guest)
-#define gfn_to_mfn_unshare(d, g, t) gfn_to_mfn_type((d), (g), (t), p2m_unshare)
+#define get_gfn(d, g, t)         get_gfn_type((d), (g), (t), p2m_alloc)
+#define get_gfn_query(d, g, t)   get_gfn_type((d), (g), (t), p2m_query)
+#define get_gfn_guest(d, g, t)   get_gfn_type((d), (g), (t), p2m_guest)
+#define get_gfn_unshare(d, g, t) get_gfn_type((d), (g), (t), p2m_unshare)
 
 /* Compatibility function exporting the old untyped interface */
-static inline unsigned long gmfn_to_mfn(struct domain *d, unsigned long gpfn)
+static inline unsigned long get_gfn_untyped(struct domain *d, unsigned long gpfn)
 {
     mfn_t mfn;
     p2m_type_t t;
-    mfn = gfn_to_mfn(d, gpfn, &t);
+    mfn = get_gfn(d, gpfn, &t);
     if ( p2m_is_valid(t) )
         return mfn_x(mfn);
     return INVALID_MFN;
 }
 
+/* This is a noop for now. */
+static inline void __put_gfn(struct p2m_domain *p2m, unsigned long gfn)
+{
+}
+
+#define put_gfn(d, gfn) __put_gfn(p2m_get_hostp2m((d)), (gfn))
+
+/* These are identical for now. The intent is to have the caller not worry 
+ * about put_gfn. To only be used in printk's, crash situations, or to 
+ * peek at a type. You're not holding the p2m entry exclsively after calling
+ * this. */
+#define get_gfn_unlocked(d, g, t)         get_gfn_type((d), (g), (t), p2m_alloc)
+#define get_gfn_query_unlocked(d, g, t)   get_gfn_type((d), (g), (t), p2m_query)
+#define get_gfn_guest_unlocked(d, g, t)   get_gfn_type((d), (g), (t), p2m_guest)
+#define get_gfn_unshare_unlocked(d, g, t) get_gfn_type((d), (g), (t), p2m_unshare)
+
 /* General conversion function from mfn to gfn */
 static inline unsigned long mfn_to_gfn(struct domain *d, mfn_t mfn)
 {
@@ -529,7 +549,8 @@
 #define p2m_gfn_check_limit(d, g, o) 0
 #endif
 
-/* Directly set a p2m entry: only for use by p2m code */
+/* Directly set a p2m entry: only for use by p2m code. Does not need
+ * a call to put_gfn afterwards/ */
 int set_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn, 
                   unsigned int page_order, p2m_type_t p2mt, p2m_access_t p2ma);
 

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

From xen-changelog-bounces@lists.xensource.com Sat Nov 12 16:11:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 12 Nov 2011 16:11:25 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RPNfQ-0007Cs-PC; Sat, 12 Nov 2011 16:11:24 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RPNfJ-0007CJ-Qg
	for xen-changelog@lists.xensource.com; Sat, 12 Nov 2011 16:11:18 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-2.tower-182.messagelabs.com!1321143074!2894198!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3015 invoked from network); 13 Nov 2011 00:11:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-2.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2011 00:11:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RPNfG-0006Ee-7Y
	for xen-changelog@lists.xensource.com; Sun, 13 Nov 2011 00:11:14 +0000
Message-Id: <E1RPNfG-0006Ee-7Y@xenbits.xen.org>
Date: Sun, 13 Nov 2011 00:11:13 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] x86/amd: Eliminate cache flushing
	when entering C3 on select AMD processors
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Mark Langsdorf <mark.langsdorf@amd.com>
# Date 1321114281 0
# Node ID 55879870fc8f8bb004325146d0c183a2d756ce35
# Parent  8c2d76193eafe78c2e846462fb41f1308df09088
x86/amd: Eliminate cache flushing when entering C3 on select AMD processors

AMD Fam15h processors have a shared cache. It does not need
to be be flushed when entering C3 and doing so causes reduces
performance. Modify acpi_processor_power_init_bm_check to
prevent these processors from flushing when entering C3.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
xen-unstable changeset:   23511:450f1d198e1e
xen-unstable date:        Tue Jun 14 12:46:29 2011 +0100
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 8c2d76193eaf -r 55879870fc8f xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Wed Nov 02 15:02:18 2011 +0000
+++ b/xen/arch/x86/acpi/cpu_idle.c	Sat Nov 12 16:11:21 2011 +0000
@@ -710,7 +710,8 @@
     flags->bm_check = 0;
     if ( num_online_cpus() == 1 )
         flags->bm_check = 1;
-    else if ( c->x86_vendor == X86_VENDOR_INTEL )
+    else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
+              ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
     {
         /*
          * Today all MP CPUs that support C3 share cache.

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

From xen-changelog-bounces@lists.xensource.com Sat Nov 12 16:11:36 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 12 Nov 2011 16:11:36 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RPNfc-0007Fy-D3; Sat, 12 Nov 2011 16:11:36 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RPNfK-0007CK-CV
	for xen-changelog@lists.xensource.com; Sat, 12 Nov 2011 16:11:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-21.messagelabs.com!1321143075!3952054!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25632 invoked from network); 13 Nov 2011 00:11:15 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2011 00:11:15 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RPNfG-0006GQ-TZ
	for xen-changelog@lists.xensource.com; Sun, 13 Nov 2011 00:11:14 +0000
Message-Id: <E1RPNfG-0006GQ-TZ@xenbits.xen.org>
Date: Sun, 13 Nov 2011 00:11:14 +0000
From: Xen patchbot-4.1-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.1-testing] Revert c/s 23666:b96f8bdcaa15
	KEXEC: disconnect all PCI devices from the PCI bus on crash
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1321114442 0
# Node ID 9702967e89dd005a8b3f24eb1d10c46712c2e3ed
# Parent  55879870fc8f8bb004325146d0c183a2d756ce35
Revert c/s 23666:b96f8bdcaa15 KEXEC: disconnect all PCI devices from the PCI bus on crash

It turns out that this causes all mannor of problems on certain
motherboards (so far with no pattern I can discern)

Problems include:
* Hanging forever checking hlt instruction.
* Panics when trying to change switch root device
* Drivers hanging when trying to check for interrupts.

From: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
Committed-by: Keir Fraser <keir@xen.org>
xen-unstable changeset:   24137:0844b17df7a9
xen-unstable date:        Fri Nov 11 18:14:35 2011 +0000
---


diff -r 55879870fc8f -r 9702967e89dd xen/arch/x86/crash.c
--- a/xen/arch/x86/crash.c	Sat Nov 12 16:11:21 2011 +0000
+++ b/xen/arch/x86/crash.c	Sat Nov 12 16:14:02 2011 +0000
@@ -28,7 +28,6 @@
 #include <asm/apic.h>
 #include <asm/io_apic.h>
 #include <xen/iommu.h>
-#include <xen/pci.h>
 #include <asm/hpet.h>
 
 static atomic_t waiting_for_crash_ipi;
@@ -83,8 +82,6 @@
         msecs--;
     }
 
-    disconnect_pci_devices();
-
     /* Crash shutdown any IOMMU functionality as the crashdump kernel is not
      * happy when booting if interrupt/dma remapping is still enabled */
     iommu_crash_shutdown();
diff -r 55879870fc8f -r 9702967e89dd xen/drivers/passthrough/pci.c
--- a/xen/drivers/passthrough/pci.c	Sat Nov 12 16:11:21 2011 +0000
+++ b/xen/drivers/passthrough/pci.c	Sat Nov 12 16:14:02 2011 +0000
@@ -499,25 +499,6 @@
     return 0;
 }
 
-/* Disconnect all PCI devices from the PCI buses. From the PCI spec:
- *   "When a 0 is written to [the COMMAND] register, the device is
- *    logically disconnected from the PCI bus for all accesses except
- *    configuration accesses. All devices are required to support
- *    this base level of functionality."
- */
-void disconnect_pci_devices(void)
-{
-    struct pci_dev *pdev;
-
-    spin_lock(&pcidevs_lock);
-
-    list_for_each_entry ( pdev, &alldevs_list, alldevs_list )
-        pci_conf_write16(pdev->bus, PCI_SLOT(pdev->devfn),
-                         PCI_FUNC(pdev->devfn), PCI_COMMAND, 0);
-
-    spin_unlock(&pcidevs_lock);
-}
-
 #ifdef SUPPORT_MSI_REMAPPING
 static void dump_pci_devices(unsigned char ch)
 {
diff -r 55879870fc8f -r 9702967e89dd xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Sat Nov 12 16:11:21 2011 +0000
+++ b/xen/include/xen/pci.h	Sat Nov 12 16:14:02 2011 +0000
@@ -94,8 +94,6 @@
 struct pci_dev *pci_get_pdev(int bus, int devfn);
 struct pci_dev *pci_get_pdev_by_domain(struct domain *d, int bus, int devfn);
 
-void disconnect_pci_devices(void);
-
 uint8_t pci_conf_read8(
     unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
 uint16_t pci_conf_read16(

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

From xen-changelog-bounces@lists.xensource.com Sat Nov 12 18:55:21 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Sat, 12 Nov 2011 18:55:21 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RPQE5-0005Lt-03; Sat, 12 Nov 2011 18:55:21 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RPQE0-0005LB-CS
	for xen-changelog@lists.xensource.com; Sat, 12 Nov 2011 18:55:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-182.messagelabs.com!1321152911!2885133!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 22211 invoked from network); 13 Nov 2011 02:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	13 Nov 2011 02:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RPQDv-0000ZJ-1C
	for xen-changelog@lists.xensource.com; Sun, 13 Nov 2011 02:55:11 +0000
Message-Id: <E1RPQDv-0000ZJ-1C@xenbits.xen.org>
Date: Sun, 13 Nov 2011 02:55:09 +0000
From: Xen patchbot-4.0-testing <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-4.0-testing] x86/amd: Eliminate cache flushing
	when entering C3 on select AMD processors
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Mark Langsdorf <mark.langsdorf@amd.com>
# Date 1321114519 0
# Node ID cdff7052bad8e0ee5fce18c9db54386b517c7d96
# Parent  a5cc3b953ed99f61a2cfbef72a9f8befdfa49a24
x86/amd: Eliminate cache flushing when entering C3 on select AMD processors

AMD Fam15h processors have a shared cache. It does not need=
to be be flushed when entering C3 and doing so causes reduces
performance. Modify acpi_processor_power_init_bm_check to
prevent these processors from flushing when entering C3.

Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
xen-unstable changeset:   23511:450f1d198e1e
xen-unstable date:        Tue Jun 14 12:46:29 2011 +0100
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a5cc3b953ed9 -r cdff7052bad8 xen/arch/x86/acpi/cpu_idle.c
--- a/xen/arch/x86/acpi/cpu_idle.c	Tue Oct 25 16:44:40 2011 +0100
+++ b/xen/arch/x86/acpi/cpu_idle.c	Sat Nov 12 16:15:19 2011 +0000
@@ -549,7 +549,8 @@
     flags->bm_check = 0;
     if ( num_online_cpus() == 1 )
         flags->bm_check = 1;
-    else if ( c->x86_vendor == X86_VENDOR_INTEL )
+    else if ( (c->x86_vendor == X86_VENDOR_INTEL) ||
+              ((c->x86_vendor == X86_VENDOR_AMD) && (c->x86 == 0x15)) )
     {
         /*
          * Today all MP CPUs that support C3 share cache.

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

From xen-changelog-bounces@lists.xensource.com Mon Nov 14 14:55:18 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 14 Nov 2011 14:55:18 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQ5Qr-0000eD-Ug; Mon, 14 Nov 2011 14:55:17 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQ5Qo-0000dD-78
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 14:55:14 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1321311311!3465057!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 15931 invoked from network); 14 Nov 2011 22:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2011 22:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQ5Qk-0008CF-VY
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 22:55:10 +0000
Message-Id: <E1RQ5Qk-0008CF-VY@xenbits.xen.org>
Date: Mon, 14 Nov 2011 22:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] docs: report if we do not build a
	doc due to lack of the necessary tool
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1321293053 0
# Node ID 39bc21b5060b843dc3b1f081c337662efcf0d35a
# Parent  e2cc58b85b6eaf0c4348ee805d4ad011f829cbf6
docs: report if we do not build a doc due to lack of the necessary tool

Previously only some targets did this. An alternative would be to make a hard
dependency on these tools, this might make more sense especially for markdown?

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r e2cc58b85b6e -r 39bc21b5060b docs/Makefile
--- a/docs/Makefile	Mon Nov 14 17:49:14 2011 +0000
+++ b/docs/Makefile	Mon Nov 14 17:50:53 2011 +0000
@@ -58,7 +58,8 @@
 .PHONY: man-pages
 man-pages:
 	@if which $(POD2MAN) 1>/dev/null 2>/dev/null; then \
-	$(MAKE) $(DOC_MAN1) $(DOC_MAN5); fi
+	$(MAKE) $(DOC_MAN1) $(DOC_MAN5); else              \
+	echo "pod2man not installed; skipping man-pages."; fi
 
 man1/%.1: man/%.pod.1 Makefile
 	$(INSTALL_DIR) $(@D)
@@ -120,14 +121,16 @@
         echo "Running latex2html to generate $*/index.html ... "; \
 	$(LATEX2HTML) -split 0 -show_section_numbers -toc_depth 3 -nonavigation \
 	-numbered_footnotes -local_icons -noinfo -math -dir $(@D) \
-	$< 1>/dev/null 2>/dev/null ;fi
+	$< 1>/dev/null 2>/dev/null ; else \
+	echo "latex2html not installed; skipping $*."; fi
 
 html/%.html: %.markdown
 	@$(INSTALL_DIR) $(@D)
 	@set -e ; if which $(MARKDOWN) 1>/dev/null 2>/dev/null; then \
 	echo "Running markdown to generate $*.html ... "; \
 	$(MARKDOWN) $< > $@.tmp ; \
-	$(call move-if-changed,$@.tmp,$@) ; fi
+	$(call move-if-changed,$@.tmp,$@) ; else \
+	echo "markdown not installed; skipping $*.html."; fi
 
 txt/%.txt: %.txt
 	$(INSTALL_DIR) $(@D)

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

From xen-changelog-bounces@lists.xensource.com Mon Nov 14 14:55:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 14 Nov 2011 14:55:25 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQ5Qz-0000h0-Ht; Mon, 14 Nov 2011 14:55:25 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQ5Qo-0000dE-Ac
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 14:55:14 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1321311311!4178637!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3797 invoked from network); 14 Nov 2011 22:55:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2011 22:55:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQ5Qk-0008BH-Ac
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 22:55:10 +0000
Message-Id: <E1RQ5Qk-0008BH-Ac@xenbits.xen.org>
Date: Mon, 14 Nov 2011 22:55:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xenpaging: munmap all pages after
	page-in
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Olaf Hering <olaf@aepfle.de>
# Date 1321292954 0
# Node ID e2cc58b85b6eaf0c4348ee805d4ad011f829cbf6
# Parent  0844b17df7a9dd885e98e505f14fc99c1951b483
xenpaging: munmap all pages after page-in

Do munmap() on all mapped pages, not just the first one.  Without this
change the gfns backing the remaining pages can not be paged out again
because the page count does not go down to 1. This change was missing
from changeset 23827:d1d6abc1db20.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 0844b17df7a9 -r e2cc58b85b6e tools/xenpaging/pagein.c
--- a/tools/xenpaging/pagein.c	Fri Nov 11 18:14:35 2011 +0000
+++ b/tools/xenpaging/pagein.c	Mon Nov 14 17:49:14 2011 +0000
@@ -44,7 +44,7 @@
         /* Ignore errors */
         page = xc_map_foreign_pages(pia->xch, pia->dom, PROT_READ, gfns, num);
         if (page)
-            munmap(page, PAGE_SIZE);
+            munmap(page, PAGE_SIZE * num);
     }
     page_in_possible = 0;
     pthread_exit(NULL);

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

From xen-changelog-bounces@lists.xensource.com Mon Nov 14 14:55:34 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 14 Nov 2011 14:55:34 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQ5R7-0000kL-RO; Mon, 14 Nov 2011 14:55:33 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQ5Qp-0000dG-9i
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 14:55:15 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1321311312!4099413!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 16455 invoked from network); 14 Nov 2011 22:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2011 22:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQ5Ql-0008Ci-FZ
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 22:55:11 +0000
Message-Id: <E1RQ5Ql-0008Ci-FZ@xenbits.xen.org>
Date: Mon, 14 Nov 2011 22:55:10 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools: xend: tolerate empty
	state/*.xml
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1321293294 0
# Node ID a3a2e300951a7d181ae825b5de408faa889928c6
# Parent  39bc21b5060b843dc3b1f081c337662efcf0d35a
tools: xend: tolerate empty state/*.xml

Bugzilla 1680: Xend fails to start if /var/lib/xend/state/*.xml are empty
which I get often when replacing the Xen hypervisor with a newer version.

This can be easily be reproduced under Fedora Core 16 by installing
xen RPMs and then replacing the xen.gz with a newer version.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Anthony Low <shinji@pikopiko.org>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 39bc21b5060b -r a3a2e300951a tools/python/xen/xend/XendStateStore.py
--- a/tools/python/xen/xend/XendStateStore.py	Mon Nov 14 17:50:53 2011 +0000
+++ b/tools/python/xen/xend/XendStateStore.py	Mon Nov 14 17:54:54 2011 +0000
@@ -101,6 +101,9 @@
         if not os.path.exists(xml_path):
             return {}
 
+        if not os.path.getsize(xml_path) == 0:
+            return {}
+
         dom = minidom.parse(xml_path)
         root = dom.documentElement
         state = {}

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

From xen-changelog-bounces@lists.xensource.com Mon Nov 14 14:55:40 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 14 Nov 2011 14:55:40 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQ5RE-0000nW-6E; Mon, 14 Nov 2011 14:55:40 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQ5Qp-0000dI-Sj
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 14:55:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1321311312!3512496!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 9754 invoked from network); 14 Nov 2011 22:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2011 22:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQ5Qm-0008Dy-Lr
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 22:55:12 +0000
Message-Id: <E1RQ5Qm-0008Dy-Lr@xenbits.xen.org>
Date: Mon, 14 Nov 2011 22:55:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/check: check for headers and
	libraries in user defined folders.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1321294664 0
# Node ID ca618f5deec257150480d89848ab173ace217e5a
# Parent  078392e5078d4482c2ae50200cf2610e50e7e259
tools/check: check for headers and libraries in user defined folders.

Parse EXTRA_INCLUDES, EXTRA_LIB, PREPEND_INCLUDES, PREPEND_LIB,
APPEND_INCLUDES, APPEND_LIB during checks, to search for required
files.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r 078392e5078d -r ca618f5deec2 Config.mk
--- a/Config.mk	Mon Nov 14 18:14:07 2011 +0000
+++ b/Config.mk	Mon Nov 14 18:17:44 2011 +0000
@@ -176,6 +176,9 @@
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
+CHECK_LIB = $(EXTRA_LIB) $(PREPEND_LIB) $(APPEND_LIB)
+CHECK_INCLUDES = $(EXTRA_INCLUDES) $(PREPEND_INCLUDES) $(APPEND_INCLUDES)
+
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
 
diff -r 078392e5078d -r ca618f5deec2 tools/check/Makefile
--- a/tools/check/Makefile	Mon Nov 14 18:14:07 2011 +0000
+++ b/tools/check/Makefile	Mon Nov 14 18:17:44 2011 +0000
@@ -1,18 +1,24 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
+# Export the necessary environment variables for the tests
+export PYTHON
+export LIBXENAPI_BINDINGS
+export CHECK_INCLUDES
+export CHECK_LIB
+
 .PHONY: all install
 all install: check-build
 
 # Check this machine is OK for building on.
 .PHONY: check-build
 check-build:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk build
+	./chk build
 
 # Check this machine is OK for installing on.
 .PHONY: check-install
 check-install:
-	PYTHON=$(PYTHON) LIBXENAPI_BINDINGS=$(LIBXENAPI_BINDINGS) ./chk install
+	./chk install
 
 .PHONY: clean
 clean:
diff -r 078392e5078d -r ca618f5deec2 tools/check/funcs.sh
--- a/tools/check/funcs.sh	Mon Nov 14 18:14:07 2011 +0000
+++ b/tools/check/funcs.sh	Mon Nov 14 18:17:44 2011 +0000
@@ -25,15 +25,23 @@
 }
 
 has_header() {
+	check_sys_root || return 1
+
 	case $1 in
 		/*) ;;
-		*) set -- "/usr/include/$1" ;;
+		*)
+		if [ -r "$CROSS_SYS_ROOT/usr/include/$1" ]; then
+			return 0
+		fi
+		for path in ${CHECK_INCLUDES}; do
+			if [ -r "$CROSS_SYS_ROOT${path}/$1" ]; then
+				return 0
+			fi
+		done
+		;;
 	esac
 
-	check_sys_root || return 1
-
-	test -r "$CROSS_SYS_ROOT$1"
-	return $?
+	return 1
 }
 
 has_lib() {
@@ -42,6 +50,7 @@
 	# subshell to prevent pollution of caller's environment
 	(
 	PATH=/sbin:$PATH        # for ldconfig
+	LIBRARIES="$CHECK_LIB /usr/lib"
 
 	# This relatively common in a sys-root; libs are installed but
 	# ldconfig hasn't run there, so ldconfig -p won't work.
@@ -49,8 +58,15 @@
 	    echo "Please run ldconfig -r \"$CROSS_SYS_ROOT\" to generate ld.so.cache"
 	    # fall through; ldconfig test below should fail
 	fi
-	ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
-	return $?
+	if [ "${OS}" = "Linux" ]; then
+		ldconfig -p ${CROSS_SYS_ROOT+-r "$CROSS_SYS_ROOT"} | grep -Fq "$1"
+		return $?
+	fi
+	if [ "${OS}" = "NetBSD" ]; then
+		ls -1 ${LIBRARIES} | grep -Fq "$1"
+		return $?
+	fi
+	return 1
 	)
 }
 

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

From xen-changelog-bounces@lists.xensource.com Mon Nov 14 14:55:49 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Mon, 14 Nov 2011 14:55:49 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQ5RN-0000qg-KD; Mon, 14 Nov 2011 14:55:49 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQ5Qp-0000dH-J5
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 14:55:16 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-13.tower-182.messagelabs.com!1321311312!2570789!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25833 invoked from network); 14 Nov 2011 22:55:12 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-13.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	14 Nov 2011 22:55:12 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQ5Qm-0008DL-4s
	for xen-changelog@lists.xensource.com; Mon, 14 Nov 2011 22:55:12 +0000
Message-Id: <E1RQ5Qm-0008DL-4s@xenbits.xen.org>
Date: Mon, 14 Nov 2011 22:55:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] tools/build: Introduce {PREPEND,
	APPEND}_{LIB, INCLUDES}
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Roger Pau Monne <roger.pau@entel.upc.edu>
# Date 1321294447 0
# Node ID 078392e5078d4482c2ae50200cf2610e50e7e259
# Parent  a3a2e300951a7d181ae825b5de408faa889928c6
tools/build: Introduce {PREPEND,APPEND}_{LIB,INCLUDES}

Create two new variables called APPEND_ and PREPEND_ to add compile
flags at the beginning or at the end of the search path.

Added a new semantic for user defined compile flags, here is the list
of possible options:

PREPEND_LIB: add libraries to the search path before xen
             (before xen installation folders).
PREPEND_INCLUDES: add headers to the search path before xen
                  (before xen installation folders).
APPEND_LIB: add libraries to the search path at the end
            (after all xen installation folders have been added).
APPEND_INCLUDES: add libraries to the search path at the end
                 (after all xen installation folders have been added).

EXTRA_INCLUDES and EXTRA_LIB can still be used, and they will have the
same effect as PREPEND_INCLUDES and PREPEND_LIB.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
---


diff -r a3a2e300951a -r 078392e5078d Config.mk
--- a/Config.mk	Mon Nov 14 17:54:54 2011 +0000
+++ b/Config.mk	Mon Nov 14 18:14:07 2011 +0000
@@ -171,6 +171,10 @@
 
 LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i)) 
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
+LDFLAGS += $(foreach i, $(PREPEND_LIB), -L$(i))
+CFLAGS += $(foreach i, $(PREPEND_INCLUDES), -I$(i))
+APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
+APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
 EMBEDDED_EXTRA_CFLAGS := -nopie -fno-stack-protector -fno-stack-protector-all
 EMBEDDED_EXTRA_CFLAGS += -fno-exceptions
diff -r a3a2e300951a -r 078392e5078d tools/Rules.mk
--- a/tools/Rules.mk	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/Rules.mk	Mon Nov 14 18:14:07 2011 +0000
@@ -86,18 +86,18 @@
 	$(XEN_ROOT)/tools/python/install-wrap "$(PYTHON_PATH)" $(INSTALL_PROG)
 
 %.opic: %.c
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $<
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS_$*.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
 
 %.o: %.c
-	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
 
 %.o: %.cc
-	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $<
+	$(CC) $(CPPFLAGS) $(CXXFLAGS) $(CXXFLAGS_$*.o) -c -o $@ $< $(APPEND_CFLAGS)
 
 %.o: %.S
-	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@
+	$(CC) $(CFLAGS) $(CFLAGS_$*.o) -c $< -o $@ $(APPEND_CFLAGS)
 %.opic: %.S
-	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $<
+	$(CC) $(CPPFLAGS) -DPIC $(CFLAGS) $(CFLAGS.opic) -fPIC -c -o $@ $< $(APPEND_CFLAGS)
 
 subdirs-all subdirs-clean subdirs-install subdirs-distclean: .phony
 	@set -e; for subdir in $(SUBDIRS) $(SUBDIRS-y); do \
diff -r a3a2e300951a -r 078392e5078d tools/console/Makefile
--- a/tools/console/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/console/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -23,10 +23,10 @@
 	$(RM) client/*.o daemon/*.o
 
 xenconsoled: $(patsubst %.c,%.o,$(wildcard daemon/*.c))
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsoled)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsoled) $(APPEND_LDFLAGS)
 
 xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS) $(LDLIBS_xenconsole) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: $(BIN)
diff -r a3a2e300951a -r 078392e5078d tools/libfsimage/Rules.mk
--- a/tools/libfsimage/Rules.mk	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/libfsimage/Rules.mk	Mon Nov 14 18:14:07 2011 +0000
@@ -24,7 +24,7 @@
 	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
 
 $(FSLIB): $(PIC_OBJS)
-	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS)
+	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
 
 clean distclean:
 	rm -f $(PIC_OBJS) $(FSLIB) $(DEPS)
diff -r a3a2e300951a -r 078392e5078d tools/libvchan/Makefile
--- a/tools/libvchan/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/libvchan/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -29,16 +29,16 @@
 	ln -sf $< $@
 
 libxenvchan.so.$(MAJOR).$(MINOR): $(LIBVCHAN_PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenvchan.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBVCHAN_LIBS) $(APPEND_LDFLAGS)
 
 libxenvchan.a: $(LIBVCHAN_OBJS)
 	$(AR) rcs libxenvchan.a $^
 
 vchan-node1: $(NODE_OBJS) libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan)
+	$(CC) $(LDFLAGS) -o $@ $(NODE_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
 
 vchan-node2: $(NODE2_OBJS) libxenvchan.so
-	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan)
+	$(CC) $(LDFLAGS) -o $@ $(NODE2_OBJS) $(LDLIBS_libxenvchan) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff -r a3a2e300951a -r 078392e5078d tools/libxc/Makefile
--- a/tools/libxc/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/libxc/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -156,7 +156,7 @@
 	ln -sf $< $@
 
 libxenctrl.so.$(MAJOR).$(MINOR): $(CTRL_PIC_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenctrl.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(DLOPEN_LIBS) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
 # libxenguest
 
@@ -192,10 +192,10 @@
 
 libxenguest.so.$(MAJOR).$(MINOR): COMPRESSION_LIBS = $(call zlib-options,l)
 libxenguest.so.$(MAJOR).$(MINOR): $(GUEST_PIC_OBJS) libxenctrl.so
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenguest.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $(GUEST_PIC_OBJS) $(COMPRESSION_LIBS) -lz $(LDLIBS_libxenctrl) $(PTHREAD_LIBS) $(APPEND_LDFLAGS)
 
 xenctrl_osdep_ENOSYS.so: $(OSDEP_PIC_OBJS) libxenctrl.so
-	$(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl)
+	$(CC) -g $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $(OSDEP_PIC_OBJS) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
 
diff -r a3a2e300951a -r 078392e5078d tools/libxen/Makefile
--- a/tools/libxen/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/libxen/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -44,13 +44,13 @@
 	ln -sf $< $@
 
 libxenapi.so.$(MAJOR).$(MINOR): $(LIBXENAPI_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenapi.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(APPEND_LDFLAGS)
 
 libxenapi.a: $(LIBXENAPI_OBJS)
 	$(AR) rcs libxenapi.a $^
 
 $(TEST_PROGRAMS): test/%: test/%.o libxenapi.so
-	$(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi
+	$(CC) $(LDFLAGS) -o $@ $< -L . -lxenapi $(APPEND_LDFLAGS)
 
 
 .PHONY: install
diff -r a3a2e300951a -r 078392e5078d tools/libxl/Makefile
--- a/tools/libxl/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/libxl/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -104,7 +104,7 @@
 	ln -sf $< $@
 
 libxenlight.so.$(MAJOR).$(MINOR): $(LIBXL_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenlight.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) $(APPEND_LDFLAGS)
 
 libxenlight.a: $(LIBXL_OBJS)
 	$(AR) rcs libxenlight.a $^
@@ -116,16 +116,16 @@
 	ln -sf $< $@
 
 libxlutil.so.$(XLUMAJOR).$(XLUMINOR): $(LIBXLU_OBJS)
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS)
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxlutil.so.$(XLUMAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) $(APPEND_LDFLAGS)
 
 libxlutil.a: $(LIBXLU_OBJS)
 	$(AR) rcs libxlutil.a $^
 
 xl: $(XL_OBJS) libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 testidl: testidl.o libxlutil.so libxenlight.so
-	$(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: all
diff -r a3a2e300951a -r 078392e5078d tools/misc/Makefile
--- a/tools/misc/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/misc/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -47,30 +47,30 @@
 	set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d clean; done
 
 xen-hvmctx: xen-hvmctx.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xen-hvmcrash: xen-hvmcrash.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xenperf: xenperf.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xenpm: xenpm.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 gtracestat: gtracestat.o
-	$(CC) $(LDFLAGS) -o $@ $<
+	$(CC) $(LDFLAGS) -o $@ $< $(APPEND_LDFLAGS)
 
 xenlockprof: xenlockprof.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 xen-hptool: xen-hptool.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
 xenwatchdogd: xenwatchdogd.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 gtraceview: gtraceview.o
-	$(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(CURSES_LIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r a3a2e300951a -r 078392e5078d tools/xcutils/Makefile
--- a/tools/xcutils/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xcutils/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -27,16 +27,16 @@
 build: $(PROGRAMS)
 
 xc_restore: xc_restore.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
 xc_save: xc_save.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(APPEND_LDFLAGS)
 
 readnotes: readnotes.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
 lsevtchn: lsevtchn.o
-	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl)
+	$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
 .PHONY: install
 install: build
diff -r a3a2e300951a -r 078392e5078d tools/xenbackendd/Makefile
--- a/tools/xenbackendd/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenbackendd/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -33,6 +33,6 @@
 	rm -f $(DEPS)
 
 xenbackendd: xenbackendd.o
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r a3a2e300951a -r 078392e5078d tools/xenmon/Makefile
--- a/tools/xenmon/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenmon/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -41,9 +41,9 @@
 	$(RM) -f xentrace_setmake setmask.o
 
 xenbaked: xenbaked.o Makefile
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 xentrace_setmask: setmask.o Makefile
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r a3a2e300951a -r 078392e5078d tools/xenpaging/Makefile
--- a/tools/xenpaging/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenpaging/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -20,7 +20,7 @@
 all: $(IBINS)
 
 xenpaging: $(OBJS)
-	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS)
 
 install: all
 	$(INSTALL_DIR) $(DESTDIR)/var/lib/xen/xenpaging
diff -r a3a2e300951a -r 078392e5078d tools/xenpmd/Makefile
--- a/tools/xenpmd/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenpmd/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -19,6 +19,6 @@
 	$(RM) -f xenpmd xenpmd.o $(DEPS)
 
 xenpmd: xenpmd.o Makefile
-	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS)
+	$(CC) $(LDFLAGS) $< -o $@ $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
diff -r a3a2e300951a -r 078392e5078d tools/xenstat/libxenstat/Makefile
--- a/tools/xenstat/libxenstat/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenstat/libxenstat/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -51,7 +51,7 @@
 
 $(SHLIB): $(OBJECTS-y)
 	$(CC) $(LDFLAGS) $(SONAME_FLAGS) $(SHLIB_LDFLAGS) -o $@ \
-	    $(OBJECTS-y) $(LDLIBS-y)
+	    $(OBJECTS-y) $(LDLIBS-y) $(APPEND_LDFLAGS)
 
 src/libxenstat.so.$(MAJOR): $(SHLIB)
 	$(MAKE_LINK) $(<F) $@
@@ -95,7 +95,7 @@
 	swig -python $(SWIG_FLAGS) -outdir $(@D) -o $(PYSRC) $<
 
 $(PYLIB): $(PYSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(PYTHON_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(APPEND_LDFLAGS)
 
 python-bindings: $(PYLIB) $(PYMOD)
 
@@ -117,7 +117,7 @@
 	swig -perl $(SWIG_FLAGS) -outdir $(@D) -o $(PERLSRC) $<
 
 $(PERLLIB): $(PERLSRC)
-	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $<
+	$(CC) $(CFLAGS) $(LDFLAGS) $(PERL_FLAGS) $(SHLIB_LDFLAGS) -lxenstat -o $@ $< $(APPEND_LDFLAGS)
 
 .PHONY: perl-bindings
 perl-bindings: $(PERLLIB) $(PERLMOD)
diff -r a3a2e300951a -r 078392e5078d tools/xenstore/Makefile
--- a/tools/xenstore/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xenstore/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -47,19 +47,19 @@
 endif
  
 xenstored: $(XENSTORED_OBJS)
-	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@
+	$(CC) $(LDFLAGS) $^ $(LDLIBS_libxenctrl) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
 $(CLIENTS): xenstore
 	ln -f xenstore $@
 
 xenstore: xenstore_client.o $(LIBXENSTORE)
-	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
 xenstore-control: xenstore_control.o $(LIBXENSTORE)
-	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@
+	$(CC) $(LDFLAGS) $< $(LDLIBS_libxenstore) $(SOCKET_LIBS) -o $@ $(APPEND_LDFLAGS)
 
 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
-	$(CC) $(LDFLAGS) $^ -o $@
+	$(CC) $(LDFLAGS) $^ -o $@ $(APPEND_LDFLAGS)
 
 libxenstore.so: libxenstore.so.$(MAJOR)
 	ln -sf $< $@
@@ -69,7 +69,7 @@
 xs.opic: CFLAGS += -DUSE_PTHREAD
 
 libxenstore.so.$(MAJOR).$(MINOR): xs.opic xs_lib.opic
-	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread
+	$(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxenstore.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(SOCKET_LIBS) -lpthread $(APPEND_LDFLAGS)
 
 libxenstore.a: xs.o xs_lib.o
 	$(AR) rcs $@ $^
diff -r a3a2e300951a -r 078392e5078d tools/xentrace/Makefile
--- a/tools/xentrace/Makefile	Mon Nov 14 17:54:54 2011 +0000
+++ b/tools/xentrace/Makefile	Mon Nov 14 18:14:07 2011 +0000
@@ -35,13 +35,13 @@
 	$(RM) *.a *.so *.o *.rpm $(BIN) $(LIBBIN) $(DEPS)
 
 xentrace: xentrace.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 xenctx: xenctx.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 xentrace_setsize: setsize.o
-	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS)
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) $(APPEND_LDFLAGS)
 
 -include $(DEPS)
 

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 15 07:13:05 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 15 Nov 2011 07:13:05 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQKh5-0004Ao-Dq; Tue, 15 Nov 2011 07:13:03 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQKfK-00048c-Ta
	for xen-changelog@lists.xensource.com; Tue, 15 Nov 2011 07:11:22 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-15.tower-21.messagelabs.com!1321369870!4296210!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 26972 invoked from network); 15 Nov 2011 15:11:11 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-15.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	15 Nov 2011 15:11:11 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQKfG-00047G-LI
	for xen-changelog@lists.xensource.com; Tue, 15 Nov 2011 15:11:10 +0000
Message-Id: <E1RQKfG-00047G-LI@xenbits.xen.org>
Date: Tue, 15 Nov 2011 15:11:09 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvmloader: Move acpi_info structure
	out from low memory.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1321301735 0
# Node ID 848049b14ec7fbd28bd4cd756e01609698b60c7a
# Parent  ca618f5deec257150480d89848ab173ace217e5a
hvmloader: Move acpi_info structure out from low memory.

This avoids a conflict with SeaBIOS's memory management. Moreover
there is no reason that acp_info must live below 1MB, and moving it
out actually simplifies our code.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/acpi/build.c
--- a/tools/firmware/hvmloader/acpi/build.c	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/build.c	Mon Nov 14 20:15:35 2011 +0000
@@ -276,7 +276,7 @@
 
 void acpi_build_tables(struct acpi_config *config, unsigned int physical)
 {
-    struct acpi_info *acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
+    struct acpi_info *acpi_info;
     struct acpi_20_rsdp *rsdp;
     struct acpi_20_rsdt *rsdt;
     struct acpi_20_xsdt *xsdt;
@@ -287,6 +287,9 @@
     unsigned long        secondary_tables[16];
     int                  nr_secondaries, i;
 
+    /* Allocate and initialise the acpi info area. */
+    mem_hole_populate_ram(ACPI_INFO_PHYSICAL_ADDRESS >> PAGE_SHIFT, 1);
+    acpi_info = (struct acpi_info *)ACPI_INFO_PHYSICAL_ADDRESS;
     memset(acpi_info, 0, sizeof(*acpi_info));
 
     /*
diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Mon Nov 14 20:15:35 2011 +0000
@@ -61,8 +61,8 @@
 
     Scope (\_SB)
     {
-       /* ACPI_INFO_PHYSICAL_ADDRESS == 0x9F000 */
-       OperationRegion(BIOS, SystemMemory, 0x9F000, 24)
+       /* ACPI_INFO_PHYSICAL_ADDRESS == 0xFC000000 */
+       OperationRegion(BIOS, SystemMemory, 0xFC000000, 24)
        Field(BIOS, ByteAcc, NoLock, Preserve) {
            UAR1, 1,
            UAR2, 1,
diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/config.h	Mon Nov 14 20:15:35 2011 +0000
@@ -54,18 +54,17 @@
 #define PCI_MEM_END         0xfc000000
 extern unsigned long pci_mem_start, pci_mem_end;
 
-/* Reserved for special BIOS mappings, etc. */
-#define RESERVED_MEMBASE    0xfc000000
 
 /* Memory map. */
 #define SCRATCH_PHYSICAL_ADDRESS      0x00010000
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
-#define ACPI_INFO_PHYSICAL_ADDRESS    0x0009F000
 #define VGABIOS_PHYSICAL_ADDRESS      0x000C0000
 #define HVMLOADER_PHYSICAL_ADDRESS    0x00100000
-
-#define ACPI_INFO_SIZE                     0xC00
-#define ACPI_INFO_PHYSICAL_END (ACPI_INFO_PHYSICAL_ADDRESS + ACPI_INFO_SIZE)
+/* Special BIOS mappings, etc. are allocated from here upwards... */
+#define RESERVED_MEMBASE              0xFC000000
+/* NB. ACPI_INFO_PHYSICAL_ADDRESS *MUST* match definition in acpi/dsdt.asl! */
+#define ACPI_INFO_PHYSICAL_ADDRESS    0xFC000000
+#define RESERVED_MEMORY_DYNAMIC       0xFC001000
 
 extern unsigned long scratch_start;
 
diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/e820.c
--- a/tools/firmware/hvmloader/e820.c	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/e820.c	Mon Nov 14 20:15:35 2011 +0000
@@ -81,55 +81,24 @@
     /* Lowmem must be at least 512K to keep Windows happy) */
     ASSERT ( lowmem_reserved_base > 512<<10 );
 
-    /*
-     * Lowmem reservation must either cover the ACPI info region
-     * entirely or not at all. Sitting half way through suggests
-     * something funny is going on.
-     */
-    ASSERT ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS ||
-             lowmem_reserved_base > ACPI_INFO_PHYSICAL_END );
-
     ASSERT ( bios_image_base < 0x100000 );
 
-    if ( lowmem_reserved_base < ACPI_INFO_PHYSICAL_ADDRESS )
+    /*
+     * 0x0-lowmem_reserved_base: Ordinary RAM.
+     */
+    e820[nr].addr = 0x00000;
+    e820[nr].size = lowmem_reserved_base;
+    e820[nr].type = E820_RAM;
+    nr++;
+
+    /* lowmem_reserved_base-0xA0000: reserved by BIOS implementation. */
+    if ( lowmem_reserved_base < 0xA0000 )
     {
-        /*
-         * 0x0-lowmem_reserved_base: Ordinary RAM.
-         */
-        e820[nr].addr = 0x00000;
-        e820[nr].size = lowmem_reserved_base;
-        e820[nr].type = E820_RAM;
-        nr++;
-    }
-    else
-    {
-        /* 0x0-ACPI_INFO: Ordinary RAM. */
-        e820[nr].addr = 0x00000;
-        e820[nr].size = ACPI_INFO_PHYSICAL_ADDRESS;
-        e820[nr].type = E820_RAM;
-        nr++;
-
-        /* ACPI INFO: Reserved. */
-        e820[nr].addr = ACPI_INFO_PHYSICAL_ADDRESS;
-        e820[nr].size = ACPI_INFO_SIZE;
+        /* Reserved for internal use. */
+        e820[nr].addr = lowmem_reserved_base;
+        e820[nr].size = 0xA0000-lowmem_reserved_base;
         e820[nr].type = E820_RESERVED;
         nr++;
-
-        /* ACPI_INFO-lowmem_reserved_base: Ordinary RAM. */
-        e820[nr].addr = ACPI_INFO_PHYSICAL_END;
-        e820[nr].size = lowmem_reserved_base - ACPI_INFO_PHYSICAL_END;
-        e820[nr].type = E820_RAM;
-        nr++;
-    }
-
-    /* lowmem_reserved_base-0xa00000: reserved by BIOS implementation. */
-    if ( lowmem_reserved_base < 0xA0000 )
-    {
-            /* Reserved for internal use. */
-            e820[nr].addr = lowmem_reserved_base;
-            e820[nr].size = 0xA0000-lowmem_reserved_base;
-            e820[nr].type = E820_RESERVED;
-            nr++;
     }
 
     /*
diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/rombios.c
--- a/tools/firmware/hvmloader/rombios.c	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/rombios.c	Mon Nov 14 20:15:35 2011 +0000
@@ -47,7 +47,6 @@
 {
     /*
      * 0x9E000-0x09F000: Stack.
-     * 0x9F000-0x09C000: ACPI info.
      * 0x9FC00-0x0A0000: Extended BIOS Data Area (EBDA).
      * ...
      * 0xE0000-0x0F0000: PC-specific area. We place various tables here.
diff -r ca618f5deec2 -r 848049b14ec7 tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c	Mon Nov 14 18:17:44 2011 +0000
+++ b/tools/firmware/hvmloader/util.c	Mon Nov 14 20:15:35 2011 +0000
@@ -343,7 +343,7 @@
     }
 }
 
-static uint32_t reserve = RESERVED_MEMBASE - 1;
+static uint32_t reserve = RESERVED_MEMORY_DYNAMIC - 1;
 
 xen_pfn_t mem_hole_alloc(uint32_t nr_mfns)
 {

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 15 16:11:20 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 15 Nov 2011 16:11:20 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQT5z-0006tb-Vj; Tue, 15 Nov 2011 16:11:19 -0800
Received: from mail174.messagelabs.com ([85.158.138.51])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQT5w-0006sl-Ns
	for xen-changelog@lists.xensource.com; Tue, 15 Nov 2011 16:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-14.tower-174.messagelabs.com!1321402273!1713829!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20989 invoked from network); 16 Nov 2011 00:11:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-14.tower-174.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2011 00:11:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQT5s-0008C6-Lv
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 00:11:12 +0000
Message-Id: <E1RQT5s-0008C6-Lv@xenbits.xen.org>
Date: Wed, 16 Nov 2011 00:11:11 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] xen: avoid crash enabling turbo mode
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Ian Campbell <ian.campbell@citrix.com>
# Date 1321363478 -3600
# Node ID cd3ef25f207a3925f1f8650c227e24f839da13ad
# Parent  848049b14ec7fbd28bd4cd756e01609698b60c7a
xen: avoid crash enabling turbo mode

On a system which has not had P-state information pushed down into the
hypervisor running "xenpm enable-turbo-mode" will reliably crash the host.

(XEN) PM OP 38 on CPU0
(XEN) ----[ Xen-4.2-unstable  x86_64  debug=y  Not tainted ]----
(XEN) CPU:    0
(XEN) RIP:    e008:[<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN) RFLAGS: 0000000000010297   CONTEXT: hypervisor
(XEN) rax: 0000000000000000   rbx: ffff82c48029fe40   rcx: 0000000000000000
(XEN) rdx: 0000000000000000   rsi: 000000000000000a   rdi: 0000000000000000
(XEN) rbp: ffff82c48029fd08   rsp: ffff82c48029fd08   r8:  0000000000000004
(XEN) r9:  0000000000000000   r10: 00000000fffffffd   r11: ffff82c480218f20
(XEN) r12: ffff830106e720b0   r13: 0000000000000000   r14: ffff82c4802bff80
(XEN) r15: ffff82c48025c0e4   cr0: 000000008005003b   cr4: 00000000000026f0
(XEN) cr3: 000000011f459000   cr2: 0000000000000051
(XEN) ds: 007b   es: 007b   fs: 00d8   gs: 0033   ss: 0000   cs: e008
(XEN) Xen stack trace from rsp=ffff82c48029fd08:
(XEN)    ffff82c48029fdb8 ffff82c48014c427 ffff82c48029fd98 ffff82c48016b2d6
(XEN)    ffff82c48029fdb8 ffff82c48029fd60 00000000001196c5 0000000116bbe025
(XEN)    0000000116bbe025 ffff8301196c5338 ffff82f6022d77c0 0000000000000000
(XEN)    ffff82f60205edf0 0000000000000000 0000000000000000 ffff8300dffba000
(XEN)    ffff82c48029fdb8 ffff82c48029ff18 0000000008050004 0000000000000000
(XEN)    ffff82c4802bff80 ffff82c48025c0e4 ffff82c48029fef8 ffff82c480124fd8
(XEN)    0000000000000000 ffff83011f48c000 0000000116bbe025 0000000000000025
(XEN)    ffff82c48029fe28 0000000080167722 ffff82c48029ff08 ffff83011f48c000
(XEN)    ffff82f60232d8a0 ffff8300dffba000 ffff83011f48c000 ffff82f60232d8a0
(XEN)    ffff82c48029fed8 ffff82c48017296a 000000080000000c 0000000000000026
(XEN)    bfb338b000000000 bfb33874bfb33868 b78988f800000000 0000008800000000
(XEN)    b787a6e0b78533a0 ffffffff00000001 080487aeb7897ff4 bfb3389000000001
(XEN)    b7898ab0b7889626 0000000100000000 0000000000000001 0804867800000001
(XEN)    000000000804e998 00000000b78533a0 bfb33e70bfb33a7c 0000000000000000
(XEN)    0000000000000000 ffff8300dffba000 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 00007d3b7fd600c7 ffff82c48021511e
(XEN)    00000000c1002467 0000000000000023 0000000000000000 0000000000000000
(XEN)    0000000000000000 0000000000000000 00000000dbf5bef8 0000000008050004
(XEN)    0000000000000000 0000000000000000 0000000000000000 0000000000000000
(XEN)    0000000000000023 00000000bfb33874 00000000bfb33868 0000000000000000
(XEN) Xen call trace:
(XEN)    [<ffff82c48013ceed>] cpufreq_enable_turbo+0x1d/0x29
(XEN)    [<ffff82c48014c427>] do_pm_op+0x884/0x8e7
(XEN)    [<ffff82c480124fd8>] do_sysctl+0x6d8/0x9f0
(XEN)    [<ffff82c48021511e>] compat_hypercall+0xae/0x107
(XEN)
(XEN) Pagetable walk from 0000000000000051:
(XEN)  L4[0x000] = 0000000116dbc027 000000000001bd22
(XEN)  L3[0x000] = 0000000119ba8027 000000000001eb36
(XEN)  L2[0x000] = 0000000000000000 ffffffffffffffff
(XEN)
(XEN) ****************************************
(XEN) Panic on CPU 0:
(XEN) FATAL PAGE FAULT
(XEN) [error_code=0000]
(XEN) Faulting linear address: 0000000000000051
(XEN) ****************************************
(XEN)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 848049b14ec7 -r cd3ef25f207a xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c	Mon Nov 14 20:15:35 2011 +0000
+++ b/xen/drivers/cpufreq/utility.c	Tue Nov 15 14:24:38 2011 +0100
@@ -396,7 +396,7 @@
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
         policy->turbo = CPUFREQ_TURBO_ENABLED;
 }
 
@@ -405,7 +405,7 @@
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    if (policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
+    if (policy && policy->turbo != CPUFREQ_TURBO_UNSUPPORTED)
         policy->turbo = CPUFREQ_TURBO_DISABLED;
 }
 
@@ -414,7 +414,7 @@
     struct cpufreq_policy *policy;
 
     policy = per_cpu(cpufreq_cpu_policy, cpuid);
-    return policy->turbo;
+    return policy && policy->turbo;
 }
 
 /*********************************************************************

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 15 16:11:29 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 15 Nov 2011 16:11:29 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQT69-0006wg-EV; Tue, 15 Nov 2011 16:11:29 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQT5x-0006sp-IW
	for xen-changelog@lists.xensource.com; Tue, 15 Nov 2011 16:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-5.tower-21.messagelabs.com!1321402274!2801852!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 21123 invoked from network); 16 Nov 2011 00:11:14 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-5.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2011 00:11:14 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQT5u-0008E4-B5
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 00:11:14 +0000
Message-Id: <E1RQT5u-0008E4-B5@xenbits.xen.org>
Date: Wed, 16 Nov 2011 00:11:13 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] KEXEC cleanup: IA64 specific
	functions should not live in generic header files
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Andrew Cooper <andrew.cooper3@citrix.com>
# Date 1321365018 -3600
# Node ID fd3567cafe1c7ccd0ddba0ad7fb067d435e13529
# Parent  967845cb565bc88caaca573eaff99ad39cc36c2a
KEXEC cleanup: IA64 specific functions should not live in generic header files

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Committed-by: Jan Beulich <jbeulich@suse.com>
---


diff -r 967845cb565b -r fd3567cafe1c xen/arch/ia64/xen/crash.c
--- a/xen/arch/ia64/xen/crash.c	Tue Nov 15 14:47:41 2011 +0100
+++ b/xen/arch/ia64/xen/crash.c	Tue Nov 15 14:50:18 2011 +0100
@@ -15,6 +15,7 @@
 #include <linux/hardirq.h>
 #include <linux/smp.h>
 #include <asm/processor.h>
+#include <asm/kexec.h>
 #include <xen/sched.h>
 
 void machine_crash_shutdown(void)
diff -r 967845cb565b -r fd3567cafe1c xen/include/asm-ia64/kexec.h
--- a/xen/include/asm-ia64/kexec.h	Tue Nov 15 14:47:41 2011 +0100
+++ b/xen/include/asm-ia64/kexec.h	Tue Nov 15 14:50:18 2011 +0100
@@ -10,6 +10,7 @@
                                 unsigned long boot_param,
                                 unsigned long dom0_relocate_new_kernel);
 void crash_save_xen_notes(void);
+void kexec_disable_iosapic(void);
 void machine_kexec(xen_kexec_image_t *image);
 unsigned long kdump_find_rsvd_region(unsigned long size,
                                      struct rsvd_region *rsvd_regions, int n);
diff -r 967845cb565b -r fd3567cafe1c xen/include/xen/kexec.h
--- a/xen/include/xen/kexec.h	Tue Nov 15 14:47:41 2011 +0100
+++ b/xen/include/xen/kexec.h	Tue Nov 15 14:50:18 2011 +0100
@@ -31,7 +31,6 @@
 void machine_reboot_kexec(xen_kexec_image_t *image);
 void machine_kexec(xen_kexec_image_t *image);
 void kexec_crash(void);
-void kexec_disable_iosapic(void);
 void kexec_crash_save_cpu(void);
 crash_xen_info_t *kexec_crash_save_info(void);
 void machine_crash_shutdown(void);

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

From xen-changelog-bounces@lists.xensource.com Tue Nov 15 16:11:37 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Tue, 15 Nov 2011 16:11:37 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQT6G-0006za-SM; Tue, 15 Nov 2011 16:11:36 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQT5w-0006so-SX
	for xen-changelog@lists.xensource.com; Tue, 15 Nov 2011 16:11:17 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-6.tower-216.messagelabs.com!1321402273!3676055!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 8325 invoked from network); 16 Nov 2011 00:11:13 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-6.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	16 Nov 2011 00:11:13 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQT5t-0008DY-OB
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 00:11:13 +0000
Message-Id: <E1RQT5t-0008DY-OB@xenbits.xen.org>
Date: Wed, 16 Nov 2011 00:11:12 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] ia64: fix the build
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321364861 -3600
# Node ID 967845cb565bc88caaca573eaff99ad39cc36c2a
# Parent  cd3ef25f207a3925f1f8650c227e24f839da13ad
ia64: fix the build

This addresses all remaining build problems introduced over the last
several months.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
---


diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux-xen/iosapic.c
--- a/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux-xen/iosapic.c	Tue Nov 15 14:47:41 2011 +0100
@@ -275,12 +275,6 @@
 	iosapic_intr_info[vector].dest = dest;
 }
 
-static void
-nop (struct irq_desc *desc)
-{
-	/* do nothing... */
-}
-
 void
 kexec_disable_iosapic(void)
 {
@@ -428,7 +422,7 @@
 #define iosapic_shutdown_level_irq	mask_irq
 #define iosapic_enable_level_irq	unmask_irq
 #define iosapic_disable_level_irq	mask_irq
-#define iosapic_ack_level_irq		nop
+#define iosapic_ack_level_irq		irq_actor_none
 
 static hw_irq_controller irq_type_iosapic_level = {
 	.typename =	"IO-SAPIC-level",
@@ -446,9 +440,9 @@
  */
 
 static unsigned int
-iosapic_startup_edge_irq (unsigned int irq)
+iosapic_startup_edge_irq (struct irq_desc *desc)
 {
-	unmask_irq(irq);
+	unmask_irq(desc);
 	/*
 	 * IOSAPIC simply drops interrupts pended while the
 	 * corresponding pin was masked, so we can't know if an
@@ -458,23 +452,21 @@
 }
 
 static void
-iosapic_ack_edge_irq (unsigned int irq)
+iosapic_ack_edge_irq (struct irq_desc *desc)
 {
-	irq_desc_t *idesc = irq_descp(irq);
-
-	move_irq(irq);
+	move_irq(idesc->irq);
 	/*
 	 * Once we have recorded IRQ_PENDING already, we can mask the
 	 * interrupt for real. This prevents IRQ storms from unhandled
 	 * devices.
 	 */
-	if ((idesc->status & (IRQ_PENDING|IRQ_DISABLED)) == (IRQ_PENDING|IRQ_DISABLED))
-		mask_irq(irq);
+	if ((desc->status & (IRQ_PENDING|IRQ_DISABLED)) == (IRQ_PENDING|IRQ_DISABLED))
+		mask_irq(desc);
 }
 
 #define iosapic_enable_edge_irq		unmask_irq
-#define iosapic_disable_edge_irq	nop
-#define iosapic_end_edge_irq		nop
+#define iosapic_disable_edge_irq	irq_disable_none
+#define iosapic_end_edge_irq		irq_actor_none
 
 static hw_irq_controller irq_type_iosapic_edge = {
 	.typename =	"IO-SAPIC-edge",
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux-xen/irq_ia64.c
--- a/xen/arch/ia64/linux-xen/irq_ia64.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux-xen/irq_ia64.c	Tue Nov 15 14:47:41 2011 +0100
@@ -242,6 +242,16 @@
 };
 #endif
 
+static hw_irq_controller irq_type_ia64_lsapic = {
+	.typename =	"LSAPIC",
+	.startup =	irq_startup_none,
+	.shutdown =	irq_shutdown_none,
+	.enable =	irq_enable_none,
+	.disable =	irq_disable_none,
+	.ack =		irq_actor_none,
+	.end =		irq_actor_none
+};
+
 void
 register_percpu_irq (ia64_vector vec, struct irqaction *action)
 {
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux-xen/mca.c
--- a/xen/arch/ia64/linux-xen/mca.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux-xen/mca.c	Tue Nov 15 14:47:41 2011 +0100
@@ -428,9 +428,9 @@
 		return;
 
 	spin_lock_irqsave(&desc->lock, flags);
-	if (!desc->depth++) {
+	if (!desc->arch.depth++) {
 		desc->status |= IRQ_DISABLED;
-		desc->handler->disable(irq);
+		desc->handler->disable(desc);
 	}
 	spin_unlock_irqrestore(&desc->lock, flags);
 }
@@ -456,7 +456,7 @@
 		return;
 
 	spin_lock_irqsave(&desc->lock, flags);
-	switch (desc->depth) {
+	switch (desc->arch.depth) {
 	case 0:
 		WARN_ON(1);
 		break;
@@ -468,11 +468,11 @@
 			desc->status = status | IRQ_REPLAY;
 			hw_resend_irq(desc->handler,irq);
 		}
-		desc->handler->enable(irq);
+		desc->handler->enable(desc);
 		/* fall-through */
 	}
 	default:
-		desc->depth--;
+		desc->arch.depth--;
 	}
 	spin_unlock_irqrestore(&desc->lock, flags);
 }
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux-xen/sn/kernel/irq.c
--- a/xen/arch/ia64/linux-xen/sn/kernel/irq.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux-xen/sn/kernel/irq.c	Tue Nov 15 14:47:41 2011 +0100
@@ -72,6 +72,7 @@
 			(u64) sn_irq_info->irq_cookie, 0, 0);
 }
 
+#ifndef XEN
 static unsigned int sn_startup_irq(unsigned int irq)
 {
 	return 0;
@@ -88,9 +89,16 @@
 static void sn_enable_irq(unsigned int irq)
 {
 }
+#endif
 
+#ifdef XEN
+static void sn_ack_irq(struct irq_desc *desc)
+{
+	unsigned int irq = desc->irq;
+#else
 static void sn_ack_irq(unsigned int irq)
 {
+#endif
 	u64 event_occurred, mask;
 
 	irq = irq & 0xff;
@@ -102,8 +110,14 @@
 	move_native_irq(irq);
 }
 
+#ifdef XEN
+static void sn_end_irq(struct irq_desc *desc)
+{
+	unsigned int irq = desc->irq;
+#else
 static void sn_end_irq(unsigned int irq)
 {
+#endif
 	int ivec;
 	u64 event_occurred;
 
@@ -224,13 +238,17 @@
 static hw_irq_controller irq_type_sn = {
 #ifndef XEN
 	.name		= "SN hub",
-#else
-	.typename	= "SN hub",
-#endif
 	.startup	= sn_startup_irq,
 	.shutdown	= sn_shutdown_irq,
 	.enable		= sn_enable_irq,
 	.disable	= sn_disable_irq,
+#else
+	.typename	= "SN hub",
+	.startup	= irq_startup_none,
+	.shutdown	= irq_shutdown_none,
+	.enable		= irq_enable_none,
+	.disable	= irq_disable_none,
+#endif
 	.ack		= sn_ack_irq,
 	.end		= sn_end_irq,
 #ifndef XEN
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux/Makefile
--- a/xen/arch/ia64/linux/Makefile	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux/Makefile	Tue Nov 15 14:47:41 2011 +0100
@@ -9,7 +9,6 @@
 obj-y += extable.o
 obj-y += flush.o
 obj-y += hpsim.o
-obj-y += irq_lsapic.o
 obj-y += linuxextable.o
 obj-y += machvec.o
 obj-y += memcpy_mck.o
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux/README.origin
--- a/xen/arch/ia64/linux/README.origin	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/linux/README.origin	Tue Nov 15 14:47:41 2011 +0100
@@ -7,7 +7,6 @@
 efi_stub.S		-> linux/arch/ia64/kernel/efi_stub.S
 extable.c		-> linux/arch/ia64/mm/extable.c
 hpsim.S			-> linux/arch/ia64/hp/sim/hpsim.S
-irq_lsapic.c		-> linux/arch/ia64/kernel/irq_lsapic.c
 linuxextable.c		-> linux/kernel/extable.c
 machvec.c		-> linux/arch/ia64/kernel/machvec.c
 numa.c			-> linux/arch/ia64/mm/numa.c
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/linux/irq_lsapic.c
--- a/xen/arch/ia64/linux/irq_lsapic.c	Tue Nov 15 14:24:38 2011 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * LSAPIC Interrupt Controller
- *
- * This takes care of interrupts that are generated by the CPU's
- * internal Streamlined Advanced Programmable Interrupt Controller
- * (LSAPIC), such as the ITC and IPI interrupts.
-    *
- * Copyright (C) 1999 VA Linux Systems
- * Copyright (C) 1999 Walt Drummond <drummond@valinux.com>
- * Copyright (C) 2000 Hewlett-Packard Co
- * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com>
- */
-
-#include <linux/sched.h>
-#include <linux/irq.h>
-
-static unsigned int
-lsapic_noop_startup (unsigned int irq)
-{
-	return 0;
-}
-
-static void
-lsapic_noop (unsigned int irq)
-{
-	/* nuthing to do... */
-}
-
-hw_irq_controller irq_type_ia64_lsapic = {
-	.typename =	"LSAPIC",
-	.startup =	lsapic_noop_startup,
-	.shutdown =	lsapic_noop,
-	.enable =	lsapic_noop,
-	.disable =	lsapic_noop,
-	.ack =		lsapic_noop,
-	.end =		lsapic_noop
-};
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c	Tue Nov 15 14:47:41 2011 +0100
@@ -17,6 +17,7 @@
 #include <asm/pdb.h>
 #include <xen/trace.h>
 #include <xen/console.h>
+#include <xen/grant_table.h>
 #include <xen/guest_access.h>
 #include <xen/pci.h>
 #include <asm/vmx.h>
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/domain.c	Tue Nov 15 14:47:41 2011 +0100
@@ -23,6 +23,7 @@
 #include <xen/delay.h>
 #include <xen/softirq.h>
 #include <xen/mm.h>
+#include <xen/grant_table.h>
 #include <xen/iocap.h>
 #include <asm/asm-xsi-offsets.h>
 #include <asm/system.h>
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/fw_emul.c
--- a/xen/arch/ia64/xen/fw_emul.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/fw_emul.c	Tue Nov 15 14:47:41 2011 +0100
@@ -31,7 +31,7 @@
 #include <asm/vcpu.h>
 #include <asm/vmx_vcpu.h>
 #include <asm/dom_fw.h>
-#include <asm/uaccess.h>
+#include <xen/guest_access.h>
 #include <xen/console.h>
 #include <xen/hypercall.h>
 #include <xen/softirq.h>
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/hypercall.c
--- a/xen/arch/ia64/xen/hypercall.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/hypercall.c	Tue Nov 15 14:47:41 2011 +0100
@@ -70,7 +70,8 @@
 		evtchn_unmask(pirq_to_evtchn(d, pirq));
 		spin_unlock(&d->event_lock);
 	}
-	return pirq_guest_eoi(pirq);
+	pirq_guest_eoi(pirq_info(d, pirq));
+	return 0;
 }
 
 long do_pirq_guest_eoi(int pirq)
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/irq.c
--- a/xen/arch/ia64/xen/irq.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/irq.c	Tue Nov 15 14:47:41 2011 +0100
@@ -95,8 +95,11 @@
 		struct irq_desc *desc = irq_to_desc(irq);
 
 		desc->irq = irq;
-		init_one_irq_desc(desc);
+		if (init_one_irq_desc(desc))
+			BUG();
 	}
+
+	return 0;
 }
 
 void __do_IRQ_guest(int irq);
@@ -105,14 +108,14 @@
  * Special irq handlers.
  */
 
-static void ack_none(unsigned int irq)
+static void ack_none(struct irq_desc *desc)
 {
 /*
  * 'what should we do if we get a hw irq event on an illegal vector'.
  * each architecture has to answer this themselves, it doesn't deserve
  * a generic callback i think.
  */
-	printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", irq, smp_processor_id());
+	printk(KERN_ERR "Unexpected irq vector 0x%x on CPU %u!\n", desc->irq, smp_processor_id());
 }
 
 hw_irq_controller no_irq_type = {
@@ -147,11 +150,11 @@
 		/*
 		 * No locking required for CPU-local interrupts:
 		 */
-		desc->handler->ack(irq);
+		desc->handler->ack(desc);
 		local_irq_enable();
 		desc->action->handler(irq, desc->action->dev_id, regs);
 		local_irq_disable();
-		desc->handler->end(irq);
+		desc->handler->end(desc);
 		return 1;
 	}
 
@@ -163,7 +166,7 @@
 		return 1;
 	}
 
-	desc->handler->ack(irq);
+	desc->handler->ack(desc);
 	status = desc->status & ~IRQ_REPLAY;
 	status |= IRQ_PENDING; /* we _want_ to handle it */
 
@@ -215,7 +218,7 @@
 	 * The ->end() handler has to deal with interrupts which got
 	 * disabled while the handler was running.
 	 */
-	desc->handler->end(irq);
+	desc->handler->end(desc);
 	spin_unlock(&desc->lock);
 
 	return 1;
@@ -248,10 +251,10 @@
 
 	*p = new;
 
-	desc->depth = 0;
+	desc->arch.depth = 0;
 	desc->status &= ~(IRQ_DISABLED | IRQ_INPROGRESS | IRQ_GUEST);
-	desc->handler->startup(vector);
-	desc->handler->enable(vector);
+	desc->handler->startup(desc);
+	desc->handler->enable(desc);
 	desc->arch.vector = vector;
 	spin_unlock_irqrestore(&desc->lock,flags);
 
@@ -287,9 +290,9 @@
 	spin_lock_irqsave(&desc->lock, flags);
 	clear_bit(vec, ia64_xen_vector);
 	desc->action = NULL;
-	desc->depth = 1;
+	desc->arch.depth = 1;
 	desc->status |= IRQ_DISABLED;
-	desc->handler->shutdown(vec);
+	desc->handler->shutdown(desc);
 	desc->arch.vector = -1;
 	spin_unlock_irqrestore(&desc->lock, flags);
 
@@ -336,7 +339,7 @@
         clear_pirq_eoi(action->guest[i], vector);
 
     desc->status &= ~(IRQ_INPROGRESS|IRQ_GUEST_EOI_PENDING);
-    desc->handler->enable(vector);
+    desc->handler->enable(desc);
 }
 
 static struct timer irq_guest_eoi_timer[NR_IRQS];
@@ -383,7 +386,7 @@
 	if ( already_pending == action->nr_guests )
 	{
 		stop_timer(&irq_guest_eoi_timer[irq]);
-		desc->handler->disable(irq);
+		desc->handler->disable(desc);
         desc->status |= IRQ_GUEST_EOI_PENDING;
         for ( i = 0; i < already_pending; ++i )
         {
@@ -417,31 +420,28 @@
     return ACKTYPE_NONE;
 }
 
-int pirq_guest_eoi(struct pirq *pirq)
+void pirq_guest_eoi(struct pirq *pirq)
 {
     irq_desc_t *desc;
     irq_guest_action_t *action;
 
-    desc = &irq_desc[irq];
+    desc = &irq_desc[pirq->pirq];
     spin_lock_irq(&desc->lock);
     action = (irq_guest_action_t *)desc->action;
 
     if ( action->ack_type == ACKTYPE_NONE )
     {
         ASSERT(!pirq->masked);
-        stop_timer(&irq_guest_eoi_timer[irq]);
+        stop_timer(&irq_guest_eoi_timer[pirq->pirq]);
         _irq_guest_eoi(desc);
     }
 
     if ( test_and_clear_bool(pirq->masked) && (--action->in_flight == 0) )
     {
         ASSERT(action->ack_type == ACKTYPE_UNMASK);
-        desc->handler->end(irq);
+        desc->handler->end(desc);
     }
     spin_unlock_irq(&desc->lock);
-
-    return 0;
-
 }
 
 int pirq_guest_unmask(struct domain *d)
@@ -505,12 +505,12 @@
         action->nr_guests = 0;
         action->in_flight = 0;
         action->shareable = will_share;
-        action->ack_type  = pirq_acktype(irq);
+        action->ack_type  = pirq_acktype(pirq->pirq);
         
-        desc->depth = 0;
+        desc->arch.depth = 0;
         desc->status |= IRQ_GUEST;
         desc->status &= ~IRQ_DISABLED;
-        desc->handler->startup(pirq->pirq);
+        desc->handler->startup(desc);
 
         /* Attempt to bind the interrupt target to the correct CPU. */
 #if 0 /* FIXME CONFIG_SMP ??? */
@@ -549,9 +549,9 @@
     return rc;
 }
 
-void pirq_guest_unbind(struct domain *d, int irq, struct pirq *pirq)
+void pirq_guest_unbind(struct domain *d, struct pirq *pirq)
 {
-    irq_desc_t         *desc = &irq_desc[irq];
+    irq_desc_t         *desc = &irq_desc[pirq->pirq];
     irq_guest_action_t *action;
     unsigned long       flags;
     int                 i;
@@ -569,17 +569,17 @@
     if ( action->ack_type == ACKTYPE_UNMASK )
         if ( test_and_clear_bool(pirq->masked) &&
              (--action->in_flight == 0) )
-            desc->handler->end(irq);
+            desc->handler->end(desc);
 
     if ( !action->nr_guests )
     {
         BUG_ON(action->in_flight != 0);
         desc->action = NULL;
         xfree(action);
-        desc->depth   = 1;
+        desc->arch.depth   = 1;
         desc->status |= IRQ_DISABLED;
         desc->status &= ~IRQ_GUEST;
-        desc->handler->shutdown(irq);
+        desc->handler->shutdown(desc);
     }
 
     spin_unlock_irqrestore(&desc->lock, flags);    
@@ -610,10 +610,24 @@
 	/* FIXME */
 }
 
+void (pirq_cleanup_check)(struct pirq *pirq, struct domain *d)
+{
+    /*
+     * Check whether all fields have their default values, and delete
+     * the entry from the tree if so.
+     *
+     * NB: Common parts were already checked.
+     */
+    if ( !pt_pirq_cleanup_check(&pirq->arch.dpci) )
+        return;
+
+    if ( radix_tree_delete(&d->pirq_tree, pirq->pirq) != pirq )
+        BUG();
+}
 /*
  * Exit an interrupt context. Process softirqs if needed and possible:
  */
 void irq_exit(void)
 {
-	sub_preempt_count(IRQ_EXIT_OFFSET);
+	preempt_count() -= IRQ_EXIT_OFFSET;/* sub_preempt_count(IRQ_EXIT_OFFSET); */
 }
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/mm.c
--- a/xen/arch/ia64/xen/mm.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/mm.c	Tue Nov 15 14:47:41 2011 +0100
@@ -176,6 +176,7 @@
 #include <asm/tlb_track.h>
 #include <linux/efi.h>
 #include <linux/sort.h>
+#include <xen/grant_table.h>
 #include <xen/guest_access.h>
 #include <asm/page.h>
 #include <asm/dom_fw_common.h>
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/pci.c
--- a/xen/arch/ia64/xen/pci.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/pci.c	Tue Nov 15 14:47:41 2011 +0100
@@ -83,54 +83,57 @@
 
 
 uint8_t pci_conf_read8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     uint32_t value;
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_read(0, bus, (dev<<3)|func, reg, 1, &value);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_read(seg, bus, (dev<<3)|func, reg, 1, &value);
     return (uint8_t)value;
 }
 
 uint16_t pci_conf_read16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     uint32_t value;
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_read(0, bus, (dev<<3)|func, reg, 2, &value);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_read(seg, bus, (dev<<3)|func, reg, 2, &value);
     return (uint16_t)value;
 }
 
 uint32_t pci_conf_read32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg)
 {
     uint32_t value;
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_read(0, bus, (dev<<3)|func, reg, 4, &value);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_read(seg, bus, (dev<<3)|func, reg, 4, &value);
     return (uint32_t)value;
 }
 
 void pci_conf_write8(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint8_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint8_t data)
 {
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_write(0, bus, (dev<<3)|func, reg, 1, data);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_write(seg, bus, (dev<<3)|func, reg, 1, data);
 }
 
 void pci_conf_write16(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint16_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint16_t data)
 {
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_write(0, bus, (dev<<3)|func, reg, 2, data);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_write(seg, bus, (dev<<3)|func, reg, 2, data);
 }
 
 void pci_conf_write32(
-    unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
-    uint32_t data)
+    unsigned int seg, unsigned int bus, unsigned int dev, unsigned int func,
+    unsigned int reg, uint32_t data)
 {
-    BUG_ON((bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
-    pci_sal_write(0, bus, (dev<<3)|func, reg, 4, data);
+    BUG_ON((seg > 65535) || (bus > 255) || (dev > 31) || (func > 7) || (reg > 255));
+    pci_sal_write(seg, bus, (dev<<3)|func, reg, 4, data);
 }
 
 int pci_find_ext_capability(int seg, int bus, int devfn, int cap)
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/tlb_track.c
--- a/xen/arch/ia64/xen/tlb_track.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/tlb_track.c	Tue Nov 15 14:47:41 2011 +0100
@@ -22,6 +22,7 @@
 
 #include <asm/tlb_track.h>
 #include <asm/p2m_entry.h>
+#include <xen/grant_table.h>
 #include <asm/vmx_mm_def.h>  /* for IA64_RR_SHIFT */
 #include <asm/vmx_vcpu.h>    /* for VRN7 */
 #include <asm/vcpu.h>        /* for PSCB() */
diff -r cd3ef25f207a -r 967845cb565b xen/arch/ia64/xen/vhpt.c
--- a/xen/arch/ia64/xen/vhpt.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/ia64/xen/vhpt.c	Tue Nov 15 14:47:41 2011 +0100
@@ -516,7 +516,7 @@
 		on_each_cpu((void (*)(void *))local_flush_tlb_all, NULL, 1);
 	else
 		on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1);
-	cpumask_clear_cpu(d->domain_dirty_cpumask);
+	cpumask_clear(d->domain_dirty_cpumask);
 }
 
 void flush_tlb_for_log_dirty(struct domain *d)
@@ -545,7 +545,7 @@
 	} else {
 		on_each_cpu((void (*)(void *))flush_tlb_vhpt_all, d, 1);
 	}
-	cpumask_clear_cpu(d->domain_dirty_cpumask);
+	cpumask_clear(d->domain_dirty_cpumask);
 }
 
 void flush_tlb_mask(const cpumask_t *mask)
diff -r cd3ef25f207a -r 967845cb565b xen/arch/x86/domctl.c
--- a/xen/arch/x86/domctl.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/arch/x86/domctl.c	Tue Nov 15 14:47:41 2011 +0100
@@ -27,7 +27,7 @@
 #include <asm/hvm/cacheattr.h>
 #include <asm/processor.h>
 #include <asm/acpi.h> /* for hvm_acpi_power_button */
-#include <asm/hypercall.h> /* for arch_do_domctl */
+#include <xen/hypercall.h> /* for arch_do_domctl */
 #include <xsm/xsm.h>
 #include <xen/iommu.h>
 #include <asm/mem_event.h>
diff -r cd3ef25f207a -r 967845cb565b xen/common/event_channel.c
--- a/xen/common/event_channel.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/common/event_channel.c	Tue Nov 15 14:47:41 2011 +0100
@@ -365,8 +365,10 @@
 
     bind->port = port;
 
+#ifdef CONFIG_X86
     if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
         map_domain_emuirq_pirq(d, pirq, IRQ_PT);
+#endif
 
  out:
     spin_unlock(&d->event_lock);
@@ -421,8 +423,10 @@
         pirq->evtchn = 0;
         pirq_cleanup_check(pirq, d1);
         unlink_pirq_port(chn1, d1->vcpu[chn1->notify_vcpu_id]);
+#ifdef CONFIG_X86
         if ( is_hvm_domain(d1) && domain_pirq_to_irq(d1, pirq->pirq) > 0 )
             unmap_domain_pirq_emuirq(d1, pirq->pirq);
+#endif
         break;
     }
 
diff -r cd3ef25f207a -r 967845cb565b xen/common/page_alloc.c
--- a/xen/common/page_alloc.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/common/page_alloc.c	Tue Nov 15 14:47:41 2011 +0100
@@ -42,7 +42,12 @@
 #include <asm/page.h>
 #include <asm/numa.h>
 #include <asm/flushtlb.h>
+#ifdef CONFIG_X86
 #include <asm/p2m.h>
+#else
+#define p2m_pod_offline_or_broken_hit(pg) 0
+#define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)
+#endif
 
 /*
  * Comma-separated list of hexadecimal page numbers containing bad bytes.
diff -r cd3ef25f207a -r 967845cb565b xen/drivers/passthrough/vtd/dmar.c
--- a/xen/drivers/passthrough/vtd/dmar.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/dmar.c	Tue Nov 15 14:47:41 2011 +0100
@@ -809,6 +809,7 @@
     return ((dmar_flags & flags) == DMAR_INTR_REMAP);
 }
 
+#ifdef CONFIG_X86
 int platform_supports_x2apic(void)
 {
     unsigned int flags = 0;
@@ -819,3 +820,4 @@
     flags = DMAR_INTR_REMAP | DMAR_X2APIC_OPT_OUT;
     return ((dmar_flags & flags) == DMAR_INTR_REMAP);
 }
+#endif
diff -r cd3ef25f207a -r 967845cb565b xen/drivers/passthrough/vtd/intremap.c
--- a/xen/drivers/passthrough/vtd/intremap.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/intremap.c	Tue Nov 15 14:47:41 2011 +0100
@@ -47,8 +47,8 @@
 })
 #define __ioapic_write_entry(apic, pin, raw, ent) ({ \
     ASSERT(raw); \
-    __io_apic_write(apic, 0x10 + 2 * (pin), ((u32 *)&_e_)[0]); \
-    __io_apic_write(apic, 0x11 + 2 * (pin), ((u32 *)&_e_)[1]); \
+    __io_apic_write(apic, 0x10 + 2 * (pin), ((u32 *)&(ent))[0]); \
+    __io_apic_write(apic, 0x11 + 2 * (pin), ((u32 *)&(ent))[1]); \
 })
 #else
 #include <asm/apic.h>
@@ -392,7 +392,7 @@
         ( (index = apic_pin_2_ir_idx[apic][ioapic_pin]) < 0 ) )
         return __io_apic_read(apic, reg);
 
-    old_rte = __ioapic_read_entry(apic, ioapic_pin, TRUE);
+    old_rte = __ioapic_read_entry(apic, ioapic_pin, 1);
 
     if ( remap_entry_to_ioapic_rte(iommu, index, &old_rte) )
         return __io_apic_read(apic, reg);
@@ -420,7 +420,7 @@
         return;
     }
 
-    old_rte = __ioapic_read_entry(apic, ioapic_pin, TRUE);
+    old_rte = __ioapic_read_entry(apic, ioapic_pin, 1);
 
     remap_rte = (struct IO_APIC_route_remap_entry *) &old_rte;
 
@@ -440,7 +440,7 @@
             __io_apic_write(apic, reg & ~1, *(u32 *)&old_rte);
     }
     else
-        __ioapic_write_entry(apic, ioapic_pin, TRUE, old_rte);
+        __ioapic_write_entry(apic, ioapic_pin, 1, old_rte);
 }
 
 #if defined(__i386__) || defined(__x86_64__)
@@ -838,6 +838,8 @@
     spin_unlock_irqrestore(&iommu->register_lock, flags);
 }
 
+#ifndef __ia64__
+
 /*
  * This function is used to enable Interrupt remapping when
  * enable x2apic
@@ -912,3 +914,5 @@
     for_each_drhd_unit ( drhd )
         disable_qinval(drhd->iommu);
 }
+
+#endif /* !__ia64__ */
diff -r cd3ef25f207a -r 967845cb565b xen/drivers/passthrough/vtd/iommu.c
--- a/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/drivers/passthrough/vtd/iommu.c	Tue Nov 15 14:47:41 2011 +0100
@@ -33,9 +33,11 @@
 #include <xen/keyhandler.h>
 #include <asm/msi.h>
 #include <asm/irq.h>
+#ifndef __ia64__
 #include <asm/hvm/vmx/vmx.h>
 #include <asm/p2m.h>
 #include <mach_apic.h>
+#endif
 #include "iommu.h"
 #include "dmar.h"
 #include "extern.h"
@@ -990,7 +992,11 @@
     return 0;
 }
 
+#ifndef __ia64__
 static void dma_msi_end(struct irq_desc *desc, u8 vector)
+#else
+static void dma_msi_end(struct irq_desc *desc)
+#endif
 {
     dma_msi_unmask(desc);
     ack_APIC_irq();
@@ -1790,6 +1796,7 @@
 
 static int vtd_ept_page_compatible(struct iommu *iommu)
 {
+#ifndef __ia64__
     u64 ept_cap, vtd_cap = iommu->cap;
 
     /* EPT is not initialised yet, so we must check the capability in
@@ -1799,6 +1806,9 @@
 
     return ( ept_has_2mb(ept_cap) == cap_sps_2mb(vtd_cap) 
              && ept_has_1gb(ept_cap) == cap_sps_1gb(vtd_cap) );
+#else
+    return 0;
+#endif
 }
 
 /*
@@ -1806,6 +1816,7 @@
  */
 void iommu_set_pgd(struct domain *d)
 {
+#ifndef __ia64__
     struct hvm_iommu *hd  = domain_hvm_iommu(d);
     mfn_t pgd_mfn;
 
@@ -1816,6 +1827,7 @@
 
     pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d)));
     hd->pgd_maddr = pagetable_get_paddr(pagetable_from_mfn(pgd_mfn));
+#endif
 }
 
 static int rmrr_identity_mapping(struct domain *d,
@@ -2107,7 +2119,7 @@
             iommu_intremap = 0;
 
         if ( !vtd_ept_page_compatible(iommu) )
-            iommu_hap_pt_share = FALSE;
+            iommu_hap_pt_share = 0;
 
         ret = iommu_set_interrupt(iommu);
         if ( ret < 0 )
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/config.h
--- a/xen/include/asm-ia64/config.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/config.h	Tue Nov 15 14:47:41 2011 +0100
@@ -211,10 +211,6 @@
 // see common/keyhandler.c
 #define	nop()	asm volatile ("nop 0")
 
-// from include/linux/preempt.h (needs including from interrupt.h or smp.h)
-#define preempt_enable()	do { } while (0)
-#define preempt_disable()	do { } while (0)
-
 // needed for include/xen/linuxtime.h
 typedef s64 time_t;
 typedef s64 suseconds_t;
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/domain.h
--- a/xen/include/asm-ia64/domain.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/domain.h	Tue Nov 15 14:47:41 2011 +0100
@@ -317,12 +317,8 @@
     cpumask_t cache_coherent_map;
 };
 
-struct arch_pirq {
-    struct hvm_pirq_dpci dpci;
-};
-
 #define pirq_dpci(pirq) ((pirq) ? &(pirq)->arch.dpci : NULL)
-#define dpci_pirq(dpci) container_of(dpci, struct pirq, arch.dpci)
+#define dpci_pirq(dp) container_of(dp, struct pirq, arch.dpci)
 
 #define alloc_pirq_struct(d) ({ \
     struct pirq *pirq = xmalloc(struct pirq); \
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/hvm/irq.h
--- a/xen/include/asm-ia64/hvm/irq.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/hvm/irq.h	Tue Nov 15 14:47:41 2011 +0100
@@ -22,7 +22,7 @@
 #ifndef __ASM_IA64_HVM_IRQ_H__
 #define __ASM_IA64_HVM_IRQ_H__
 
-#include <xen/irq.h>
+#include <asm/irq.h>
 
 #define VIOAPIC_NUM_PINS  48
 
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/linux-xen/asm/hw_irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/hw_irq.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/hw_irq.h	Tue Nov 15 14:47:41 2011 +0100
@@ -79,8 +79,6 @@
 extern __u8 isa_irq_to_vector_map[16];
 #define isa_irq_to_vector(x)	isa_irq_to_vector_map[(x)]
 
-extern hw_irq_controller irq_type_ia64_lsapic;	/* CPU-internal interrupt controller */
-
 extern int assign_irq_vector (int irq);	/* allocate a free vector */
 extern void free_irq_vector (int vector);
 extern void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect);
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/linux-xen/asm/irq.h
--- a/xen/include/asm-ia64/linux-xen/asm/irq.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/irq.h	Tue Nov 15 14:47:41 2011 +0100
@@ -15,11 +15,18 @@
 #define NR_IRQS		256
 
 #ifdef XEN
+#include <xen/hvm/irq.h>
+
 struct arch_irq_desc {
         int  vector;
+	unsigned int depth;
         cpumask_var_t cpu_mask;
 };
 
+struct arch_pirq {
+	struct hvm_pirq_dpci dpci;
+};
+
 int init_irq_data(void);
 #endif
 
@@ -66,6 +73,8 @@
     while(!x)
 
 #define domain_pirq_to_irq(d, irq) domain_irq_to_vector(d, irq)
+
+#define hvm_domain_use_pirq(d, info) 0
 #endif
 
 #endif /* _ASM_IA64_IRQ_H */
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/linux-xen/asm/spinlock.h
--- a/xen/include/asm-ia64/linux-xen/asm/spinlock.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/asm/spinlock.h	Tue Nov 15 14:47:41 2011 +0100
@@ -35,6 +35,17 @@
 } raw_rwlock_t;
 #define _RAW_RW_LOCK_UNLOCKED /*(raw_rwlock_t)*/ { 0, 0 }
 
+#define _raw_read_lock(rw)								\
+do {											\
+	raw_rwlock_t *__read_lock_ptr = (rw);						\
+											\
+	while (unlikely(ia64_fetchadd(1, (int *) __read_lock_ptr, acq) < 0)) {		\
+		ia64_fetchadd(-1, (int *) __read_lock_ptr, rel);			\
+		while (*(volatile int *)__read_lock_ptr < 0)				\
+			cpu_relax();							\
+	}										\
+} while (0)
+
 #define _raw_read_unlock(rw)					\
 do {								\
 	raw_rwlock_t *__read_lock_ptr = (rw);			\
@@ -68,7 +79,14 @@
 
 #endif /* !ASM_SUPPORTED */
 
-#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+#define _raw_read_trylock(rw) ({					\
+	raw_rwlock_t *__read_lock_ptr = (rw);				\
+	int orig = ia64_fetchadd(1, (int *) __read_lock_ptr, acq);	\
+									\
+	if (unlikely(orig < 0))						\
+		ia64_fetchadd(-1, (int *) __read_lock_ptr, rel);	\
+	(orig >= 0);							\
+})
 
 #define _raw_write_unlock(x)								\
 ({											\
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/linux-xen/linux/hardirq.h
--- a/xen/include/asm-ia64/linux-xen/linux/hardirq.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/linux-xen/linux/hardirq.h	Tue Nov 15 14:47:41 2011 +0100
@@ -107,7 +107,8 @@
 #define irq_enter()					\
 	do {						\
 		account_system_vtime(current);		\
-		add_preempt_count(HARDIRQ_OFFSET);	\
+		/*add_preempt_count(HARDIRQ_OFFSET);*/	\
+		preempt_count() += HARDIRQ_OFFSET;	\
 	} while (0)
 
 extern void irq_exit(void);
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-ia64/xenoprof.h
--- a/xen/include/asm-ia64/xenoprof.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-ia64/xenoprof.h	Tue Nov 15 14:47:41 2011 +0100
@@ -24,6 +24,8 @@
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
 
+#include <xen/grant_table.h>
+
 int xenoprof_arch_init(int *num_events, char *cpu_type);
 int xenoprof_arch_reserve_counters(void);
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
diff -r cd3ef25f207a -r 967845cb565b xen/include/asm-x86/hypercall.h
--- a/xen/include/asm-x86/hypercall.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/asm-x86/hypercall.h	Tue Nov 15 14:47:41 2011 +0100
@@ -7,7 +7,6 @@
 
 #include <public/physdev.h>
 #include <public/arch-x86/xen-mca.h> /* for do_mca */
-#include <public/domctl.h> /* for arch_do_domctl */
 #include <xen/types.h>
 
 /*
@@ -97,11 +96,6 @@
     int cmd, struct vcpu *v, XEN_GUEST_HANDLE(void) arg);
 
 extern long
-arch_do_domctl(
-    struct xen_domctl *domctl,
-    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
-
-extern long
 arch_do_sysctl(
     struct xen_sysctl *op, 
     XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/acpi.h
--- a/xen/include/xen/acpi.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/acpi.h	Tue Nov 15 14:47:41 2011 +0100
@@ -360,7 +360,9 @@
 static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
 #endif
 
+#ifdef XEN_GUEST_HANDLE
 int acpi_set_pdc_bits(u32 acpi_id, XEN_GUEST_HANDLE(uint32));
+#endif
 int arch_acpi_set_pdc_bits(u32 acpi_id, u32 *, u32 mask);
 
 #ifdef CONFIG_ACPI_NUMA
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/efi.h
--- a/xen/include/xen/efi.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/efi.h	Tue Nov 15 14:47:41 2011 +0100
@@ -1,10 +1,12 @@
 #ifndef __XEN_EFI_H__
 #define __XEN_EFI_H__
 
+#ifndef __ASSEMBLY__
 #include <xen/types.h>
+#endif
 
 #if defined(__ia64__)
-# #include <linux/efi.h>
+# include_next <linux/efi.h>
 #else
 
 # if defined(__i386__)
@@ -27,6 +29,8 @@
 
 #endif
 
+#ifndef __ASSEMBLY__
+
 union xenpf_efi_info;
 union compat_pf_efi_info;
 
@@ -44,4 +48,6 @@
 int efi_compat_get_info(uint32_t idx, union compat_pf_efi_info *);
 int efi_compat_runtime_call(struct compat_pf_efi_runtime_call *);
 
+#endif /* !__ASSEMBLY__ */
+
 #endif /* __XEN_EFI_H__ */
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/hypercall.h
--- a/xen/include/xen/hypercall.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/hypercall.h	Tue Nov 15 14:47:41 2011 +0100
@@ -36,6 +36,11 @@
     XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
 
 extern long
+arch_do_domctl(
+    struct xen_domctl *domctl,
+    XEN_GUEST_HANDLE(xen_domctl_t) u_domctl);
+
+extern long
 do_sysctl(
     XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl);
 
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/iommu.h
--- a/xen/include/xen/iommu.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/iommu.h	Tue Nov 15 14:47:41 2011 +0100
@@ -35,7 +35,11 @@
 extern bool_t amd_iommu_perdev_intremap;
 
 /* Does this domain have a P2M table we can use as its IOMMU pagetable? */
+#ifndef __ia64__
 #define iommu_use_hap_pt(d) (hap_enabled(d) && iommu_hap_pt_share)
+#else
+#define iommu_use_hap_pt(d) 0
+#endif
 
 extern struct rangeset *mmio_ro_ranges;
 
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/irq.h
--- a/xen/include/xen/irq.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/irq.h	Tue Nov 15 14:47:41 2011 +0100
@@ -27,6 +27,7 @@
 #define IRQ_GUEST         (1u<<4) /* IRQ is handled by guest OS(es) */
 #define IRQ_MOVE_PENDING  (1u<<5) /* IRQ is migrating to another CPUs */
 #define IRQ_PER_CPU       (1u<<6) /* IRQ is per CPU */
+#define IRQ_GUEST_EOI_PENDING (1u<<7) /* IRQ was disabled, pending a guest EOI */
 
 /* Special IRQ numbers. */
 #define AUTO_ASSIGN_IRQ         (-1)
@@ -46,7 +47,11 @@
     void (*enable)(struct irq_desc *);
     void (*disable)(struct irq_desc *);
     void (*ack)(struct irq_desc *);
+#ifdef CONFIG_X86
     void (*end)(struct irq_desc *, u8 vector);
+#else
+    void (*end)(struct irq_desc *);
+#endif
     void (*set_affinity)(struct irq_desc *, const cpumask_t *);
 };
 
diff -r cd3ef25f207a -r 967845cb565b xen/include/xen/pci.h
--- a/xen/include/xen/pci.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xen/pci.h	Tue Nov 15 14:47:41 2011 +0100
@@ -39,7 +39,9 @@
         u8 bus;
         u8 devfn;
     } physfn;
-   vmask_t used_vectors; 
+#ifdef CONFIG_X86
+    vmask_t used_vectors;
+#endif
 };
 
 struct pci_dev {
diff -r cd3ef25f207a -r 967845cb565b xen/include/xsm/xsm.h
--- a/xen/include/xsm/xsm.h	Tue Nov 15 14:24:38 2011 +0100
+++ b/xen/include/xsm/xsm.h	Tue Nov 15 14:47:41 2011 +0100
@@ -109,6 +109,10 @@
     int (*add_range) (struct domain *d, char *name, unsigned long s, unsigned long e);
     int (*remove_range) (struct domain *d, char *name, unsigned long s, unsigned long e);
 
+    int (*test_assign_device) (uint32_t machine_bdf);
+    int (*assign_device) (struct domain *d, uint32_t machine_bdf);
+    int (*deassign_device) (struct domain *d, uint32_t machine_bdf);
+
     long (*__do_xsm_op) (XEN_GUEST_HANDLE(xsm_op_t) op);
 
 #ifdef CONFIG_X86
@@ -146,9 +150,6 @@
 			      struct page_info *page);
     int (*add_to_physmap) (struct domain *d1, struct domain *d2);
     int (*sendtrigger) (struct domain *d);
-    int (*test_assign_device) (uint32_t machine_bdf);
-    int (*assign_device) (struct domain *d, uint32_t machine_bdf);
-    int (*deassign_device) (struct domain *d, uint32_t machine_bdf);
     int (*bind_pt_irq) (struct domain *d, struct xen_domctl_bind_pt_irq *bind);
     int (*pin_mem_cacheattr) (struct domain *d);
     int (*ext_vcpucontext) (struct domain *d, uint32_t cmd);
@@ -428,6 +429,21 @@
     return xsm_call(remove_range(d, name, s, e));
 }
 
+static inline int xsm_test_assign_device(uint32_t machine_bdf)
+{
+    return xsm_call(test_assign_device(machine_bdf));
+}
+
+static inline int xsm_assign_device(struct domain *d, uint32_t machine_bdf)
+{
+    return xsm_call(assign_device(d, machine_bdf));
+}
+
+static inline int xsm_deassign_device(struct domain *d, uint32_t machine_bdf)
+{
+    return xsm_call(deassign_device(d, machine_bdf));
+}
+
 static inline long __do_xsm_op (XEN_GUEST_HANDLE(xsm_op_t) op)
 {
 #ifdef XSM_ENABLE
@@ -612,21 +628,6 @@
     return xsm_call(sendtrigger(d));
 }
 
-static inline int xsm_test_assign_device(uint32_t machine_bdf)
-{
-    return xsm_call(test_assign_device(machine_bdf));
-}
-
-static inline int xsm_assign_device(struct domain *d, uint32_t machine_bdf)
-{
-    return xsm_call(assign_device(d, machine_bdf));
-}
-
-static inline int xsm_deassign_device(struct domain *d, uint32_t machine_bdf)
-{
-    return xsm_call(deassign_device(d, machine_bdf));
-}
-
 static inline int xsm_bind_pt_irq(struct domain *d, 
                                                 struct xen_domctl_bind_pt_irq *bind)
 {

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:33:46 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:33:46 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpvG-00016z-Jy; Wed, 16 Nov 2011 16:33:46 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvA-00015y-VF
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:41 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-8.tower-216.messagelabs.com!1321490016!3849263!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 3939 invoked from network); 17 Nov 2011 00:33:37 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-8.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:37 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpv3-0004LQ-8V
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:34 +0000
Message-Id: <E1RQpv3-0004LQ-8V@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:29 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] hvm: introduce
	HVM_PARAM_BUFIOREQ_EVTCHN
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@eu.citrix.com>
# Date 1321456657 0
# Node ID a5f1d3b1612bb48e1cb09dc66b0909e3613dc855
# Parent  fd3567cafe1c7ccd0ddba0ad7fb067d435e13529
hvm: introduce HVM_PARAM_BUFIOREQ_EVTCHN

Introduce an event channel for buffered io event notifications,
advertise the port number using an hvm param.  This way the device
model is not forced to check the buffered io page for data several
times a second for the entire life of the VM (buffered io is mostly
used for stdvga emulation in Xen that is switched off after the guest
goes into graphical mode).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r fd3567cafe1c -r a5f1d3b1612b xen/arch/x86/hvm/hvm.c
--- a/xen/arch/x86/hvm/hvm.c	Tue Nov 15 14:50:18 2011 +0100
+++ b/xen/arch/x86/hvm/hvm.c	Wed Nov 16 15:17:37 2011 +0000
@@ -985,6 +985,16 @@
 
     /* Register ioreq event channel. */
     v->arch.hvm_vcpu.xen_port = rc;
+
+    if ( v->vcpu_id == 0 )
+    {
+        /* Create bufioreq event channel. */
+        rc = alloc_unbound_xen_event_channel(v, 0);
+        if ( rc < 0 )
+            goto fail2;
+        v->domain->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN] = rc;
+    }
+
     spin_lock(&v->domain->arch.hvm_domain.ioreq.lock);
     if ( v->domain->arch.hvm_domain.ioreq.va != NULL )
         get_ioreq(v)->vp_eport = v->arch.hvm_vcpu.xen_port;
@@ -3597,6 +3607,9 @@
                         if ( rc == 0 )
                             rc = nestedhvm_vcpu_initialise(v);
                 break;
+            case HVM_PARAM_BUFIOREQ_EVTCHN:
+                rc = -EINVAL;
+                break;
             }
 
             if ( rc == 0 ) 
diff -r fd3567cafe1c -r a5f1d3b1612b xen/arch/x86/hvm/io.c
--- a/xen/arch/x86/hvm/io.c	Tue Nov 15 14:50:18 2011 +0100
+++ b/xen/arch/x86/hvm/io.c	Wed Nov 16 15:17:37 2011 +0000
@@ -118,6 +118,8 @@
     wmb();
     pg->write_pointer += qw ? 2 : 1;
 
+    notify_via_xen_event_channel(v->domain,
+            v->domain->arch.hvm_domain.params[HVM_PARAM_BUFIOREQ_EVTCHN]);
     spin_unlock(&iorp->lock);
     
     return 1;
diff -r fd3567cafe1c -r a5f1d3b1612b xen/include/public/hvm/params.h
--- a/xen/include/public/hvm/params.h	Tue Nov 15 14:50:18 2011 +0100
+++ b/xen/include/public/hvm/params.h	Wed Nov 16 15:17:37 2011 +0000
@@ -52,6 +52,7 @@
 #define HVM_PARAM_IOREQ_PFN    5
 
 #define HVM_PARAM_BUFIOREQ_PFN 6
+#define HVM_PARAM_BUFIOREQ_EVTCHN 26
 
 #ifdef __ia64__
 
@@ -141,6 +142,6 @@
 /* Boolean: Enable nestedhvm (hvm only) */
 #define HVM_PARAM_NESTEDHVM    24
 
-#define HVM_NR_PARAMS          26
+#define HVM_NR_PARAMS          27
 
 #endif /* __XEN_PUBLIC_HVM_PARAMS_H__ */

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:03 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:03 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpvX-0001B6-7P; Wed, 16 Nov 2011 16:34:03 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvD-000164-Jg
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:44 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-216.messagelabs.com!1321490020!3858304!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 25343 invoked from network); 17 Nov 2011 00:33:40 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:40 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpv6-0004Mo-Ga
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:38 +0000
Message-Id: <E1RQpv6-0004Mo-Ga@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:34 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] [shadow] Disable higher level
	pagetables early unshadow only when the "process dying"
	hypercall is used.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Gianluca Guida <gianluca.guida@citrix.com>
# Date 1321456773 0
# Node ID 3ecc8fef428138e4304ef11b47498981e63626b3
# Parent  a5f1d3b1612bb48e1cb09dc66b0909e3613dc855
[shadow] Disable higher level pagetables early unshadow only when the "process dying" hypercall is used.

This patch fixes a performance problem in fully virtualized guests.

Signed-off-by: Gianluca Guida <gianluca.guida@citrix.com>
Tested-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r a5f1d3b1612b -r 3ecc8fef4281 xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c	Wed Nov 16 15:17:37 2011 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c	Wed Nov 16 15:19:33 2011 +0000
@@ -2728,8 +2728,9 @@
            || ( !v->domain->arch.paging.shadow.pagetable_dying_op
                 && v->arch.paging.shadow.last_emulated_mfn_for_unshadow == mfn_x(gmfn) ) )
          && sh_mfn_is_a_page_table(gmfn)
-         && !(mfn_to_page(gmfn)->shadow_flags
-              & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64)) )
+         && (!v->domain->arch.paging.shadow.pagetable_dying_op ||
+             !(mfn_to_page(gmfn)->shadow_flags
+               & (SHF_L2_32|SHF_L2_PAE|SHF_L2H_PAE|SHF_L4_64))) )
     {
         perfc_incr(shadow_early_unshadow);
         sh_remove_shadows(v, gmfn, 1, 0 /* Fast, can fail to unshadow */ );

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:10 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:10 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpve-0001EH-9q; Wed, 16 Nov 2011 16:34:10 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvG-00016M-BZ
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:46 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-216.messagelabs.com!1321490023!3787252!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 18755 invoked from network); 17 Nov 2011 00:33:43 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:43 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpvB-0004P0-Bb
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:41 +0000
Message-Id: <E1RQpvB-0004P0-Bb@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:40 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86-64/test_x86_emulate: fix
	blowfish test
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com
# Date 1321456825 0
# Node ID 753b21aa4087c207286f49e1dba0a74c48b5477b
# Parent  3ecc8fef428138e4304ef11b47498981e63626b3
x86-64/test_x86_emulate: fix blowfish test

Incorrect register usage in the _start() wrapper caused the 64-bit
execution emulation to fail.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 3ecc8fef4281 -r 753b21aa4087 tools/tests/x86_emulator/blowfish.c
--- a/tools/tests/x86_emulator/blowfish.c	Wed Nov 16 15:19:33 2011 +0000
+++ b/tools/tests/x86_emulator/blowfish.c	Wed Nov 16 15:20:25 2011 +0000
@@ -30,7 +30,7 @@
 #else
     "shlq $32,%rdx; movl %eax,%edi; orq %rdx,%rdi; "
     "call blowfish_test; "
-    "movq %rax,%rdi; movl %eax,%eax; shrq $32,%rdx; "
+    "movq %rax,%rdx; movl %eax,%eax; shrq $32,%rdx; "
 #endif
     "ret"
     );

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:19 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:19 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpvm-0001HY-U7; Wed, 16 Nov 2011 16:34:19 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvI-000177-H7
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:49 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-21.messagelabs.com!1321490025!4531058!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 2533 invoked from network); 17 Nov 2011 00:33:45 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:45 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpvD-0004Pn-Pe
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:44 +0000
Message-Id: <E1RQpvD-0004Pn-Pe@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:43 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] test_x86_emulate: Get public Xen
	headers via tools/include.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1321457335 0
# Node ID 6316cd1183f8752d72ea2f822bdd92b4a0137ff8
# Parent  753b21aa4087c207286f49e1dba0a74c48b5477b
test_x86_emulate: Get public Xen headers via tools/include.

Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 753b21aa4087 -r 6316cd1183f8 tools/tests/x86_emulator/Makefile
--- a/tools/tests/x86_emulator/Makefile	Wed Nov 16 15:20:25 2011 +0000
+++ b/tools/tests/x86_emulator/Makefile	Wed Nov 16 15:28:55 2011 +0000
@@ -37,8 +37,10 @@
 x86_emulate:
 	[ -L x86_emulate ] || ln -sf $(XEN_ROOT)/xen/arch/x86/x86_emulate .
 
+HOSTCFLAGS += $(CFLAGS_xeninclude)
+
 x86_emulate.o: x86_emulate.c x86_emulate
-	$(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
 
 test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate
-	$(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
diff -r 753b21aa4087 -r 6316cd1183f8 tools/tests/x86_emulator/test_x86_emulator.c
--- a/tools/tests/x86_emulator/test_x86_emulator.c	Wed Nov 16 15:20:25 2011 +0000
+++ b/tools/tests/x86_emulator/test_x86_emulator.c	Wed Nov 16 15:28:55 2011 +0000
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
-#include <public/xen.h>
+#include <xen/xen.h>
 #include <sys/mman.h>
 
 #include "x86_emulate/x86_emulate.h"
diff -r 753b21aa4087 -r 6316cd1183f8 tools/tests/x86_emulator/x86_emulate.c
--- a/tools/tests/x86_emulator/x86_emulate.c	Wed Nov 16 15:20:25 2011 +0000
+++ b/tools/tests/x86_emulator/x86_emulate.c	Wed Nov 16 15:28:55 2011 +0000
@@ -1,7 +1,7 @@
 #include <stddef.h>
 #include <stdint.h>
 #include <string.h>
-#include <public/xen.h>
+#include <xen/xen.h>
 
 #include "x86_emulate/x86_emulate.h"
 #include "x86_emulate/x86_emulate.c"

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:25 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:25 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpvt-0001KJ-Rj; Wed, 16 Nov 2011 16:34:25 -0800
Received: from mail27.messagelabs.com ([193.109.254.147])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvK-00017X-1i
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:50 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-11.tower-27.messagelabs.com!1321490013!45955480!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 4949 invoked from network); 17 Nov 2011 00:33:33 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-11.tower-27.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:33 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpvG-0004Qd-4x
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:46 +0000
Message-Id: <E1RQpvG-0004Qd-4x@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:45 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86_emulate: Define and use BUG()
	and bool_t.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1321458529 0
# Node ID 0262e108c939b64ab26aff0877d3880da931e0bf
# Parent  6316cd1183f8752d72ea2f822bdd92b4a0137ff8
x86_emulate: Define and use BUG() and bool_t.

Original patch by Jan Beulich <jbeulich@suse.com>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 6316cd1183f8 -r 0262e108c939 tools/tests/x86_emulator/x86_emulate.c
--- a/tools/tests/x86_emulator/x86_emulate.c	Wed Nov 16 15:28:55 2011 +0000
+++ b/tools/tests/x86_emulator/x86_emulate.c	Wed Nov 16 15:48:49 2011 +0000
@@ -1,7 +1,13 @@
+#include <stdbool.h>
 #include <stddef.h>
 #include <stdint.h>
+#include <stdlib.h>
 #include <string.h>
 #include <xen/xen.h>
 
+typedef bool bool_t;
+
+#define BUG() abort()
+
 #include "x86_emulate/x86_emulate.h"
 #include "x86_emulate/x86_emulate.c"
diff -r 6316cd1183f8 -r 0262e108c939 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Wed Nov 16 15:28:55 2011 +0000
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Wed Nov 16 15:48:49 2011 +0000
@@ -538,7 +538,7 @@
  * Given byte has even parity (even number of 1s)? SDM Vol. 1 Sec. 3.4.3.1,
  * "Status Flags": EFLAGS.PF reflects parity of least-sig. byte of result only.
  */
-static int even_parity(uint8_t v)
+static bool_t even_parity(uint8_t v)
 {
     asm ( "test %b0,%b0; setp %b0" : "=a" (v) : "0" (v) );
     return v;
@@ -728,9 +728,9 @@
  * IN:  Multiplicand=m[0], Multiplier=m[1]
  * OUT: Return CF/OF (overflow status); Result=m[1]:m[0]
  */
-static int mul_dbl(unsigned long m[2])
+static bool_t mul_dbl(unsigned long m[2])
 {
-    int rc;
+    bool_t rc;
     asm ( "mul %4; seto %b2"
           : "=a" (m[0]), "=d" (m[1]), "=q" (rc)
           : "0" (m[0]), "1" (m[1]), "2" (0) );
@@ -742,9 +742,9 @@
  * IN:  Multiplicand=m[0], Multiplier=m[1]
  * OUT: Return CF/OF (overflow status); Result=m[1]:m[0]
  */
-static int imul_dbl(unsigned long m[2])
+static bool_t imul_dbl(unsigned long m[2])
 {
-    int rc;
+    bool_t rc;
     asm ( "imul %4; seto %b2"
           : "=a" (m[0]), "=d" (m[1]), "=q" (rc)
           : "0" (m[0]), "1" (m[1]), "2" (0) );
@@ -757,7 +757,7 @@
  * OUT: Return 1: #DE
  *      Return 0: Quotient=u[0], Remainder=u[1]
  */
-static int div_dbl(unsigned long u[2], unsigned long v)
+static bool_t div_dbl(unsigned long u[2], unsigned long v)
 {
     if ( (v == 0) || (u[1] >= v) )
         return 1;
@@ -775,9 +775,9 @@
  * NB. We don't use idiv directly as it's moderately hard to work out
  *     ahead of time whether it will #DE, which we cannot allow to happen.
  */
-static int idiv_dbl(unsigned long u[2], unsigned long v)
+static bool_t idiv_dbl(unsigned long u[2], unsigned long v)
 {
-    int negu = (long)u[1] < 0, negv = (long)v < 0;
+    bool_t negu = (long)u[1] < 0, negv = (long)v < 0;
 
     /* u = abs(u) */
     if ( negu )
@@ -809,7 +809,7 @@
     return 0;
 }
 
-static int
+static bool_t
 test_cc(
     unsigned int condition, unsigned int flags)
 {
@@ -932,7 +932,7 @@
     return ops->inject_hw_exception(EXC_GP, 0, ctxt) ? : X86EMUL_EXCEPTION;
 }
 
-static int
+static bool_t
 in_realmode(
     struct x86_emulate_ctxt *ctxt,
     const struct x86_emulate_ops  *ops)
@@ -947,7 +947,7 @@
     return (!rc && !(cr0 & CR0_PE));
 }
 
-static int
+static bool_t
 in_protmode(
     struct x86_emulate_ctxt *ctxt,
     const struct x86_emulate_ops  *ops)
@@ -1178,7 +1178,7 @@
     case 14: p = &regs->r14; break;
     case 15: p = &regs->r15; break;
 #endif
-    default: p = NULL; break;
+    default: BUG(); p = NULL; break;
     }
 
     return p;

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:32 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:32 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpw0-0001NH-DX; Wed, 16 Nov 2011 16:34:32 -0800
Received: from mail216.messagelabs.com ([85.158.143.99])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvM-00017p-1w
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:53 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-4.tower-216.messagelabs.com!1321490029!3836236!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 28588 invoked from network); 17 Nov 2011 00:33:49 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-4.tower-216.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:49 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpvH-0004RM-O3
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:48 +0000
Message-Id: <E1RQpvH-0004RM-O3@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:47 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] test_x86_emulator: add a "run"
	target to the test code makefile
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321458655 0
# Node ID 1cbb3c1dfb3203f5344a6c1c52507b9e75af6742
# Parent  0262e108c939b64ab26aff0877d3880da931e0bf
test_x86_emulator: add a "run" target to the test code makefile

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Committed-by: Keir Fraser <keir@xen.org>
---


diff -r 0262e108c939 -r 1cbb3c1dfb32 tools/tests/x86_emulator/Makefile
--- a/tools/tests/x86_emulator/Makefile	Wed Nov 16 15:48:49 2011 +0000
+++ b/tools/tests/x86_emulator/Makefile	Wed Nov 16 15:50:55 2011 +0000
@@ -7,6 +7,10 @@
 .PHONY: all
 all: $(TARGET)
 
+.PHONY: run
+run: $(TARGET)
+	./$(TARGET)
+
 .PHONY: blowfish.h
 blowfish.h:
 	rm -f blowfish.bin

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

From xen-changelog-bounces@lists.xensource.com Wed Nov 16 16:34:41 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Wed, 16 Nov 2011 16:34:41 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RQpw8-0001QW-V3; Wed, 16 Nov 2011 16:34:41 -0800
Received: from mail182.messagelabs.com ([85.158.139.83])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RQpvN-000185-Nl
	for xen-changelog@lists.xensource.com; Wed, 16 Nov 2011 16:33:55 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-16.tower-182.messagelabs.com!1321490030!3434091!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 20873 invoked from network); 17 Nov 2011 00:33:50 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-16.tower-182.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 00:33:50 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RQpvJ-0004S6-Kk
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 00:33:50 +0000
Message-Id: <E1RQpvJ-0004S6-Kk@xenbits.xen.org>
Date: Thu, 17 Nov 2011 00:33:49 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] x86/emulator: add feature checks for
	newer instructions
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Jan Beulich <jbeulich@suse.com>
# Date 1321459471 0
# Node ID 644ca5d3ec435f3372ce88a4de86909bd4033819
# Parent  1cbb3c1dfb3203f5344a6c1c52507b9e75af6742
x86/emulator: add feature checks for newer instructions

Certain instructions were introduced only after the i686 or original
x86-64 architecture, so we should not try to emulate them if the guest
is not seeing the respective feature enabled (or, worse, if the
underlying hardware doesn't support them). This affects fisttp,
movnti, and cmpxchg16b.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 1cbb3c1dfb32 -r 644ca5d3ec43 xen/arch/x86/x86_emulate/x86_emulate.c
--- a/xen/arch/x86/x86_emulate/x86_emulate.c	Wed Nov 16 15:50:55 2011 +0000
+++ b/xen/arch/x86/x86_emulate/x86_emulate.c	Wed Nov 16 16:04:31 2011 +0000
@@ -955,6 +955,47 @@
     return !(in_realmode(ctxt, ops) || (ctxt->regs->eflags & EFLG_VM));
 }
 
+#define EAX 0
+#define ECX 1
+#define EDX 2
+#define EBX 3
+
+static bool_t vcpu_has(
+    unsigned int eax,
+    unsigned int reg,
+    unsigned int bit,
+    struct x86_emulate_ctxt *ctxt,
+    const struct x86_emulate_ops *ops)
+{
+    unsigned int ebx = 0, ecx = 0, edx = 0;
+    int rc = X86EMUL_OKAY;
+
+    fail_if(!ops->cpuid);
+    rc = ops->cpuid(&eax, &ebx, &ecx, &edx, ctxt);
+    if ( rc == X86EMUL_OKAY )
+    {
+        switch ( reg )
+        {
+        case EAX: reg = eax; break;
+        case EBX: reg = ebx; break;
+        case ECX: reg = ecx; break;
+        case EDX: reg = edx; break;
+        default: BUG();
+        }
+        if ( !(reg & (1U << bit)) )
+            rc = ~X86EMUL_OKAY;
+    }
+
+ done:
+    return rc == X86EMUL_OKAY;
+}
+
+#define vcpu_must_have(leaf, reg, bit) \
+    generate_exception_if(!vcpu_has(leaf, reg, bit, ctxt, ops), EXC_UD, -1)
+#define vcpu_must_have_sse2() vcpu_must_have(0x00000001, EDX, 26)
+#define vcpu_must_have_sse3() vcpu_must_have(0x00000001, ECX,  0)
+#define vcpu_must_have_cx16() vcpu_must_have(0x00000001, ECX, 13)
+
 static int
 in_longmode(
     struct x86_emulate_ctxt *ctxt,
@@ -2738,6 +2779,7 @@
                 emulate_fpu_insn_memsrc("fildl", src.val);
                 break;
             case 1: /* fisttp m32i */
+                vcpu_must_have_sse3();
                 ea.bytes = 4;
                 dst = ea;
                 dst.type = OP_MEM;
@@ -2846,6 +2888,7 @@
                 emulate_fpu_insn_memsrc("fldl", src.val);
                 break;
             case 1: /* fisttp m64i */
+                vcpu_must_have_sse3();
                 ea.bytes = 8;
                 dst = ea;
                 dst.type = OP_MEM;
@@ -2953,6 +2996,7 @@
                 emulate_fpu_insn_memsrc("filds", src.val);
                 break;
             case 1: /* fisttp m16i */
+                vcpu_must_have_sse3();
                 ea.bytes = 2;
                 dst = ea;
                 dst.type = OP_MEM;
@@ -4141,6 +4185,7 @@
 
     case 0xc3: /* movnti */
         /* Ignore the non-temporal hint for now. */
+        vcpu_must_have_sse2();
         generate_exception_if(dst.bytes <= 2, EXC_UD, -1);
         dst.val = src.val;
         break;
@@ -4151,6 +4196,8 @@
 
         generate_exception_if((modrm_reg & 7) != 1, EXC_UD, -1);
         generate_exception_if(ea.type != OP_MEM, EXC_UD, -1);
+        if ( op_bytes == 8 )
+            vcpu_must_have_cx16();
         op_bytes *= 2;
 
         /* Get actual old value. */

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

From xen-changelog-bounces@lists.xensource.com Thu Nov 17 03:23:24 2011
Return-path: <xen-changelog-bounces@lists.xensource.com>
Envelope-to: www-data@lists.xensource.com
Delivery-date: Thu, 17 Nov 2011 03:23:24 -0800
Received: from localhost ([127.0.0.1] helo=lists.colo.xensource.com)
	by lists.xensource.com with esmtp (Exim 4.43)
	id 1RR03w-0004Bk-9l; Thu, 17 Nov 2011 03:23:24 -0800
Received: from mail21.messagelabs.com ([85.158.143.35])
	by lists.xensource.com with esmtp (Exim 4.43) id 1RR02t-0003lD-Ck
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 03:22:19 -0800
X-Env-Sender: xen@xenbits.xen.org
X-Msg-Ref: server-9.tower-21.messagelabs.com!1321528936!4494654!1
X-Originating-IP: [93.93.131.152]
X-StarScan-Version: 6.4.1; banners=-,-,-
X-VirusChecked: Checked
Received: (qmail 11043 invoked from network); 17 Nov 2011 11:22:16 -0000
Received: from xenbits.xen.org (HELO xenbits.xen.org) (93.93.131.152)
	by server-9.tower-21.messagelabs.com with AES256-SHA encrypted SMTP;
	17 Nov 2011 11:22:16 -0000
Received: from xen by xenbits.xen.org with local (Exim 4.72)
	(envelope-from <xen@xenbits.xen.org>) id 1RR02p-0002ju-OU
	for xen-changelog@lists.xensource.com; Thu, 17 Nov 2011 11:22:15 +0000
Message-Id: <E1RR02p-0002ju-OU@xenbits.xen.org>
Date: Thu, 17 Nov 2011 11:22:14 +0000
From: Xen patchbot-unstable <patchbot@xen.org>
To: xen-changelog@lists.xensource.com
Subject: [Xen-changelog] [xen-unstable] elf: Fix Elf64 types and structs to
	match the specification.
X-BeenThere: xen-changelog@lists.xensource.com
X-Mailman-Version: 2.1.5
Precedence: list
Reply-To: xen-devel@lists.xensource.com
List-Id: BK change log <xen-changelog.lists.xensource.com>
List-Unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, 
	<mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
List-Post: <mailto:xen-changelog@lists.xensource.com>
List-Help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-Subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>,
	<mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
Sender: xen-changelog-bounces@lists.xensource.com
Errors-To: xen-changelog-bounces@lists.xensource.com

# HG changeset patch
# User Keir Fraser <keir@xen.org>
# Date 1321467674 0
# Node ID dbdc840f8f62db58321b5009e5e0f7833066386f
# Parent  644ca5d3ec435f3372ce88a4de86909bd4033819
elf: Fix Elf64 types and structs to match the specification.

The layouts were actually correct, but the type names were a bit
messed up.

Original patch by Volker Eckert <volker.eckert@citrix.com>
Signed-off-by: Keir Fraser <keir@xen.org>
---


diff -r 644ca5d3ec43 -r dbdc840f8f62 tools/libxc/xc_dom_elfloader.c
--- a/tools/libxc/xc_dom_elfloader.c	Wed Nov 16 16:04:31 2011 +0000
+++ b/tools/libxc/xc_dom_elfloader.c	Wed Nov 16 18:21:14 2011 +0000
@@ -237,7 +237,7 @@
 
         /* Name is NULL. */
         if ( elf_64bit(&syms) )
-            *(Elf64_Half*)(&shdr->e64.sh_name) = 0;
+            *(Elf64_Word*)(&shdr->e64.sh_name) = 0;
         else
             *(Elf32_Word*)(&shdr->e32.sh_name) = 0;
     }
diff -r 644ca5d3ec43 -r dbdc840f8f62 xen/include/xen/elfstructs.h
--- a/xen/include/xen/elfstructs.h	Wed Nov 16 16:04:31 2011 +0000
+++ b/xen/include/xen/elfstructs.h	Wed Nov 16 18:21:14 2011 +0000
@@ -26,27 +26,20 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-typedef uint8_t		Elf_Byte;
-
 typedef uint32_t	Elf32_Addr;	/* Unsigned program address */
 typedef uint32_t	Elf32_Off;	/* Unsigned file offset */
+typedef uint16_t	Elf32_Half;	/* Unsigned medium integer */
 typedef int32_t		Elf32_Sword;	/* Signed large integer */
 typedef uint32_t	Elf32_Word;	/* Unsigned large integer */
-typedef uint16_t	Elf32_Half;	/* Unsigned medium integer */
 
 typedef uint64_t	Elf64_Addr;
 typedef uint64_t	Elf64_Off;
-typedef int32_t		Elf64_Shalf;
-
+typedef uint16_t	Elf64_Half;
 typedef int32_t		Elf64_Sword;
 typedef uint32_t	Elf64_Word;
-
 typedef int64_t		Elf64_Sxword;
 typedef uint64_t	Elf64_Xword;
 
-typedef uint32_t	Elf64_Half;
-typedef uint16_t	Elf64_Quarter;
-
 /*
  * e_ident[] identification indexes
  * See http://www.caldera.com/developers/gabi/2000-07-17/ch4.eheader.html 
@@ -127,19 +120,19 @@
 
 typedef struct {
 	unsigned char	e_ident[EI_NIDENT];	/* Id bytes */
-	Elf64_Quarter	e_type;			/* file type */
-	Elf64_Quarter	e_machine;		/* machine type */
-	Elf64_Half	e_version;		/* version number */
+	Elf64_Half	e_type;			/* file type */
+	Elf64_Half	e_machine;		/* machine type */
+	Elf64_Word	e_version;		/* version number */
 	Elf64_Addr	e_entry;		/* entry point */
 	Elf64_Off	e_phoff;		/* Program hdr offset */
 	Elf64_Off	e_shoff;		/* Section hdr offset */
-	Elf64_Half	e_flags;		/* Processor flags */
-	Elf64_Quarter	e_ehsize;		/* sizeof ehdr */
-	Elf64_Quarter	e_phentsize;		/* Program header entry size */
-	Elf64_Quarter	e_phnum;		/* Number of program headers */
-	Elf64_Quarter	e_shentsize;		/* Section header entry size */
-	Elf64_Quarter	e_shnum;		/* Number of section headers */
-	Elf64_Quarter	e_shstrndx;		/* String table index */
+	Elf64_Word	e_flags;		/* Processor flags */
+	Elf64_Half	e_ehsize;		/* sizeof ehdr */
+	Elf64_Half	e_phentsize;		/* Program header entry size */
+	Elf64_Half	e_phnum;		/* Number of program headers */
+	Elf64_Half	e_shentsize;		/* Section header entry size */
+	Elf64_Half	e_shnum;		/* Number of section headers */
+	Elf64_Half	e_shstrndx;		/* String table index */
 } Elf64_Ehdr;
 
 /* e_type */
@@ -202,14 +195,14 @@
 } Elf32_Shdr;
 
 typedef struct {
-	Elf64_Half	sh_name;	/* section name */
-	Elf64_Half	sh_type;	/* section type */
+	Elf64_Word	sh_name;	/* section name */
+	Elf64_Word	sh_type;	/* section type */
 	Elf64_Xword	sh_flags;	/* section flags */
 	Elf64_Addr	sh_addr;	/* virtual address */
 	Elf64_Off	sh_offset;	/* file offset */
 	Elf64_Xword	sh_size;	/* section size */
-	Elf64_Half	sh_link;	/* link to another */
-	Elf64_Half	sh_info;	/* misc info */
+	Elf64_Word	sh_link;	/* link to another */
+	Elf64_Word	sh_info;	/* misc info */
 	Elf64_Xword	sh_addralign;	/* memory alignment */
 	Elf64_Xword	sh_entsize;	/* table entry size */
 } Elf64_Shdr;
@@ -284,11 +277,11 @@
 } Elf32_Sym;
 
 typedef struct {
-	Elf64_Half	st_name;	/* Symbol name index in str table */
-	Elf_Byte	st_info;	/* type / binding attrs */
-	Elf_Byte	st_other;	/* unused */
-	Elf64_Quarter	st_shndx;	/* section index of symbol */
-	Elf64_Xword	st_value;	/* value of symbol */
+	Elf64_Word	st_name;	/* Symbol name index in str table */
+	unsigned char	st_info;	/* type / binding attrs */
+	unsigned char	st_other;	/* unused */
+	Elf64_Half	st_shndx;	/* section index of symbol */
+	Elf64_Addr	st_value;	/* value of symbol */
 	Elf64_Xword	st_size;	/* size of symbol */
 } Elf64_Sym;
 
@@ -341,12 +334,12 @@
 #define ELF32_R_INFO(s,t) 	(((s) << 8) + (unsigned char)(t))
 
 typedef struct {
-	Elf64_Xword	r_offset;	/* where to do it */
+	Elf64_Addr	r_offset;	/* where to do it */
 	Elf64_Xword	r_info;		/* index & type of relocation */
 } Elf64_Rel;
 
 typedef struct {
-	Elf64_Xword	r_offset;	/* where to do it */
+	Elf64_Addr	r_offset;	/* where to do it */
 	Elf64_Xword	r_info;		/* index & type of relocation */
 	Elf64_Sxword	r_addend;	/* adjustment value */
 } Elf64_Rela;
@@ -368,8 +361,8 @@
 } Elf32_Phdr;
 
 typedef struct {
-	Elf64_Half	p_type;		/* entry type */
-	Elf64_Half	p_flags;	/* flags */
+	Elf64_Word	p_type;		/* entry type */
+	Elf64_Word	p_flags;	/* flags */
 	Elf64_Off	p_offset;	/* offset */
 	Elf64_Addr	p_vaddr;	/* virtual address */
 	Elf64_Addr	p_paddr;	/* physical address */
@@ -407,10 +400,10 @@
 } Elf32_Dyn;
 
 typedef struct {
-	Elf64_Xword	d_tag;		/* controls meaning of d_val */
+	Elf64_Sxword	d_tag;		/* controls meaning of d_val */
 	union {
+		Elf64_Xword	d_val;
 		Elf64_Addr	d_ptr;
-		Elf64_Xword	d_val;
 	} d_un;
 } Elf64_Dyn;
 
@@ -458,9 +451,9 @@
 } Elf32_Note;
 
 typedef struct {
-	Elf64_Half namesz;
-	Elf64_Half descsz;
-	Elf64_Half type;
+	Elf64_Word namesz;
+	Elf64_Word descsz;
+	Elf64_Word type;
 } Elf64_Note;
 
 

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

